/* ============ Tap Tap Reborn — design system ============ */
:root {
  --bg: #07051a; --bg-2: #120a2c; --bg-3: #1d0c3a;
  --text: #f6f3ff; --text-2: rgba(246,243,255,.66); --text-3: rgba(246,243,255,.42);
  --surface: rgba(255,255,255,.055); --surface-2: rgba(255,255,255,.09); --stroke: rgba(255,255,255,.09); --stroke-2: rgba(255,255,255,.16);
  --red: #ff3d6e; --green: #2ef08a; --blue: #3aa0ff; --gold: #ffc23d; --violet: #a98bff;
  --flame: linear-gradient(135deg, #ffd24a 0%, #ff7a2b 48%, #ff2e63 100%);
  --perfect: #ffd84d; --great: #5dffb0; --good: #7cc4ff; --miss: #ff4d6a;
  --d-easy: #2ef08a; --d-medium: #3aa0ff; --d-hard: #ff8a3d; --d-insane: #ff4fb8;
  --r-sm: 12px; --r-md: 18px; --r-lg: 26px; --r-xl: 32px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --display: "Unbounded", system-ui, sans-serif;
  --ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --spring: cubic-bezier(.2, .9, .25, 1.15);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: var(--app-h, 100%); overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--ui);
  -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; flex: none; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
h1, h2, h3 { margin: 0; }
.t2 { color: var(--text-2); } .t3 { color: var(--text-3); } .small { font-size: 13px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- orbs (the TTR signature) ---------- */
.orb { display: block; width: 28px; height: 28px; border-radius: 50%; position: relative; }
.orb::after { content: ""; position: absolute; left: 18%; top: 12%; width: 42%; height: 30%; border-radius: 50%; background: radial-gradient(rgba(255,255,255,.95), rgba(255,255,255,0) 70%); transform: rotate(-25deg); }
.o-red   { background: radial-gradient(circle at 35% 30%, #ffc6d5, var(--red) 45%, #6e0022); box-shadow: 0 0 22px rgba(255,61,110,.7); }
.o-green { background: radial-gradient(circle at 35% 30%, #c8ffe2, var(--green) 45%, #005a2c); box-shadow: 0 0 22px rgba(46,240,138,.6); }
.o-blue  { background: radial-gradient(circle at 35% 30%, #c8e5ff, var(--blue) 45%, #073a7c); box-shadow: 0 0 22px rgba(58,160,255,.7); }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; height: var(--app-h, 100%); bottom: auto; display: none; flex-direction: column; padding: calc(var(--sat) + 10px) 20px calc(var(--sab) + 16px);
  background:
    radial-gradient(90% 55% at 50% 108%, rgba(120,60,255,.30), transparent 70%),
    radial-gradient(60% 40% at 0% 30%, rgba(255,61,110,.08), transparent 70%),
    radial-gradient(60% 40% at 100% 45%, rgba(58,160,255,.09), transparent 70%),
    linear-gradient(var(--bg), var(--bg-2) 60%, var(--bg-3));
}
.screen.active { display: flex; animation: enter .34s var(--ease); }
.screen.active.back { animation-name: enterback; }
#game.active, #loading.active, #results.active { animation-name: fadein; }   /* the game measures its canvas: no sliding */
@keyframes enter { from { opacity: 0; transform: translateX(26px); } }
@keyframes enterback { from { opacity: 0; transform: translateX(-26px); } }

/* ---------- buttons ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 22px; border-radius: var(--r-md);
  font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .2px;
  background: var(--surface-2); border: 1px solid var(--stroke); box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .15s var(--spring), background .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--flame); border: 0; color: #fff; text-shadow: 0 1px 2px rgba(120,20,0,.35);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.45), inset 0 -3px 0 rgba(120,0,40,.25), 0 10px 30px -6px rgba(255,90,40,.55); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); font-family: var(--ui); font-weight: 700; }
.btn.small { min-height: 40px; width: auto; padding: 0 16px; font-size: 13px; border-radius: 12px; }
.btn + .btn { margin-top: 10px; }
.glass-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); transition: transform .15s var(--spring); }
.glass-btn:active { transform: scale(.92); }
.glass-btn.accent { background: var(--flame); border: 0; box-shadow: 0 6px 20px -4px rgba(255,90,40,.6); }
.text-btn { font-weight: 700; font-size: 14px; color: var(--text-2); padding: 8px 4px; }
.text-btn.danger { color: var(--miss); }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: .8px; background: var(--surface-2); }
.pill.gold { background: linear-gradient(135deg, #fff1a8, var(--gold)); color: #3a2600; }
.pill.flame { background: var(--flame); color: #fff; }
.card { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-md); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }

/* ---------- home ---------- */
#home { padding: 0; overflow: hidden; background: var(--bg); }
#attract { position: absolute; inset: 0; width: 100%; height: 100%; }
.home-scrim { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgba(7,5,26,.92) 0%, rgba(7,5,26,.35) 38%, rgba(7,5,26,.1) 55%, rgba(7,5,26,.75) 78%, rgba(7,5,26,.96) 100%); }
.home-top { position: relative; padding: calc(var(--sat) + 9vh) 24px 0; display: flex; justify-content: center; }
.brand { text-align: center; }
.brand-orbs { display: flex; gap: 14px; justify-content: center; margin-bottom: 18px; }
.brand-orbs .orb { width: 30px; height: 30px; animation: bob 1.6s var(--ease) infinite; }
.brand-orbs .orb:nth-child(2) { animation-delay: .18s; } .brand-orbs .orb:nth-child(3) { animation-delay: .36s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-9px); } }
.wordmark span { display: block; font-family: var(--display); font-weight: 900; font-size: clamp(54px, 17vw, 92px); line-height: .9; letter-spacing: -2px;
  transform: skewX(-9deg); background: linear-gradient(180deg, #fff 35%, #d6c8ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #4b2a9a) drop-shadow(0 6px 0 #2a1560) drop-shadow(0 16px 24px rgba(0,0,0,.55)); padding: 0 .1em; }
.subbrand { display: inline-block; margin-top: 14px; padding: 7px 16px 6px 22px; border-radius: 999px; font-family: var(--display); font-weight: 800; font-size: clamp(14px, 4.4vw, 20px);
  letter-spacing: .5em; background: var(--flame); color: #fff; transform: skewX(-9deg); box-shadow: 0 8px 26px -6px rgba(255,90,40,.7), inset 0 1.5px 0 rgba(255,255,255,.45); }
.home-bottom { position: relative; flex: none; padding: 10px 24px calc(var(--sab) + 26px); display: flex; flex-direction: column; align-items: center; }
.cta { position: relative; overflow: hidden; width: min(100%, 360px); height: 76px; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 14px;
  font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: 1px; color: #fff; background: var(--flame);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), inset 0 -4px 0 rgba(120,0,40,.28), 0 18px 44px -10px rgba(255,90,40,.75);
  transition: transform .18s var(--spring); }
.cta svg { width: 26px; height: 26px; }
.cta:active { transform: scale(.96); }
.cta::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: shine 4.5s ease-in-out 1.2s infinite; }
@keyframes shine { 0% { left: -60%; } 22%, 100% { left: 130%; } }
.home-row { display: flex; gap: 10px; margin-top: 16px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 800; font-size: 14px;
  background: rgba(255,255,255,.08); border: 1px solid var(--stroke); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); transition: transform .15s var(--spring); }
.chip svg { width: 17px; height: 17px; }
.chip:active { transform: scale(.95); }
.home-count { margin: 14px 0 0; font-size: 13px; color: var(--text-3); font-weight: 600; }
.hint { margin: 6px 0 0; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* ---------- top bar / titles ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; height: 48px; }
.titleblock { margin: 6px 0 14px; }
.titleblock h2 { font-family: var(--display); font-weight: 800; font-size: 32px; letter-spacing: -.5px; }
.titleblock p { margin: 4px 0 0; font-weight: 600; font-size: 14px; }
.search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--stroke); margin-bottom: 14px; color: var(--text-3); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 15px; font-weight: 600; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }

/* ---------- song list ---------- */
.song-list { list-style: none; margin: 0 -20px; padding: 0 20px 24px; overflow-y: auto; flex: 1; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(transparent, #000 10px, #000 calc(100% - 24px), transparent); }
.song { display: flex; align-items: center; gap: 14px; padding: 10px; margin: 0 -10px 4px; border-radius: var(--r-md); transition: background .15s, transform .15s var(--spring); cursor: pointer;
  animation: rise .4s var(--ease) both; }
.song:active { background: var(--surface); transform: scale(.985); }
@media (hover: hover) { .song:hover { background: var(--surface); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.cover { position: relative; flex: none; width: 58px; height: 58px; border-radius: 14px; overflow: hidden; background-size: cover; background-position: center;
  box-shadow: 0 6px 18px -6px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.08); display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 22px; color: rgba(255,255,255,.92); text-shadow: 0 2px 8px rgba(0,0,0,.3); }
.cover.lg { width: 84px; height: 84px; border-radius: 18px; font-size: 32px; }
.cover.xl { width: 132px; height: 132px; border-radius: 50%; font-size: 48px; }
.cover .dots { position: absolute; bottom: 6px; left: 0; right: 0; display: flex; gap: 3px; justify-content: center; }
.cover .dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.75); }
.song-meta { min-width: 0; flex: 1; }
.song-title { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.song-sub { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.dpips { display: flex; gap: 4px; }
.dpips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.14); }
.dpips i.on.e { background: var(--d-easy); box-shadow: 0 0 6px var(--d-easy); } .dpips i.on.m { background: var(--d-medium); box-shadow: 0 0 6px var(--d-medium); }
.dpips i.on.h { background: var(--d-hard); box-shadow: 0 0 6px var(--d-hard); } .dpips i.on.i { background: var(--d-insane); box-shadow: 0 0 6px var(--d-insane); }
.tag { font-size: 10px; font-weight: 800; letter-spacing: .6px; color: var(--text-3); text-transform: uppercase; }
.rank-badge { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 15px;
  background: var(--surface-2); border: 1px solid var(--stroke); }
.rank-S { color: #2a1800; background: linear-gradient(135deg, #fff1a8, var(--gold) 50%, #ff8a3d); border: 0; box-shadow: 0 0 16px rgba(255,194,61,.5); }
.rank-A { color: var(--great); } .rank-B { color: var(--good); } .rank-C { color: var(--violet); } .rank-D { color: var(--text-3); }
.empty { text-align: center; margin: auto 0; padding: 0 16px 10vh; }
.empty-orbs { display: flex; gap: 12px; justify-content: center; margin-bottom: 22px; }
.empty-orbs .orb { animation: bob 1.6s var(--ease) infinite; } .empty-orbs .orb:nth-child(2) { animation-delay: .18s; } .empty-orbs .orb:nth-child(3) { animation-delay: .36s; }
.empty h3 { font-family: var(--display); font-weight: 800; font-size: 22px; }
.empty p { margin: 8px auto 22px; max-width: 280px; line-height: 1.45; }
.empty .btn { width: auto; display: inline-flex; }
.empty .small { margin-top: 18px; }
.drop { position: absolute; inset: 12px; z-index: 30; border-radius: var(--r-xl); border: 2px dashed rgba(255,194,61,.7); background: rgba(20,10,40,.85);
  display: grid; place-items: center; text-align: center; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.drop svg { width: 44px; height: 44px; color: var(--gold); display: block; margin: 0 auto 12px; }
.drop b { font-family: var(--display); font-size: 18px; }

/* ---------- difficulty sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(3,2,12,.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadein .25s; }
@keyframes fadein { from { opacity: 0; } }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 20px calc(var(--sab) + 18px); border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: linear-gradient(rgba(38,24,78,.97), rgba(17,10,40,.98)); border-top: 1px solid var(--stroke-2); box-shadow: 0 -20px 60px rgba(0,0,0,.5);
  animation: sheetup .38s var(--spring); }
@keyframes sheetup { from { transform: translateY(100%); } }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.22); margin: 0 auto 16px; }
.sheet-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.sheet-meta { min-width: 0; }
.sheet h3 { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sheet-meta p { margin: 4px 0 0; font-weight: 600; }
.diff-list { display: grid; gap: 8px; }
.diff { --c: var(--d-easy); display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: var(--r-md); text-align: left;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 18%, transparent), rgba(255,255,255,.035) 60%); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  transition: transform .15s var(--spring), background .2s; }
.diff:active { transform: scale(.97); }
@media (hover: hover) { .diff:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 28%, transparent), rgba(255,255,255,.05) 60%); } }
.diff.medium { --c: var(--d-medium); } .diff.hard { --c: var(--d-hard); } .diff.insane { --c: var(--d-insane); }
.diff-name { flex: 1; }
.diff-name b { display: block; font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: .3px; color: var(--c); }
.lv { display: flex; gap: 4px; margin-top: 7px; }
.lv i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.12); }
.lv i.on { background: var(--c); box-shadow: 0 0 8px var(--c); }
.diff-best { text-align: right; font-size: 12px; font-weight: 700; color: var(--text-3); line-height: 1.3; }
.diff-best b { display: block; font-family: var(--display); font-size: 14px; color: var(--text); font-weight: 700; }
.diff .rank-badge { width: 32px; height: 32px; font-size: 14px; }
.sheet-foot { display: flex; justify-content: center; gap: 22px; margin-top: 12px; }

/* ---------- loading ---------- */
#loading { justify-content: center; align-items: center; }
.loading-box { text-align: center; width: min(100%, 340px); }
.loading-art { position: relative; width: 170px; height: 170px; margin: 0 auto 26px; display: grid; place-items: center; }
.loading-art .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 6; }
.ring-fg { fill: none; stroke: var(--gold); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 339.3; transition: stroke-dashoffset .2s; filter: drop-shadow(0 0 6px rgba(255,194,61,.6)); }
.loading-art .cover { animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-box h3 { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.25; }
.loading-box p { margin: 8px 0 0; font-weight: 600; }

/* ---------- game ---------- */
#game { padding: 0; background: var(--bg); }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
#game, #game * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pause-btn { position: absolute; top: calc(var(--sat) + 12px); right: 14px; z-index: 5; background: rgba(10,6,30,.45); }
.pause-btn svg { width: 16px; height: 16px; }
.tapstart { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 34px; border-radius: var(--r-lg); background: rgba(30,18,64,.8); border-color: var(--stroke-2); }
.tapstart svg { width: 40px; height: 40px; color: var(--gold); }
.tapstart b { font-family: var(--display); font-size: 20px; }
.tapstart span { font-size: 13px; font-weight: 600; }
.overlay { position: absolute; inset: 0; z-index: 10; background: rgba(5,3,18,.66); display: grid; place-items: center; padding: 20px;
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); animation: fadein .2s; }
.pause-card { width: min(100%, 340px); padding: 26px 20px 16px; text-align: center; background: rgba(30,18,64,.7); border-color: var(--stroke-2); animation: pop .3s var(--spring); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--text-3); }
.pause-card h3 { font-family: var(--display); font-weight: 800; font-size: 22px; margin: 6px 0 22px; line-height: 1.2; }

/* ---------- results ---------- */
#results { overflow-y: auto; touch-action: pan-y; }
.results { width: min(100%, 420px); margin: auto; text-align: center; padding: 12px 0; }
.rank-wrap { position: relative; margin-bottom: 6px; }
.rank { font-family: var(--display); font-weight: 900; font-size: 120px; line-height: 1; letter-spacing: -4px; transform: skewX(-8deg); display: inline-block;
  background: linear-gradient(180deg, #fff, #cfc2ff); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(169,139,255,.5)); animation: rankin .6s var(--spring) both; padding: 0 .08em; }
.rank.S { background-image: linear-gradient(180deg, #fff6c2 10%, var(--gold) 50%, #ff6a2b); filter: drop-shadow(0 0 34px rgba(255,160,40,.6)); }
.rank.A { background-image: linear-gradient(180deg, #e2fff0, var(--great)); filter: drop-shadow(0 0 30px rgba(93,255,176,.45)); }
.rank.B { background-image: linear-gradient(180deg, #e3f2ff, var(--good)); filter: drop-shadow(0 0 30px rgba(124,196,255,.45)); }
.rank.C { background-image: linear-gradient(180deg, #efe9ff, var(--violet)); }
.rank.D { background-image: linear-gradient(180deg, #ddd, #777); filter: none; }
@keyframes rankin { from { transform: skewX(-8deg) scale(2.2); opacity: 0; } }
.chips { display: flex; gap: 8px; justify-content: center; min-height: 24px; }
.results h3 { font-family: var(--display); font-weight: 800; font-size: 20px; margin-top: 16px; line-height: 1.25; }
.results > p { margin: 8px 0 0; }
.big-score { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 13vw, 64px); letter-spacing: -1.5px; margin: 14px 0 2px; font-variant-numeric: tabular-nums; }
.breakdown { padding: 14px; margin-top: 18px; }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.stack i { display: block; height: 100%; transform-origin: left; animation: grow .8s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.legend { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 12px; }
.legend div { font-size: 11px; font-weight: 800; letter-spacing: .6px; color: var(--text-3); }
.legend b { display: block; font-family: var(--display); font-size: 17px; margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.stats .card { padding: 12px 6px; }
.stats b { display: block; font-family: var(--display); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 11.5px; font-weight: 700; color: var(--text-3); }
.tip { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; margin-top: 8px; text-align: left; border-color: rgba(255,194,61,.35); background: rgba(255,194,61,.08); }
.tip p { margin: 0; flex: 1; font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.tip .btn { flex: none; margin: 0; }
.results-actions { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; margin-top: 20px; }
.results-actions .btn + .btn { margin-top: 0; }

/* ---------- settings ---------- */
.settings { overflow-y: auto; flex: 1; touch-action: pan-y; width: 100%; max-width: 560px; margin: 0 auto; padding-bottom: 20px; }
.group-label { margin: 18px 4px 8px; font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-3); }
.group { padding: 0 16px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 0; font-weight: 700; font-size: 15.5px; text-align: left; }
.row + .row { border-top: 1px solid var(--stroke); }
.row.col { flex-direction: column; align-items: stretch; }
.row-top { display: flex; justify-content: space-between; }
.val { font-family: var(--display); font-size: 14px; color: var(--gold); }
.row small { font-size: 12.5px; line-height: 1.45; font-weight: 600; }
.row.link svg { color: var(--text-3); width: 18px; height: 18px; }
.row.danger { color: var(--miss); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: none; margin: 4px 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--violet), #ff7a2b); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--blue), var(--violet), #ff7a2b); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4), 0 0 0 4px rgba(255,255,255,.12); }
input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.switch { -webkit-appearance: none; appearance: none; flex: none; width: 52px; height: 32px; border-radius: 16px; background: rgba(255,255,255,.14); position: relative; cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .25s var(--spring); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.about { margin: 22px 4px 0; line-height: 1.5; }

/* ---------- toasts ---------- */
.toast, .upload-toast { position: fixed; left: 50%; bottom: calc(var(--sab) + 20px); transform: translateX(-50%); z-index: 50; width: max-content; max-width: calc(100% - 32px);
  background: rgba(24,14,52,.92); border: 1px solid var(--stroke-2); border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.5);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); animation: toastin .35s var(--spring); }
.toast { padding: 12px 18px; font-size: 14px; font-weight: 700; text-align: center; }
@keyframes toastin { from { transform: translate(-50%, 20px); opacity: 0; } }
.upload-toast { width: min(360px, calc(100% - 32px)); padding: 14px 16px; }
.upload-top { display: flex; justify-content: space-between; font-size: 14px; }
.upload-toast p { margin: 4px 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-toast .bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.upload-toast .bar i { display: block; height: 100%; width: 0; background: var(--flame); transition: width .2s; }

/* ---------- wide screens ---------- */
@media (min-width: 700px) {
  #game #stage { left: 50%; width: min(100%, 560px); transform: translateX(-50%); }
  .pause-btn { right: calc(50% - min(50%, 280px) + 14px); }
  #songs > *, #settings > .topbar, #settings > .titleblock { width: 100%; max-width: 640px; margin-left: auto; margin-right: auto; }
  #songs .song-list { max-width: 680px; }
  .sheet { inset: 0; margin: auto; width: 480px; height: fit-content; border-radius: var(--r-xl); border: 1px solid var(--stroke-2); padding-bottom: 20px; animation: pop .3s var(--spring); }
  .sheet-handle { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
