:root {
  --bg: #14121f; --card: #1f1c30; --line: #332f4d; --text: #f2f0ff; --muted: #a29fc0;
  --accent: #e5a00d; --good: #3ecf8e; --bad: #ff5c7a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 480px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column; gap: 14px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1 { font-size: 22px; margin: 0; letter-spacing: .3px; cursor: pointer; }
h1 span { color: var(--accent); }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.hud { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; text-align: right; }
.hud b { color: var(--text); font-size: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=search], select {
  width: 100%; font-size: 16px; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); margin-bottom: 12px; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; }
.row { display: flex; justify-content: space-between; align-items: baseline; }
.big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
button { font: inherit; border: 0; border-radius: 12px; padding: 14px 16px; cursor: pointer; width: 100%;
  background: var(--line); color: var(--text); min-height: 50px; }
button.primary { background: var(--accent); color: #1a1300; font-weight: 700; }
button:disabled { opacity: .5; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.err { color: var(--bad); font-size: 14px; margin: 8px 0 0; }
.err:empty, .hint:empty { display: none; }
.hidden { display: none !important; }

/* mode picker */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode { text-align: left; background: var(--card); border: 1px solid var(--line); padding: 12px; min-height: 92px; display: flex; flex-direction: column; gap: 4px; }
.mode .ico { font-size: 22px; }
.mode b { font-size: 15px; }
.mode small { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.mode.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.seg { display: flex; gap: 6px; margin-bottom: 12px; }
.seg button { min-height: 42px; padding: 8px; font-size: 14px; }
.seg button.on { background: var(--accent); color: #1a1300; font-weight: 700; }
.seg.wrap { display: grid; grid-template-columns: repeat(3, 1fr); }
.link { color: var(--accent); font-size: 14px; text-decoration: none; }
.btnlink { display: block; text-align: center; background: var(--accent); color: #1a1300; font-weight: 700; border-radius: 12px; padding: 14px; text-decoration: none; }
.servers { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.servers:empty { display: none; }
.srv { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.srv div { flex: 1; min-width: 0; }
.srv small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); flex: none; }
.srv .dot.down { background: var(--bad); }
.srv button { width: auto; min-height: 36px; padding: 6px 12px; font-size: 13px; }
.chosen { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--accent); font-size: 14px; }
.suggest { display: grid; gap: 6px; margin: -6px 0 12px; }
.suggest:empty { display: none; }
.suggest button { min-height: 44px; padding: 10px 12px; text-align: left; font-size: 14px; background: var(--bg); border: 1px solid var(--line); }
.suggest button small { color: var(--muted); }

/* player */
.player { display: grid; place-items: center; padding: 4px 0; }
.ring { position: relative; width: 168px; height: 168px; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--line); }
.ring .prog { stroke: var(--accent); stroke-linecap: round; }
.ring button { position: absolute; inset: 16px; width: auto; border-radius: 50%; background: var(--card);
  font-size: 44px; display: grid; place-items: center; border: 1px solid var(--line); }
.ring button.loading { font-size: 16px; color: var(--muted); }
.meta-line { text-align: center; color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.goal { text-align: center; font-size: 20px; font-weight: 800; margin: 10px 0 0; }
.goal:empty { display: none; }
.ring button.count { font-size: 52px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.pips { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.pips:empty { display: none; }
.pips span { font-size: 12px; padding: 4px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.pips span.used { color: var(--bad); text-decoration: line-through; }
.pips span.now { color: #1a1300; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.tools { display: flex; gap: 8px; margin-top: 12px; }
.tools button { padding: 10px; min-height: 44px; font-size: 14px; }
.worth { text-align: center; font-size: 13px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.worth b { color: var(--accent); }
.clue { text-align: center; margin-top: 8px; color: var(--accent); font-size: 14px; }
.clue:empty { display: none; }

.choices { display: grid; gap: 10px; }
.choices:empty { display: none; }
.choices.grid2 { grid-template-columns: 1fr 1fr; }
.choices button { text-align: left; background: var(--card); border: 1px solid var(--line); }
.choices.grid2 button { text-align: center; font-weight: 700; }
.choices button:disabled { opacity: .7; }
.choices button.right, .choices button.wrong { opacity: 1; }
.choices button.right { background: color-mix(in srgb, var(--good) 25%, var(--card)); border-color: var(--good); }
.choices button.wrong { background: color-mix(in srgb, var(--bad) 25%, var(--card)); border-color: var(--bad); }

.reveal { display: flex; gap: 14px; align-items: center; }
.reveal img { width: 92px; height: 92px; border-radius: 10px; object-fit: cover; background: var(--line); flex: none; }
.reveal .t { font-size: 18px; font-weight: 700; }
.reveal .a { color: var(--muted); }
.verdict { font-weight: 700; font-size: 18px; margin-bottom: 10px; display: flex; justify-content: space-between; }
.verdict.good { color: var(--good); } .verdict.bad { color: var(--bad); }
.stack { display: grid; gap: 10px; margin-top: 14px; }
.final { text-align: center; }
.final .big { font-size: 48px; color: var(--accent); }
.flash { animation: flash .5s; }
@keyframes flash { from { transform: scale(1.05); } to { transform: none; } }

/* lobby: the chosen artist / album / genre */
.pick { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--bg); border: 1px solid var(--line); padding: 10px; margin-bottom: 12px; }
.pick.on { border-color: var(--accent); }
.pick .br-art { width: 56px; height: 56px; flex: none; }
.pick-text { flex: 1; min-width: 0; }
.pick-text b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-text small { color: var(--muted); font-size: 13px; }
.pick-go { color: var(--accent); font-size: 26px; line-height: 1; }

/* music browser: full screen, like a media player's library */
body.br-open { overflow: hidden; }
.br { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 0; max-width: 1100px; margin: 0 auto; }
.br-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px 4px; }
.br-back { width: 44px; min-height: 44px; padding: 0; font-size: 30px; line-height: 1; background: none; color: var(--accent); flex: none; }
.br-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.br-title b { font-size: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-title small { color: var(--muted); font-size: 13px; white-space: nowrap; }
.br-tabs { display: flex; gap: 6px; padding: 4px 16px 8px; }
.br-tabs button { min-height: 38px; padding: 6px 10px; font-size: 14px; border-radius: 999px; }
.br-tabs button.on { background: var(--accent); color: #1a1300; font-weight: 700; }
.br-tools { display: flex; gap: 8px; padding: 0 16px 10px; }
.br-tools input, .br-tools select { margin: 0; padding: 10px; font-size: 16px; min-width: 0; }
.br-tools input { flex: 1.4; }
.br-tools select { flex: 1; }
.br-dir { width: 46px; min-height: 0; padding: 0; flex: none; font-size: 18px; }
.br-body { flex: 1; position: relative; min-height: 0; }
.br-scroll { position: absolute; inset: 0; overflow-y: auto; padding: 2px 28px max(24px, env(safe-area-inset-bottom)) 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.br-space { position: relative; }
.br-empty, .br-note { color: var(--muted); text-align: center; font-size: 14px; margin: 24px 0; }
.br-card { position: absolute; left: 0; top: 0; padding: 0; background: none; border-radius: 0; min-height: 0;
  display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 0; }
.br-card.static { position: static; }
.br-art { position: relative; display: block; width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--card); }
.br-art.round { border-radius: 50%; }
.br-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.br-art.skel { animation: skel 1.2s ease-in-out infinite alternate; }
@keyframes skel { from { opacity: .5; } to { opacity: 1; } }
.br-ph { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 26px; color: rgba(255,255,255,.85);
  background: linear-gradient(135deg, hsl(var(--h) 45% 32%), hsl(calc(var(--h) + 40) 45% 18%)); }
.br-name { margin-top: 6px; font-size: 13.5px; font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.br-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-card.genre { border-radius: 12px; overflow: hidden; }
.br-genre { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 10px 12px;
  background: linear-gradient(135deg, hsl(var(--h) 55% 40%), hsl(calc(var(--h) + 50) 55% 22%)); }
.br-genre b { font-size: 16px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.br-genre small { font-size: 12px; color: rgba(255,255,255,.75); }
.br-card:active .br-art, .br-card.genre:active { transform: scale(.97); }
.br-az { position: absolute; right: 2px; top: 4px; bottom: 8px; width: 24px; display: flex; flex-direction: column; justify-content: space-around;
  align-items: center; touch-action: none; user-select: none; -webkit-user-select: none; font-size: 11px; font-weight: 700; color: var(--accent); }
.br-az:empty { display: none; }
.br-az span { flex: 1; display: grid; place-items: center; max-height: 22px; width: 100%; }
.br-bubble { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); width: 84px; height: 84px; border-radius: 20px;
  background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 44px; font-weight: 800; color: var(--accent); pointer-events: none; }
.br-page { position: absolute; inset: 0; z-index: 2; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.br-page-body { flex: 1; overflow-y: auto; padding: 0 16px max(24px, env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.br-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 4px; }
.br-hero .br-art { width: min(56vw, 240px); }
.br-hero .br-ph { font-size: 56px; }
.br-hero-name { font-size: 24px; color: var(--text); text-transform: none; letter-spacing: 0; margin: 14px 0 0; font-weight: 800; }
.br-hero .br-note { margin: 4px 0 0; }
.br-hero .br-play { margin-top: 14px; max-width: 320px; }
.br-h { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 22px 0 10px; }
.br-albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px 10px; }
.br-sheet { position: absolute; inset: 0; z-index: 3; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.br-sheet-card { width: 100%; max-width: 480px; background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom)); display: grid; gap: 10px; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.br-sheet-card .br-art { width: min(60vw, 220px); margin: 0 auto 4px; }
.br-sheet-text { text-align: center; display: grid; gap: 2px; }
.br-sheet-text b { font-size: 19px; }
.br-sheet-text span { color: var(--muted); }
.br-sheet-text small { color: var(--muted); font-size: 13px; }

/* game settings side menu (game-menu.js), solo and multiplayer */
.setbtn { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--card); border: 1px solid var(--line); }
.setbtn .ico { font-size: 22px; flex: none; }
.setbtn b { display: block; font-size: 16px; }
.setbtn small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.setbtn small:empty { display: none; }
.iconbtn { width: auto; min-height: 36px; padding: 6px 10px; font-size: 14px; border-radius: 999px; }
html.dr-lock, html.dr-lock body { overflow: hidden; }
.drawer { position: fixed; inset: 0; z-index: 30; visibility: hidden; }
.drawer.open { visibility: visible; }
.dr-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .2s; }
.drawer.open .dr-scrim { opacity: 1; }
.dr-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 90vw); background: var(--bg); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease-out; }
.drawer.open .dr-panel { transform: none; }
.dr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: max(12px, env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line); }
.dr-head b { font-size: 18px; }
.dr-x { width: 44px; min-height: 44px; padding: 0; font-size: 18px; background: var(--card); }
.dr-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 16px; }
.dr-body section { padding: 12px 0 4px; border-bottom: 1px solid var(--line); }
.dr-body section:last-child { border-bottom: 0; }
.dr-body h3 { font-size: 13px; margin: 0 0 10px; color: var(--accent); text-transform: uppercase; letter-spacing: .6px; }
.dr-rules .rules { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; line-height: 1.35; }
.dr-rules .rules li::marker { color: var(--accent); }
.dr-field { margin-bottom: 14px; }
.dr-field label { margin-bottom: 4px; }
.dr-field .seg { margin-bottom: 4px; }
.dr-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dr-row .big { font-size: 20px; }
.dr-range { display: flex; align-items: center; gap: 8px; }
.dr-range input { flex: 1; min-width: 0; }
.dr-step { width: 40px; min-height: 40px; padding: 0; font-size: 20px; flex: none; }
.dr-hint { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.dr-hint:empty { display: none; }
.dr-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line); font-size: 11.5px; }
.dr-foot { padding: 10px 16px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: grid; gap: 8px; }
.dr-foot:empty { display: none; }
.dr-pin { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.dr-pin input { width: auto; min-height: 0; margin: 0; }
.dr-foot .hint { margin: 0; }
