/* ============================================================
   活動島嶼 — dark "Modern Product" design system
   Mobile-first. Tokens → primitives → components → responsive.
   ============================================================ */
:root {
  /* color — dark */
  --bg: #0a0b0e;
  --bg-1: #0e1014;
  --surface: #14161c;
  --surface-2: #191c23;
  --elevated: #1f232b;
  --border: rgba(255,255,255,.07);
  --border-2: rgba(255,255,255,.12);
  --text: #eceef2;
  --text-2: #9aa1ad;
  --text-3: #646b78;
  --accent: #6d7bff;
  --accent-press: #5a68ff;
  --accent-ink: #c3c9ff;
  --accent-soft: rgba(109,123,255,.14);
  --ok: #34d399;
  --ok-soft: rgba(52,211,153,.14);
  --warn: #f5b53d;
  --warn-soft: rgba(245,181,61,.14);

  /* space (4pt) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;
  /* radii */
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;
  /* elevation (dark: rely on borders + soft glow) */
  --sh-1: 0 1px 0 rgba(255,255,255,.03), 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 8px 24px rgba(0,0,0,.45);
  --sh-3: 0 24px 64px rgba(0,0,0,.6);
  /* motion */
  --ease: cubic-bezier(.2,.8,.2,1);
  --fast: .14s; --med: .24s; --slow: .36s;

  --appbar-h: 56px;
  --tabbar-h: 60px;

  color-scheme: dark;
  font-family: "Manrope", "Noto Sans TC", system-ui, -apple-system, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); overscroll-behavior-y: none; overflow-x: clip; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30; height: var(--appbar-h);
  display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s4);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(140%) blur(14px); border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; display: block; box-shadow: 0 0 14px rgba(222,74,31,.35); }
.appbar-links { display: none; gap: var(--s1); margin-left: var(--s4); }
.appbar-links a, .seg-link { padding: 8px 12px; border-radius: var(--r-sm); font-size: 14px; font-weight: 600; color: var(--text-2); border: none; background: transparent; }
.appbar-links a:hover, .seg-link:hover { color: var(--text); background: var(--surface-2); }
.appbar-links a.active, .seg-link.active { color: var(--text); }
.appbar-spacer { flex: 1; }
.appbar-search { display: none; position: relative; }
.appbar-search input { width: 260px; height: 38px; padding: 0 14px 0 36px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); font-size: 14px; transition: border-color var(--fast), box-shadow var(--fast), width var(--med) var(--ease); }
.appbar-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); width: 300px; }
.appbar-search .s-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.icon-btn { width: 38px; height: 38px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--text-2); transition: background var(--fast), color var(--fast), transform var(--fast); }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- layout ---------- */
.app { max-width: 1160px; margin: 0 auto; padding: 0 var(--s4) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s8)); }
.view[hidden] { display: none; }
.view-head { padding: var(--s6) 0 var(--s4); }
.view-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 4px; }
.view-head p { margin: 0; color: var(--text-2); font-size: 14px; }

/* ---------- filter bar ---------- */
.filterbar {
  position: sticky; top: calc(var(--appbar-h) + env(safe-area-inset-top)); z-index: 30;
  display: flex; justify-content: center; padding: var(--s3) 0; margin: 0 calc(-1 * var(--s4)); padding-left: var(--s4); padding-right: var(--s4);
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
/* Airbnb-style segmented search bar */
.searchbar { display: flex; align-items: center; gap: 2px; width: 100%; max-width: 560px; padding: 5px 5px 5px 6px; border-radius: var(--r-full); border: 1px solid var(--border-2); background: var(--surface); box-shadow: var(--sh-1); }
.sb-seg { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 16px; border: 0; border-radius: var(--r-full); background: transparent; text-align: left; transition: background var(--fast); }
.sb-seg:hover { background: var(--surface-2); }
.sb-seg.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-2); }
.sb-k { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: .02em; }
.sb-v { font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sb-v.on { color: var(--text); }
.sb-sep { width: 1px; height: 26px; background: var(--border); flex: 0 0 auto; }
.sb-go { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--accent); color: #fff; }
.sb-go svg { width: 18px; height: 18px; }
.sb-go[data-on] { box-shadow: 0 0 0 3px var(--accent-soft); }

/* facet popover — anchored card (desktop) / bottom sheet (mobile) */
.facet-pop { position: fixed; inset: 0; z-index: 45; }
.facet-scrim { position: absolute; inset: 0; background: rgba(4,5,7,.5); backdrop-filter: blur(2px); animation: fade var(--med); }
.facet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 78vh; overflow-y: auto;
  padding: var(--s5) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border-2);
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--sh-3); animation: sheet-up var(--med) var(--ease); }
.facet-head { font-size: 13px; font-weight: 800; color: var(--text-3); letter-spacing: .04em; margin-bottom: var(--s3); }
.facet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.fo { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 46px; padding: 0 14px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 600; }
.fo:hover { border-color: var(--border-2); }
.fo.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.fo[disabled] { opacity: .35; pointer-events: none; }
.fo-n { font-size: 12px; font-weight: 700; opacity: .55; }
.fo.on .fo-n { opacity: .8; }
.fo-near { display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px 14px; margin-bottom: var(--s3); border-radius: var(--r-lg); border: 1px solid var(--accent-soft); background: var(--accent-soft); color: var(--accent-ink); text-align: left; }
.fo-near svg { width: 20px; height: 20px; flex: 0 0 auto; }
.fo-near b { display: block; font-size: 14px; }
.fo-near small { color: var(--text-3); font-size: 12px; }
.fo-near.on { box-shadow: inset 0 0 0 2px var(--accent); }
.facet-rows { display: flex; flex-direction: column; gap: var(--s2); }
.fo-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-align: left; }
.fo-row.on { box-shadow: inset 0 0 0 2px var(--text); }
.fo-row b { display: block; font-size: 15px; font-weight: 700; }
.fo-row small { color: var(--text-3); font-size: 12px; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (min-width: 720px) {
  .facet-scrim { background: rgba(4,5,7,.28); backdrop-filter: none; }
  .facet-panel {
    left: 50%; right: auto; bottom: auto; transform: translateX(-50%);
    top: calc(var(--appbar-h) + env(safe-area-inset-top) + 64px);
    width: min(560px, calc(100vw - 48px)); max-height: 70vh;
    border: 1px solid var(--border-2); border-radius: var(--r-xl); animation: pop var(--med) var(--ease);
  }
}
/* pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; padding: var(--s5) 0 var(--s3); }
.pg-num, .pg-arrow { min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 14px; font-weight: 700; }
.pg-num:hover, .pg-arrow:not([disabled]):hover { border-color: var(--border-2); color: var(--text); }
.pg-num.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.pg-arrow[disabled] { opacity: .35; }
.pg-gap { color: var(--text-3); padding: 0 2px; }

/* ---------- detail hero: my ticket QR (default if held) ⇄ island ---------- */
.hero-qr, .hero-island { position: absolute; transition: inset .28s var(--ease), width .28s var(--ease), height .28s var(--ease), border-radius .28s var(--ease); }
.hero-island { background: var(--bg-1); }
.hero-qr { display: grid; place-items: center; background: radial-gradient(120% 120% at 50% 20%, #20242e, #0e1016); }
:root { --pip-w: 132px; --pip-h: 96px; }
/* QR is the main view; island is the corner thumbnail */
.detail-hero.qr-main .hero-qr { inset: 0; width: 100%; height: 100%; z-index: 0; }
.detail-hero.qr-main .hero-island { right: 14px; bottom: 14px; width: var(--pip-w); height: var(--pip-h); border-radius: var(--r-lg); z-index: 2; box-shadow: 0 8px 24px rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.85); }
.detail-hero.qr-main .build-bar, .detail-hero.qr-main .visual-cap { display: none; }
/* swapped: island is the main view, QR is the thumbnail */
.detail-hero.island-main .hero-island { inset: 0; width: 100%; height: 100%; border-radius: 0; z-index: 0; }
.detail-hero.island-main .hero-qr { right: 14px; bottom: 14px; width: var(--pip-w); height: var(--pip-h); border-radius: var(--r-lg); overflow: hidden; z-index: 2; box-shadow: 0 8px 24px rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.85); }
/* QR content */
.hero-qr-inner { text-align: center; padding: 12px; }
.hero-qr-code { width: 200px; height: 200px; margin: 0 auto 12px; background: #fff; border-radius: 14px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); display: grid; place-items: center; }
.hero-qr-code img { width: 100%; height: 100%; display: block; }
.hero-qr-meta { font-size: 14px; font-weight: 800; color: var(--text); letter-spacing: .02em; }
.hero-qr-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
/* when QR is the small thumbnail, hide the text — just show the code */
.detail-hero.island-main .hero-qr-meta, .detail-hero.island-main .hero-qr-hint { display: none; }
.detail-hero.island-main .hero-qr-code { width: 100%; height: 100%; margin: 0; border-radius: 0; box-shadow: none; padding: 6px; }
/* the PiP toggle button sits on the thumbnail corner */
.hero-pip { position: absolute; right: 14px; bottom: 14px; width: var(--pip-w); height: var(--pip-h); z-index: 3; border: 0; background: transparent; border-radius: var(--r-lg); cursor: pointer; display: flex; align-items: flex-start; justify-content: flex-end; padding: 7px; }
.hero-pip[hidden] { display: none; }
.hero-pip-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: #fff; padding: 4px 11px; border-radius: var(--r-full); background: rgba(8,9,12,.72); backdrop-filter: blur(4px); box-shadow: 0 1px 4px rgba(0,0,0,.3); pointer-events: none; }
.hero-pip-label::before { content: "⤢"; font-size: 13px; }
.hero-pip:hover .hero-pip-label { background: rgba(8,9,12,.9); }

/* ---------- feed ---------- */
.feed { padding-top: var(--s5); display: flex; flex-direction: column; gap: var(--s6); }
.section-label { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--text-3); letter-spacing: .04em; text-transform: none; margin-bottom: calc(-1 * var(--s2)); }
.grid { display: grid; grid-template-columns: 1fr; gap: var(--s4); }

/* card */
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; transition: transform var(--fast) var(--ease), border-color var(--fast), box-shadow var(--fast); will-change: transform; }
.card:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: var(--sh-2); }
.card:active { transform: translateY(0) scale(.992); }
.card-cover { position: relative; aspect-ratio: 16/10; background: linear-gradient(160deg, #1a1e28, #111319); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(8,9,12,.55)); }
.skeleton { position: absolute; inset: 0; background: linear-gradient(100deg, #16191f 30%, #1d212a 50%, #16191f 70%); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }
.badge { position: absolute; z-index: 2; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: var(--r-full); backdrop-filter: blur(8px); }
.badge-cat { top: 10px; left: 10px; background: rgba(20,22,28,.7); border: 1px solid var(--border-2); color: var(--text); }
.badge-going { bottom: 10px; left: 10px; background: rgba(8,9,12,.5); color: #eef0f3; display: inline-flex; align-items: center; gap: 5px; }
.badge-going .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.card-body { padding: var(--s4); }
.card-date { font-size: 13px; font-weight: 700; color: var(--accent-ink); letter-spacing: -.01em; margin-bottom: 5px; }
.past-tag { font-size: 11px; font-weight: 700; color: var(--text-3); background: var(--surface-2); padding: 1px 7px; border-radius: var(--r-full); }
/* island as circular corner badge when a cover image is present */
.island-badge { position: absolute; z-index: 2; bottom: 10px; right: 10px; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255,255,255,.8); background: var(--surface-2); box-shadow: 0 2px 10px rgba(0,0,0,.45); }
.island-badge img { width: 100%; height: 100%; object-fit: cover; }
/* AI link auto-fill row in the editor */
.ai-link { display: flex; gap: var(--s2); margin-bottom: var(--s3); }
.ai-link input { flex: 1; min-width: 0; height: 44px; border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface); padding: 0 14px; font-size: 14px; color: var(--text); }
.ai-link input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ai-link .btn { height: 44px; padding: 0 16px; white-space: nowrap; }
.card-title { font-size: 17px; font-weight: 800; letter-spacing: -.02em; line-height: 1.35; margin: 0 0 var(--s3); }
.card-meta { display: flex; flex-direction: column; gap: 6px; }
.meta-row { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.meta-row svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--text-3); }
.mine-tag { display: inline-flex; align-items: center; gap: 5px; margin-top: var(--s3); font-size: 12px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 4px 10px; border-radius: var(--r-full); }
.mine-tag svg { width: 13px; height: 13px; }

/* featured hero */
.feature { position: relative; border: 1px solid var(--border); border-radius: var(--r-xl); overflow: hidden; background: var(--surface); transition: border-color var(--fast), box-shadow var(--fast); }
.feature:hover { border-color: var(--border-2); box-shadow: var(--sh-2); }
.feature-cover { position: relative; aspect-ratio: 16/10; background: linear-gradient(160deg, #1a1e28, #0f1116); }
.feature-cover img { width: 100%; height: 100%; object-fit: cover; }
.feature-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(8,9,12,.82)); }
.feature-body { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--s5); }
.feature .pill-row { display: flex; gap: 6px; margin-bottom: var(--s2); }
.feature-title { font-size: 22px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 6px; }
.feature-sub { display: flex; flex-wrap: wrap; gap: var(--s4); font-size: 13px; color: var(--text-2); }
.feature-sub b { color: var(--accent-ink); font-weight: 700; }
.feature-sub span { display: inline-flex; align-items: center; gap: 6px; }
.feature-sub svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--text-3); }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-full); background: rgba(20,22,28,.7); border: 1px solid var(--border-2); backdrop-filter: blur(8px); }

/* ---------- bottom tab bar (mobile) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--border);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: none; color: var(--text-3); font-size: 11px; font-weight: 700; transition: color var(--fast); }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--text); }
.tab .badge-num { position: absolute; transform: translate(12px,-12px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-full); background: var(--accent); color: #fff; font-size: 10px; display: grid; place-items: center; }

/* ---------- sheet (detail / search) ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet[hidden] { display: none; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(4,5,7,.62); backdrop-filter: blur(3px); animation: fade var(--med); }
@keyframes fade { from { opacity: 0; } }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; top: 0;
  background: var(--bg-1); display: flex; flex-direction: column; overflow: hidden;
  animation: sheetup var(--slow) var(--ease);
}
@keyframes sheetup { from { transform: translateY(6%); opacity: .6; } }
@keyframes pop { from { transform: translate(-50%,-48%) scale(.98); opacity: .5; } }

/* detail */
.detail-hero { position: relative; height: 42vh; min-height: 240px; overflow: hidden; background: linear-gradient(180deg, #1a1f2e, #0e1016); flex: 0 0 auto; }
#island-canvas { display: block; touch-action: none; }
.detail-back { position: absolute; top: calc(var(--s3) + env(safe-area-inset-top)); left: var(--s3); z-index: 3; height: 38px; padding: 0 14px 0 10px; display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-full); border: 1px solid var(--border-2); background: rgba(10,11,14,.6); backdrop-filter: blur(8px); font-size: 13px; font-weight: 700; }
.detail-back svg { width: 16px; height: 16px; }
.detail-share { position: absolute; top: calc(var(--s3) + env(safe-area-inset-top)); right: calc(var(--s3) + 48px); z-index: 3; height: 38px; padding: 0 14px 0 11px; display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-full); border: 1px solid var(--border-2); background: rgba(10,11,14,.6); backdrop-filter: blur(8px); color: var(--text); font-size: 13px; font-weight: 700; }
.detail-share svg { width: 16px; height: 16px; }
.detail-fav { position: absolute; top: calc(var(--s3) + env(safe-area-inset-top)); right: var(--s3); z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-2); background: rgba(10,11,14,.6); backdrop-filter: blur(8px); color: var(--text); display: grid; place-items: center; }
.detail-fav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; }
.detail-fav.on svg { fill: #ff5a7a; stroke: #ff5a7a; }
.detail-fav:active { transform: scale(.92); }
/* heart on event cards */
.fav-btn { position: absolute; top: 10px; right: 10px; z-index: 4; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(10,11,14,.5); backdrop-filter: blur(6px); color: #fff; display: grid; place-items: center; }
.fav-btn svg { width: 19px; height: 19px; fill: none; stroke: #fff; transition: transform var(--fast); }
.fav-btn.on svg { fill: #ff5a7a; stroke: #ff5a7a; }
.fav-btn:active svg { transform: scale(.8); }
.fav-btn.fav-row { position: static; width: 30px; height: 30px; background: transparent; backdrop-filter: none; flex: 0 0 auto; }
.fav-btn.fav-row svg { stroke: #ff5a7a; fill: #ff5a7a; }
.plist-n { color: var(--text-3); font-weight: 700; }
/* favorite collections (boards) */
.coll-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: var(--s2); margin-bottom: var(--s2); }
.coll-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 700; white-space: nowrap; }
.coll-chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.coll-chip .coll-n { font-size: 11px; opacity: .6; }
.coll-chip.coll-add { color: var(--accent-ink); border-color: var(--accent-soft); background: var(--accent-soft); }
.coll-manage { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.coll-vis { height: 30px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 700; }
.btn-soft.xs { height: 30px; padding: 0 12px; font-size: 12px; }
.fav-item .fav-move { flex: 0 0 auto; max-width: 104px; height: 30px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font-size: 12px; }
.fav-item .fav-move:focus { outline: none; border-color: var(--accent); }
.fav-empty { color: var(--text-3); font-size: 13px; padding: 12px 2px 4px; }
.coll-block { margin-bottom: var(--s4); }
.coll-head { display: flex; align-items: center; gap: 8px; margin-bottom: var(--s2); }
.coll-head b { font-size: 15px; font-weight: 800; }
.coll-vis-mini { font-size: 11px; color: var(--text-3); font-weight: 600; }
.detail-share:active { transform: scale(.96); }
.build-bar { position: absolute; top: calc(var(--s3) + env(safe-area-inset-top)); right: var(--s3); z-index: 3; display: flex; gap: 5px; padding: 5px; border-radius: 14px; background: rgba(10,11,14,.66); backdrop-filter: blur(10px); border: 1px solid var(--border); }
.build-bar[hidden] { display: none; }
.build-bar button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 700; }
.build-bar button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.visual-cap { position: absolute; left: var(--s4); bottom: var(--s3); z-index: 3; font-size: 12px; font-weight: 600; color: var(--text-2); background: rgba(10,11,14,.5); padding: 5px 11px; border-radius: var(--r-full); backdrop-filter: blur(6px); }

.detail-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: var(--s6) var(--s5) 0; }
.detail-tags { display: flex; gap: 6px; margin-bottom: var(--s4); }
.detail-body h2 { font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.25; margin: 0 0 var(--s5); }
.info-list { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s6); }
.info-item { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.info-ic { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent-ink); }
.info-ic svg { width: 19px; height: 19px; }
.info-tx .k { font-size: 12px; color: var(--text-3); font-weight: 600; }
.info-tx .v { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.info-tx .v small { font-weight: 400; color: var(--text-2); }
.host { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: var(--s5); }
.host-av { width: 40px; height: 40px; border-radius: 50%; background: conic-gradient(from 200deg, var(--accent), #9aa6ff); display: grid; place-items: center; font-weight: 800; color: #0a0b0e; }
.host .k { font-size: 12px; color: var(--text-3); }
.host .v { font-size: 14px; font-weight: 700; }
.desc { font-size: 14.5px; line-height: 1.8; color: var(--text-2); margin: 0 0 var(--s10); }

/* sticky register dock */
.dock { position: sticky; bottom: 0; margin: 0 calc(-1 * var(--s5)); padding: var(--s4) var(--s5) calc(var(--s4) + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg-1) 88%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border); display: flex; align-items: center; gap: var(--s4); }
.dock .cap { flex: 1; min-width: 0; }
.dock .cap .bar { height: 5px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; margin-bottom: 6px; }
.dock .cap .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #9aa6ff); border-radius: var(--r-full); transition: width var(--slow) var(--ease); }
.dock .cap small { font-size: 12px; color: var(--text-2); }
.btn { height: 48px; padding: 0 24px; border-radius: var(--r); border: none; font-size: 15px; font-weight: 800; letter-spacing: -.01em; transition: transform var(--fast), background var(--fast), filter var(--fast); white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(109,123,255,.35); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(.98); }
.statepill { height: 48px; display: inline-flex; align-items: center; gap: 7px; padding: 0 20px; border-radius: var(--r); font-weight: 700; font-size: 14px; }
.statepill.pending { background: var(--warn-soft); color: var(--warn); }
.statepill.going { background: var(--ok-soft); color: var(--ok); }
.statepill svg { width: 16px; height: 16px; }

/* tickets view */
.tickets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s5); padding-top: var(--s5); }

/* Apple Wallet-style ticket stub */
.pass { position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-1); transition: transform var(--fast), box-shadow var(--fast); }
.pass:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.pass-top { position: relative; height: 132px; overflow: hidden; cursor: pointer; background: linear-gradient(160deg, #1a1e28, #0f1116); }
.pass-top img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.pass-top::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(8,9,12,.08), rgba(8,9,12,.66)); }
.pass-cat, .pass-status { position: absolute; z-index: 2; top: 12px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-full); backdrop-filter: blur(8px); }
.pass-cat { left: 12px; background: rgba(20,22,28,.7); border: 1px solid var(--border-2); color: var(--text); }
.pass-status { right: 12px; }
.pass-status.going { background: var(--accent-soft); color: var(--accent-ink); }
.pass-status.checked { background: var(--ok-soft); color: var(--ok); }
.pass-status.pending { background: var(--warn-soft); color: var(--warn); }
.pass-body { padding: var(--s4) var(--s5) var(--s3); }
.pass-body h3 { margin: 0 0 var(--s3); font-size: 18px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; cursor: pointer; }
.pass-rows { display: flex; flex-direction: column; gap: 7px; }
.prow { display: flex; gap: var(--s3); font-size: 13px; align-items: baseline; }
.prow .pl { color: var(--text-3); width: 40px; flex: 0 0 auto; }
.prow .pv { color: var(--text); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .pv.mono { font-family: ui-monospace, monospace; letter-spacing: .04em; color: var(--accent-ink); }
.pass-perf { position: relative; border-top: 2px dashed var(--border-2); margin: var(--s2) 0; }
.pass-perf::before, .pass-perf::after { content: ""; position: absolute; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background: var(--bg); }
.pass-perf::before { left: -11px; } .pass-perf::after { right: -11px; }
.pass-stub { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s5) var(--s4); }
.pass-qr { width: 80px; height: 80px; flex: 0 0 auto; border-radius: 10px; background: #fff; padding: 5px; display: grid; place-items: center; }
.pass-qr img { width: 100%; height: 100%; }
.pass-qr.placeholder { background: var(--surface-2); color: var(--text-3); }
.pass-qr.placeholder svg { width: 26px; height: 26px; }
.pass-stub-info { min-width: 0; flex: 1; }
.pss { font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-bottom: 8px; }
.ticket-acts { display: flex; gap: var(--s2); flex-wrap: wrap; }
.tact { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px; border-radius: var(--r-sm); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-size: 12.5px; font-weight: 700; }
.tact:hover { background: var(--elevated); }
.tact svg { width: 14px; height: 14px; }

/* add-to-calendar buttons (detail) */
.cal-actions { display: flex; gap: var(--s2); margin-bottom: var(--s6); flex-wrap: wrap; }
.btn-soft { display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 700; }
.btn-soft:hover { background: var(--surface-2); }
.btn-soft svg { width: 16px; height: 16px; color: var(--accent-ink); }

/* empty state — vertically centered in the view */
.empty { grid-column: 1 / -1; min-height: 56vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-3); padding: var(--s10) var(--s6); }
.empty .ill { width: 64px; height: 64px; margin: 0 auto var(--s4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-3); }
.empty .ill svg { width: 28px; height: 28px; }
.empty h3 { color: var(--text-2); font-size: 17px; margin: 0 0 6px; }
.empty p { font-size: 13.5px; margin: 0; max-width: 320px; }

/* search sheet (mobile) */
.search-sheet .sheet-panel { top: 0; bottom: auto; min-height: 100%; }
.search-head { display: flex; align-items: center; gap: var(--s3); padding: calc(var(--s3) + env(safe-area-inset-top)) var(--s4) var(--s3); border-bottom: 1px solid var(--border); }
.search-head input { flex: 1; height: 42px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); padding: 0 14px; font-size: 15px; }
.search-head input:focus { outline: none; border-color: var(--accent); }
.search-cancel { background: none; border: none; color: var(--accent-ink); font-weight: 700; font-size: 14px; padding: 8px; }

/* buttons (shared) */
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.danger { color: #ff7a7a; border-color: rgba(255,122,122,.3); }
.btn-ghost.danger:hover { background: rgba(255,122,122,.1); }

/* organizer console */
.org-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.org-actions { display: flex; gap: var(--s2); }
.org-actions .btn { height: 42px; padding: 0 16px; font-size: 14px; }
@media (max-width: 560px) {
  .org-head { align-items: stretch; }
  .org-actions { width: 100%; }
  .org-actions .btn { flex: 1; padding: 0 10px; }
}
/* organizer toolbar (filters + search) */
.org-toolbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s4) 0 var(--s2); }
.org-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); }
.org-tab { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border: 0; border-radius: var(--r-full); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 700; white-space: nowrap; }
.org-tab.active { background: var(--text); color: var(--bg); }
.org-n { font-size: 11px; font-weight: 700; opacity: .6; }
.org-tab.active .org-n { opacity: .8; }
.org-search { flex: 1 1 200px; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); color: var(--text-3); }
.org-search svg { width: 16px; height: 16px; flex: 0 0 auto; }
.org-search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 14px; color: var(--text); }
.org-search input:focus { outline: none; }
.org-events { display: grid; grid-template-columns: 1fr; gap: var(--s4); padding-top: var(--s2); }
.org-events .pager, .org-events .org-pagewrap { grid-column: 1 / -1; }
.oev { display: grid; grid-template-columns: 84px 1fr; gap: var(--s4); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.oev-cover { width: 84px; height: 84px; border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.oev-cover img { width: 100%; height: 100%; object-fit: cover; }
.oev-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.oev-title { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.oev-sub { font-size: 12px; color: var(--text-2); }
.oev-stats { display: flex; gap: var(--s4); margin-top: 2px; }
.oev-stat { font-size: 12px; color: var(--text-2); }
.oev-stat b { display: block; font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.oev-stat.warn b { color: var(--warn); }
.oev-stat.oev-shared { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 0; }
.oev-stat.oev-shared b { display: inline; font-size: 13px; color: var(--accent); }
.oev-badge { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); letter-spacing: .02em; }
.oev-actions { display: flex; gap: var(--s2); margin-top: var(--s2); flex-wrap: wrap; }
.oev-actions button { height: 34px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; }
.oev-actions button:hover { background: var(--elevated); }
.oev-actions button.pending-dot::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-left: 6px; vertical-align: middle; }

/* form sheet (editor / roster) */
.form-panel { position: absolute; left: 0; right: 0; bottom: 0; top: 0; background: var(--bg-1); display: flex; flex-direction: column; overflow: hidden; animation: sheetup var(--slow) var(--ease); }
.form-head { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--s4) + env(safe-area-inset-top)) var(--s5) var(--s4); border-bottom: 1px solid var(--border); }
.form-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.form-close { width: 34px; height: 34px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.form-body { overflow-y: auto; padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.fld input, .fld textarea, .fld-select { width: 100%; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); padding: 12px 14px; font-size: 15px; color: var(--text); }
.fld input:focus, .fld textarea:focus, .fld-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.fld textarea { resize: vertical; }
.fld-select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23646b78' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.fld-select option { background: var(--surface); color: var(--text); }
.fld-hint { font-size: 11.5px; color: var(--text-3); font-weight: 400; margin-top: 2px; }
.warn-hint { color: var(--warn); font-weight: 600; }
/* cover image dropzone */
.dropzone { position: relative; border: 1.5px dashed var(--border-2); border-radius: var(--r); background: var(--surface); aspect-ratio: 16 / 8; display: grid; place-items: center; overflow: hidden; cursor: pointer; transition: border-color var(--fast), background var(--fast); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dz-empty { text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.7; padding: var(--s3); }
#dz-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dz-remove { position: absolute; top: 8px; right: 8px; z-index: 2; background: rgba(10,11,14,.7); color: #fff; border: none; border-radius: var(--r-full); padding: 5px 12px; font-size: 12px; font-weight: 700; }
/* uploaded cover banner in event detail */
.detail-cover { margin: 0 0 var(--s5); border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-2); }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* map embed in detail */
.map-embed { margin: 0 0 var(--s6); border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); position: relative; }
.map-embed iframe { width: 100%; height: 180px; border: 0; display: block; filter: grayscale(.2) brightness(.9); }
.map-open { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s2); font-size: 13px; font-weight: 700; color: var(--accent-ink); }
.map-open svg { width: 14px; height: 14px; }
.dist-badge { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(8,9,12,.6); color: #eef0f3; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: var(--r-full); backdrop-filter: blur(6px); }
.fld-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.fld-toggle { flex-direction: row; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); padding: 10px 14px; }
.fld-toggle input { display: none; }
.fld-toggle .switch { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-2); position: relative; transition: background var(--fast); flex: 0 0 auto; }
.fld-toggle .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-3); transition: transform var(--fast), background var(--fast); }
.fld-toggle input:checked + .switch { background: var(--accent-soft); border-color: var(--accent); }
.fld-toggle input:checked + .switch::after { transform: translateX(18px); background: var(--accent); }
.form-foot { display: flex; align-items: center; gap: var(--s3); padding-top: var(--s2); position: sticky; bottom: 0; }
.form-foot .btn { height: 46px; }

/* roster */
.roster-stats { display: flex; gap: var(--s5); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.roster-stats .st b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.roster-stats .st span { font-size: 12px; color: var(--text-2); }
.roster-body { overflow-y: auto; padding: var(--s4) var(--s5) var(--s10); display: flex; flex-direction: column; gap: var(--s2); }
.rrow { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.rrow .rav { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; color: var(--text-2); flex: 0 0 auto; }
.rrow .rinfo { flex: 1; min-width: 0; }
.rrow .rinfo strong { font-size: 14px; font-weight: 700; }
.rrow .rinfo small { display: block; font-size: 12px; color: var(--text-3); }
.rrow .rbtns { display: flex; gap: 6px; }
.rrow .rbtns button { height: 32px; padding: 0 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 700; border: none; }
.b-approve { background: var(--accent); color: #fff; }
.b-reject { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-2) !important; }
.r-status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--r-full); }
.r-status.approved { background: var(--ok-soft); color: var(--ok); }
.r-status.checked { background: var(--accent-soft); color: var(--accent-ink); }
.r-status.rejected { background: rgba(255,122,122,.14); color: #ff7a7a; }

/* scanner */
.scanner-panel { position: absolute; left: 0; right: 0; bottom: 0; top: 0; background: #000; display: flex; flex-direction: column; animation: sheetup var(--slow) var(--ease); }
.scanner-panel .form-head { background: var(--bg-1); }
.scanner-stage { position: relative; flex: 1; overflow: hidden; display: grid; place-items: center; }
#scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; width: 62vw; max-width: 280px; aspect-ratio: 1; border: 3px solid rgba(255,255,255,.9); border-radius: 20px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); }
.scan-result { padding: var(--s5); padding-bottom: calc(var(--s5) + env(safe-area-inset-bottom)); background: var(--bg-1); font-size: 15px; font-weight: 600; text-align: center; min-height: 84px; display: grid; place-items: center; }
.scan-result.ok { color: var(--ok); } .scan-result.dup { color: var(--warn); } .scan-result.err { color: #ff7a7a; }

/* ticket card in detail */
.ticket-card { display: flex; align-items: center; gap: var(--s4); padding: var(--s4); border-radius: var(--r-lg); margin-bottom: var(--s6); background: linear-gradient(135deg, rgba(109,123,255,.16), rgba(109,123,255,.05)); border: 1px solid var(--accent-soft); }
.ticket-card-info { flex: 1; min-width: 0; }
.ticket-card-info .k { font-size: 12px; color: var(--text-3); font-weight: 600; }
.ticket-card-info .tno { font-size: 26px; font-weight: 800; letter-spacing: 1px; margin: 2px 0 4px; }
.ticket-card-info small { font-size: 12px; color: var(--text-2); }
.ticket-card-qr { width: 76px; height: 76px; border-radius: 10px; background: #fff; padding: 5px; flex: 0 0 auto; display: grid; place-items: center; }
.ticket-card-qr img { width: 100%; height: 100%; border-radius: 4px; }

/* ticket QR */
.ticket-qr { width: 64px; height: 64px; border-radius: 8px; background: #fff; padding: 4px; flex: 0 0 auto; display: grid; place-items: center; align-self: center; }
.qr-big { display: grid; place-items: center; padding: var(--s5) 0; }
.qr-big img { width: 220px; height: 220px; background: #fff; border-radius: var(--r); padding: 10px; }
.qr-code-text { text-align: center; font-family: ui-monospace, monospace; font-size: 13px; color: var(--text-2); letter-spacing: 1px; margin-top: var(--s2); }

@media (min-width: 640px) { .org-events { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1025px) {
  .form-sheet .form-panel { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%,-50%); width: min(640px, calc(100vw - 64px)); height: min(760px, calc(100vh - 64px)); border-radius: var(--r-xl); border: 1px solid var(--border-2); box-shadow: var(--sh-3); animation: pop var(--med) var(--ease); }
  .scanner-sheet .scanner-panel { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%,-50%); width: min(520px, calc(100vw - 64px)); height: min(680px, calc(100vh - 64px)); border-radius: var(--r-xl); overflow: hidden; }
  .org-events { grid-template-columns: 1fr 1fr 1fr; }
}

/* profile page */
.profile-hero { position: relative; height: 38vh; min-height: 220px; background: linear-gradient(180deg, #1a1f2e, #0e1016); flex: 0 0 auto; }
#profile-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.profile-body { flex: 1; overflow-y: auto; padding: var(--s6) var(--s5) var(--s10); }
.profile-id { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s4); }
.profile-av { width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(from 200deg, var(--accent), #9aa6ff); color: #0a0b0e; display: grid; place-items: center; font-weight: 800; font-size: 22px; flex: 0 0 auto; }
.profile-id .nm { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.profile-id .un { font-size: 13px; color: var(--text-3); }
.profile-bio { font-size: 14px; color: var(--text-2); line-height: 1.7; margin: 0 0 var(--s5); }
.profile-stats { display: flex; gap: var(--s6); padding: var(--s4) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: var(--s5); }
.pstat b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.pstat span { font-size: 12px; color: var(--text-2); }
.profile-actions { display: flex; gap: var(--s2); margin-bottom: var(--s6); }
.profile-actions .btn, .profile-actions .btn-soft { flex: 1; height: 44px; justify-content: center; }
.friend-tag { font-size: 12px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 4px 10px; border-radius: var(--r-full); align-self: center; }
.plist-head { font-size: 13px; font-weight: 700; color: var(--text-3); margin: 0 0 var(--s3); }
.pevent { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: var(--s2); cursor: pointer; }
.pevent:hover { background: var(--surface); }
.pevent .pe-type { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-full); }
.pe-type.shared { background: var(--accent-soft); color: var(--accent-ink); }
.pe-type.hosted { background: var(--surface-2); color: var(--text-2); }
.pevent .pe-main { flex: 1; min-width: 0; }
.pevent .pe-main strong { font-size: 14px; font-weight: 700; display: block; }
.pevent .pe-main small { font-size: 12px; color: var(--text-3); }

/* island editor */
.edit-stage { position: relative; flex: 1; min-height: 0; background: linear-gradient(180deg, #1a1f2e, #0e1016); }
#edit-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.edit-save { position: absolute; top: calc(var(--s3) + env(safe-area-inset-top)); right: var(--s3); z-index: 3; height: 38px; padding: 0 18px; }
.edit-hint { position: absolute; bottom: var(--s3); left: 50%; transform: translateX(-50%); z-index: 3; font-size: 12px; color: var(--text-2); background: rgba(10,11,14,.6); padding: 6px 12px; border-radius: var(--r-full); backdrop-filter: blur(6px); white-space: nowrap; }
.unlock-bar { position: absolute; top: calc(var(--s3) + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 3; font-size: 12px; font-weight: 600; color: var(--text-2); background: rgba(10,11,14,.6); padding: 6px 12px; border-radius: var(--r-full); backdrop-filter: blur(6px); }
.palette { flex: 0 0 auto; display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom)); background: var(--bg-1); border-top: 1px solid var(--border); }
.mat { flex: 0 0 auto; width: 60px; height: 64px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--text-2); position: relative; }
.mat.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.mat.locked { opacity: .4; }
.mat .swatch { width: 34px; height: 34px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: rgba(255,255,255,.04); }
.mat .swatch img { width: 100%; height: 100%; object-fit: contain; }
.mat .swatch.eraser { background: repeating-linear-gradient(45deg, #3a3f47, #3a3f47 5px, #23262c 5px, #23262c 10px); }
.mat .swatch.raise, .mat .swatch.lower { font-weight: 900; font-size: 19px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, #23262c); }
.mat .swatch.raise::before { content: '▲'; }
.mat .swatch.lower::before { content: '▼'; }
.mat.mat-tool.active .swatch { box-shadow: 0 0 0 2px var(--accent) inset; }
.mat .lockdot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 2px var(--surface); }
.mat { width: 66px; height: 78px; gap: 6px; }

/* profile meta + desktop two-pane */
.profile-meta { display: flex; flex-wrap: wrap; gap: var(--s4); margin: 0 0 var(--s5); font-size: 13px; color: var(--text-2); }
.pmeta { display: inline-flex; align-items: center; gap: 6px; }
.pmeta svg { width: 14px; height: 14px; color: var(--text-3); }
.profile-actions { flex-wrap: wrap; }
.profile-actions .btn, .profile-actions .btn-soft { flex: 1 1 auto; min-width: 90px; }

/* QR modal */
.qr-sheet[hidden] { display: none; }
.qr-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(360px, calc(100vw - 40px)); background: var(--bg-1); border: 1px solid var(--border-2); border-radius: var(--r-xl); box-shadow: var(--sh-3); padding: var(--s6); text-align: center; animation: pop var(--med) var(--ease); }
.qr-card h3 { font-size: 17px; font-weight: 800; margin: 0 0 var(--s4); }
.qr-img { width: 220px; height: 220px; margin: 0 auto var(--s3); background: #fff; border-radius: var(--r); padding: 12px; display: grid; place-items: center; }
.qr-img img { width: 100%; height: 100%; }
.qr-url { font-size: 12px; color: var(--text-3); word-break: break-all; margin-bottom: var(--s4); }

/* shared-event mode hides registration fields */
.mode-shared .fld-capacity { display: none; }

@media (min-width: 1025px) {
  .profile-sheet .sheet-panel { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%,-50%); width: min(1040px, calc(100vw - 64px)); height: min(680px, calc(100vh - 64px)); border-radius: var(--r-xl); border: 1px solid var(--border-2); box-shadow: var(--sh-3); flex-direction: row; animation: pop var(--med) var(--ease); }
  .profile-hero { height: auto; width: 50%; min-height: 0; }
  .profile-body { padding: var(--s8); }
}

/* account button */
.account-btn { height: 38px; min-width: 38px; padding: 0 6px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; }
.account-btn[hidden] { display: none; }
.account-btn:hover { background: var(--surface-2); }
.account-btn .av { width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(from 200deg, var(--accent), #9aa6ff); color: #0a0b0e; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.account-btn .lbl { padding-right: 6px; }

/* sign-in sheet */
.auth-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(420px, calc(100vw - 32px)); background: var(--bg-1); border: 1px solid var(--border-2); border-radius: var(--r-xl); box-shadow: var(--sh-3); padding: var(--s8) var(--s6) var(--s6); text-align: center; animation: pop var(--med) var(--ease); }
.auth-sheet .sheet-panel { display: none; }
.auth-mark { width: 56px; height: 56px; margin: 0 auto var(--s4); border-radius: 16px; object-fit: cover; display: block; box-shadow: 0 0 28px rgba(222,74,31,.4); }
.auth-card h2 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 var(--s2); }
.auth-card p { font-size: 13.5px; line-height: 1.7; color: var(--text-2); margin: 0 0 var(--s5); }
.auth-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: var(--s4); }
.auth-tab { flex: 1; height: 36px; border: none; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 700; border-radius: 9px; }
.auth-tab.active { background: var(--elevated); color: var(--text); }
.auth-card form { display: flex; flex-direction: column; gap: var(--s3); }
.auth-card input { height: 48px; border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface); padding: 0 16px; font-size: 15px; text-align: center; }
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-card .btn-primary { width: 100%; }
.auth-msg { font-size: 13px; font-weight: 600; padding: 10px 12px; border-radius: 10px; text-align: center; }
.auth-msg[hidden] { display: none; }
.auth-msg.err { background: rgba(255,122,122,.12); color: #ff8a8a; }
.auth-msg.ok { background: var(--ok-soft); color: var(--ok); }
.auth-alt { margin-top: var(--s4); background: none; border: none; color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.auth-alt:hover { text-decoration: underline; }
.auth-dismiss { display: block; width: 100%; margin-top: var(--s3); background: none; border: none; color: var(--text-3); font-size: 13px; font-weight: 600; }
.auth-dismiss:hover { color: var(--text-2); }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); transform: translate(-50%, 12px); z-index: 70; background: var(--elevated); color: var(--text); border: 1px solid var(--border-2); padding: 12px 18px; border-radius: var(--r); font-size: 14px; font-weight: 600; box-shadow: var(--sh-3); opacity: 0; pointer-events: none; transition: opacity var(--med), transform var(--med) var(--ease); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =================== responsive =================== */
@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; gap: var(--s5); }
  .feature-cover { aspect-ratio: 21/9; }
  .feature-title { font-size: 26px; }
  .tickets-grid { grid-template-columns: 1fr 1fr; }
  .toast { bottom: 24px; }
}
@media (min-width: 1025px) {
  :root { --appbar-h: 64px; }
  .app { padding-bottom: var(--s16); }
  .appbar-links { display: flex; }
  .appbar-search { display: block; }
  .appbar .icon-search { display: none; }
  .tabbar { display: none; }
  .view-head { padding: var(--s10) 0 var(--s5); }
  .view-head h1 { font-size: 32px; }
  .grid { grid-template-columns: 1fr 1fr 1fr; }
  /* featured hero becomes a horizontal split on desktop */
  .feature { display: grid; grid-template-columns: 1.15fr 1fr; }
  .feature-cover { aspect-ratio: auto; height: 340px; }
  .feature-cover::after { background: linear-gradient(90deg, transparent 50%, rgba(8,9,12,.4)); }
  .feature-body { position: static; display: flex; flex-direction: column; justify-content: center; padding: var(--s8); }
  .feature-title { font-size: 28px; }
  /* detail as centered two-pane modal */
  .sheet-scrim { cursor: zoom-out; }
  .detail .sheet-panel { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%,-50%); width: min(1040px, calc(100vw - 64px)); height: min(680px, calc(100vh - 64px)); border-radius: var(--r-xl); border: 1px solid var(--border-2); box-shadow: var(--sh-3); flex-direction: row; animation: pop var(--med) var(--ease); }
  @keyframes pop { from { transform: translate(-50%,-48%) scale(.98); opacity: .5; } }
  .detail-hero { height: auto; width: 48%; min-height: 0; }
  .detail-body { padding: var(--s8) var(--s8) 0; }
  .dock { margin: 0 calc(-1 * var(--s8)); padding: var(--s5) var(--s8); }
}
@media (min-width: 1280px) { .app { padding-left: 0; padding-right: 0; } }
