/* 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: 12px; right: 12px; 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: 12px; right: 56px; 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: 6px 0 14px; }
.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: 72px 1fr auto; align-items: center; gap: 8px; 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; } .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: 12px; right: 100px; 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; }
.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; }
#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); }
#looksClose { width: 44px; height: 44px; border-radius: 4px; padding: 0; font-size: 16px; }

/* 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 plain text link, not a button; links keep the gold colour when visited */
#gate .gateLink button.linkish, #gate .gateLink button.linkish:hover { background: transparent; border: 0; box-shadow: none; padding: 6px 0; min-height: 0; width: auto; color: #f2b64c; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
#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: 8px; }
