/* ECHO — styles.css */
  html, body { margin: 0; height: 100%; height: 100dvh; background: #0b0e1a; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
  canvas { display: block; }   /* sized in px by resize() from the visual viewport */
  #gear { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); cursor: pointer; display: grid; place-items: center; z-index: 5; }
  #gear:hover { background: rgba(255,255,255,0.16); }
  #panel { position: fixed; top: 56px; right: 12px; width: min(360px, calc(100vw - 24px)); box-sizing: border-box; background: rgba(16,20,36,0.96); color: #eef0f4; border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; padding: 14px; font: 14px system-ui, sans-serif; z-index: 6; }
  #panel[hidden] { display: none; }
  #panel .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
  #panel .row > span:first-child { color: rgba(255,255,255,0.6); }
  #panel button { font: inherit; color: #fff; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
  #panel button:hover { background: rgba(255,255,255,0.18); }
  #panel b { font-weight: 700; min-width: 48px; display: inline-block; }
  #panel .hint { color: rgba(255,255,255,0.45); font-size: 12px; margin: 4px 0 12px; }

/* username gate */
#gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(11,14,26,0.82); z-index: 10; padding: 20px; }
#gate[hidden] { display: none; }
#gate .card { width: min(360px, 100%); background: rgba(16,20,36,0.98); border: 1px solid rgba(255,255,255,0.12); border-radius: 18px; padding: 22px 20px; color: #eef0f4; font: 15px system-ui, sans-serif; }
#gate h2 { margin: 0 0 14px; font-size: 22px; font-weight: 800; }
#gate input { width: 100%; box-sizing: border-box; font: 700 20px system-ui, sans-serif; letter-spacing: .02em; color: #fff; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.18); border-radius: 12px; padding: 12px 14px; outline: none; }
#gate input:focus { border-color: #f2b64c; }
#gate .sub { color: rgba(255,255,255,0.6); font-size: 13px; margin: 10px 0 0; }
#gate .err { color: #fb7185; font-size: 13px; min-height: 18px; margin: 8px 0 0; }
#gate .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
#gate button { font: inherit; color: #fff; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; padding: 10px 16px; cursor: pointer; min-height: 44px; }
#gate button.primary { background: #f2b64c; color: #1a1405; font-weight: 700; border-color: transparent; }
#gate button:disabled { opacity: .6; cursor: default; }
#gate .note { color: rgba(255,255,255,0.4); font-size: 12px; margin: 16px 0 0; line-height: 1.4; }

/* leaderboard */
#lbBtn { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(64px + env(safe-area-inset-right, 0px)); width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); cursor: pointer; display: grid; place-items: center; z-index: 5; }
#lbBtn:hover { background: rgba(255,255,255,0.16); }
#lbBtn[hidden] { display: none; }
#lb { position: fixed; inset: 0; z-index: 9; background: rgba(11,14,26,0.86); display: flex; align-items: stretch; justify-content: center; }
#lb[hidden] { display: none; }
.lbPanel { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; background: #10141f; color: #eef0f4; font: 15px system-ui, sans-serif; }
@media (min-width: 640px) { .lbPanel { width: 480px; height: min(720px, 92vh); margin: auto; border: 1px solid rgba(255,255,255,0.12); border-radius: 18px; overflow: hidden; } }
.lbHead { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; padding-top: max(14px, env(safe-area-inset-top)); border-bottom: 1px solid rgba(255,255,255,0.08); }
.lbTitle { font-size: 18px; font-weight: 800; } .lbSub { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 2px; }
#lbClose { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.08); color: #fff; font-size: 24px; cursor: pointer; }
#lbScroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; position: relative; }
#lbSpacer { position: relative; width: 100%; }
.lbRow { position: absolute; left: 0; right: 0; height: 56px; display: grid; grid-template-columns: 64px 1fr auto auto; align-items: center; gap: 10px; padding: 0 16px; box-sizing: border-box; border-bottom: 1px solid rgba(255,255,255,0.05); transition: background 0.12s; }
.lbRow .r { color: rgba(255,255,255,0.55); font-variant-numeric: tabular-nums; font-weight: 700; }
.lbRow .u { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbRow .b { font-variant-numeric: tabular-nums; color: rgba(255,255,255,0.85); }
.lbRow.top1 .r { color: #f2b64c; } .lbRow.top2 .r { color: #cfd6e4; } .lbRow.top3 .r { color: #d9a066; }
.lbRow.me { background: rgba(242,182,76,0.14); box-shadow: inset 3px 0 0 #f2b64c; } .lbRow.me .u { color: #f2b64c; }
.lbRow.skeleton .u, .lbRow.skeleton .b { color: transparent; background: rgba(255,255,255,0.06); border-radius: 6px; height: 14px; }
#lbState { position: absolute; left: 0; right: 0; top: 64px; bottom: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; color: rgba(255,255,255,0.6); padding: 20px; pointer-events: none; }
#lbState[hidden] { display: none; }
#lbState button { pointer-events: auto; font: inherit; color: #fff; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; padding: 10px 16px; min-height: 44px; cursor: pointer; }
#lbYou { flex: none; height: 56px; padding-bottom: env(safe-area-inset-bottom); box-sizing: content-box; border: 0; border-top: 1px solid rgba(255,255,255,0.1); background: #1a1f2e; color: #f2b64c; font: 700 16px system-ui, sans-serif; cursor: pointer; text-align: center; }
#lbYou:disabled { color: rgba(255,255,255,0.5); cursor: default; }
#lbTop { position: absolute; right: 14px; bottom: calc(56px + 14px + env(safe-area-inset-bottom)); height: 40px; padding: 0 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.15); background: #1a1f2e; color: #fff; font: 700 13px/1 system-ui, sans-serif; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 5px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
#lbTop span { font-size: 11px; color: rgba(255,255,255,0.6); }
#lbTop[hidden] { display: none; }

/* V0.7 flow: HUD buttons fade out during a run; sheets slide/fade in (cosmetic only, input is never delayed) */
#gear, #lbBtn { transition: opacity .15s ease; }
body[data-state="play"] #gear, body[data-state="play"] #lbBtn { opacity: 0; pointer-events: none; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
#lb:not([hidden]) .lbPanel, #panel:not([hidden]), #gate:not([hidden]) .card { animation: sheetIn .18s ease-out; }
@media (prefers-reduced-motion: reduce) { #gear, #lbBtn { transition: none; } #lb:not([hidden]) .lbPanel, #panel:not([hidden]), #gate:not([hidden]) .card { animation: none; } }

/* audio controls */
#panel .ctl { display: flex; align-items: center; gap: 10px; }
#panel input[type="range"] { width: 110px; accent-color: #f2b64c; height: 28px; cursor: pointer; }
#panel .ctl button { min-width: 48px; }

/* sync toast: only ever shown on the title or death screen, never during a run */
#toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 7; background: rgba(16,20,36,0.94); color: #eef0f4; border: 1px solid rgba(255,255,255,0.14); border-radius: 999px; padding: 9px 16px; font: 600 13px system-ui, sans-serif; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; animation: sheetIn .18s ease-out; }
#toast[hidden] { display: none; }
#toast.ok { color: #4ade80; } #toast.warn { color: rgba(255,255,255,0.7); }
body[data-state="play"] #toast { display: none; }

/* look & beat pickers (settings) */
#panel { max-height: calc(100dvh - 80px); overflow-y: auto; }
#panel .sect { margin: 4px 0 12px; } #panel .sectTitle { font-size: 14px; color: #eef0f4; font-weight: 600; margin-bottom: 8px; } #panel .sectSub { color: rgba(255,255,255,0.45); font-weight: 400; margin-left: 6px; font-size: 12px; }
#panel .beats, #panel .bgs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#panel .beat { display: flex; align-items: center; gap: 8px; justify-content: flex-start; padding: 9px 10px; border-radius: 10px; min-height: 44px; }
#panel .beat .wave { width: 28px; height: 12px; }
#panel .beat .w1 { color: #f2b64c; } #panel .beat .w2 { color: #a78bfa; } #panel .beat .w3 { color: #22d3ee; } #panel .beat .w4 { color: #fb7185; }
#panel .bg { display: block; padding: 0; border-radius: 12px; overflow: hidden; text-align: left; min-height: 44px; }
#panel .bg .thumb { display: block; width: 100%; height: 62px; object-fit: cover; }
#panel .bg .bgName { display: block; padding: 6px 10px 8px; font-size: 13px; }
#panel .beat.on, #panel .bg.on { outline: 2px solid #f2b64c; outline-offset: -2px; background: rgba(242,182,76,0.12); }

/* leaderboard run sheet (tap a row) */
#lb .lbRow { cursor: pointer; }
#lbRun { position: absolute; inset: 0; z-index: 3; display: flex; align-items: flex-end; justify-content: center; background: rgba(6,8,16,0.55); padding: 12px; }
#lbRun[hidden] { display: none; }
.lbRunCard { width: 100%; max-width: 420px; background: #141a2c; border: 1px solid rgba(255,255,255,0.14); border-radius: 16px; padding: 16px 18px 14px; animation: sheetIn .18s ease-out; }
.lbRunName { font-size: 18px; font-weight: 700; color: #fff; } .lbRunMeta { color: rgba(255,255,255,0.55); font-size: 13px; margin-top: 2px; }
.lbRunBest { font-size: 44px; font-weight: 800; letter-spacing: -1px; color: #f2b64c; margin: 10px 0 0; line-height: 1; } .lbRunSub { color: rgba(255,255,255,0.5); font-size: 13px; margin: 14px 0 16px; }
.lbRunActions { display: flex; gap: 8px; } .lbRunActions button { flex: 1; min-height: 44px; } .lbRunActions .primary { background: #f2b64c; color: #1a1405; border-color: #f2b64c; font-weight: 700; }
.lbRunNote { color: rgba(255,255,255,0.55); font-size: 12px; margin-top: 10px; }

/* history view */
#lbHistory { position: absolute; inset: 0; z-index: 4; background: #0f1424; display: flex; flex-direction: column; }
#lbHistory[hidden] { display: none; }
.lbHistHead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.lbHistHead button { min-height: 36px; padding: 6px 12px; } .lbHistTitle { font-size: 16px; font-weight: 700; color: #fff; }
.lbHistScroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 14px 20px; }
.lbHistDay { color: rgba(255,255,255,0.5); font-size: 12px; font-weight: 600; letter-spacing: 0.4px; margin: 14px 0 6px; text-transform: uppercase; }
.lbHistRow { display: grid; grid-template-columns: minmax(84px, auto) 1fr auto; align-items: center; gap: 14px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.05); margin-bottom: 6px; }
.lbHistRow.pb { background: rgba(242,182,76,0.14); border: 1px solid rgba(242,182,76,0.45); }
.lbHistTime { font-weight: 800; font-size: 17px; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 4px; } .lbHistRow.pb .lbHistTime { color: #f2b64c; }
.lbHistMeta { color: rgba(255,255,255,0.55); font-size: 12px; } .lbHistPb { color: #f2b64c; font-weight: 800; font-size: 11px; margin-left: 6px; }
.lbHistPlay { min-height: 34px; padding: 4px 10px; border-radius: 8px; } .lbHistPlay[disabled] { opacity: 0.35; }
#lbHistMore { width: 100%; min-height: 40px; margin-top: 8px; } .lbHistNote { color: rgba(255,255,255,0.55); font-size: 13px; text-align: center; padding: 20px 10px; }

/* daily / all-time switch */
.lbTabs { display: flex; gap: 6px; margin-top: 8px; } .lbTabs button { min-height: 32px; padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.lbTabs button.on { background: #f2b64c; color: #1a1405; border-color: #f2b64c; font-weight: 700; }

/* settings panel header: a close control that nothing can cover */
#panel .panelHead { position: sticky; top: 0; z-index: 2; background: inherit; margin: -4px 0 6px; padding-top: 4px; }
#panel .panelTitle { font-weight: 800; font-size: 16px; color: #fff; }
#closePanelTop { min-width: 40px; min-height: 40px; border-radius: 999px; padding: 0; font-size: 16px; line-height: 1; }

/* rows read as tappable */
.lbRow .chev { color: rgba(255,255,255,0.35); font-size: 22px; line-height: 1; padding-left: 4px; }
.lbRow:hover { background: rgba(255,255,255,0.06); } .lbRow:active { background: rgba(255,255,255,0.12); }
.lbRow.me:hover { background: rgba(242,182,76,0.2); }
.lbHint { color: rgba(255,255,255,0.45); font-size: 12px; margin-top: 6px; }

/* invisible probe: its padding exposes the device safe-area insets to the renderer */
#safeProbe { position: fixed; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
/* overlays keep clear of the insets too */
#lb, #panel, #gate { padding-top: max(0px, env(safe-area-inset-top, 0px)); padding-bottom: max(0px, env(safe-area-inset-bottom, 0px)); box-sizing: border-box; }

/* leaderboard list: a thin, dark scrollbar instead of the system white one */

.lbHistScroll, #panel { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; }
.lbHistScroll::-webkit-scrollbar, #panel::-webkit-scrollbar { width: 6px; } .lbHistScroll::-webkit-scrollbar-thumb, #panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }
button.danger { border-color: rgba(251,113,133,0.5); color: #fb7185; }

.btnLink { display: inline-block; min-height: 36px; line-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); color: #fff; text-decoration: none; font-size: 14px; }

#howLink { position: fixed; left: calc(14px + env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 3; color: rgba(255,255,255,0.6); font: 600 13px system-ui, sans-serif; text-decoration: none; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); }
body[data-state="play"] #howLink, body[data-state="dead"] #howLink { display: none; }
/* scrollbars fully hidden on scrollable panels (touch scrolling unaffected) */
#lbScroll, .lbScroll, .lbHistScroll, #panel, #gate { scrollbar-width: none; -ms-overflow-style: none; }
#lbScroll::-webkit-scrollbar, .lbScroll::-webkit-scrollbar, .lbHistScroll::-webkit-scrollbar, #panel::-webkit-scrollbar, #gate::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* username gate: scrollable, top-aligned on short/keyboard-shrunk viewports so the input and Continue stay reachable */
#gate { align-items: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: max(20px, env(safe-area-inset-top, 0px)) 20px max(20px, env(safe-area-inset-bottom, 0px)); }
#gate .card { margin: auto; }
@media (max-height: 520px) { #gate .card { padding: 14px 16px; } #gate h2 { font-size: 18px; margin-bottom: 8px; } #gate .note { display: none; } }
/* settings panel: always scrollable within the visible viewport */
/* touch hardening: no long-press callouts or text selection on the play surface */
canvas { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* "my position": the row pulses gold twice, then settles */
@keyframes rowFlash { 0% { background: rgba(242,182,76,0.55); } 50% { background: rgba(242,182,76,0.14); } 75% { background: rgba(242,182,76,0.45); } 100% { background: rgba(242,182,76,0.14); } }
.lbRow.flash { animation: rowFlash 1.2s ease-out 1; }

/* Looks: tabs + grid */
.lkTabs { display: flex; gap: 6px; margin: 6px 0 6px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,0.06); } .lkTabs button { flex: 1; min-height: 40px; padding: 4px 10px; border-radius: 10px; font-size: 14px; color: rgba(255,255,255,0.6); border-color: transparent; background: transparent; }
.lkTabs button.on { background: #f2b64c; color: #1a1405; font-weight: 800; box-shadow: 0 2px 10px rgba(242,182,76,0.35); }
.lkHead { font-size: 15px; font-weight: 800; color: #fff; margin: 4px 2px 8px; }
#looksGrid button.bg, #looksGrid button.beat { position: relative; }
#looksGrid .lock { position: absolute; top: 6px; right: 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.4px; padding: 3px 7px; border-radius: 999px; background: rgba(242,182,76,0.95); color: #1a1405; }
#looksGrid button.locked { opacity: 0.72; } #looksGrid button.locked.on { opacity: 1; }
#looksGrid canvas.skinThumb { width: 100%; height: 110px; display: block; border-radius: 10px 10px 0 0; }

#looksGrid .lkName { display: block; padding: 7px 10px 9px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
#looksGrid .bg.on .lkName, #looksGrid .beat.on .lkName { color: #f2b64c; }
/* light backgrounds (Paper White): the on-screen controls go dark so they stay visible */
body.lightbg #gear, body.lightbg #lbBtn { background: rgba(27,33,48,0.85); color: #fff; border-color: rgba(27,33,48,0.9); }
body.lightbg #howLink { background: rgba(27,33,48,0.8); color: #fff; border-color: rgba(27,33,48,0.9); }

#panel .beat .lkName { min-width: 0; flex: 1; }
@media (max-width: 400px) { #panel .beats, #panel .bgs { grid-template-columns: 1fr; } }

/* Looks page */
#looks { position: fixed; inset: 0; z-index: 9; background: rgba(11,14,26,0.86); display: flex; align-items: center; justify-content: center; padding: 12px; box-sizing: border-box; }
#looks[hidden] { display: none; }
.lkPage { width: min(600px, 100%); max-height: 100%; display: flex; flex-direction: column; background: rgba(16,20,36,0.98); border: 1px solid rgba(255,255,255,0.12); border-radius: 18px; color: #eef0f4; font: 14px system-ui, sans-serif; overflow: hidden; }
.lkPage .lbHead { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 16px 8px; gap: 12px; }
.lkPage .lkTabs { margin: 4px 12px 0; }
.lkBody { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 12px 16px; scrollbar-width: none; } .lkBody::-webkit-scrollbar { display: none; }
#looks #looksGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 360px) { #looks #looksGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#looksClose { width: 44px; height: 44px; border-radius: 22px; padding: 0; font-size: 16px; }
#looksBtn { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(116px + env(safe-area-inset-right, 0px)); width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); cursor: pointer; display: grid; place-items: center; z-index: 5; }
body.lightbg #looksBtn { background: rgba(27,33,48,0.85); color: #fff; }
#looksBtn:hover { background: rgba(255,255,255,0.14); }
body[data-state="play"] #looksBtn { display: none; }

/* packs (bottom of the Looks page) */
.packs { margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; gap: 8px; }
.packs[hidden] { display: none; }   /* the display:flex above would otherwise override the hidden attribute (launch build hides the shop) */
.packRow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); }
.packRow.bundle { background: rgba(242,182,76,0.12); border-color: rgba(242,182,76,0.6); }
.packRow.owned { opacity: 0.75; } .packRow.owned .packBuy { background: rgba(74,222,128,0.15); color: #4ade80; border-color: rgba(74,222,128,0.4); }
.packName { font-weight: 800; font-size: 14px; } .packSub { font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 2px; }
.packBuy { min-height: 40px; min-width: 76px; padding: 0 14px; border-radius: 10px; font-weight: 800; }
.packRow.flash { animation: rowFlash 1.2s ease-out 1; }
/* locked items: a lock badge in the corner, dimmed thumbnail */
#looksGrid button.locked .thumb, #looksGrid button.locked .skinThumb { filter: saturate(0.6) brightness(0.75); }
#looksGrid .lock { display: inline-flex; align-items: center; gap: 4px; }

/* Looks cards: the rc8 look, kept on purpose — solid light-grey "arcade" buttons with dark text on the dark page */
#looks button { font: inherit; color: #111; background: #e9e9e9; border: 2px solid #8a8a8a; border-radius: 4px; padding: 5px 10px; cursor: pointer; }
#looks button:hover { background: #f4f4f4; } #looks button:active { background: #d8d8d8; border-color: #666; }
#looks .lkTabs { background: transparent; padding: 0; gap: 8px; } #looks .lkTabs button { min-height: 40px; color: #222; background: #dcdcdc; border: 2px solid #8a8a8a; border-radius: 4px; font-weight: 700; }
#looks .lkTabs button.on { background: #f2b64c; border-color: #b07a1c; color: #1a1405; box-shadow: none; }
#looks .lkHead { color: #fff; }
#looksGrid .card { display: flex; flex-direction: column; padding: 0; border-radius: 4px; overflow: hidden; background: #e9e9e9; border: 2px solid #8a8a8a; color: #111; }
#looksGrid .card.on { border-color: #f2b64c; outline: 2px solid #f2b64c; outline-offset: -2px; background: #fff3d6; }
#looksGrid .card .face { display: block; width: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; text-align: left; position: relative; min-height: 44px; }
#looksGrid .card .face:hover { background: #f4f4f4; }
#looksGrid .card .thumb { display: block; width: 100%; height: 110px; object-fit: cover; }
#looksGrid .card .skinThumb { display: block; width: 100%; height: 110px; }
#looksGrid .card.beat .face { display: flex; align-items: center; justify-content: center; height: 110px; padding: 0; }
#looksGrid .card.beat .wave { width: 72px; height: 32px; }
#looksGrid .pvChip { position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.3px; padding: 3px 7px; border-radius: 3px; background: #1a1405; color: #fff; border: 1px solid #000; pointer-events: none; }
#looksGrid .card.beat .pvChip { position: absolute; left: 6px; bottom: 6px; }
#looksGrid .card.previewing .pvChip { background: #f2b64c; color: #1a1405; border-color: #b07a1c; }
#looksGrid .card .lkName { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: 0; padding: 6px 8px 7px; border: 0; border-radius: 0; border-top: 2px solid #8a8a8a; background: #dcdcdc; color: #111; font-size: 13px; font-weight: 700; text-align: left; }
#looksGrid .card .lkName:hover { background: #ededed; }
#looksGrid .card .lkName .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
#looksGrid .card .lkName .st { flex: none; font-size: 11px; font-weight: 800; color: #9a6a12; }
#looksGrid .card .lkName.cur .st { color: #1f7a3a; } #looksGrid .card .lkName.cur { cursor: default; background: #fff3d6; }
#looksGrid .card .lkName.lockedName .st { color: #666; }
#looksGrid .card.locked .face .thumb, #looksGrid .card.locked .face .skinThumb { filter: saturate(0.6) brightness(0.8); }
#looksGrid .card.locked .lock { position: absolute; top: 6px; right: 6px; background: #f2b64c; color: #1a1405; border: 1px solid #b07a1c; border-radius: 3px; }
#looksGrid .card.beat.locked .lock { position: absolute; top: 6px; right: 6px; }
/* Today's: the named card that the daily pick is showing right now glows gold even while locked; its own card keeps full colour */
#looksGrid .card.todayPick { border-color: #f2b64c; box-shadow: 0 0 0 2px #f2b64c, 0 0 16px rgba(242,182,76,0.75); }
#looksGrid .card.todayPick.locked .face .thumb, #looksGrid .card.todayPick.locked .face .skinThumb { filter: none; }
#looksGrid .card.todayPick .lkName .st { color: #9a6a12; }
#looksGrid .card.todayPick.locked .lock { top: 6px; right: 6px; }
#looksGrid .card.todayCard .lkName .st, #looksGrid .card.todayPick .lkName .st { white-space: normal; }
#looksGrid .lock { max-width: calc(100% - 12px); box-sizing: border-box; }
#looksGrid .lock .lockTx { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#looksGrid .lock.iconOnly { gap: 0; padding-left: 5px; padding-right: 5px; }
#looksGrid .lock.iconOnly .lockTx { display: none; }
#looks .packRow { background: #e9e9e9; border: 2px solid #8a8a8a; border-radius: 4px; color: #111; }
#looks .packRow.bundle { background: #fff3d6; border-color: #b07a1c; }
#looks .packName { color: #111; } #looks .packSub { color: #444; }
#looks .packBuy { font-weight: 800; } #looks .packBuy.primary { background: #f2b64c; border-color: #b07a1c; color: #1a1405; }
#looks .packRow.owned { opacity: 1; background: #e4f5e9; } #looks .packRow.owned .packBuy { background: #cfeedb; color: #1f7a3a; border-color: #1f7a3a; }
#looks .hint { color: rgba(255,255,255,0.6); }
#looks .hint a.storeLink { color: #f2b64c; font-weight: 700; text-decoration: underline; }
#looksClose { width: 44px; height: 44px; border-radius: 4px; padding: 0; font-size: 16px; }
/* in the apps: purchase status line and Restore purchases (Apple requires a visible restore for one-time purchases) */
#looks .storeMsg { font-size: 13px; font-weight: 700; padding: 8px 10px; border-radius: 4px; background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.18); }
#looks .storeMsg[data-kind="ok"] { background: #e4f5e9; color: #1f7a3a; border-color: #1f7a3a; }
#looks .storeMsg[data-kind="err"] { background: #fde8e8; color: #9b1c1c; border-color: #9b1c1c; }
#looks .storeMsg[hidden], #looks .restoreBtn[hidden] { display: none; }
#looks button.restoreBtn { align-self: center; background: transparent; border: 0; color: #f2b64c; font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 8px 6px; min-height: 40px; }
#looks button.restoreBtn:hover { background: transparent; color: #ffd27a; } #looks button.restoreBtn:disabled { opacity: 0.5; cursor: default; }
#looks .packBuy:disabled { cursor: default; }

/* device linking */
.linkBox { margin: -4px 0 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); }
.linkCode { font: 800 28px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 3px; text-align: center; color: #f2b64c; margin: 4px 0 8px; user-select: all; }
#linkInput { flex: 1; min-width: 0; font: 700 18px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 2px; text-transform: uppercase; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2); background: rgba(0,0,0,0.3); color: #fff; }
#linkEnter .row { margin-bottom: 8px; gap: 8px; }

/* code entry on the username gate */
.gateLink { margin-top: 12px; } .gateLink .linkish { background: transparent; border: 0; color: #f2b64c; font: inherit; font-size: 13px; padding: 6px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#gateLinkBox .row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
#gateLinkInput { flex: 1; min-width: 0; font: 700 18px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 2px; text-transform: uppercase; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2); background: rgba(0,0,0,0.3); color: #fff; }
#gate[data-mode="rename"] .gateLink { display: none; }

/* icon and close buttons: centred glyphs on every engine (Safari gives buttons padding and line-height that nudge SVGs/✕ off-centre) */
#gear, #lbBtn, #looksBtn, #lbClose, #closePanelTop, #looksClose { display: inline-grid; place-items: center; padding: 0; line-height: 1; box-sizing: border-box; -webkit-appearance: none; appearance: none; }
#gear svg, #lbBtn svg, #looksBtn svg { display: block; }
#lbClose, #closePanelTop, #looksClose { font-family: system-ui, -apple-system, sans-serif; }
/* landscape phones: the lane runs along the bottom, so the how-to-play link moves to the top-left corner (the icons are top-right) */
@media (max-height: 520px) { #howLink { bottom: auto; top: calc(12px + env(safe-area-inset-top, 0px)); } }
/* gate: the transfer-code entry is a full-width outlined button under Continue (rc17.5: the old 13px text link went unseen) */
#gate .gateLink button.linkish, #gate .gateLink button.linkish:hover { display: block; width: 100%; box-sizing: border-box; min-height: 46px; padding: 10px 14px; background: transparent; border: 1px solid rgba(255,255,255,0.28); border-radius: 12px; box-shadow: none; color: #fff; font-size: 15px; font-weight: 600; line-height: 1.3; text-decoration: none; }
#gate .gateLink button.linkish:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.4); }
#gate .gateLink::before { content: attr(data-or); display: block; margin: 10px 0 8px; color: rgba(255,255,255,0.4); font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
#gate .gateLink[data-or=""]::before { display: none; }
#gate .note a, #gate .note a:visited { color: #f2b64c; }
/* gate: a single action fills the width; with Cancel present (rename) the two sit side by side */
#gate .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
#gate[data-mode="first"] .actions { margin-top: 10px; } #gate[data-mode="first"] .actions #gateGo { width: 100%; }
#gate[data-mode="rename"] .actions button { flex: 1; }
#gate .gateLink { text-align: center; margin-top: 12px; }

/* rc14.2 — on the death screen the toast moves to the top (the link pills own the bottom of the screen); the canvas
   reserves room for it. Portrait: under the icon row. Landscape: in the top row, clear of the icons on the right. */
body[data-state="dead"] #toast { bottom: auto; top: calc(64px + env(safe-area-inset-top, 0px)); }
@media (max-height: 520px) {
  body[data-state="dead"] #toast { top: calc(12px + env(safe-area-inset-top, 0px)); max-width: calc(100vw - 320px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); }
}

/* rc14.2 accessibility: the top icons meet the 44pt (Apple) / 48dp-with-spacing (Android) minimum tap size,
   keyboard focus is always visible, and a hidden live region reads the death result to screen readers */
#gear, #lbBtn, #looksBtn { width: 44px; height: 44px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #f2b64c; outline-offset: 2px; }
.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0; }

/* rc15 — Language picker */
#langSel { font: 600 14px system-ui, sans-serif; color: #fff; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18); border-radius: 10px; padding: 8px 10px; min-height: 40px; max-width: 200px; }
#langSel option { color: #111; background: #fff; }
/* long translations: row labels never break mid-word, control groups wrap instead of running off the panel */
#panel .row > span:first-child { flex: 0 0 auto; white-space: nowrap; }
#panel .ctl { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
#panel .row > span:last-child { min-width: 0; text-align: end; }
.packRow[hidden] { display: none !important; }

/* rc16 — pause. The button lives top-right during a run (the settings icons are hidden then); the overlay sits above
   the canvas so a tap on it can never reach the game as a jump. */
#pauseBtn { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.85); display: flex; align-items: center; justify-content: center; z-index: 6; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
#pauseBtn[hidden] { display: none; }
#pauseOverlay { position: fixed; inset: 0; z-index: 9; background: rgba(11,14,26,0.72); display: flex; align-items: center; justify-content: center; padding: 24px; padding-top: calc(24px + env(safe-area-inset-top, 0px)); padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
#pauseOverlay[hidden] { display: none; }
.pauseCard { width: min(320px, 100%); background: #141a2c; border: 1px solid rgba(255,255,255,0.12); border-radius: 18px; padding: 22px 20px; display: flex; flex-direction: column; gap: 10px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.pauseTitle { font: 800 24px/1.2 system-ui, sans-serif; color: #fff; }
.pauseSub { font: 500 14px/1.4 system-ui, sans-serif; color: rgba(255,255,255,0.62); min-height: 1em; margin-bottom: 6px; }
.pauseSub:empty { display: none; }
.pauseCard button { min-height: 48px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.08); color: #fff; font: 700 16px system-ui, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.pauseCard button.primary { background: #f2b64c; color: #1a1405; border-color: transparent; }

/* rc16 — the Today tab explains that the course itself changes daily */
.lbDailyNote { color: rgba(242,182,76,0.85); margin-top: 4px; }
.lbDailyNote[hidden] { display: none; }

/* ---- website only: getting the app (getapp.js). Never shown inside the apps. ---- */
.storeRow { display: flex; flex-wrap: wrap; gap: 8px; }
.storeBtn { display: inline-flex; flex-direction: column; justify-content: center; align-items: flex-start; box-sizing: border-box; min-width: 132px; min-height: 46px; padding: 5px 14px; border-radius: 10px; background: #000; border: 1px solid rgba(255,255,255,0.4); color: #fff; text-decoration: none; line-height: 1.12; -webkit-tap-highlight-color: transparent; }
.storeBtn .sbCap { font: 600 10px system-ui, sans-serif; opacity: 0.85; white-space: nowrap; }
.storeBtn .sbName { font: 700 18px system-ui, sans-serif; letter-spacing: -0.2px; white-space: nowrap; }
.storeBtn:hover { border-color: #f2b64c; }
.qrBox { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.qrBox img { display: block; width: 96px; height: 96px; box-sizing: border-box; padding: 3px; border-radius: 8px; background: #fff; image-rendering: pixelated; }
.qrText { font: 500 12px/1.3 system-ui, sans-serif; color: rgba(255,255,255,0.7); max-width: 180px; text-align: center; }
.gaX { position: absolute; top: 8px; inset-inline-end: 8px; width: 36px; height: 36px; border-radius: 999px; border: none; background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); font: 600 15px system-ui, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.gaX:hover { color: #fff; background: rgba(255,255,255,0.12); }

/* pop-up: packs are sold in the app */
#webBuy { position: fixed; inset: 0; z-index: 11; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; background: rgba(5,7,14,0.72); touch-action: auto; }
#webBuy[hidden] { display: none; }
#webBuy .wbCard { position: relative; width: min(380px, 100%); max-height: 100%; overflow-y: auto; box-sizing: border-box; padding: 24px 20px 18px; border-radius: 18px; background: #141a2c; border: 1px solid rgba(242,182,76,0.6); color: #fff; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.5); scrollbar-width: none; }
#webBuy .wbTitle { font: 800 20px/1.25 system-ui, sans-serif; margin: 2px 34px 10px; }
#webBuy .wbPrefix { font: 700 14px/1.4 system-ui, sans-serif; color: #f2b64c; margin-bottom: 8px; }
#webBuy .wbBody { font: 500 14px/1.5 system-ui, sans-serif; color: rgba(255,255,255,0.78); margin-bottom: 16px; }
#webBuy .wbScan { display: flex; justify-content: center; margin-bottom: 14px; }
#webBuy .storeRow { justify-content: center; margin-bottom: 14px; }
#webBuy .wbSoon { font: 500 13px/1.4 system-ui, sans-serif; color: rgba(255,255,255,0.6); margin-bottom: 14px; }
#webBuy .wbLink { color: #f2b64c; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
#webBuy .wbOk { min-width: 132px; min-height: 46px; border-radius: 12px; border: none; background: #f2b64c; color: #1a1405; font: 800 16px system-ui, sans-serif; cursor: pointer; }

/* A: "get the app" pill, phones, title screen */
#getAppLink { position: fixed; right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 3; color: #f2b64c; font: 700 13px system-ui, sans-serif; text-decoration: none; padding: 8px 14px; border-radius: 999px; background: rgba(242,182,76,0.1); border: 1px solid rgba(242,182,76,0.75); -webkit-tap-highlight-color: transparent; }
body[data-state="play"] #getAppLink, body[data-state="dead"] #getAppLink { display: none; }
body.lightbg #getAppLink { background: rgba(27,33,48,0.85); }

/* C: "play on your phone" card, death screen, once per visit */
#appCard { position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 4; transform: translateX(-50%); width: min(330px, calc(100% - 24px)); box-sizing: border-box; padding: 9px 12px 11px; border-radius: 13px; background: rgba(20,26,44,0.95); border: 1px solid rgba(242,182,76,0.7); color: #fff; animation: appCardIn 0.25s ease-out; }
#appCard[hidden] { display: none; }
#appCard .acTitle { font: 800 14px/1.3 system-ui, sans-serif; margin-inline-end: 34px; }
#appCard .acSub { font: 500 11.5px/1.3 system-ui, sans-serif; color: rgba(255,255,255,0.65); margin-top: 1px; margin-bottom: 8px; margin-inline-end: 34px; }
#appCard .acBody { display: flex; align-items: center; gap: 10px; }
#appCard .storeRow { flex: 1; gap: 6px; }
#appCard .storeBtn { flex: 1 1 110px; min-width: 0; max-width: 170px; height: 36px; min-height: 0; padding: 0 10px; border-radius: 8px; overflow: hidden; }   /* fixed height whatever the language */
#appCard .storeBtn .sbCap { font-size: 9px; }
#appCard .storeBtn .sbName { font-size: 14px; }
#appCard .qrBox img { width: 62px; height: 62px; }
#appCard .gaX { top: 6px; inset-inline-end: 6px; width: 30px; height: 30px; font-size: 13px; }   /* compact card (rc17.6): it sat over the play field */
#appCard.land { left: auto; bottom: auto; right: calc(16px + env(safe-area-inset-right, 0px)); transform: none; transform-origin: top right; }   /* landscape: far right, under the ground line (top set by getapp.js) */
#appCard.land { animation-name: appCardInLand; }
@keyframes appCardInLand { from { opacity: 0; } to { opacity: 1; } }
@keyframes appCardIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* D: QR + store buttons, computers, title screen (big enough windows only) */
#appCorner { display: none; position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 3; gap: 14px; align-items: center; padding: 12px 16px 12px 12px; border-radius: 16px; background: rgba(20,26,44,0.88); border: 1px solid rgba(255,255,255,0.14); color: #fff; }
@media (min-width: 900px) and (min-height: 600px) { body[data-state="title"] #appCorner { display: flex; } }
#appCorner .qrBox img { width: 92px; height: 92px; }
#appCorner .acTitle { font: 800 15px/1.3 system-ui, sans-serif; }
#appCorner .acSub { font: 500 12px/1.35 system-ui, sans-serif; color: rgba(255,255,255,0.62); margin: 1px 0 8px; }
#appCorner .storeRow { flex-direction: column; gap: 6px; }
#appCorner .storeBtn { min-height: 38px; min-width: 124px; padding: 3px 11px; }
#appCorner .storeBtn .sbName { font-size: 15px; }
.storeBtn.soonBtn { opacity: 0.45; cursor: default; pointer-events: none; filter: grayscale(1); }   /* Google Play until it's public */

/* close buttons keep their round 44px shape on narrow phones (iPhone mini, SE): the heading text wraps instead */
#lbClose, #looksClose, #closePanelTop { flex: 0 0 auto; }
.lbHead > div:first-child, #panel .panelHead > :first-child { min-width: 0; }

/* What's new card: one per version, title screen only */
#whatsNew { position: fixed; inset: 0; z-index: 11; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; background: rgba(5,7,14,0.72); touch-action: auto; }
#whatsNew .wnCard { width: min(380px, 100%); max-height: 100%; overflow-y: auto; box-sizing: border-box; padding: 22px 20px 18px; border-radius: 18px; background: #141a2c; border: 1px solid rgba(242,182,76,0.6); color: #fff; box-shadow: 0 20px 60px rgba(0,0,0,0.5); scrollbar-width: none; }
#whatsNew .wnKicker { font: 800 11px/1.2 system-ui, sans-serif; letter-spacing: 1.6px; text-transform: uppercase; color: #f2b64c; margin-bottom: 6px; }
#whatsNew .wnTitle { font: 800 22px/1.2 system-ui, sans-serif; margin-bottom: 12px; }
#whatsNew .wnList { list-style: none; margin: 0 0 16px; padding: 0; }
#whatsNew .wnList li { position: relative; padding: 7px 0 7px 22px; font: 500 14px/1.45 system-ui, sans-serif; color: rgba(255,255,255,0.82); border-top: 1px solid rgba(255,255,255,0.08); }
#whatsNew .wnList li:first-child { border-top: 0; }
#whatsNew .wnList li::before { content: ""; position: absolute; left: 4px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: #f2b64c; box-shadow: 0 0 8px rgba(242,182,76,0.8); }
#whatsNew .wnOk { display: block; width: 100%; min-height: 46px; border-radius: 12px; border: none; background: #f2b64c; color: #1a1405; font: 800 16px system-ui, sans-serif; cursor: pointer; }

/* Settings → Racer colour */
#racerSwatches { gap: 8px; }
#panel #racerSwatches button.swatch { min-width: 0; width: 30px; height: 30px; padding: 0; border-radius: 50%; background: var(--sw); border: 2px solid rgba(255,255,255,0.25); }
#panel #racerSwatches button.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.35); }
