/* ================================================================
   SMITHS WATCHMAKER — mobile-first, all-screen adaptive
   ================================================================ */
:root {
  --gold: #c9a227;
  --gold-bright: #e8c75a;
  --ink: #0d0f0e;
  --ink-2: #141715;
  --ink-3: #1d211f;
  --paper: #f2ead8;
  --muted: #8a9088;
  --danger: #c0392b;
  --ok: #3f8f5f;
  --serif: "Cormorant Garamond", "Didot", "Bodoni MT", "Playfair Display", "Noto Serif", Georgia, "Times New Roman", serif;
  --display: "Marcellus", "Cormorant Garamond", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#app { position: fixed; inset: 0; width: 100%; height: 100dvh; }

#stage {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

/* ============ screens ============ */
.screen {
  position: absolute; inset: 0;
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

#screen-title {
  /* the live 3D watch shows through the top — the hero of the page */
  background: linear-gradient(180deg,
    rgba(10,12,11,0) 0%,
    rgba(10,12,11,.25) 16%,
    rgba(10,12,11,.86) 30%,
    rgba(8,10,9,.97) 42%,
    #0a0c0b 100%);
}

/* The title is now scrollable: the first viewport (.title-inner) stays pinned at
   exactly 100dvh and unchanged; the leaderboard flows below it. */
#screen-title { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.title-inner {
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  position: relative;
  padding: calc(var(--sat) + 4px) max(18px, var(--sal)) calc(var(--sab) + 10px) max(18px, var(--sar));
  display: flex; flex-direction: column;
  gap: clamp(5px, 1.1dvh, 11px);
}
.hero-space { flex: 1 1 28px; min-height: 8px; max-height: 120px; }

/* The single-pager must never crush its own controls: on a flex column a child
   with content (the gold button, the card rows, the labels) can otherwise be
   squashed below its natural height. Pin them so they keep their real size. */
.brand-mark, .tagline, .select-label,
.movement-cards, .mode-cards, .diff-cards,
.btn-primary, .music-pill, .best-times { flex-shrink: 0; }
.ig-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 4px;
  color: var(--gold);
  text-decoration: none;
  font-size: 10.5px; letter-spacing: .22em;
  font-family: var(--display);
  opacity: .85;
  animation: riseIn 1s .2s cubic-bezier(.2,.8,.25,1) both;
}
.ig-link svg { width: 12px; height: 12px; flex: 0 0 12px; }
.ig-link:active { opacity: .65; }

.brand-mark { text-align: center; margin-bottom: 2px; }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } }
.brand, .brand-sub, .deco-divider { animation: riseIn .9s cubic-bezier(.2,.8,.25,1) both; }
.deco-divider {
  height: clamp(20px, 4.4dvh, 40px);
  width: min(88%, 380px);
  margin: 6px auto 2px;
  background-image: url('../assets/deco.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 10px rgba(201,162,39,.35));
}
.deco-flip { transform: scaleY(-1); margin-top: 2px; }
.brand {
  font-family: var(--display);
  font-size: clamp(28px, 6dvh, 50px);
  letter-spacing: .4em;
  text-indent: .4em;
  font-weight: 400;
  background: linear-gradient(105deg, #f6efdb 38%, #fff8e2 47%, #caa544 50%, #f6efdb 60%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brandShimmer 7s ease-in-out infinite;
  text-shadow: 0 0 38px rgba(201,162,39,.18);
}
@keyframes brandShimmer { 0%, 100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }
.brand-sub {
  font-size: clamp(11px, 3vw, 13px);
  letter-spacing: .58em;
  text-indent: .58em;
  color: var(--gold);
  margin-top: 2px;
  font-family: var(--display);
}
.tagline {
  text-align: center;
  color: #b9bfb4;
  font-size: clamp(12px, 1.9dvh, 15px);
  line-height: 1.4;
  font-style: italic;
  font-family: var(--serif);
  animation: riseIn 1s .12s cubic-bezier(.2,.8,.25,1) both;
}
.tagline br { display: none; } /* one line — this is a single-pager */

.select-label {
  font-size: 10px; letter-spacing: .3em;
  color: var(--muted);
  margin-top: clamp(2px, 0.6dvh, 8px);
}

.movement-cards { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(6px, 1dvh, 9px); }
.movement-card {
  background: var(--ink-2);
  border: 1px solid #2a2e2b;
  border-radius: 13px;
  padding: clamp(5px, 0.95dvh, 10px) 11px;
  color: var(--paper);
  text-align: left;
  display: flex; flex-direction: column; gap: clamp(1px, 0.4dvh, 4px);
  cursor: pointer;
  transition: border-color .2s, transform .1s;
}
.movement-card.selected {
  border-color: var(--gold);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(201,162,39,.14), transparent 60%),
    linear-gradient(180deg, #1d201d, #151815);
  box-shadow: 0 0 0 1px var(--gold), 0 10px 30px rgba(201,162,39,.16), inset 0 1px 0 rgba(255,244,214,.12);
}
.movement-card:active { transform: scale(.98); }
.mc-flag { font-size: clamp(16px, 2.4dvh, 20px); line-height: 1; }
.mc-name { font-family: var(--display); font-size: clamp(15px, 4.4vw, 19px); letter-spacing: .03em; }
/* the friendly, first-time-reader line — what this watch IS, in plain words */
.mc-layman {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(10.5px, 1.35dvh, 12.5px); line-height: 1.2;
  color: var(--gold-bright);
}
/* difficulty dots: ●○○ */
.mc-dots { display: inline-flex; gap: 4px; align-items: center; }
.mc-dots i {
  width: 5.5px; height: 5.5px; border-radius: 50%;
  border: 1px solid var(--gold);
  background: transparent;
}
.mc-dots i.on { background: var(--gold); box-shadow: 0 0 5px rgba(201,162,39,.5); }
.movement-card.selected .mc-dots i.on { background: var(--gold-bright); border-color: var(--gold-bright); }
.mc-desc { font-size: clamp(9.5px, 1.3dvh, 11px); color: var(--muted); line-height: 1.35; }

.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-card {
  background: var(--ink-2);
  border: 1px solid #2a2e2b; border-radius: 12px;
  padding: clamp(6px, 1.2dvh, 11px) 6px;
  color: var(--paper);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer;
  transition: border-color .2s, transform .1s;
}
.mode-card.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.mode-card:active { transform: scale(.97); }
.mode-ico { font-size: 19px; }
.mode-name { font-size: clamp(11px, 3.2vw, 13px); letter-spacing: .06em; }
.mode-desc { font-size: 9px; color: var(--muted); text-align: center; line-height: 1.4; }

.diff-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.diff-card {
  background: var(--ink-2);
  border: 1px solid #2a2e2b; border-radius: 12px;
  padding: clamp(5px, 1dvh, 9px) 6px;
  color: var(--paper);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer;
}
.diff-card.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.diff-name { font-size: clamp(11px, 3.2vw, 13px); letter-spacing: .05em; }
.diff-desc { font-size: 9px; color: var(--muted); text-align: center; line-height: 1.4; }

.btn-primary {
  margin-top: clamp(4px, 1dvh, 10px);
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, #a8851d);
  color: #141008;
  border: none; border-radius: 999px;
  padding: clamp(12px, 1.8dvh, 16px) 22px;
  font-size: 14px; font-weight: 700; letter-spacing: .24em;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(201,162,39,.3), inset 0 1px 0 rgba(255,250,230,.55), inset 0 -2px 6px rgba(90,66,8,.35);
  transition: transform .1s, box-shadow .2s;
}
.btn-primary:active { transform: scale(.98); }
.btn-shine {
  position: absolute; top: 0; bottom: 0; width: 46%;
  background: linear-gradient(105deg, transparent, rgba(255,252,240,.55), transparent);
  animation: btnShine 3.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes btnShine { 0% { left: -60%; } 55%, 100% { left: 120%; } }
.music-pill {
  margin: 0 auto;
  width: fit-content;
  background: rgba(255,255,255,.05);
  border: 1px solid #3a3f3b;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 9.5px; letter-spacing: .2em;
  cursor: pointer;
}
.best-times { font-size: 10px; line-height: 1.5; }
.select-label { margin-top: 0; }
.btn-secondary {
  background: transparent;
  color: var(--paper);
  border: 1px solid #3a3f3b; border-radius: 999px;
  padding: 12px 16px;
  font-size: 12px; letter-spacing: .12em;
  cursor: pointer;
}
.btn-small {
  background: var(--gold); color: #141008;
  border: none; border-radius: 999px;
  padding: 10px 22px;
  font-size: 12px; font-weight: 700; letter-spacing: .15em;
  cursor: pointer;
}
.best-times { text-align: center; font-size: 11px; color: var(--muted); letter-spacing: .08em; line-height: 1.8; }
.best-times b { color: var(--gold); font-weight: 600; }

/* ============ scroll cue (bottom edge of first viewport) ============ */
.scroll-cue {
  /* in normal flow — it must NEVER overlap the start button */
  position: static;
  flex-shrink: 0;
  margin: 2px auto 0;
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 0;
  border: none; cursor: pointer;
  color: var(--gold);
  padding: 4px 0 2px;
  background: none;
  opacity: 0;
  animation: cueFadeIn .8s 1.1s ease both;
}
.scroll-cue-text { font-family: var(--display); font-size: 8px; letter-spacing: .3em; opacity: .7; }
.scroll-cue-chev {
  font-size: 20px; line-height: .7; color: var(--gold-bright);
  animation: cueBob 1.7s ease-in-out infinite;
}
@keyframes cueFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cueBob {
  0%, 100% { transform: translateY(0); opacity: .55; }
  50% { transform: translateY(4px); opacity: 1; }
}
/* the cue is only meaningful while the leaderboard exists below */
.scroll-cue.hidden { display: none; }

/* ============ leaderboard (below the fold on the title) ============ */
.leaderboard {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px max(18px, var(--sal)) calc(var(--sab) + 40px) max(18px, var(--sar));
}
.lb-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lb-heading {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(22px, 6vw, 30px);
  letter-spacing: .22em; text-indent: .22em;
  color: var(--paper);
  margin-top: 2px;
}
.lb-subheading {
  font-family: var(--serif); font-style: italic;
  font-size: 14px; letter-spacing: .12em;
  color: var(--gold);
  margin-top: -4px; margin-bottom: 4px;
}
.lb-tabs {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 7px;
  width: 100%;
}
.lb-pill {
  background: rgba(255,255,255,.04);
  border: 1px solid #3a3f3b;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: var(--display);
  font-size: 10px; letter-spacing: .14em;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.lb-pill.selected {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(201,162,39,.1);
  box-shadow: inset 0 0 10px rgba(201,162,39,.12);
}
.lb-list { width: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.lb-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid rgba(201,162,39,.18);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(24,27,25,.82), rgba(14,17,15,.9)),
    url('../assets/guilloche.jpg') center / 300px repeat;
}
.lb-rank {
  font-family: var(--display);
  font-size: 16px; text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.lb-row.top1 .lb-rank { color: var(--gold-bright); }
.lb-row.top2 .lb-rank { color: #d9c98e; }
.lb-row.top3 .lb-rank { color: #c9a227; }
.lb-row.top1 { border-color: rgba(232,199,90,.5); box-shadow: 0 0 16px rgba(201,162,39,.14); }
.lb-name-wrap { min-width: 0; display: flex; align-items: center; gap: 7px; }
.lb-name {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--paper);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-ig {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  color: var(--gold); opacity: .75;
}
.lb-ig:active { opacity: .5; }
.lb-ig svg { width: 13px; height: 13px; display: block; }
.lb-time {
  font-variant-numeric: tabular-nums;
  font-size: 15px; letter-spacing: .04em;
  color: var(--gold-bright);
  text-align: right;
}
.lb-empty {
  text-align: center;
  font-family: var(--serif); font-style: italic;
  font-size: 13px; color: var(--muted);
  padding: 22px 10px;
  border: 1px dashed #34393577; border-radius: 12px;
}
.lb-note {
  font-size: 9.5px; letter-spacing: .18em;
  color: var(--muted);
  margin-top: 4px;
}

/* ============ HOW IT WORKS (scroll region, deco numerals) ============ */
.how-it-works {
  max-width: 480px;
  /* the fixed-height first viewport can let its footer lines (best time, maison
     link) overflow a little past 100dvh; this top margin keeps the scroll
     region clear of that overflow so nothing collides on the seam */
  margin: clamp(64px, 12dvh, 104px) auto 0;
  padding: 14px max(18px, var(--sal)) 6px max(18px, var(--sar));
}
.hiw-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hiw-heading {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(18px, 5vw, 24px);
  letter-spacing: .26em; text-indent: .26em;
  color: var(--paper);
}
.hiw-steps {
  display: flex; align-items: stretch; justify-content: center;
  gap: clamp(4px, 1.6vw, 10px);
  width: 100%;
  margin-top: 2px;
}
.hiw-step {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 6px;
  border: 1px solid rgba(201,162,39,.24);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(24,27,25,.85), rgba(14,17,15,.92)),
    url('../assets/guilloche.jpg') center / 300px repeat;
  text-align: center;
}
.hiw-num {
  font-family: var(--display);
  font-size: clamp(22px, 6vw, 30px);
  line-height: 1;
  letter-spacing: .04em;
  background: linear-gradient(180deg, #f6efdb 30%, #e8c75a 52%, #a8851d);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  text-shadow: 0 0 18px rgba(201,162,39,.16);
}
.hiw-label {
  font-family: var(--serif);
  font-size: clamp(11px, 1.5dvh, 13px); line-height: 1.3;
  color: #c4cabe;
}
.hiw-sep {
  align-self: center;
  color: var(--gold); opacity: .6;
  font-size: clamp(12px, 3vw, 16px);
  flex: 0 0 auto;
}

/* ============ FROM THE BOUTIQUE (swipeable product strip) ============ */
.boutique-strip {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 0 8px;
}
.bq-inner { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bq-heading {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(18px, 5vw, 24px);
  letter-spacing: .26em; text-indent: .26em;
  color: var(--paper);
}
.bq-subheading {
  font-family: var(--serif); font-style: italic;
  font-size: 13px; letter-spacing: .08em;
  color: var(--gold);
  margin-bottom: 8px;
}
.bq-rail {
  display: flex; gap: 12px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 4px max(18px, var(--sal)) 8px max(18px, var(--sar));
}
.bq-rail::-webkit-scrollbar { display: none; }
.bq-card {
  flex: 0 0 auto;
  width: 150px;
  scroll-snap-align: start;
  text-decoration: none;
  display: flex; flex-direction: column;
  border: 1px solid rgba(201,162,39,.22);
  border-radius: 14px;
  overflow: hidden;
  background: var(--ink-2);
  transition: border-color .2s, transform .1s;
}
.bq-card:active { transform: scale(.98); }
.bq-frame {
  width: 100%; aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  background:
    linear-gradient(180deg, rgba(20,23,21,.5), rgba(12,14,12,.7)),
    url('../assets/guilloche.jpg') center / 220px repeat;
}
.bq-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bq-img-empty { background: transparent; }
.bq-meta {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 11px 12px;
}
.bq-vendor {
  font-size: 8.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
}
.bq-title {
  font-family: var(--serif);
  font-size: 13.5px; line-height: 1.3;
  color: var(--paper);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.bq-price {
  font-variant-numeric: tabular-nums;
  font-size: 12px; letter-spacing: .03em;
  color: var(--gold-bright);
  margin-top: 2px;
}

/* Short viewports (small phones, landscape, on-screen-keyboard): the no-scroll
   single-pager would clip the "SIT AT THE BENCH" button, so let the title page
   scroll gracefully instead. Normal phones (>700px tall) stay a fixed pager. */
@media (max-height: 700px) {
  #screen-title { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .title-inner {
    height: auto;
    min-height: 100dvh;
    justify-content: flex-start;
  }
  .hero-space { flex-basis: 14px; max-height: 40px; }
}

/* ============ HUD ============ */
#screen-game { pointer-events: none; touch-action: none; overflow: hidden; overflow: clip; }
#screen-game > * { pointer-events: auto; }

#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: calc(var(--sat) + 10px) max(14px, var(--sal)) 10px max(14px, var(--sar));
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(10,12,11,.92), rgba(10,12,11,0));
}
.hud-btn {
  width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--paper); font-size: 22px; line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
}
.hud-center { flex: 1; min-width: 0; text-align: center; }
.hud-step { font-size: 10px; letter-spacing: .25em; color: var(--gold); }
.hud-part {
  font-family: var(--serif);
  font-size: clamp(15px, 4.4vw, 19px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud-right { flex: 0 0 auto; text-align: right; }
.hud-timer { font-variant-numeric: tabular-nums; font-size: 16px; letter-spacing: .06em; }
.hud-mistakes { font-size: 10px; color: var(--danger); letter-spacing: .1em; min-height: 13px; }
.hud-music { font-size: 16px; color: var(--gold); }
.hud-music.muted { color: #4a4f4a; text-decoration: line-through; }
.hud-progress {
  position: absolute;
  top: calc(var(--sat) + 58px);
  left: 14px; right: 14px;
  height: 2px;
  background: rgba(255,255,255,.08);
  border-radius: 1px;
  pointer-events: none;
}
.hud-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  box-shadow: 0 0 8px rgba(232,199,90,.5);
  transition: width .6s cubic-bezier(.2,.8,.3,1);
}

.hint-banner {
  pointer-events: none !important; /* never block the 3D stage */
  position: absolute;
  top: calc(var(--sat) + 64px);
  left: 50%; transform: translateX(-50%);
  max-width: min(86vw, 420px);
  background: rgba(20,23,21,.92);
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 12.5px; line-height: 1.5;
  text-align: center;
  color: var(--paper);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 5;
}
.hint-banner b { color: var(--gold-bright); }

/* power gauge */
.power-gauge {
  pointer-events: none !important;
  position: absolute;
  top: calc(var(--sat) + 120px);
  left: 50%; transform: translateX(-50%);
  width: min(70vw, 300px);
  text-align: center;
}
.pg-label { font-size: 9px; letter-spacing: .3em; color: var(--gold); margin-bottom: 6px; }
.pg-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.pg-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width .12s linear; }

/* explode control */
/* vertical slider via rotate(-90deg) — writing-mode vertical ranges are
   unreliable on iOS Safari */
.explode-ctl {
  position: absolute;
  right: max(12px, var(--sar));
  top: 50%;
  transform: translateY(-50%);
  width: 32px; height: min(38vh, 280px);
  z-index: 4;
}
.explode-ctl input[type=range] {
  position: absolute;
  top: 50%; left: 50%;
  width: min(38vh, 280px); height: 32px;
  transform: translate(-50%, -50%) rotate(-90deg);
  accent-color: var(--gold);
  touch-action: none;
}
.explode-label {
  position: absolute;
  top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  font-size: 9px; letter-spacing: .25em; color: var(--muted);
  writing-mode: vertical-rl;
}

/* find-the-part marker */
.target-marker {
  position: absolute;
  pointer-events: none !important;
  z-index: 5;
  transform: translate(-50%, -50%);
  width: 0; height: 0;
}
.tm-ring {
  position: absolute;
  left: 50%; top: 50%;
  width: 58px; height: 58px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2.5px solid var(--gold-bright);
  box-shadow: 0 0 18px rgba(232,199,90,.65), inset 0 0 14px rgba(232,199,90,.25);
  animation: tmPulse 1.1s ease-in-out infinite;
}
@keyframes tmPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.78); opacity: .95; }
  50% { transform: translate(-50%, -50%) scale(1.12); opacity: .45; }
}
.tm-arrow {
  position: absolute;
  left: 50%; top: -46px;
  transform: translateX(-50%);
  color: var(--gold-bright);
  font-size: 26px;
  text-shadow: 0 2px 10px rgba(0,0,0,.8);
  animation: tmBounce .9s ease-in-out infinite;
}
@keyframes tmBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-7px); }
}

/* 3D tool preview */
.tool-preview-wrap {
  position: absolute;
  right: max(10px, var(--sar));
  bottom: calc(var(--sab) + 132px);
  pointer-events: none !important;
  z-index: 4;
  text-align: center;
  animation: cardIn .25s ease;
}
#tool-preview {
  width: 104px; height: 104px;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.55));
}
.tool-preview-label {
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--gold);
  background: rgba(13,15,14,.72);
  border: 1px solid rgba(201,162,39,.35);
  border-radius: 999px;
  padding: 3px 10px;
  display: inline-block;
  max-width: 150px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
@media (orientation: landscape) and (max-height: 500px) {
  .tool-preview-wrap { right: max(10px, var(--sar)); bottom: calc(var(--sab) + 18px); }
}

/* gesture ring */
.gesture-ring {
  position: absolute;
  width: 92px; height: 92px;
  margin-left: -46px; margin-top: -46px;
  pointer-events: none !important;
  z-index: 6;
}
.gesture-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gr-track { fill: none; stroke: rgba(255,255,255,.18); stroke-width: 5; }
.gr-fill {
  fill: none; stroke: var(--gold-bright); stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 276.5;
  stroke-dashoffset: 276.5;
}
.gr-icon {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 26px; color: var(--gold-bright);
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
}

/* ============ first-time gesture coach ============ */
.gesture-coach {
  position: absolute;
  z-index: 6;
  pointer-events: none !important; /* never blocks input */
  transform: translate(-50%, -100%);
  width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  animation: coachIn .3s ease both;
}
@keyframes coachIn { from { opacity: 0; transform: translate(-50%, -90%); } }
.gc-stage { width: 72px; height: 72px; filter: drop-shadow(0 3px 8px rgba(0,0,0,.6)); }
.gc-svg { width: 100%; height: 100%; overflow: visible; }
.gc-arc { stroke: var(--gold-bright); stroke-width: 5; stroke-linecap: round; }
.gc-head { fill: var(--gold-bright); }
.gc-finger {
  fill: rgba(242,234,216,.95);
  stroke: var(--gold); stroke-width: 1.5;
}
/* unscrew: rotating circular arrow */
.gc-spin { animation: gcSpin 1.7s linear infinite; transform-origin: 50px 50px; }
@keyframes gcSpin { to { transform: rotate(-360deg); } }
/* lift: a finger riding a dashed arc up */
.gc-dash { stroke-dasharray: 5 6; opacity: .7; }
.gc-drag { animation: gcDrag 1.7s ease-in-out infinite; }
@keyframes gcDrag {
  0% { transform: translate(0, 0); opacity: 0; }
  15% { opacity: 1; }
  75% { transform: translate(40px, -56px); opacity: 1; }
  100% { transform: translate(40px, -56px); opacity: 0; }
}
.gc-rise { animation: gcRise 1.7s ease-in-out infinite; }
@keyframes gcRise { 0%, 55% { opacity: 0; } 75%, 100% { opacity: 1; } }
/* hold: expanding ripples under a pressed finger */
.gc-ripple {
  fill: none; stroke: var(--gold-bright); stroke-width: 3;
  transform-origin: 50px 50px;
  animation: gcRipple 1.8s ease-out infinite;
}
.gc-ripple2 { animation-delay: .9s; }
@keyframes gcRipple {
  0% { transform: scale(.5); opacity: .9; }
  100% { transform: scale(2.1); opacity: 0; }
}
/* pull: a finger sliding toward an arrow */
.gc-slide { animation: gcSlide 1.6s ease-in-out infinite; }
@keyframes gcSlide {
  0% { transform: translateX(0); opacity: 0; }
  20% { opacity: 1; }
  80% { transform: translateX(44px); opacity: 1; }
  100% { transform: translateX(44px); opacity: 0; }
}
.gc-pull { animation: gcPullPulse 1.6s ease-in-out infinite; transform-origin: 77px 50px; }
@keyframes gcPullPulse { 0%, 100% { opacity: .55; } 60% { opacity: 1; } }
.gc-caption {
  font-family: var(--display);
  font-size: 9.5px; letter-spacing: .14em;
  color: var(--gold-bright);
  background: rgba(13,15,14,.82);
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ============ toolbar ============ */
#toolbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px max(10px, var(--sal)) calc(var(--sab) + 8px) max(10px, var(--sar));
  background: linear-gradient(0deg, rgba(8,10,9,.96) 60%, rgba(8,10,9,0));
  z-index: 5;
}
.tool-rail {
  display: flex; gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding: 6px 2px 8px;
  scrollbar-width: none;
}
.tool-rail::-webkit-scrollbar { display: none; }

.tool-chip {
  flex: 0 0 auto;
  min-width: 66px;
  background: var(--ink-3);
  border: 1px solid #2e332f;
  border-radius: 12px;
  padding: 8px 8px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--paper);
  cursor: pointer;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.tool-chip.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 4px 16px rgba(201,162,39,.25);
  background: #232722;
}
.tool-chip:active { transform: scale(.95); }
/* the tool the current phase needs but the player hasn't grabbed: a stronger,
   self-evident pulse that survives auto-scroll-to-centre */
.tool-chip.guide {
  position: relative;
  border-color: var(--gold-bright);
  animation: toolGuide 1.05s ease-in-out infinite;
}
@keyframes toolGuide {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,199,90,.55), 0 0 0 1px var(--gold); transform: scale(1); }
  50% { box-shadow: 0 0 0 7px rgba(232,199,90,0), 0 0 18px rgba(201,162,39,.5), 0 0 0 1px var(--gold-bright); transform: scale(1.06); }
}
/* "▼ pick this tool" caption bouncing above the guided chip (apprentice) */
.tool-cap {
  position: absolute;
  left: 50%; bottom: calc(100% + 7px);
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 8.5px; letter-spacing: .12em;
  color: var(--gold-bright);
  background: rgba(13,15,14,.92);
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
  animation: toolCapBob 1s ease-in-out infinite;
}
@keyframes toolCapBob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}
.tool-ico { width: 30px; height: 30px; }
.tool-ico svg { width: 100%; height: 100%; }
.tool-name { font-size: 9px; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.tool-chip.selected .tool-name { color: var(--gold-bright); }
.tool-size {
  font-size: 8.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
  color: #111;
}

/* The parts-tray tab: an obviously tappable gold pill (was inert-looking text) */
.tray-tab {
  margin: 4px auto 2px;
  width: fit-content;
  min-height: 40px;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--display);
  font-size: 10.5px; letter-spacing: .26em;
  color: var(--gold-bright);
  padding: 8px 20px;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(201,162,39,.12), rgba(201,162,39,.04));
  border: 1px solid rgba(201,162,39,.5);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(232,199,90,.22), inset 0 0 12px rgba(201,162,39,.14), 0 2px 10px rgba(0,0,0,.35);
  transition: transform .12s, box-shadow .2s, border-color .2s;
}
.tray-tab:active { transform: scale(.96); }
.tray-tab-label { color: var(--gold-bright); }
.tray-tab-badge {
  display: inline-grid; place-items: center;
  min-width: 19px; height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gold);
  color: #141008;
  font-family: var(--sans);
  font-size: 10px; font-weight: 700; letter-spacing: 0;
  line-height: 1;
}
.tray-chevron {
  font-size: 11px; line-height: 1; color: var(--gold-bright);
  animation: trayChevBob 1.8s ease-in-out infinite;
}
@keyframes trayChevBob {
  0%, 100% { transform: translateY(0); opacity: .7; }
  50% { transform: translateY(-3px); opacity: 1; }
}
/* stronger call-to-action when the game wants the player to open the tray */
.tray-tab.attention {
  animation: trayAttention 1.15s ease-in-out infinite;
  border-color: var(--gold-bright);
}
.tray-tab.attention .tray-chevron { animation-duration: .8s; }
@keyframes trayAttention {
  0%, 100% {
    box-shadow: inset 0 1px 0 rgba(232,199,90,.22), inset 0 0 12px rgba(201,162,39,.14),
      0 0 0 0 rgba(232,199,90,.5), 0 2px 10px rgba(0,0,0,.35);
    transform: scale(1);
  }
  50% {
    box-shadow: inset 0 1px 0 rgba(232,199,90,.3), inset 0 0 16px rgba(201,162,39,.28),
      0 0 0 6px rgba(232,199,90,0), 0 2px 14px rgba(0,0,0,.4);
    transform: scale(1.045);
  }
}

/* tray sheet */
.tray-sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 62vh; /* fallback: iOS < 15.4 has no dvh */
  max-height: 62dvh;
  background: #11141288;
  background: rgba(17,20,18,.97);
  border-top: 1px solid rgba(201,162,39,.35);
  border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(var(--sab) + 20px);
  transform: translateY(105%);
  transition: transform .32s cubic-bezier(.2,.9,.25,1);
  z-index: 8;
  overflow-y: auto;
  touch-action: pan-y;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.tray-sheet.open { transform: translateY(0); }
.tray-handle {
  width: 64px; height: 5px; border-radius: 3px; background: #4a504b;
  margin: 4px auto 10px;
  padding: 10px 40px; background-clip: content-box; /* generous tap target */
  cursor: pointer;
}
.tray-title { font-size: 11px; letter-spacing: .3em; color: var(--gold); text-align: center; margin-bottom: 12px; font-weight: 500; }
.tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.tray-slot {
  background: rgba(255,255,255,.04);
  border: 1px dashed #34393577;
  border-radius: 10px;
  padding: 8px 6px;
  min-height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-align: center;
}
.tray-slot.filled { border-style: solid; border-color: rgba(201,162,39,.45); background: rgba(201,162,39,.06); }
.tray-slot.next-up { border-color: var(--gold-bright); box-shadow: 0 0 12px rgba(232,199,90,.25); }
.ts-dot { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f5f0e4, #9b8c55); box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.tray-slot:not(.filled) .ts-dot { background: transparent; border: 1px dashed #3a3f3b; box-shadow: none; }
.ts-img {
  width: 52px; height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.55));
  pointer-events: none;
}
.tray-slot:not(.filled) .ts-img { opacity: .28; filter: grayscale(.7) drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.ts-name { font-size: 9.5px; line-height: 1.3; color: var(--paper); }
.tray-slot:not(.filled) .ts-name { color: #555c57; }

/* ============ part card ============ */
.part-card {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(86vw, 380px);
  background: linear-gradient(180deg, #181b19, #101312);
  border: 1px solid var(--gold);
  border-radius: 18px;
  padding: 22px 22px 18px;
  text-align: center;
  z-index: 20;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  animation: cardIn .3s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes cardIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.92); } }
.pc-badge { font-size: 9px; letter-spacing: .35em; color: var(--gold); margin-bottom: 10px; }
.part-card {
  background:
    linear-gradient(180deg, rgba(24,27,25,.97), rgba(16,19,18,.985)),
    url('../assets/guilloche.jpg') center / 380px repeat;
}
.part-card h3 { font-family: var(--display); font-size: 23px; font-weight: 400; margin-bottom: 2px; }
.pc-alt { font-size: 11px; color: var(--muted); font-style: italic; margin-bottom: 10px; }
.part-card p { font-size: 13px; line-height: 1.55; color: #cfd4cd; margin-bottom: 10px; }
.pc-fact { font-size: 12px !important; color: var(--gold-bright) !important; font-style: italic; }
.part-card .btn-small { margin-top: 6px; }

/* toast */
.toast {
  position: absolute;
  bottom: calc(var(--sab) + 130px);
  left: 50%; transform: translateX(-50%);
  pointer-events: none;
  background: rgba(20,23,21,.95);
  border: 1px solid rgba(255,255,255,.15);
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 12.5px;
  white-space: nowrap;
  z-index: 15;
  animation: toastIn .25s ease;
}
.toast.error { border-color: var(--danger); color: #f0b9b1; }
.toast.success { border-color: var(--ok); color: #b9e3c8; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* loupe vignette */
#loupe-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(circle at 50% 46%, transparent 32%, rgba(5,6,5,.88) 67%);
}
#loupe-vignette::after {
  content: "";
  position: absolute;
  left: 50%; top: 46%;
  width: min(78vw, 78vh); height: min(78vw, 78vh);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 3px solid rgba(201,162,39,.55);
  box-shadow: inset 0 0 50px rgba(0,0,0,.5);
}

/* ============ done screen ============ */
#screen-done {
  background:
    radial-gradient(100% 70% at 50% 0%, rgba(201,162,39,.13), transparent 55%),
    linear-gradient(180deg, rgba(16,19,18,.94), rgba(10,12,11,.97)),
    url('../assets/guilloche.jpg') center / 420px repeat;
  display: flex;
}
#done-title { font-family: var(--display); }
.done-inner {
  margin: auto; /* centers when it fits, stays scrollable when it doesn't */
  width: min(92vw, 420px);
  padding: calc(var(--sat) + 20px) 16px calc(var(--sab) + 24px);
  text-align: center;
  display: flex; flex-direction: column; gap: 14px;
  align-items: center;
}
.done-badge {
  width: 76px; height: 76px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  display: grid; place-items: center;
  font-size: 34px; color: var(--gold-bright);
  box-shadow: 0 0 50px rgba(201,162,39,.3);
  animation: badgePop .5s cubic-bezier(.2,.9,.3,1.4);
}
@keyframes badgePop { from { transform: scale(.4); opacity: 0; } }
#done-title { font-family: var(--serif); font-weight: 400; font-size: clamp(20px, 6vw, 26px); letter-spacing: .08em; }
.done-stars { font-size: 30px; letter-spacing: .2em; color: var(--gold-bright); min-height: 38px; }
.done-stars .dim { color: #3a3f3b; }
.done-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; width: 100%;
}
.ds { background: var(--ink-2); border: 1px solid #2a2e2b; border-radius: 12px; padding: 12px 4px; display: flex; flex-direction: column; gap: 2px; }
.ds-num { font-size: clamp(15px, 4.6vw, 20px); font-variant-numeric: tabular-nums; color: var(--paper); }
.ds-label { font-size: 8.5px; letter-spacing: .2em; color: var(--muted); }
.done-rank { font-size: 13px; color: var(--gold); letter-spacing: .15em; }
.done-best { font-size: 11px; color: var(--muted); }
.done-row { display: flex; gap: 8px; width: 100%; }
.done-row .btn-secondary { flex: 1; padding: 12px 6px; font-size: 10.5px; }
#btn-share { width: 100%; }

/* ============ done-screen: join the leaderboard ============ */
.lb-form {
  width: 100%;
  display: flex; flex-direction: column; gap: 9px;
  padding: 16px 15px;
  border: 1px solid rgba(201,162,39,.32);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(24,27,25,.9), rgba(14,17,15,.95)),
    url('../assets/guilloche.jpg') center / 300px repeat;
}
.lb-form.hidden { display: none; }
.lb-form-title {
  font-family: var(--display);
  font-size: 11px; letter-spacing: .28em;
  color: var(--gold);
  text-align: center;
  margin-bottom: 2px;
}
.lb-input {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid #3a3f3b;
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .02em;
  -webkit-user-select: text; user-select: text;
  touch-action: auto;
  transition: border-color .2s;
}
.lb-input::placeholder { color: #6b716b; font-style: italic; }
.lb-input:focus { outline: none; border-color: var(--gold); }
.lb-ig-field { position: relative; display: flex; align-items: center; }
.lb-ig-at {
  position: absolute; left: 14px;
  color: var(--gold); font-family: var(--serif); font-size: 15px;
  pointer-events: none;
}
.lb-input-ig { padding-left: 28px; }
.lb-submit {
  width: 100%;
  margin-top: 2px;
  background: transparent;
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 12px 16px;
  font-family: var(--display);
  font-size: 12px; letter-spacing: .2em;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.lb-submit:hover { background: rgba(201,162,39,.1); }
.lb-submit:active { transform: scale(.98); }
.lb-submit:disabled { opacity: .5; cursor: default; }
.lb-result {
  font-family: var(--serif); font-size: 13px;
  text-align: center; line-height: 1.5;
  color: #cfd4cd;
}
.lb-result.hidden { display: none; }
.lb-result b { color: var(--gold-bright); font-weight: 600; }
.lb-result.error { color: #f0b9b1; }

/* ============ store bar (first-viewport boutique link) ============ */
.store-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  flex-shrink: 0;
  margin: 0 -18px;
  padding: calc(var(--sat) * 0 + 9px) 14px 9px;
  background: rgba(10,12,11,.55);
  border-bottom: 1px solid rgba(201,162,39,.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-decoration: none;
  font-family: var(--display);
  font-size: 9.5px;
  letter-spacing: .22em;
  color: #b9bfb4;
  white-space: nowrap;
}
.store-bar .sb-mark { color: var(--gold-bright); }
.store-bar .sb-sep { color: #5a6058; }
.store-bar .sb-cta {
  margin-left: 8px;
  color: var(--gold);
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 999px;
  padding: 3px 10px;
}
.store-bar:active { opacity: .7; }

/* ============ maison links (subtle Shopify bridges) ============ */
.maison-line {
  display: block;
  text-align: center;
  margin-top: 2px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12.5px;
  color: #9aa096;
  text-decoration: none;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.maison-line b { color: var(--gold); font-weight: 500; }
@media (max-height: 880px) {
  #screen-title .tagline { display: none; }
  .title-inner { gap: clamp(4px, 0.9dvh, 9px); }
}
.maison-card {
  display: flex; flex-direction: column; gap: 3px;
  width: 100%;
  text-decoration: none;
  text-align: center;
  padding: 13px 16px;
  border: 1px solid rgba(201,162,39,.32);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(24,27,25,.9), rgba(14,17,15,.95)),
    url('../assets/guilloche.jpg') center / 300px repeat;
}
.maison-eyebrow { font-size: 8.5px; letter-spacing: .34em; color: var(--gold); }
.maison-name { font-family: var(--display); font-size: 17px; color: var(--paper); }
.maison-cta { font-family: var(--serif); font-style: italic; font-size: 12px; color: #9aa096; }

/* ============ site footer (ownership & trademark) ============ */
.site-footer {
  text-align: center;
  padding: 26px 24px calc(var(--sab) + 30px);
  color: #6f7570;
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.7;
}
.sf-rule {
  height: 1px; width: min(60%, 260px);
  margin: 0 auto 16px;
  background: linear-gradient(90deg, transparent, rgba(201,162,39,.45), transparent);
}
.site-footer .sf-strong { color: #a8aea4; font-family: var(--display); letter-spacing: .14em; font-size: 11px; }
.site-footer .sf-links a { color: var(--gold); text-decoration: none; }

/* ============ loader ============ */
#loader {
  position: absolute; inset: 0;
  background: var(--ink);
  z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .4s;
}
#loader.fade { opacity: 0; pointer-events: none; }
.loader-balance {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  border-top-color: transparent;
  position: relative;
  animation: balanceSwing 1.05s cubic-bezier(.45,0,.55,1) infinite alternate;
}
.loader-balance::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 46px; height: 3px;
  background: var(--gold);
  transform: translate(-50%, -50%);
  border-radius: 2px;
}
@keyframes balanceSwing { from { transform: rotate(-160deg); } to { transform: rotate(160deg); } }
.loader-text { font-size: 10px; letter-spacing: .4em; color: var(--muted); }

/* ============ responsive refinements ============ */
@media (min-width: 600px) {
  .title-inner { justify-content: center; }
  .tray-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
@media (max-height: 640px) {
  .brand { font-size: 30px; }
  .tagline { display: none; }
  .title-inner { gap: 10px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .title-inner { max-width: 760px; }
  .movement-cards { grid-template-columns: 1fr 1fr; }
  #toolbar { right: auto; left: 0; top: calc(var(--sat) + 58px); bottom: 0; width: 96px;
    padding: 8px 8px calc(var(--sab) + 8px) max(8px, var(--sal));
    background: linear-gradient(90deg, rgba(8,10,9,.96) 60%, rgba(8,10,9,0)); }
  .tool-rail { flex-direction: column; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; max-height: 100%; }
  .tray-tab { position: absolute; bottom: calc(var(--sab) + 6px); left: 50%; transform: translateX(-50%); }
}
