/* Self-hosted fonts (SIL OFL / Apache 2.0, see assets/fonts) for Hindi text and the share card */
@font-face { font-family: "Anton"; src: url("/assets/fonts/anton-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Permanent Marker"; src: url("/assets/fonts/permanent-marker-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans Devanagari"; src: url("/assets/fonts/noto-sans-devanagari-devanagari-600-normal.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Noto Sans Devanagari"; src: url("/assets/fonts/noto-sans-devanagari-devanagari-800-normal.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }
:root {
  color-scheme: light;
  --paper: #f5f4ef;
  --ink: #454640;
  --soft: #ecece4;
  --line: #d9dacf;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border-radius: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .32; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.game {
  --controls-height: env(safe-area-inset-bottom);
  --hud-offset: 58px; /* set from main.js: just below the score panel */
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
}
.game-stage {
  position: absolute;
  top: env(safe-area-inset-top);
  right: env(safe-area-inset-right);
  bottom: var(--controls-height);
  left: env(safe-area-inset-left);
}
#track { display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -4px; }
.run-actions { position: absolute; top: 48%; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; }
.start-button {
  height: 48px;
  min-width: 168px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  pointer-events: auto;
}
.start-button span { font-size: 18px; }
.start-button:hover { background: #292b27; }
.start-button[hidden] { display: none; }
.game-controls {
  /* Phones & tablets: a vertical stack in the top-right, under the score — theme, sound, pause */
  position: absolute;
  top: calc(var(--hud-offset) + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#theme { order: 1; }
#sound { order: 2; }
#pause { order: 3; }
.tool-button { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--paper) 78%, transparent); font-size: 22px; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.tool-button:hover:not(:disabled) { background: var(--soft); }
.sound-slash { display: none; position: absolute; width: 29px; height: 2px; background: var(--ink); transform: rotate(-45deg); box-shadow: 0 0 0 2px var(--paper); }
#sound[aria-pressed="true"] .sound-slash { display: block; }
.jump-button { display: none; /* tap anywhere on the game to jump */ align-items: center; justify-content: center; gap: 12px; width: min(180px, 40vw); height: 64px; border: 1px solid var(--ink); background: transparent; font-size: 11px; letter-spacing: 1.8px; touch-action: none; user-select: none; -webkit-user-select: none; }
.jump-button span { font-size: 26px; }
.jump-button:active, .jump-button.is-held { background: var(--ink); color: var(--paper); }
.theme-sun { display: none; }
[data-theme="dark"] { color-scheme: dark; }
[data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
[data-theme="dark"] .start-button:hover { background: var(--sky); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width: 760px) and (hover: hover) and (pointer: fine) {
  .game-controls { top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); flex-direction: row; gap: 6px; }
  #theme, #sound, #pause { order: 0; }
  .tool-button { border-radius: 6px; box-shadow: none; }
  .tool-button:hover:not(:disabled) { background: var(--paper); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- Opening splash ---------- */
.splash { position: fixed; inset: 0; z-index: 20; background: #05070f; cursor: pointer; touch-action: none; transition: opacity .55s ease; }
.splash canvas { display: block; width: 100%; height: 100%; }
.splash.is-leaving { opacity: 0; pointer-events: none; }
.splash-skip { position: absolute; top: calc(48px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); height: 36px; padding: 0 16px; border: 1px solid rgba(255,255,255,.55); border-radius: 18px; background: rgba(0,0,0,.45); color: #fff; font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 2px; backdrop-filter: blur(4px); }
.splash-skip:hover { background: rgba(255,255,255,.18); }
.splash-hint { position: absolute; left: 50%; bottom: calc(52px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 8px 14px; border-radius: 16px; background: rgba(0,0,0,.55); color: #fff; font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; pointer-events: none; animation: splash-pulse 1.4s ease-in-out infinite; }
.splash-hint[hidden] { display: none; }
.splash-welcome { position:absolute; bottom:calc(5dvh + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); width:min(90%,480px); text-align:center; color:#f7ebd4; }
.splash-welcome[hidden] { display:none; }
.splash-features { margin:0 0 20px; font:700 10px/1.7 system-ui,sans-serif; letter-spacing:1.4px; }
.splash-play { width:min(100%,290px); min-height:60px; border:1px solid #ffe0a7; border-radius:19px; background:linear-gradient(135deg,#ffd38b,#e99549); color:#172b26; box-shadow:0 8px 32px #0004,inset 0 1px 0 #fff9; font:800 20px/1.2 system-ui,"Noto Sans Devanagari",sans-serif; transition:transform .2s,box-shadow .2s; cursor:pointer; }
.splash-play:hover { transform:translateY(-2px);box-shadow:0 12px 36px #0005,inset 0 1px 0 #fff9; }
.splash-play:focus-visible { outline:3px solid white;outline-offset:5px; }
.splash-sound-note { margin:14px 0 0; font:500 12px/1.5 system-ui,"Noto Sans Devanagari",sans-serif; opacity:.8; }
@media (max-height:500px) { .splash-welcome { bottom:16px; } .splash-features { display:none; } .splash-play { min-height:46px; } .splash-sound-note { margin:6px 0 0; } }
@keyframes splash-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .splash-hint { animation: none; } }

/* ---------- Mobile Snack Bar: Tap for Jump (Before Game Start) ---------- */
.mobile-hint-snackbar {
  position: absolute;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  color: var(--paper);
  border: 1px solid color-mix(in srgb, var(--paper) 25%, transparent);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.35s ease, transform 0.35s ease;
  animation: mobile-snackbar-float 2.2s ease-in-out infinite;
}
.mobile-hint-snackbar[hidden] {
  display: none !important;
}
.mobile-hint-snackbar.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
  pointer-events: none;
}
.mobile-hint-text { white-space: nowrap; }
.mobile-hint-icon {
  font-size: 15px;
  display: inline-block;
  animation: tap-hand-bounce 1s ease-in-out infinite alternate;
}
@keyframes tap-hand-bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-3px); }
}
@keyframes mobile-snackbar-float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}
@media (min-width: 760px) and (hover: hover) and (pointer: fine) {
  .mobile-hint-snackbar {
    display: none !important;
  }
}

/* ---------- Run extras: outfit + share card buttons, toast, world record banner ---------- */
.run-actions { flex-direction: column; align-items: center; gap: 10px; padding: 0 16px; }
.run-extras { display: flex; gap: 8px; pointer-events: auto; }
.run-extras:not(:has(button:not([hidden]))) { display: none; }
.extra-button {
  height: 40px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 20px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); color: var(--ink);
  font-size: 11px; font-weight: 700; letter-spacing: 1px; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.extra-button:hover { background: var(--soft); }
.extra-button[hidden] { display: none; }
.extra-button--card { background: linear-gradient(135deg, #ff5e3a, #ff9a3d); border-color: #c2410c; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); animation: card-glow 2.4s ease-in-out infinite; }
.extra-button--card:hover { background: linear-gradient(135deg, #f04a26, #ff8a1d); }
@keyframes card-glow { 50% { box-shadow: 0 0 0 4px rgba(255, 138, 61, .28), 0 2px 8px rgba(0,0,0,.15); } }
.toast { margin: 0; padding: 8px 14px; border-radius: 18px; background: #15803d; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .4px; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.toast[hidden] { display: none; }
.record-banner {
  display: flex; align-items: center; gap: 14px;
  margin: 4px 0 0; max-width: min(560px, 100%); padding: 14px 18px; border-radius: 22px;
  font-size: 12px; line-height: 1.5; text-align: left; pointer-events: none;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
}
.record-portrait { flex: none; display: flex; padding: 3px; border-radius: 50%; border: 1px solid var(--glass-edge); background: linear-gradient(145deg, rgba(255,255,255,.65), rgba(255,255,255,.08)); box-shadow: inset 0 1px 2px rgba(255,255,255,.8), 0 3px 12px rgba(0,0,0,.16); }
.record-portrait .avatar { box-shadow: none; }
.record-content { min-width: 0; }
.record-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; }
.record-label { font-size: 11px; font-weight: 800; letter-spacing: 1.2px; }
.record-value { font-size: 23px; line-height: 1.25; font-weight: 800; font-variant-numeric: tabular-nums; }
.record-detail { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.record-banner[hidden] { display: none; }
@media (max-width: 480px) {
  .record-banner { gap: 10px; padding: 12px; border-radius: 18px; font-size: 11px; }
  .record-label { font-size: 10px; letter-spacing: .7px; }
  .record-value { font-size: 21px; }
}
.lang-button { font-size: 13px; font-weight: 800; font-family: "Noto Sans Devanagari", ui-sans-serif, system-ui, sans-serif; }
#lang { order: 1; }
@media (min-width: 760px) and (hover: hover) and (pointer: fine) { #lang { order: 0; } }
html[lang="hi"] .start-button, html[lang="hi"] .extra-button, html[lang="hi"] .mobile-hint-snackbar { font-family: "Noto Sans Devanagari", ui-sans-serif, system-ui, sans-serif; letter-spacing: .3px; font-size: 13px; }

/* ---------- Sheets (modal panels) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 10, 16, .62); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s ease;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
}
.sheet-backdrop.is-open { opacity: 1; }
.sheet-backdrop[hidden] { display: none; }
.sheet {
  width: min(920px, 100%); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain;
  border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.sheet--outfits { width: min(640px, 100%); }
.sheet--record { width: min(440px, 100%); }
.sheet--poster-invite { width: min(460px, 100%); }
.poster-invite-rank { margin: 0 0 14px; font-size: 13px; font-weight: 800; color: #b45309; letter-spacing: .5px; }
[data-theme="dark"] .poster-invite-rank { color: #fbbf24; }
.poster-invite-message { margin: 0 0 12px; font-size: 17px; line-height: 1.5; }
.poster-invite-note { margin: 0 0 20px; font-size: 13px; line-height: 1.5; opacity: .8; }
.poster-invite-actions { flex-wrap: wrap; }
.poster-invite-actions .card-btn { flex: 1 1 150px; min-height: 48px; }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 12px 20px; background: var(--paper); border-bottom: 1px solid var(--line); }
.sheet-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: .2px; }
.sheet-close { width: 40px; height: 40px; border: 0; border-radius: 20px; background: var(--soft); font-size: 24px; line-height: 1; }
.sheet-body { padding: 16px 20px 20px; }
.sheet button:focus-visible, .sheet input:focus-visible, .sheet label:has(input[type=file]:focus-visible) { outline: 2px solid #f97316; outline-offset: 2px; }

/* share card */
.card-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.card-preview { position: relative; }
.card-canvas { display: block; width: 100%; height: auto; aspect-ratio: 1080 / 1350; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.3); touch-action: none; background: #222; }
.card-drag-hint { margin: 8px 0 0; text-align: center; font-size: 12px; opacity: .7; }
.card-drag-hint[hidden] { display: none; }
.card-form { display: flex; flex-direction: column; gap: 16px; }
.card-field { display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
html[lang="hi"] .card-field { text-transform: none; font-size: 14px; }
.card-input { height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: var(--ink); font: 600 16px/1 ui-sans-serif, system-ui, "Noto Sans Devanagari", sans-serif; text-transform: none; letter-spacing: 0; }
.card-row { display: flex; gap: 8px; flex-wrap: wrap; }
.card-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--ink); border-radius: 12px; background: transparent; color: var(--ink);
  font: 700 14px/1 ui-sans-serif, system-ui, "Noto Sans Devanagari", sans-serif; text-decoration: none; cursor: pointer; text-transform: none; letter-spacing: 0;
}
.card-btn[hidden] { display: none; }
.card-btn--photo { background: var(--ink); color: var(--paper); }
.card-btn--ghost { border-color: var(--line); }
.card-btn--primary { background: linear-gradient(135deg, #ff5e3a, #ff9a3d); border-color: #c2410c; color: #fff; }
.card-btn--share { background: #1d4ed8; border-color: #1e40af; color: #fff; }
.card-btn--whatsapp { background: #16a34a; border-color: #15803d; color: #fff; }
.card-btn:disabled { opacity: .6; }
.card-zoom { display: flex; align-items: center; gap: 10px; text-transform: none; font-weight: 600; }
.card-zoom[hidden] { display: none; }
.card-zoom input { flex: 1; accent-color: #f97316; }
.card-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.card-swatch { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 6px; border: 1px solid var(--line); border-radius: 20px; background: var(--soft); font: 600 13px/1 ui-sans-serif, system-ui, "Noto Sans Devanagari", sans-serif; text-transform: none; letter-spacing: 0; }
.card-swatch[aria-checked="true"] { border-color: #f97316; box-shadow: 0 0 0 2px #f97316 inset; }
.card-swatch-dot { width: 28px; height: 28px; border-radius: 14px; border: 1px solid rgba(0,0,0,.2); }
.card-slogan { display: flex; align-items: center; gap: 8px; }
.card-slogan-text { flex: 1; min-height: 44px; display: grid; place-items: center; padding: 6px 10px; border-radius: 12px; background: #facc15; color: #111; text-align: center; font: 400 16px/1.2 "Permanent Marker", "Noto Sans Devanagari", cursive; text-transform: none; letter-spacing: 0; }
.card-arrow { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); font-size: 22px; }
.card-privacy { margin: -4px 0 0; font-size: 12px; opacity: .75; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card-actions .card-btn { flex: 1 1 140px; min-height: 50px; font-size: 15px; }
@media (max-width: 680px) {
  .sheet-backdrop { padding: 0; align-items: end; }
  .sheet { border-radius: 20px 20px 0 0; max-height: 94dvh; }
  .card-layout { grid-template-columns: 1fr; gap: 16px; }
  .card-preview { width: min(100%, 340px); margin: 0 auto; }
}

/* outfits */
.outfit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.outfit-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); font-family: inherit; }
.outfit-tile[aria-checked="true"] { border-color: #f97316; box-shadow: 0 0 0 2px #f97316 inset; }
.outfit-tile[aria-disabled="true"] { cursor: not-allowed; }
.outfit-tile[aria-disabled="true"] .outfit-canvas { filter: grayscale(1) brightness(.6); opacity: .55; }
.outfit-canvas { width: 96px; height: 120px; image-rendering: pixelated; }
.outfit-name { font-size: 13px; font-weight: 700; }
.outfit-lock { font-size: 11px; opacity: .75; }
.outfit-done { width: 100%; margin-top: 16px; min-height: 48px; }

/* world record form */
.record-form { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.record-crown { font-size: 48px; line-height: 1; animation: crown-bob 1.6s ease-in-out infinite; }
@keyframes crown-bob { 50% { transform: translateY(-5px) rotate(-6deg); } }
.record-score { margin: 0; font: 400 56px/1 "Anton", Impact, sans-serif; color: #c2410c; }
.record-sub { margin: 0; font-size: 14px; line-height: 1.45; }
.record-form .card-field { text-align: left; }
.record-status { min-height: 1em; margin: 0; font-size: 13px; color: #dc2626; }
@media (prefers-reduced-motion: reduce) { .record-crown, .extra-button--card { animation: none; } }

/* ---------- Menu, leaderboard, posters ---------- */
.run-extras { flex-wrap: wrap; justify-content: center; max-width: 560px; }
.card-btn--cloud { width: 100%; min-height: 50px; background: #0f172a; border-color: #0f172a; color: #fff; font-size: 15px; }
[data-theme="dark"] .card-btn--cloud { background: #f8fafc; color: #0f172a; border-color: #f8fafc; }
.card-btn--danger { border-color: #fca5a5; color: #b91c1c; }
.card-link { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, #16a34a 12%, var(--paper)); border: 1px solid color-mix(in srgb, #16a34a 40%, transparent); }
.card-link[hidden] { display: none; }
.card-link-note { margin: 0; font-size: 13px; font-weight: 700; }
.card-link-input { font-size: 14px; }
.card-link .card-btn { flex: 1 1 100px; }
.sheet--board, .sheet--posters { width: min(600px, 100%); }
.board-note { margin: 0 0 12px; font-size: 14px; opacity: .8; text-align: center; }
.board-note[hidden] { display: none; }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.board-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); }
.board-row.is-top { background: linear-gradient(135deg, color-mix(in srgb, #facc15 22%, var(--soft)), var(--soft)); }
.board-row.is-you { border-color: #f97316; box-shadow: 0 0 0 2px #f97316 inset; }
.board-rank { font-size: 20px; font-weight: 800; text-align: center; }
.board-who { display: flex; flex-direction: column; min-width: 0; }
.board-who strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-who small { font-size: 12px; opacity: .7; }
.board-score { font: 400 26px/1 "Anton", Impact, sans-serif; color: #c2410c; }
.posters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.poster-item { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); }
.poster-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 1080 / 1350; border-radius: 10px; object-fit: cover; background: #222; }
.poster-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 0 2px; }
.poster-meta strong { font: 400 22px/1 "Anton", Impact, sans-serif; color: #c2410c; }
.poster-meta small { font-size: 11px; opacity: .7; text-align: right; }
.poster-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.poster-actions .card-btn { min-height: 38px; padding: 0 8px; font-size: 12px; }
.poster-actions .card-btn[hidden] { display: none; }

/* ---------- Liquid glass buttons: start run, menu, tools ---------- */
:root {
  --glass-tint: rgba(255, 255, 255, 0.22);
  --glass-tint-2: rgba(255, 255, 255, 0.06);
  --glass-edge: rgba(255, 255, 255, 0.65);
  --glass-ink: #1b1410;
  --glass-shadow: 0 10px 30px rgba(20, 16, 12, 0.22), 0 2px 6px rgba(20, 16, 12, 0.12);
}
[data-theme="dark"] {
  --glass-tint: rgba(255, 255, 255, 0.14);
  --glass-tint-2: rgba(255, 255, 255, 0.03);
  --glass-edge: rgba(255, 255, 255, 0.38);
  --glass-ink: #f8fafc;
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
}
.start-button, .extra-button, .tool-button, .record-banner {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--glass-ink);
  border: 1px solid var(--glass-edge);
  background:
    radial-gradient(120% 140% at 30% -20%, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 46%),
    linear-gradient(180deg, var(--glass-tint), var(--glass-tint-2));
  -webkit-backdrop-filter: blur(14px) saturate(185%) brightness(1.06);
  backdrop-filter: blur(14px) saturate(185%) brightness(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 0 rgba(255,255,255,0.18),
    inset 0 0 0 1px rgba(255,255,255,0.08),
    inset 0 -10px 18px rgba(255,255,255,0.10),
    var(--glass-shadow);
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
  transition: transform .18s cubic-bezier(.2,.8,.2,1.2), box-shadow .2s ease, background .2s ease;
  animation: none;
}
[data-theme="dark"] .start-button, [data-theme="dark"] .extra-button, [data-theme="dark"] .tool-button, [data-theme="dark"] .record-banner { text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
/* moving specular sheen */
.start-button::before, .extra-button::before, .record-banner::before {
  content: "";
  position: absolute;
  inset: -40% -60%;
  z-index: -1;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.55) 48%, rgba(255,255,255,0.12) 54%, transparent 62%);
  transform: translateX(-60%);
  transition: transform .8s cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
}
/* soft caustic glow on the lower edge */
.start-button::after, .extra-button::after, .record-banner::after {
  content: "";
  position: absolute;
  left: 14%; right: 14%; bottom: -1px; height: 45%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,0.45), transparent);
  filter: blur(4px);
  opacity: .55;
  pointer-events: none;
}
.start-button:hover, .extra-button:hover, .tool-button:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  background:
    radial-gradient(120% 140% at 30% -20%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 50%),
    linear-gradient(180deg, var(--glass-tint), var(--glass-tint-2));
}
.start-button:hover::before, .extra-button:hover::before { transform: translateX(60%); }
.start-button:active, .extra-button:active, .tool-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.97);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), inset 0 2px 10px rgba(0,0,0,0.12), 0 4px 12px rgba(20,16,12,0.18);
}
.start-button:focus-visible, .extra-button:focus-visible, .tool-button:focus-visible { outline: 2px solid #f97316; outline-offset: 3px; }

/* Start Run: the same glass, bigger, with a warm saffron tint */
.start-button {
  height: 56px;
  min-width: 220px;
  padding: 0 26px;
  border-radius: 28px;
  font-size: 14px;
  letter-spacing: 2px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(124, 45, 18, 0.55);
  border-color: rgba(255, 237, 213, 0.85);
  background:
    radial-gradient(120% 140% at 30% -20%, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 46%),
    linear-gradient(180deg, rgba(255, 138, 61, 0.72), rgba(234, 88, 12, 0.55));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -2px 0 rgba(124, 45, 18, 0.25),
    inset 0 -14px 22px rgba(255, 200, 150, 0.25),
    0 12px 32px rgba(234, 88, 12, 0.38),
    0 2px 6px rgba(20, 16, 12, 0.2);
}
.start-button:hover {
  background:
    radial-gradient(120% 140% at 30% -20%, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0) 50%),
    linear-gradient(180deg, rgba(255, 150, 80, 0.8), rgba(234, 88, 12, 0.62));
}
[data-theme="dark"] .start-button:hover { background: radial-gradient(120% 140% at 30% -20%, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 50%), linear-gradient(180deg, rgba(255, 150, 80, 0.75), rgba(194, 65, 12, 0.6)); }
.start-button span { font-size: 18px; }

.extra-button {
  height: 44px;
  padding: 0 18px;
  border-radius: 22px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
}
/* Make my card: rose-gold tinted glass */
.extra-button--card {
  color: #fff;
  text-shadow: 0 1px 2px rgba(124, 45, 18, 0.5);
  border-color: rgba(255, 228, 230, 0.85);
  background:
    radial-gradient(120% 140% at 30% -20%, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 46%),
    linear-gradient(180deg, rgba(244, 63, 94, 0.62), rgba(234, 88, 12, 0.5));
}
.extra-button--card:hover { background: radial-gradient(120% 140% at 30% -20%, rgba(255,255,255,0.72) 0%, rgba(255,255,255,0) 50%), linear-gradient(180deg, rgba(244, 63, 94, 0.72), rgba(234, 88, 12, 0.6)); }
.tool-button { border-radius: 14px; }
@media (min-width: 760px) and (hover: hover) and (pointer: fine) {
  .tool-button { border-radius: 12px; }
  .tool-button:hover:not(:disabled) { background: radial-gradient(120% 140% at 30% -20%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 50%), linear-gradient(180deg, var(--glass-tint), var(--glass-tint-2)); }
}
.sound-slash { background: var(--glass-ink); box-shadow: none; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .start-button, .extra-button, .tool-button, .record-banner { background-color: color-mix(in srgb, var(--paper) 80%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .start-button, .extra-button, .tool-button, .record-banner, .start-button::before, .extra-button::before, .record-banner::before { transition: none; }
}

/* ---------- Avatars, poster gallery ---------- */
.avatar { position: relative; flex: none; display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 2px 8px rgba(0,0,0,.25); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.board-row { grid-template-columns: 34px auto 1fr auto; }
.sheet--gallery { width: min(980px, 100%); }
.gallery-sub { margin: 0 0 14px; font-size: 13px; opacity: .75; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery-tile { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 6px; border-radius: 16px; border: 1px solid var(--line); background: var(--soft); text-align: left; font-family: inherit; color: inherit; transition: transform .18s ease, box-shadow .18s ease; }
.gallery-tile:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(0,0,0,.18); }
.gallery-tile.is-top { background: linear-gradient(160deg, color-mix(in srgb, #facc15 26%, var(--soft)), var(--soft) 55%); }
.gallery-tile.is-you { border-color: #f97316; box-shadow: 0 0 0 2px #f97316 inset; }
.gallery-tile img { display: block; width: 100%; height: auto; aspect-ratio: 1080 / 1350; object-fit: cover; border-radius: 11px; background: #2a160b; }
.gallery-rank { position: absolute; top: 12px; left: 12px; z-index: 1; min-width: 34px; height: 28px; padding: 0 8px; display: grid; place-items: center; border-radius: 14px; font-size: 13px; font-weight: 900; color: #fff;
  background: radial-gradient(120% 140% at 30% -20%, rgba(255,255,255,.5), transparent 46%), rgba(20, 12, 6, .45); border: 1px solid rgba(255,255,255,.55);
  -webkit-backdrop-filter: blur(8px) saturate(170%); backdrop-filter: blur(8px) saturate(170%); }
.gallery-meta { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; padding: 0 2px 2px; }
.gallery-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-score { font: 400 20px/1 "Anton", Impact, sans-serif; color: #c2410c; }
.gallery-back { align-self: flex-start; margin-bottom: 12px; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--soft); font: 700 13px/1 ui-sans-serif, system-ui, sans-serif; }
.gallery-detail { display: flex; flex-direction: column; }
.gallery-detail[hidden], .gallery-list[hidden] { display: none; }
.gallery-detail-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.gallery-big { display: block; width: 100%; height: auto; aspect-ratio: 1080 / 1350; border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.35); background: #2a160b; }
.gallery-detail-side { display: flex; flex-direction: column; gap: 16px; }
.gallery-who { display: flex; align-items: center; gap: 12px; }
.gallery-who strong { display: block; font-size: 20px; }
.gallery-who small { font-size: 14px; opacity: .75; }
.gallery-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gallery-actions .card-btn:first-child { grid-column: 1 / -1; min-height: 52px; font-size: 16px; }
.gallery-play { min-height: 56px; font-size: 17px; }
.card-cloud-status { margin: 0; min-height: 1em; font-size: 13px; font-weight: 600; }
.card-cloud-status[data-kind="warn"] { color: #b45309; }
.card-cloud-status[data-kind="error"] { color: #dc2626; }
@media (max-width: 680px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gallery-detail-body { grid-template-columns: 1fr; }
  .gallery-big { width: min(100%, 360px); margin: 0 auto; }
}

/* ---------- Poster maker: simple steps, avatar strip, pinned action bar ---------- */
.sheet--card { display: flex; flex-direction: column; overflow: hidden; height:min(760px,calc(var(--poster-viewport,100dvh) - 32px)); }
.sheet--card .sheet-body { flex: 1 1 0; min-height: 0; overflow:hidden; }
.sheet--card .card-layout { height:100%; align-items:stretch; grid-template-rows:minmax(0,1fr); }
.card-form { min-height:0; min-width:0; }
.card-editor-tabs { display:flex; gap:4px; flex:none; padding:4px; background:var(--soft); border:1px solid var(--line); border-radius:16px; }
.card-editor-tab { flex:1; min-width:0; min-height:44px; border:0; border-radius:12px; background:transparent; color:var(--ink); font:800 13px/1.2 system-ui,"Noto Sans Devanagari",sans-serif; }
.card-editor-tab[aria-pressed="true"] { background:var(--paper); box-shadow:0 2px 8px rgba(0,0,0,.1); color:#b45309; }
[data-theme="dark"] .card-editor-tab[aria-pressed="true"] { color:#ffb366; }
.card-editor-scroll { overflow:auto; min-height:0; padding:2px 3px 12px; display:flex; flex-direction:column; gap:16px; overscroll-behavior:contain; }
.card-editor-group { display:flex; flex-direction:column; gap:16px; }
.card-editor-group[hidden] { display:none; }
.card-step { display: inline-flex; align-items: center; gap: 8px; }
.card-step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 11px; background: linear-gradient(135deg, #ff5e3a, #ff9a3d); color: #fff; font-size: 12px; font-weight: 900; }
.card-avatars { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.card-avatar { position: relative; flex: none; width: 64px; height: 84px; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); scroll-snap-align: start; overflow: hidden; }
.card-avatar[aria-checked="true"] { border-color: #f97316; box-shadow: 0 0 0 2px #f97316 inset, 0 4px 12px rgba(249, 115, 22, .3); }
.card-avatar[aria-disabled="true"] .card-avatar-canvas { filter: grayscale(1) brightness(.7); opacity: .45; }
.card-avatar-canvas { display: block; width: 64px; height: 84px; }
.card-avatar-lock { position: absolute; right: 4px; bottom: 4px; font-size: 13px; }
.card-actions-bar {
  position: sticky; bottom: 0; z-index: 2; display: flex; gap: 10px; margin: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 88%, transparent); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%);
}
.card-actions-bar .card-btn { flex: 1 1 0; min-width:0; min-height: 50px; font-size: 14px; padding:0 10px; border-radius: 14px; }
.card-actions-bar .card-btn--primary { box-shadow: 0 8px 22px rgba(234, 88, 12, .35); }
.card-privacy { font-size: 11px; opacity: .65; }
@media (min-width:681px) {
  .sheet--card .card-preview { display:flex; flex-direction:column; align-items:center; }
  .sheet--card .card-canvas { height:min(540px,calc(var(--poster-viewport,100dvh) - 240px)); width:auto; max-width:100%; }
}
@media (max-width: 680px) {
  .sheet--card { max-height: var(--poster-viewport,100dvh); height: var(--poster-viewport,100dvh); border-radius: 0; }
  .sheet--card .sheet-head { padding: 10px 12px 8px 16px; }
  .sheet--card .sheet-body { padding: 8px 12px 0; }
  .sheet--card .card-layout { gap: 14px; }
  .sheet--card .card-preview { width: auto; margin: 0 auto; }
  .sheet--card .card-canvas { height: min(38dvh, 360px); width: auto; max-width: 100%; margin: 0 auto; }
  .sheet--card .card-form { gap: 14px; }
  .sheet--card .card-field { font-size: 13px; }
  .sheet--card .card-drag-hint { margin-top: 6px; }
}
@media (max-width: 680px) {
  .sheet--card .card-layout { display: flex; flex-direction: column; align-items: stretch; gap:10px; }
  .sheet--card .card-preview { display: flex; flex:none; flex-direction: column; align-items: center; width: 100%; }
  .sheet--card .card-canvas { display: block; height: min(38dvh, 360px); width: auto; aspect-ratio: 1080 / 1350; max-width: 100%; }
  .sheet--card .card-form { width: 100%; flex:1; gap:8px; }
  .card-actions-bar { flex:none; flex-wrap:nowrap; gap:6px; padding:10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .card-actions-bar .card-btn { font-size:12px; min-height:48px; padding:0 6px; }
  .card-editor-scroll { gap:10px; }
  .card-privacy { line-height:1.5; }
}
@media (max-height:580px) and (max-width:680px) { .sheet--card .card-canvas { height:28dvh; } }
@media (max-width:680px) { .sheet--card.has-keyboard .card-canvas { height:min(25dvh,calc(var(--poster-viewport) * .25)); } }
