/* SNS member app. Brand: black and ivory ground, red only where you act (70 / 20 / 10),
   Archivo for UI, Fraunces for the few editorial moments, Hind for Nepali. */
@font-face { font-family: 'Fraunces'; font-weight: 100 900; font-display: swap; src: url(/fonts/fraunces-01.woff2) format('woff2'); }

:root, [data-theme="dark"] {
  --bg: #000; --surface: #121110; --surface-2: #1B1917; --line: rgba(245,245,245,.09);
  --fg: #F5F5F5; --fg-2: #B5B0AA; --fg-3: #85807A;
  --inverse: #F5F5F5; --on-inverse: #0b0a09; --inverse-3: #6d675f;
  --red: #C1121F; --red-ink: #E2352F; --sand: #D6C3A3; --on-sand: #1a140c; --ok: #3fa864; --ok-bg: rgba(63,168,100,.16); --warn: #d69e2e; --warn-bg: rgba(214,158,46,.18);
  --glass: rgba(40,37,34,.45); --glass-edge: rgba(245,245,245,.14); --glass-hi: rgba(255,255,255,.12); --lens: #F5F5F5; --lens-ink: #0A0A0A;
  --scrim: rgba(0,0,0,.55); --peak: #EDE6D8; --ridge: #6f6a64; --input: #0b0a09;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F5F5F5; --surface: #FFFFFF; --surface-2: #ECE8E2; --line: rgba(10,9,8,.08);
  --fg: #0A0A0A; --fg-2: #4D4740; --fg-3: #7A736A;
  --inverse: #0A0A0A; --on-inverse: #F5F5F5; --inverse-3: #A8A29A;
  --red-ink: #A50E19; --ok: #1f7a3a; --ok-bg: rgba(31,122,58,.12); --warn: #9a6a10; --warn-bg: rgba(214,158,46,.2);
  --glass: rgba(255,255,255,.55); --glass-edge: rgba(255,255,255,.7); --glass-hi: rgba(255,255,255,.9); --lens: #FFFFFF; --lens-ink: #0A0A0A;
  --scrim: rgba(10,9,8,.35); --peak: #3a3530; --ridge: #8f877d; --input: #FFFFFF;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 500 15px/1.4 'Archivo', 'Hind', system-ui, sans-serif; letter-spacing: -.01em; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -.03em; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red-ink); outline-offset: 2px; }
.serif, h1.title { font-family: 'Fraunces', Georgia, serif; font-weight: 450; letter-spacing: -.03em; }
h1.title { font-size: 38px; line-height: 1.02; }
.np { font-family: 'Hind', 'Noto Sans Devanagari', sans-serif; letter-spacing: 0; }
.eyebrow { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.muted { color: var(--fg-2); } .small { font-size: 12.5px; } .center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 12px; } .stack-lg { display: grid; gap: 22px; }
.grow { flex: 1; min-width: 0; }

/* ---------- shell ---------- */
.app { position: relative; min-height: 100dvh; max-width: 560px; margin: 0 auto; }
.top { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top, 0px) + 10px) 18px 10px;
  background: linear-gradient(var(--bg) 65%, transparent); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.mark { width: 28px; height: 28px; background: url(/icons/sns-mark-ivory.png) center/contain no-repeat; display: block; }
[data-theme="light"] .mark { background-image: url(/icons/sns-mark-red.png); }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--fg); border: 0; cursor: pointer; text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red-ink); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--sand); color: var(--on-sand); font-size: 13px; font-weight: 700; text-decoration: none; }
.view { padding: 6px 18px calc(env(safe-area-inset-bottom, 0px) + 120px); outline: none; display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; gap: 16px; will-change: transform, opacity; }
.view.public { padding-bottom: 48px; }
.offline { margin: 0 18px 8px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 13px; text-align: center; padding: 8px; }

/* floating glass pill nav; the bright lens marks where you are */
.tabs { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); transform: translateX(-50%); z-index: 20; display: flex; gap: 2px; padding: 6px; border-radius: 999px;
  background: var(--glass); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-hi), 0 18px 40px -16px rgba(0,0,0,.55); }
.tab { position: relative; z-index: 1; width: 58px; height: 50px; display: grid; place-items: center; border-radius: 999px; color: var(--fg-2); transition: color 180ms ease; }
.tab svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform 160ms ease-out; }
.tab[aria-current="page"] { color: var(--lens-ink); }
.tab:active svg { transform: scale(.86); }
.lens { position: absolute; top: 6px; left: 0; width: 58px; height: 50px; border-radius: 999px; background: var(--lens); box-shadow: 0 4px 14px -4px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.6); will-change: transform; }
@media (prefers-reduced-transparency: reduce) { .tabs { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; } }
@media (max-width: 360px) { .tab { width: 52px; } .lens { width: 52px; } }

/* ---------- building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 16px; }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 999px; font-size: 11.5px; background: var(--surface-2); color: var(--fg); border: 0; font-family: inherit; }
.pill.red { background: var(--red); color: #F5F5F5; } .pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ivory { background: var(--inverse); color: var(--on-inverse); }
button.pill { cursor: pointer; }
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--fg); font: 600 15px 'Archivo', sans-serif; letter-spacing: -.01em; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.cta { background: var(--red); border-color: var(--red); color: #F5F5F5; }
.btn.ghost { background: transparent; }
.btn.done, .btn.on { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; }
.press { transition: transform 120ms ease-out; cursor: pointer; user-select: none; -webkit-user-select: none; }
.press.down { transform: scale(.97); }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; transform: scale(0); background: rgba(245,245,245,.35); }
.empty { padding: 28px 16px; text-align: center; color: var(--fg-3); border: 1px dashed var(--line); border-radius: 20px; }
.menu { display: grid; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.menu > a, .menu > button, .menu > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; text-decoration: none; background: var(--surface);
  color: var(--fg); border: 0; border-bottom: 1px solid var(--line); font: inherit; text-align: left; width: 100%; cursor: pointer; }
.menu > :last-child { border-bottom: 0; }
.menu .chev { color: var(--fg-3); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { border-radius: 22px; padding: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; align-content: space-between; gap: 8px; min-height: 100px; text-decoration: none; color: inherit; }
.tile.sand { background: var(--sand); color: var(--on-sand); border: 0; }
.tile.sand .eyebrow { color: #5c4d36; }
.tile .eyebrow { white-space: normal; }
.tile.ivory { background: var(--inverse); color: var(--on-inverse); border: 0; }
.tile.red { background: var(--red); color: #F5F5F5; border: 0; }
.big { font: 450 34px/1 'Fraunces', serif; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.big small { font: 500 13px 'Archivo', sans-serif; opacity: .7; margin-left: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { display: inline-flex; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips span { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg-2); font-size: 13px; cursor: pointer; }
.chips input:checked + span { background: var(--inverse); border-color: var(--inverse); color: var(--on-inverse); }
.chips input:focus-visible + span { outline: 2px solid var(--red-ink); }
.scroller { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px 2px; }
.scroller::-webkit-scrollbar { display: none; }

/* ---------- forms ---------- */
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--fg-2); }
input, select, textarea { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--input); color: var(--fg); font: 500 16px/1.3 'Archivo', sans-serif; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--fg-3); }
.check { display: flex; align-items: flex-start; gap: 10px; color: var(--fg); font-size: 14px; }
.check input { width: 20px; min-height: 20px; height: 20px; margin: 1px 0 0; accent-color: #C1121F; flex: none; }
.hp { position: absolute; left: -9999px; }
.error { color: var(--red-ink); font-size: 14px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: relative; background: var(--surface-2); border-radius: 999px; padding: 4px; }
.seg button { position: relative; z-index: 1; min-height: 38px; border: 0; background: none; border-radius: 999px; font: 600 13.5px 'Archivo', sans-serif; color: var(--fg-2); cursor: pointer; }
.seg button[aria-selected="true"] { color: var(--fg); }
.seg .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 999px; background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.18); will-change: transform; }

/* ---------- welcome ---------- */
.hero-photo { position: relative; margin: -6px -18px 0; min-height: 62dvh; display: flex; flex-direction: column; justify-content: flex-end; padding: 24px 22px; color: #F5F5F5;
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0) 30%, rgba(0,0,0,.25) 55%, #000 100%), url(/img/basantapur.webp) center/cover; }
[data-theme="light"] .hero-photo { background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0) 30%, rgba(0,0,0,.2) 55%, rgba(0,0,0,.85) 100%), url(/img/basantapur.webp) center/cover; border-radius: 0 0 32px 32px; }
.hero-photo h1 { font: 450 46px/.95 'Fraunces', serif; letter-spacing: -.03em; }

/* ---------- home ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.week div { display: grid; justify-items: center; gap: 5px; font-size: 10px; color: var(--fg-3); }
.week b { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--surface-2); font-size: 12px; color: var(--fg-2); }
.week b.done { background: var(--red); border-color: var(--red); color: #F5F5F5; }
.week b.today { border-color: var(--fg); color: var(--fg); }
.pledge { background: var(--inverse); color: var(--on-inverse); border-radius: 26px; padding: 18px; display: grid; gap: 12px; }
.pledge .eyebrow { color: var(--inverse-3); white-space: normal; }
.pledge h3 { font: 450 24px/1.08 'Fraunces', serif; letter-spacing: -.02em; }
.mtn-card { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 16px 16px 14px; overflow: hidden; }
.alt { display: flex; align-items: baseline; gap: 4px; margin: 6px 0 2px; }
.alt b { font: 700 46px/1 'Archivo', sans-serif; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.alt span { color: var(--fg-3); font-size: 20px; }
.mtn { display: block; width: calc(100% + 32px); aspect-ratio: 340 / 190; height: auto; margin: 6px -16px 4px; }
.flags path[fill] { transform-box: fill-box; transform-origin: top left; animation: flutter 2.6s ease-in-out infinite; animation-delay: var(--d); }
@keyframes flutter { 50% { transform: skewY(7deg) scaleX(.9); } }
.halo { transform-box: fill-box; transform-origin: center; animation: halo 1.9s ease-out infinite; }
@keyframes halo { 0% { transform: scale(.6); opacity: .5; } 100% { transform: scale(1.9); opacity: 0; } }
.rich { display: grid; gap: 8px; }
.rich p, .rich ul, .rich ol, .rich blockquote, .rich h3, .rich h4 { margin: 0; }
.rich ul, .rich ol { padding-left: 20px; }
.rich a { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }
.rich blockquote { border-left: 2px solid var(--red); padding-left: 12px; }

/* ---------- events, programmes ---------- */
.event { display: flex; gap: 12px; align-items: flex-start; }
.date-badge { flex: none; width: 54px; text-align: center; border-radius: 14px; background: var(--surface-2); padding: 7px 0; }
.date-badge b { display: block; font: 450 22px/1 'Fraunces', serif; }
.date-badge span { font-size: 10.5px; text-transform: uppercase; color: var(--fg-3); letter-spacing: .08em; }
.photo-card { position: relative; border-radius: 24px; padding: 16px; min-height: 200px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; color: #F5F5F5; background: #1b1917 center/cover; text-decoration: none; }
.photo-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.85) 80%); }
.photo-card > * { position: relative; }
.prow { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.prow .th { width: 56px; height: 56px; border-radius: 14px; background: var(--surface-2) center/cover; flex: none; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.steps span { height: 6px; border-radius: 3px; background: rgba(245,245,245,.22); }
.steps span.f { background: #F5F5F5; }
.steps span.n { background: var(--red); }
.card .steps span, .prow .steps span { background: var(--surface-2); }
.card .steps span.f, .prow .steps span.f { background: var(--fg); }
.card .steps span.n, .prow .steps span.n { background: var(--red); }
.ladder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ladder div { display: grid; gap: 3px; padding-top: 10px; border-top: 3px solid var(--surface-2); font-size: 11.5px; color: var(--fg-3); }
.ladder div b { font-size: 13px; color: var(--fg-2); }
.ladder div.done { border-top-color: var(--red); }
.ladder div.done b { color: var(--fg); }

/* ---------- member card ---------- */
.mcard { position: relative; overflow: hidden; border-radius: 24px; aspect-ratio: 1.586; padding: 18px; background: #0b0a09; color: #F5F5F5; border: 1px solid rgba(245,245,245,.12);
  display: flex; flex-direction: column; justify-content: space-between; transition: background 420ms ease, color 420ms ease; box-shadow: 0 24px 50px -24px rgba(0,0,0,.6); }
.mcard::before { content: ""; position: absolute; right: -70px; top: -50px; width: 240px; height: 240px; background: url(/icons/sns-mark-red.png) center/contain no-repeat; opacity: .22; transition: opacity 300ms; }
.mcard > * { position: relative; }
.mcard .card-mark { width: 28px; height: 28px; background: url(/icons/sns-mark-ivory.png) center/contain no-repeat; }
.mcard .name { font: 450 27px/1 'Fraunces', serif; letter-spacing: -.02em; }
.mcard .meta { display: flex; gap: 18px; font-size: 11.5px; margin-top: 10px; }
.mcard .meta span { opacity: .65; display: block; }
.mcard .meta b { font-size: 13px; }
.mcard[data-finish="ivory"] { background: #F5F5F5; color: #0A0A0A; border-color: rgba(10,9,8,.1); }
.mcard[data-finish="red"] { background: #C1121F; }
.mcard[data-finish="red"]::before { background-image: url(/icons/sns-mark-ivory.png); opacity: .14; }
.mcard[data-finish="sand"] { background: #D6C3A3; color: #1a140c; border-color: transparent; }
.mcard[data-finish="patan"] { background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.75)), url(/img/patan.webp) center 35%/cover; }
.mcard[data-finish="himalaya"] { background: linear-gradient(180deg, rgba(0,0,0,.1), rgba(0,0,0,.72)), url(/img/sunrise.webp) center/cover; }
.mcard[data-finish="bhaktapur"] { background: linear-gradient(180deg, rgba(0,0,0,.1), rgba(0,0,0,.75)), url(/img/bhaktapur.webp) center/cover; }
.mcard[data-finish="patan"]::before, .mcard[data-finish="himalaya"]::before, .mcard[data-finish="bhaktapur"]::before { opacity: 0; }
.mcard[data-finish="ivory"] .card-mark, .mcard[data-finish="sand"] .card-mark { background-image: url(/icons/sns-mark-red.png); }
.finishes { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.finishes::-webkit-scrollbar { display: none; }
.finishes button { flex: none; width: 46px; height: 46px; border-radius: 14px; border: 2px solid transparent; background: center/cover; cursor: pointer; outline: 1px solid var(--line); transition: transform 160ms ease; }
.finishes button[aria-pressed="true"] { border-color: var(--red); transform: scale(1.06); }
.qr-box { background: #F5F5F5; border-radius: 22px; padding: 18px; width: min(230px, 68vw); margin: 0 auto; border: 1px solid var(--line); }
.qr-box svg { display: block; width: 100%; height: auto; }

/* ---------- writing ---------- */
.editor { min-height: 46dvh; padding: 4px 2px 40px; font: 400 17px/1.6 'Archivo', sans-serif; color: var(--fg); outline: none; }
.editor:empty::before { content: attr(data-placeholder); color: var(--fg-3); }
.editor h3 { font: 450 22px/1.2 'Fraunces', serif; margin: 12px 0 4px; }
.editor blockquote { border-left: 2px solid var(--red); margin: 8px 0; padding-left: 12px; color: var(--fg-2); }
.title-input { border: 0; background: none; padding: 0; min-height: 0; font: 450 30px/1.08 'Fraunces', serif; letter-spacing: -.02em; color: var(--fg); }
.toolbar { position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 86px); display: flex; justify-content: space-between; gap: 4px; padding: 6px; border-radius: 16px;
  background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--glass-edge); }
.toolbar button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: none; color: var(--fg); font: 600 15px 'Archivo', sans-serif; cursor: pointer; }
.toolbar button:active { background: var(--surface-2); }
.file-row { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: var(--surface-2); }

/* ---------- sheet, overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); opacity: 0; pointer-events: none; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-width: 560px; height: 88dvh; margin: 0 auto; border-radius: 30px 30px 0 0; overflow: hidden;
  background: #000; color: #F5F5F5; transform: translateY(110%); will-change: transform; touch-action: none; }
.sheet .grab { position: absolute; top: 10px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: rgba(245,245,245,.6); z-index: 3; }
.sheet-body { position: absolute; inset: 0; display: flex; flex-direction: column; }
.sheet .ph { position: absolute; inset: 0; background: #1b1917 center/cover; }
.sheet .ph::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.4), rgba(0,0,0,0) 28%, rgba(0,0,0,.88) 62%, #000); }
.sheet .in { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; padding: 34px 20px calc(env(safe-area-inset-bottom, 0px) + 24px); overflow-y: auto; }
.overlay { position: fixed; inset: 0; z-index: 40; background: var(--bg); color: var(--fg); display: flex; flex-direction: column; align-items: center; padding: calc(env(safe-area-inset-top, 0px) + 64px) 24px calc(env(safe-area-inset-bottom, 0px) + 28px); transform: translateY(100%); will-change: transform; overflow-y: auto; }
.dots { display: flex; gap: 16px; margin: 24px 0 10px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--fg-2); transition: background 120ms, border-color 120ms, transform 160ms cubic-bezier(.3,1.6,.5,1); }
.dots i.f { background: var(--fg); border-color: var(--fg); transform: scale(1.12); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; margin-top: auto; }
.keypad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--fg); font: 500 30px 'Archivo', sans-serif; cursor: pointer; transition: transform 90ms ease-out, background 120ms; }
.keypad button.down { transform: scale(.92); background: var(--line); }
.keypad button.ghost { background: none; font-size: 14px; }
.scanner { background: #000; color: #F5F5F5; }
.viewfinder { position: relative; width: min(280px, 76vw); aspect-ratio: 1; margin: 22px 0 16px; border-radius: 28px; background: #0b0a09; overflow: hidden; flex: none; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder .frame { position: absolute; inset: 14px; border-radius: 22px; border: 3px solid #F5F5F5; clip-path: polygon(0 0, 24% 0, 24% 100%, 0 100%, 0 0, 100% 0, 100% 100%, 76% 100%, 76% 0); }
.viewfinder .line { position: absolute; left: 24px; right: 24px; height: 2px; background: var(--red); box-shadow: 0 0 14px 2px rgba(193,18,31,.7); animation: sweep 2.2s ease-in-out infinite alternate; }
@keyframes sweep { from { top: 30px; } to { top: calc(100% - 32px); } }
.result { position: fixed; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); z-index: 2; border-radius: 26px; padding: 18px; background: #F5F5F5; color: #0A0A0A; transform: translateY(140%); display: grid; gap: 6px; max-width: 532px; margin: 0 auto; }
.result .badge { justify-self: start; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; }
.haptic-proxy { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: -10px; }

/* ---------- misc ---------- */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 92px); z-index: 60; transform: translate(-50%, 16px); background: var(--inverse); color: var(--on-inverse);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2,.8,.2,1); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--fg-3); font-weight: 500; }
.code { font: 600 22px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; background: var(--surface-2); padding: 12px; border-radius: 12px; text-align: center; }
.meter { display: grid; gap: 6px; }
.meter .bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.meter.warn .bar i { background: var(--warn); } .meter.stop .bar i { background: var(--red); }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: var(--fg-2); font-size: 14px; }
.perks li { display: flex; gap: 10px; align-items: center; }
.perks li::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--red); transform: rotate(45deg); flex: none; }
.ios-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,0); transition: background .25s; }
.sheet-wrap.open { background: rgba(0,0,0,.6); }
.sheet-wrap .sheet-panel { width: 100%; max-width: 520px; background: var(--surface); color: var(--fg); border-radius: 26px 26px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 16px; transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.sheet-wrap.open .sheet-panel { transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
}
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- ticket: photo, perforated edges, live code ---------- */
.ticket { position: relative; border-radius: 28px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.ticket .t-photo { height: 170px; background: #1b1917 center/cover; }
.ticket .t-body { position: relative; padding: 18px 20px 22px; display: grid; gap: 14px; }
.ticket .t-body::before, .ticket .t-body::after { content: ""; position: absolute; top: -14px; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); }
.ticket .t-body::before { left: -14px; } .ticket .t-body::after { right: -14px; }
.perf { border: 0; border-top: 2px dashed var(--line); margin: 0 -4px; }
.t-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.t-grid b { display: block; font-size: 15px; margin-top: 3px; }

/* ---------- desktop sessions (approved from a phone): a wider, roomier layout ---------- */
.desk .app { max-width: 1040px; }
.desk .view { padding-left: 32px; padding-right: 32px; }
.desk .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.desk .mcard, .desk .qr-box { max-width: 420px; }
@media (min-width: 900px) { .desk .view { grid-template-columns: minmax(0, 1fr); } .desk h1.title { font-size: 46px; } }
