/* ===========================================================================
   Silicon — Binder
   The collectible annex of the Standout ecosystem.

   Canvas:  warm cream paper (Standout account) for Binder / Network / Account;
            dark ink only for capture moments (Scanner, AR reveal).
   Type:    old-style serif for display (names, numbers, headings),
            clean sans for UI. Same pairing as the Standout account.
   Play:    sticker-album — empty slots are glue outlines, new cards land
            tilted then straighten, the Silicon eye is alive.
   Color:   forest green = action (Standout), mint = Silicon brand moments,
            card type colors stay printed, red only ever means Due Diligence.
   =========================================================================== */

/* ---- brand faces --------------------------------------------------------
   Exposure — Standout's display face (the account, the cards). Display only.
   Inter — everything else. */
@font-face {
  font-family: 'Exposure';
  src: url('/binder/fonts/Exposure.otf') format('opentype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Exposure';
  src: url('/binder/fonts/Exposure-Italic.otf') format('opentype');
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/binder/fonts/Inter-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* paper world */
  --paper: #f4f1e6;
  --paper-2: #efeadb;
  --card-surface: #fdfcf7;
  --ink: #22291f;
  --ink-soft: rgba(34, 41, 31, 0.62);
  --ink-faint: rgba(34, 41, 31, 0.38);
  --hairline: rgba(34, 41, 31, 0.14);
  --hairline-2: rgba(34, 41, 31, 0.22);

  /* dark world (capture) */
  --night: #0c0d0b;
  --night-2: #141613;
  --night-line: rgba(244, 240, 228, 0.14);
  --cream-on-night: #f4f0e4;
  --cream-muted: rgba(244, 240, 228, 0.55);

  /* brand */
  --forest: #2e4a39;        /* Standout action green */
  --forest-deep: #22392c;
  --mint: #3fe08a;          /* Silicon */
  --mint-ink: #0b3820;
  --danger: #e5482f;        /* Due Diligence only */

  --accent: var(--mint);    /* reveal accent, overridden per card by trust */

  --serif: 'Exposure', "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: 'Inter', ui-sans-serif, -apple-system, "Segoe UI", Helvetica, sans-serif;

  --tab-h: 66px;
  --max: 460px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  /* no theme cross-fade: transitions freeze in hidden tabs and the paper/dark
     switch reads cleaner as a hard cut anyway */
}
/* faint topographic rings — the cards' contour texture, whispered */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    repeating-radial-gradient(140% 110% at 88% -24%,
      transparent 0 44px, rgba(34, 41, 31, 0.05) 44px 45.5px);
}
body.dark { background: var(--night); color: var(--cream-on-night); }
body.dark::before { display: none; }

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
body.dark :focus-visible { outline-color: var(--mint); }

.serif { font-family: var(--serif); }
.mono-label {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 700; color: var(--ink-soft);
}

/* halftone dots — the Standout button texture */
.ht { position: relative; overflow: hidden; isolation: isolate; }
.ht::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: radial-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1.4px);
  background-size: 7px 7px;
  mask-image: linear-gradient(115deg, rgba(0,0,0,.9), transparent 55%);
}

/* ---- app frame ---------------------------------------------------------- */
#app {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100%;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}
#app[hidden] { display: none; }
.view {
  flex: 1;
  padding: calc(env(safe-area-inset-top) + 8px) 18px calc(var(--tab-h) + 28px);
  /* No entrance animation: an opacity/transform intro breaks scrollIntoView
     and leaves views invisible when animations are paused (hidden tabs). */
}
.view[hidden] { display: none; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px 14px;
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand img { width: 26px; height: 26px; }
.brand b { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: 0; }
.topbar .spacer { flex: 1; }

.pill {
  border: 1px solid var(--hairline-2); border-radius: 999px;
  padding: 6px 13px; font-size: 12px; font-weight: 600; color: var(--ink);
  background: var(--card-surface); display: inline-flex; align-items: center; gap: 8px;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); }

h1.page {
  font-family: var(--serif); font-weight: 600;
  font-size: 32px; letter-spacing: -0.01em; margin: 2px 0 2px;
}
.sub {
  color: var(--ink-soft); font-size: 14px; margin: 0 0 18px;
  font-family: var(--serif); font-style: italic;
}

/* ===========================================================================
   Bottom tab bar
   =========================================================================== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: var(--max); margin: 0 auto;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--hairline);
}
.tab {
  border: 0; background: none; display: grid; place-items: center; gap: 4px;
  color: var(--ink-faint); position: relative;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--forest); --icon-bg: color-mix(in srgb, var(--forest) 22%, transparent); }
.tab.active::before {
  content: ""; position: absolute; top: 0; width: 22px; height: 2px;
  background: var(--forest);
}
body.dark .tab.active::before { background: var(--mint); }
.tab small { font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }

body.dark .tabbar {
  background: rgba(12, 13, 11, 0.86);
  border-top-color: var(--night-line);
}
body.dark .tab { color: rgba(244, 240, 228, 0.34); }
body.dark .tab.active { color: var(--mint); --icon-bg: color-mix(in srgb, var(--mint) 25%, transparent); }

/* ===========================================================================
   Card component (real photo, or rendered from data)
   =========================================================================== */
.card {
  position: relative; aspect-ratio: 3 / 4.15;
  border-radius: 7.56% / 5.47%;  /* print-measured corner (Card Animator), circular at any size */
  overflow: hidden; background: var(--type, #333);
  color: var(--type-on, #fff);
  box-shadow: 0 1px 2px rgba(34, 41, 31, 0.10), 0 4px 14px rgba(34, 41, 31, 0.10);
  isolation: isolate; user-select: none;
  container-type: inline-size;
}
.card.photo { background: #000; }
.card.photo img { width: 100%; height: 100%; object-fit: cover; }
.card-tex {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,255,255,.16), transparent 60%),
    radial-gradient(90% 60% at 50% 120%, rgba(0,0,0,.35), transparent 55%);
  mix-blend-mode: soft-light; pointer-events: none;
}
.card-inner { position: absolute; inset: 0; padding: 7cqw; display: flex; flex-direction: column; }
.card-name {
  font-family: var(--serif); font-weight: 700; line-height: .98;
  letter-spacing: 0; font-size: 15cqw; max-width: 74%;
  overflow-wrap: anywhere; text-wrap: balance;
}
.card-name.tight { font-size: 10cqw; max-width: 92%; }
.card-role {
  margin-top: auto; font-family: var(--serif); font-style: italic;
  font-size: max(9px, 6cqw); opacity: .88; max-width: 82%;
}
.card-corner {
  position: absolute; top: 7cqw; right: 7.5cqw; text-align: right;
  font-size: max(7px, 3cqw); letter-spacing: .08em; font-weight: 700;
  opacity: .82; line-height: 1.35; font-family: var(--sans);
}
.card-corner .stars { font-size: max(10px, 4.5cqw); letter-spacing: 1px; }
.card-badge {
  position: absolute; bottom: 10px; right: 10px; width: 22px; height: 22px;
  border-radius: 50%; background: rgba(0,0,0,.35); display: grid; place-items: center;
}
.card-badge img { width: 15px; height: 15px; }

/* ===========================================================================
   Deck — the album
   =========================================================================== */
.progress-wrap { margin: 2px 0 16px; }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.progress-head b {
  font-family: var(--serif); font-weight: 600; font-size: 34px; letter-spacing: -0.01em;
}
.progress-head b small {
  font-family: var(--serif); font-size: 16px; color: var(--ink-soft); font-weight: 400;
}
.track {
  height: 4px; border-radius: 2px; background: rgba(34, 41, 31, 0.12); overflow: hidden;
}
.track > span {
  display: block; height: 100%; border-radius: 2px;
  background: var(--forest);
  transition: width .6s cubic-bezier(.2,.7,.2,1);
}

.filters {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 16px;
  margin: 0 -18px; padding-left: 18px; scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--hairline); background: transparent;
  border-radius: 999px; padding: 7px 13px; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; color: var(--ink-soft); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip .count { font-weight: 400; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.chip.on .count { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.chip .swatch { width: 9px; height: 9px; border-radius: 3px; }
.chip.on { color: var(--paper); background: var(--forest); border-color: var(--forest); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.slot { position: relative; }
.slot .card { cursor: pointer; transition: transform .18s, rotate .18s, translate .18s, box-shadow .18s; }
.slot .card:active { transform: scale(.97); }
/* stickers never sit perfectly straight */
.slot:not(.locked):nth-child(3n+1) .card { rotate: -0.7deg; }
.slot:not(.locked):nth-child(3n) .card { rotate: 0.6deg; }
@media (hover: hover) {
  .slot:not(.locked) .card:hover {
    rotate: 0deg; translate: 0 -4px;
    box-shadow: 0 2px 4px rgba(34, 41, 31, .12), 0 12px 26px rgba(34, 41, 31, .16);
  }
}

/* empty slot = a glue outline waiting for its sticker */
.slot.locked .card {
  background: transparent !important; box-shadow: none;
  border: 1.5px dashed var(--hairline-2);
  color: inherit;
}
.slot.locked .ghost-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: 20px;
  color: var(--ink-faint);
}
.slot.locked .ghost-dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--tc, var(--ink-faint)); opacity: .65;
}

/* #99 — the Standout team's seat, kept warm until the art lands */
.slot.reserved .card {
  border-style: solid; border-color: var(--hairline);
  background: color-mix(in srgb, var(--paper-2) 60%, transparent) !important;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 10px; text-align: center;
}
.slot.reserved .card img { width: 26px; height: 26px; opacity: .5; }
.slot.reserved .ghost-num { position: static; font-size: 15px; }
.slot.reserved .card small {
  font-size: 9.5px; line-height: 1.35; color: var(--ink-faint); letter-spacing: .02em;
}
.slot.reserved .card small em { font-family: var(--serif); }

/* the gods — printed past the /100 set, shelved under their own rule */
.deck-sec {
  display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px;
  padding-top: 16px; border-top: 1px solid var(--hairline);
}
.deck-sec b { font-family: var(--serif); font-weight: 600; font-size: 19px; }
.deck-sec span { font-family: var(--serif); font-style: italic; font-size: 12.5px; color: var(--ink-soft); }
.deck-sec[hidden], .grid[hidden] { display: none; }

.new-flag {
  position: absolute; top: -6px; left: -6px; z-index: 3;
  background: var(--mint); color: var(--mint-ink); font-size: 9px; font-weight: 800;
  letter-spacing: .08em; padding: 3px 8px; border-radius: 999px;
  box-shadow: 0 1px 4px rgba(34, 41, 31, .25);
  transform: rotate(-3deg);
}

/* ===========================================================================
   Scanner — the dark capture room
   =========================================================================== */
#view-scanner { padding: 0; position: relative; overflow: hidden; }
.scan-stage { position: absolute; inset: 0; background: #000; }
.scan-stage video, .scan-stage .fallback {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.scan-stage .fallback {
  background: radial-gradient(90% 60% at 50% 30%, #182a1f, #0b0d0b 70%);
  display: grid; place-items: center;
}
.scan-stage .fallback span {
  color: rgba(244, 240, 228, 0.32); font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
}
.scan-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.5), transparent 22%, transparent 60%, rgba(0,0,0,.75));
}

/* live detection — the box hugs the card wherever it physically is */
.detect-box {
  position: fixed; z-index: 30; pointer-events: none; opacity: 0;
  border: 2.5px solid var(--mint); border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 0 22px rgba(63, 224, 138, .30);
  transition: left .22s ease-out, top .22s ease-out, width .22s ease-out,
              height .22s ease-out, opacity .18s ease;
}
.detect-box.seek { opacity: .55; border-style: dashed; }
.detect-box.lock {
  opacity: 1; border-style: solid;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 0 36px rgba(63, 224, 138, .55);
}
.scan-cue {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + 34px); z-index: 31;
  text-align: center; color: var(--cream-on-night); font-size: 15px;
  font-family: var(--serif); font-style: italic;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .7); pointer-events: none;
}
.scan-cue:empty { display: none; }

.scan-top {
  position: absolute; top: calc(env(safe-area-inset-top) + 14px);
  left: 0; right: 0; display: flex; justify-content: center;
}
.scan-top .pill {
  background: rgba(14, 16, 13, 0.66); border-color: var(--night-line);
  color: var(--cream-on-night); backdrop-filter: blur(12px);
  padding: 7px 15px 7px 9px;
}
/* ---- the living eye ------------------------------------------------------ */
.mascot { width: 26px; height: 26px; flex: none; overflow: visible; }
.mascot .burst { fill: var(--mint); transition: fill .3s ease; }
.mascot .eyeball { fill: #12291c; }
.mascot .pupil-dot { fill: #fff; }
.mascot .pupil { animation: wander 7s ease-in-out infinite; }
@keyframes wander {
  0%, 18%  { transform: translate(0, 0); }
  26%, 40% { transform: translate(-4.5px, 1.5px); }
  48%, 62% { transform: translate(2.5px, 3px); }
  70%, 88% { transform: translate(-1.5px, -2px); }
  100%     { transform: translate(0, 0); }
}
.mascot.blink { animation: blink .32s ease; }
@keyframes blink {
  0%, 100% { transform: scaleY(1); }
  45%      { transform: scaleY(0.08); }
}
.mascot.looking .pupil { animation: dart .55s ease-in-out infinite; }
@keyframes dart {
  0%, 100% { transform: translate(-4px, 0); }
  50%      { transform: translate(4px, 1px); }
}
.mascot.alert .burst { fill: var(--danger); }

/* ===========================================================================
   Reveal — dark theatre (the 3D stage draws the card + HUD)
   =========================================================================== */
.reveal {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: rgba(6, 7, 6, .78); backdrop-filter: blur(10px);
  place-items: center; padding: 24px;
}
.reveal.show { display: grid; }
.reveal-scrim {
  position: absolute; inset: 0;
  background: radial-gradient(70% 50% at 50% 42%,
    color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  animation: pulseGlow 3s ease-in-out infinite;
}
@keyframes pulseGlow { 0%,100% { opacity:.5 } 50% { opacity:1 } }

.reveal-3d { position: absolute; inset: 0; z-index: 2; touch-action: none; cursor: grab; }
.reveal-3d:active { cursor: grabbing; }
.reveal-3d canvas { width: 100%; height: 100%; display: block; }
.reveal-cta {
  position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 26px);
  display: flex; flex-direction: column; align-items: center; gap: 13px; z-index: 4;
  opacity: 0; animation: panelIn .5s ease 1.15s forwards; pointer-events: none;
}
@keyframes panelIn { to { opacity: 1; transform: none; } }
.reveal-cta > * { pointer-events: auto; }
.reveal-cta:empty { display: none; }
.reveal-serial {
  font-size: 12px; letter-spacing: .16em; font-weight: 700;
  color: var(--cream-muted);
}
.btn-add {
  border: 0; background: var(--mint); color: var(--mint-ink); font-weight: 800;
  font-size: 15px; letter-spacing: .02em; padding: 15px 34px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 9px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.btn-add:active { transform: scale(.97); }
.btn-add.danger { background: var(--danger); color: #2a0705; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.reveal-dismiss {
  position: fixed; top: calc(env(safe-area-inset-top) + 14px); right: 18px; z-index: 61;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--night-line);
  background: rgba(0,0,0,.4); display: grid; place-items: center; color: var(--cream-on-night);
}

/* ===========================================================================
   Network — the clubhouse ladder
   =========================================================================== */
.seg {
  display: flex; gap: 6px; background: rgba(34, 41, 31, 0.06);
  border: 1px solid var(--hairline); border-radius: 12px; padding: 4px; margin-bottom: 18px;
}
.seg button {
  flex: 1; border: 0; background: none; color: var(--ink-soft);
  font-weight: 700; font-size: 13px; padding: 9px; border-radius: 9px;
}
.seg button.on { background: var(--card-surface); color: var(--ink); box-shadow: 0 1px 4px rgba(34,41,31,.10); }

.ladder { display: flex; flex-direction: column; gap: 8px; }
.rank {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card-surface); border: 1px solid var(--hairline); border-radius: 14px;
}
.rank.me {
  border-color: var(--forest);
  background: color-mix(in srgb, var(--mint) 10%, var(--card-surface));
}
.rank .pos {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 15px; color: var(--ink-soft);
}
.rank .pos.medal { background: var(--forest); color: var(--paper); }
.rank .pos.medal.first { position: relative; }
.rank .pos.medal.first::after {
  content: "✶"; position: absolute; top: -9px; right: -5px;
  font-size: 13px; color: var(--mint); transform: rotate(18deg);
}
.rank .av {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: rgba(34, 41, 31, 0.07); border: 1px solid var(--hairline);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; color: var(--forest);
}
.rank .who { flex: 1; min-width: 0; }
.rank .who b { display: block; font-family: var(--serif); font-weight: 600; font-size: 15.5px; }
.rank .who small { color: var(--ink-soft); font-size: 11.5px; }
.rank .score { text-align: right; }
.rank .score b { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.rank .score small { display: block; color: var(--ink-soft); font-size: 10px; letter-spacing: .08em; }

/* ===========================================================================
   Account
   =========================================================================== */
.member-card {
  position: relative; border-radius: 16px; overflow: hidden;
  background:
    repeating-radial-gradient(130% 100% at 90% -30%,
      transparent 0 30px, rgba(244, 240, 228, 0.07) 30px 31.5px),
    var(--forest);
  color: var(--paper); padding: 18px 20px 16px; margin: 4px 0 20px;
  box-shadow: 0 2px 6px rgba(34, 41, 31, .18), 0 12px 30px rgba(34, 41, 31, .16);
}
.member-card.ht::after { z-index: 0; mask-image: linear-gradient(155deg, rgba(0,0,0,.55), transparent 60%); }
.member-card > * { position: relative; z-index: 1; }
.mc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 26px; }
.mc-top img { width: 22px; height: 22px; }
.mc-top span { font-size: 9.5px; font-weight: 700; letter-spacing: .18em; opacity: .75; }
.mc-name { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; }
.mc-email { font-size: 12px; opacity: .6; margin: 4px 0 18px; }
.mc-row { display: flex; justify-content: space-between; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; opacity: .85; font-variant-numeric: tabular-nums; }

.stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 22px; }
.stat-tile {
  background: var(--card-surface); border: 1px solid var(--hairline);
  border-radius: 14px; padding: 14px;
}
.stat-tile b { font-family: var(--serif); font-weight: 600; font-size: 26px; display: block; }
.stat-tile small { color: var(--ink-soft); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.rows { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 12px; padding: 15px 4px;
  border-bottom: 1px solid var(--hairline);
}
.row-item svg { width: 20px; height: 20px; color: var(--ink-soft); }
.row-item span { flex: 1; }
.row-item .chev { color: var(--ink-faint); }
.signout { color: var(--danger); font-weight: 700; }
.pill-soon {
  flex: none !important; font-size: 8.5px; font-weight: 800; letter-spacing: .14em;
  color: var(--forest); border: 1.5px solid color-mix(in srgb, var(--forest) 45%, transparent);
  border-radius: 999px; padding: 2px 7px;
}

/* ===========================================================================
   Auth — the front door (pure Standout paper)
   =========================================================================== */
#view-auth {
  display: none; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; gap: 8px; min-height: 100vh; padding: 32px;
  position: relative; z-index: 1;
}
#view-auth.show { display: flex; }
#view-auth .logo { width: 88px; height: 88px; margin-bottom: 10px; animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
#view-auth h1 {
  font-family: var(--serif); font-weight: 600; font-size: 40px;
  letter-spacing: -0.01em; margin: 0;
}
#view-auth p {
  color: var(--ink-soft); max-width: 300px; margin: 6px 0 26px; font-size: 15px;
  font-family: var(--serif); font-style: italic;
}
.auth-field { width: 100%; max-width: 340px; }
.auth-field input {
  width: 100%; padding: 15px 18px; border-radius: 14px; border: 1px solid var(--hairline-2);
  background: var(--card-surface); color: var(--ink); font-size: 16px; text-align: center;
}
.auth-field input::placeholder { color: var(--ink-faint); }
.auth-field input:focus { border-color: var(--forest); outline: none; }
.auth-btn {
  width: 100%; max-width: 340px; margin-top: 12px; padding: 16px; border: 0;
  border-radius: 999px; background: var(--forest); color: var(--paper);
  font-weight: 700; font-size: 16px;
  box-shadow: 0 2px 8px rgba(34, 41, 31, .25);
}
.auth-btn:disabled { opacity: .4; }
.auth-note {
  font-size: 12.5px; color: var(--ink-faint); margin-top: 18px; max-width: 300px;
  font-family: var(--sans) !important; font-style: normal !important;
}
.auth-sent { display: none; flex-direction: column; align-items: center; gap: 16px; }
.auth-sent.show { display: flex; }
.auth-sent .env { width: 60px; height: 60px; color: var(--forest); }
.auth-sent h1 { font-size: 26px !important; }
.link-fake {
  border: 1.5px dashed var(--hairline-2); border-radius: 14px; padding: 14px 18px;
  font-size: 13.5px; color: var(--ink-soft); background: var(--card-surface);
  cursor: pointer;
}
.link-fake b { color: var(--forest); }

/* ===========================================================================
   Card flight — reveal → its slot in the album
   =========================================================================== */
.fly-card {
  position: fixed; z-index: 1200; pointer-events: none;
  transform-origin: top left; opacity: .98;
  transition: transform .55s cubic-bezier(.4, 0, .2, 1), opacity .55s ease;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .45));
}
.fly-card .card { width: 100%; height: 100%; }
.slot.landing .card, .slot.landing .new-flag { visibility: hidden; }
/* lands tilted like a hastily-placed sticker, then straightens */
.slot.landed .card { animation: landPop .8s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes landPop {
  0%   { transform: rotate(-5deg) scale(1.12);
         box-shadow: 0 0 0 2px var(--forest), 0 10px 24px rgba(34, 41, 31, .28); }
  55%  { transform: rotate(1.6deg) scale(1.03); }
  100% { transform: rotate(0) scale(1);
         box-shadow: 0 1px 2px rgba(34, 41, 31, .10), 0 4px 14px rgba(34, 41, 31, .10); }
}

/* ===========================================================================
   Bottom sheet — "which card is it?"
   =========================================================================== */
.sheet {
  position: fixed; inset: 0; z-index: 68; display: none;
  background: rgba(12, 14, 11, .45); align-items: flex-end;
}
.sheet.show { display: flex; }
.sheet-panel {
  width: 100%; max-width: var(--max); margin: 0 auto; position: relative;
  background: var(--paper); border-top-left-radius: 24px; border-top-right-radius: 24px;
  border-top: 1px solid var(--hairline);
  padding: 10px 18px calc(env(safe-area-inset-bottom) + 20px);
  max-height: 90vh; display: flex; flex-direction: column;
  padding-left: 22px; padding-right: 22px;
  color: var(--ink);
  /* no entrance animation — frozen animations strand the panel off-screen */
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px 4px; }
.sheet-head::before {
  content: ""; position: absolute; left: 50%; top: 8px; translate: -50% 0;
  width: 40px; height: 4px; border-radius: 2px; background: var(--hairline-2);
}
.sheet-head b { font-family: var(--serif); font-weight: 600; font-size: 21px; }
.sheet-close { border: 0; background: none; color: var(--ink-soft); font-size: 18px; width: 32px; height: 32px; }
.sheet-note {
  color: var(--ink-soft); font-size: 13.5px; margin: 0 2px 12px;
  font-family: var(--serif); font-style: italic;
}
.sheet-search {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--hairline-2);
  background: var(--card-surface); color: var(--ink); font-size: 15px; margin-bottom: 12px;
}
.sheet-search::placeholder { color: var(--ink-faint); }
.sheet-search:focus { outline: none; border-color: var(--forest); }
.sheet-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }

/* scan-miss coaching — the eye explains itself; there is no picker */
.fail-shot {
  margin: 2px 0 12px; display: flex; align-items: center; gap: 12px;
}
.fail-shot img {
  width: 76px; aspect-ratio: 3 / 4.15; object-fit: cover;
  border-radius: 8px; rotate: -2deg;
  box-shadow: 0 1px 2px rgba(34, 41, 31, .12), 0 5px 14px rgba(34, 41, 31, .16);
  border: 3px solid var(--card-surface);
}
.fail-shot figcaption {
  font-family: var(--serif); font-style: italic; font-size: 12.5px; color: var(--ink-faint);
}
.fail-shot[hidden] { display: none; }

.fail-tips {
  margin: 4px 0 6px; padding: 0 0 0 2px; list-style: none;
  display: flex; flex-direction: column; gap: 9px;
}
.fail-tips li {
  display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink);
}
.fail-tips li::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 22%, transparent);
}
.card-sheet { max-width: 560px; }
.cs-body { display: flex; flex-direction: column; gap: 18px; overflow-y: auto; padding: 6px 10px 2px 2px; scrollbar-width: thin; }
.cs-card { width: min(70%, 260px); margin: 8px auto 0; }
.cs-card .card { rotate: -1.2deg; }
.cs-serial { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.cs-type {
  font-size: 10px; font-weight: 800; letter-spacing: .14em; color: var(--c);
  border: 1.5px solid color-mix(in srgb, var(--c) 55%, transparent);
  padding: 4px 10px; border-radius: 999px;
}
.cs-num { font-family: var(--serif); font-size: 17px; }
.cs-num em { font-style: italic; color: var(--ink-soft); font-size: 13px; }
.cs-facts { border-top: 1px solid var(--hairline); }
.cs-fact { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--hairline); font-size: 13px; }
.cs-fact span { color: var(--ink-soft); }
.cs-fact b { font-weight: 600; text-align: right; }
.cs-ar {
  margin-top: 16px; width: 100%; border: 0; border-radius: 999px;
  background: var(--forest); color: var(--paper); font-weight: 700; font-size: 14.5px;
  padding: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 2px 8px rgba(34, 41, 31, .25);
}
.cs-ar:active { transform: scale(.98); }

@media (min-width: 900px) {
  .sheet-panel.card-sheet { max-width: 920px; }
  .cs-body { flex-direction: row; align-items: flex-start; gap: 44px; padding-top: 14px; }
  .cs-card { width: 330px; margin: 6px 0 0; flex: none; }
  .cs-info { flex: 1; padding-top: 4px; }
  .cs-num { font-size: 21px; }
  .cs-fact { font-size: 14.5px; padding: 12px 0; }
  .as-row { font-size: 14.5px; padding: 13px 2px; }
  .as-toggle { padding: 15px 2px; }
}

/* account sheets: fields, toggles, verification rows */
.as-field { display: block; margin-bottom: 14px; }
.as-field span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px; }
.as-field input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--hairline-2);
  background: var(--card-surface); color: var(--ink); font-size: 15px;
}
.as-field input:focus { outline: none; border-color: var(--forest); }
.as-note { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--ink-soft); margin: 10px 2px 14px; }
.as-toggle {
  display: flex; align-items: center; gap: 12px; padding: 13px 2px;
  border-bottom: 1px solid var(--hairline); cursor: pointer;
}
.as-toggle > span { flex: 1; }
.as-toggle b { display: block; font-size: 14.5px; font-weight: 600; }
.as-toggle small { color: var(--ink-soft); font-size: 12px; }
.as-toggle input { display: none; }
.as-toggle i {
  width: 44px; height: 26px; border-radius: 999px; background: rgba(34,41,31,.18);
  position: relative; flex: none; transition: background .15s;
}
.as-toggle i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--card-surface); transition: translate .15s;
  box-shadow: 0 1px 3px rgba(34,41,31,.3);
}
.as-toggle input:checked + i { background: var(--forest); }
.as-toggle input:checked + i::after { translate: 18px 0; }
.as-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 2px; border-bottom: 1px solid var(--hairline); font-size: 13.5px; }
.as-row span { color: var(--ink-soft); }
.as-row b { font-weight: 600; text-align: right; }
.as-row .ok { font-style: normal; color: var(--forest); }
.rows .row-item { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; font-size: 15px; }

/* ===========================================================================
   Desktop (≥900px) — the binder opens on a desk.
   Sidebar nav (Standout account layout), wide album grid, and Scan becomes a
   connect-your-phone panel: capture is a phone act.
   =========================================================================== */
.side-brand { display: none; }
.connect-phone { display: none; }

.qr-card {
  background: var(--card-surface); border: 1px solid var(--hairline);
  border-radius: 16px; padding: 24px 28px; margin: 16px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
#qrBox { width: 190px; height: 190px; }
#qrBox svg { width: 100%; height: 100%; display: block; }
#qrBox svg path { fill: var(--ink); }
.qr-card > span { font-size: 12.5px; color: var(--ink-soft); }
.connect-note { font-size: 13px; color: var(--ink-faint); max-width: 380px; }

@media (min-width: 900px) {
  #app { max-width: none; margin: 0 0 0 236px; display: block; }
  .view {
    max-width: 1020px; margin: 0 auto;
    padding: 44px 40px 72px;
  }

  /* tab bar → sidebar */
  .tabbar {
    left: 0; right: auto; top: 0; bottom: 0; width: 236px; height: auto;
    max-width: none; margin: 0; padding: 26px 14px;
    display: flex; flex-direction: column; gap: 2px;
    border-top: 0; border-right: 1px solid var(--hairline);
    background: color-mix(in srgb, var(--paper-2) 60%, var(--paper));
    backdrop-filter: none;
  }
  .side-brand {
    display: flex; align-items: center; gap: 11px;
    padding: 6px 10px 26px;
  }
  .side-brand img { width: 34px; height: 34px; }
  .side-brand b { display: block; font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.1; }
  .side-brand span { font-size: 12px; color: var(--ink-soft); font-family: var(--serif); font-style: italic; }
  .tab {
    display: flex; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 11px 14px; border-radius: 10px; color: var(--ink-soft);
  }
  .tab:hover { background: rgba(34, 41, 31, 0.05); }
  .tab.active { background: var(--card-surface); color: var(--forest); box-shadow: 0 1px 3px rgba(34, 41, 31, .08); }
  .tab.active::before { display: none; }
  .tab svg { width: 20px; height: 20px; }
  .tab small {
    font-size: 13.5px; letter-spacing: 0; text-transform: none; font-weight: 600;
  }

  /* scanner → connect panel (no camera, no dark room) */
  #view-scanner { position: static; overflow: visible; padding: 44px 40px 72px; }
  .scan-stage, .scan-scrim, .scan-top, .detect-box, .scan-cue { display: none; }
  .connect-phone { display: flex; flex-direction: column; align-items: flex-start; }

  /* album density */
  .grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 16px; }
  .filters { margin: 0; padding-left: 0; }

  /* sheets become centred dialogs with room to breathe */
  .sheet { align-items: center; justify-content: center; padding: 48px; }
  .sheet-panel {
    border-radius: 22px; max-width: 560px; border: 1px solid var(--hairline);
    padding: 18px 34px calc(env(safe-area-inset-bottom) + 34px);
  }
  .sheet-head::before { display: none; }
  .sheet-head b { font-size: 28px; }

  /* reveal breathing room */
  .reveal-cta { bottom: 48px; }
}

.hidden { display: none !important; }
