/* JSBeats 2 — chill, Work Sans, translucent black, blue→aqua accents. */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

:root {
  --ease: cubic-bezier(0.35, 0, 0.1, 1);
  --bg: #05060c;
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --faint: rgba(255, 255, 255, 0.3);
  --line: rgba(255, 255, 255, 0.14);
  --panel: rgba(0, 0, 0, 0.55);
  --panel-solid: #0b0d16;
  --aqua: #35e0ff;
  --blue: #2f45ff;
  --accent-grad: linear-gradient(to top, #2f45ff, #35e0ff);
  --accent-grad-h: linear-gradient(to right, #2f45ff, #35e0ff);
  --yellow: rgb(255, 221, 28);
  --green: rgb(0, 204, 68);
  --crimson: crimson;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
}
html {
  background: var(--bg);
  font-family: "Montserrat", Helvetica, sans-serif;
  font-weight: 400;
}

h1,
h2,
h3,
.disp {
  font-family: "Work Sans", Helvetica, sans-serif;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* Fullscreen YouTube background — covered, dimmed, non-interactive. */
#yt-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: #000;
  display: none;
}
#yt-bg.visible {
  display: block;
}
#yt-bg iframe,
#yt-bg #yt-player {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100vw, 177.78vh);
  height: max(100vh, 56.25vw);
  transform: translate(-50%, -50%);
  filter: brightness(var(--yt-dim, 0.5)) saturate(0.9);
  pointer-events: none;
}

/* ---------- screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: none;
  overflow: hidden;
}
.screen.active {
  display: block;
  animation: screenIn 0.45s var(--ease) both;
}
@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateX(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 30px 42px 20px;
}
.screen-header h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.back-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s var(--ease);
}
.back-btn:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateX(-3px);
}

/* ---------- home ---------- */
#screen-home {
  pointer-events: none;
}
.home-wrap {
  pointer-events: auto;
  position: absolute;
  left: max(7vw, 52px);
  top: 50%;
  transform: translateY(-50%);
  width: min(560px, 84vw);
}
.logo {
  font-size: clamp(56px, 8vw, 96px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.5);
  margin-bottom: 38px; /* equal breathing room above the menu */
}
.logo span {
  color: var(--aqua);
}
.tagline {
  color: var(--muted);
  margin: 14px 0 34px;
  font-size: 15px;
  font-weight: 500;
}
.home-menu {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.menu-row {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.45));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 24px;
  cursor: pointer;
  transition: all 0.35s var(--ease);
}
.menu-row:hover {
  transform: translateX(10px);
  border-color: rgba(53, 224, 255, 0.5);
  background: linear-gradient(to right, rgba(10, 16, 40, 0.8), rgba(0, 0, 0, 0.5));
}
.menu-row h2 {
  font-size: 28px;
  font-weight: 800;
}
.menu-row p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
  font-weight: 500;
}
.home-hint {
  margin-top: 30px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
}
#home-stats {
  margin-top: 26px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

/* generic buttons (pause / results) */
.big-btn {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 17px;
  font-weight: 700;
  padding: 15px 24px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: #041018;
  background: var(--aqua);
  transition: all 0.3s var(--ease);
}
.big-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.big-btn.alt {
  background: rgba(255, 255, 255, 0.92);
  color: #10121c;
}
.big-btn.ghost {
  background: var(--panel);
  border-color: var(--line);
  color: var(--muted);
}
.big-btn.ghost:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.4);
}

/* ---------- song select (osu-style: detail left, list right) ---------- */
#song-sort {
  margin-left: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  height: 42px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.3s var(--ease);
}
#song-sort:hover,
#song-sort:focus {
  outline: none;
  border-color: var(--aqua);
  color: var(--ink);
}
#song-search {
  width: min(340px, 34vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  height: 42px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.3s var(--ease);
}
#song-search:focus {
  outline: none;
  border-color: var(--aqua);
}
#song-search::placeholder {
  color: var(--faint);
}
/* Keep the header clear of the fixed account chip in the top-right. */


#select-body {
  display: flex;
  gap: 46px; /* clean air for the selected card's slide-out */
  padding: 6px 0 0 42px; /* list runs off the right edge, osu-style */
  height: calc(100vh - 104px);
}
#select-detail {
  flex: 0 0 clamp(300px, 34vw, 392px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(8px);
  padding: 32px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-self: flex-start;
  max-height: 100%;
  overflow-y: auto;
}
.det-head {
  display: flex;
  gap: 18px;
  align-items: center;
}
#det-art {
  position: relative;
  flex: 0 0 116px;
  width: 116px;
  height: 116px; /* square — album covers stay album-shaped */
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}
.det-head-text {
  min-width: 0;
}
.eq {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
body[data-dj="playing"] .eq {
  opacity: 1;
}
.eq i {
  width: 4px;
  background: var(--aqua);
  border-radius: 2px;
  animation: eqBounce 0.9s ease-in-out infinite;
}
.eq i:nth-child(1) { height: 40%; animation-delay: 0s; }
.eq i:nth-child(2) { height: 90%; animation-delay: 0.18s; }
.eq i:nth-child(3) { height: 60%; animation-delay: 0.36s; }
.eq i:nth-child(4) { height: 80%; animation-delay: 0.54s; }
@keyframes eqBounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}
#det-title {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.12;
}
#det-artist {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  margin-top: 6px;
}
#det-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.det-stat {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 14px;
}
.det-stat span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--faint);
}
.det-stat b {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 20px;
  font-weight: 800;
}
.det-diff-d-easy { color: var(--green); }
.det-diff-d-normal { color: var(--aqua); }
.det-diff-d-hard { color: var(--yellow); }
.det-diff-d-extreme { color: var(--crimson); }
.det-diff-d-mystery { color: #9a6bff; }
#det-best {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
#det-best span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--faint);
}
#det-best b {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--yellow);
}
.det-lb-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--faint);
}
#det-lb-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lb-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
}
.lb-n {
  color: var(--faint);
  font-weight: 600;
  width: 26px;
}
.lb-rank {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 800;
  width: 26px;
}
.lb-score {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 700;
  flex: 1;
}
.lb-acc {
  color: var(--muted);
  font-size: 12px;
}
.lb-empty {
  color: var(--faint);
  font-size: 13px;
  padding: 6px 2px;
}
#det-play {
  width: 100%;
  font-size: 20px;
  padding: 16px;
}
.det-charter {
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}

#song-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 7px;
  /* A scroll container must clip, so give the cards a wide interior margin
     (offset back visually) — arc/slide transforms never reach the clip edge. */
  padding: 18px 0 34px 46px;
  margin-left: 0;
  scrollbar-width: none; /* the card fade replaces the scrollbar */
  mask-image: linear-gradient(to bottom, transparent, #000 5%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 5%, #000 94%, transparent);
}
#song-list::-webkit-scrollbar {
  display: none;
}
/* osu!mania-style skewed song cards, running off the right screen edge */
.song-row {
  --accent: var(--card-accent, var(--aqua));
  position: relative;
  flex-shrink: 0; /* never crush the third meta line */
  cursor: pointer;
  /* --arc: carousel curvature offset, keyed to the selected card */
  transform: translateX(var(--arc, 0px));
  opacity: 0.82; /* let the world & preview breathe through */
  border-radius: 10px 0 0 10px;
  border: 1px solid var(--line);
  border-right: none;
  margin-left: 28px; /* unselected cards sit inset from the container line */
  margin-right: -80px; /* hard bleed — right edge always past the screen */
  transition: all 0.3s var(--ease);
  overflow: hidden;
}
.song-row::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: background 0.3s var(--ease);
}
.song-row.selected::before {
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--accent) 26%, transparent),
    transparent 62%
  );
}
.song-row::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}
.song-row:hover {
  margin-left: 16px;
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 20%, transparent);
  opacity: 0.95;
}
.song-row.selected {
  /* flush with the container line — the leftmost card, nothing escapes */
  margin-left: 0;
  border-color: var(--accent);
  box-shadow: 0 6px 30px color-mix(in srgb, var(--accent) 30%, transparent);
  opacity: 1;
}
.song-row.d-easy { --card-accent: var(--green); }
.song-row.d-normal { --card-accent: var(--aqua); }
.song-row.d-hard { --card-accent: var(--yellow); }
.song-row.d-extreme { --card-accent: var(--crimson); }
.song-row.d-mystery { --card-accent: #9a6bff; }
.song-row-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px 118px 24px 20px; /* right side clears the off-screen bleed */
  min-height: 118px;
}
.song-row-diffblock {
  flex: 0 0 auto;
  background: var(--accent);
  color: #04060f;
  border-radius: 11px;
  width: 74px;
  height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: "Work Sans", Helvetica, sans-serif;
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
}
.song-row-diffblock b {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}
.song-row-diffblock span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.7;
  margin-top: 2px;
}
.song-row-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.song-row-title {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 800;
  font-size: 24px;
  text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-row-artist {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}
.song-row-meta {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.58);
  font-weight: 500;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.song-row-meta i {
  font-style: normal;
  white-space: nowrap;
}
.song-row-side {
  /* Pinned to the SCREEN edge: the card's arc shift is canceled by the
     same --arc variable, so every rank sits at a constant distance. */
  position: absolute;
  top: 50%;
  right: calc(108px + var(--arc, 0px));
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 88px;
}
.song-row-score {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.song-row-acc {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.song-row-best {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 800;
  font-size: 44px;
  line-height: 1;
  text-align: center;
  text-shadow: 3px 3px 3px rgba(0, 0, 0, 0.6);
}
.tag-wip {
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  color: var(--green);
  margin-left: 8px;
}
.tag-yt {
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  color: #ff5b5b;
  margin-left: 8px;
}
.song-divider {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--faint);
  padding: 14px 4px 4px;
}

/* Ambient floating particles + difficulty tint on song select */
#select-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: background 0.6s var(--ease);
}
.bg-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-particles i {
  position: absolute;
  bottom: -3vh;
  border-radius: 50%;
  background: rgba(120, 210, 255, 0.35);
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0% { transform: translateY(0); opacity: 0; }
  12% { opacity: 0.6; }
  85% { opacity: 0.25; }
  100% { transform: translateY(-108vh); opacity: 0; }
}
.bg-particles i:nth-child(1) { left: 4%; width: 5px; height: 5px; animation-duration: 17s; animation-delay: 0s; }
.bg-particles i:nth-child(2) { left: 12%; width: 3px; height: 3px; animation-duration: 23s; animation-delay: 4s; }
.bg-particles i:nth-child(3) { left: 21%; width: 6px; height: 6px; animation-duration: 14s; animation-delay: 8s; }
.bg-particles i:nth-child(4) { left: 30%; width: 3px; height: 3px; animation-duration: 26s; animation-delay: 2s; }
.bg-particles i:nth-child(5) { left: 38%; width: 4px; height: 4px; animation-duration: 19s; animation-delay: 11s; }
.bg-particles i:nth-child(6) { left: 47%; width: 3px; height: 3px; animation-duration: 24s; animation-delay: 6s; background: rgba(255,255,255,0.3); }
.bg-particles i:nth-child(7) { left: 55%; width: 5px; height: 5px; animation-duration: 16s; animation-delay: 13s; }
.bg-particles i:nth-child(8) { left: 63%; width: 4px; height: 4px; animation-duration: 21s; animation-delay: 1s; }
.bg-particles i:nth-child(9) { left: 70%; width: 3px; height: 3px; animation-duration: 27s; animation-delay: 9s; background: rgba(255,255,255,0.28); }
.bg-particles i:nth-child(10) { left: 77%; width: 6px; height: 6px; animation-duration: 15s; animation-delay: 5s; }
.bg-particles i:nth-child(11) { left: 84%; width: 3px; height: 3px; animation-duration: 22s; animation-delay: 12s; }
.bg-particles i:nth-child(12) { left: 90%; width: 4px; height: 4px; animation-duration: 18s; animation-delay: 3s; }
.bg-particles i:nth-child(13) { left: 95%; width: 3px; height: 3px; animation-duration: 25s; animation-delay: 7s; background: rgba(255,255,255,0.3); }
.bg-particles i:nth-child(14) { left: 8%; width: 4px; height: 4px; animation-duration: 20s; animation-delay: 15s; }
.song-row-best[data-rank="SS"], .lb-rank[data-rank="SS"] { color: var(--aqua); }
.song-row-best[data-rank="S"], .lb-rank[data-rank="S"] { color: var(--yellow); }
.song-row-best[data-rank="A"], .lb-rank[data-rank="A"] { color: var(--green); }
.song-row-best[data-rank="B"], .lb-rank[data-rank="B"] { color: var(--aqua); }
.song-row-best[data-rank="C"], .lb-rank[data-rank="C"] { color: #ff9838; }
.song-row-best[data-rank="D"], .lb-rank[data-rank="D"] { color: var(--crimson); }

/* ---------- settings ---------- */
.settings-body {
  max-width: 580px;
  margin: 22px auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 36px;
  backdrop-filter: blur(6px);
}
.setting label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.setting input[type="range"] {
  width: 100%;
  accent-color: var(--aqua);
}
.setting-hint {
  font-size: 12px;
  color: var(--faint);
  margin-top: 6px;
}
#keybind-row {
  display: flex;
  gap: 12px;
}
.keybind-btn {
  width: 62px;
  height: 62px;
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: all 0.3s var(--ease);
}
.keybind-btn:hover,
.keybind-btn.listening {
  border-color: var(--aqua);
  transform: translateY(-2px);
}
.check-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  cursor: pointer;
}
.check-label input {
  accent-color: var(--aqua);
  width: 16px;
  height: 16px;
}
#lane-color-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
#lane-color-row input[type="color"] {
  width: 52px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 3px;
  cursor: pointer;
  transition: border-color 0.25s var(--ease);
}
#lane-color-row input[type="color"]:hover {
  border-color: var(--aqua);
}
#lane-color-row .back-btn {
  margin-left: 6px;
  font-size: 12px;
  padding: 8px 14px;
}

/* ---------- game HUD ---------- */
#screen-game {
  pointer-events: none;
}
#hud {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
#hud.visible {
  opacity: 1;
}
#hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}
#hud-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
}
#hud-progress-fill {
  height: 100%;
  width: 0;
  background: var(--aqua);
  transition: width 0.2s linear;
}
#hud-topline {
  display: flex;
  align-items: flex-start;
  padding: 20px 32px;
  gap: 22px;
}
#hud-song {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 10px;
}
#hud-scorewrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-right: 64px; /* clear the rank bar */
}
#hud-score {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 58px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.5);
}
#hud-acc {
  font-size: 24px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 4px;
}
#hud-rank {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  margin-top: 12px;
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.5);
}

/* Original-style right-side rank bar */
#rankbar {
  position: absolute;
  right: 20px;
  top: 11vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#rankbar-outer {
  width: 16px;
  height: 62vh;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.45);
}
#rankbar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, #2f45ff, #35e0ff);
  transition: height 0.5s var(--ease);
}
#quit-countdown {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translateX(-50%);
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--crimson);
  text-shadow: 3px 3px 2px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.15s;
}
#quit-countdown.visible {
  opacity: 1;
}
#skip-hint {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 22px;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
#skip-hint.visible {
  opacity: 1;
  animation: skipPulse 1.6s ease-in-out infinite;
}
@keyframes skipPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.045); }
}
#hud-milestone {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translateX(-50%);
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 46px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--yellow);
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
}
#hud-milestone.show {
  animation: milestonePop 1.4s var(--ease) forwards;
}
@keyframes milestonePop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.6); }
  12% { opacity: 1; transform: translateX(-50%) scale(1.15); }
  24% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(0.96); }
}
#hud-rank[data-rank="SS"],
#res-rank[data-rank="SS"] {
  color: var(--aqua);
}
#hud-rank[data-rank="S"],
#res-rank[data-rank="S"] {
  color: var(--yellow);
}
#hud-rank[data-rank="A"],
#res-rank[data-rank="A"] {
  color: var(--green);
}
#hud-rank[data-rank="B"],
#res-rank[data-rank="B"] {
  color: var(--aqua);
}
#hud-rank[data-rank="C"],
#res-rank[data-rank="C"] {
  color: #ff9838;
}
#hud-rank[data-rank="D"],
#res-rank[data-rank="D"] {
  color: var(--crimson);
}

#hud-centerstack {
  position: absolute;
  left: 50%;
  top: 6%;
  transform: translateX(-50%);
  text-align: center;
}
#hud-combo-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--muted);
  opacity: 0.25;
  transition: opacity 0.3s var(--ease);
}
#hud-combo {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 104px;
  font-weight: 800;
  line-height: 1.05;
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.5);
}
#hud-combo.big {
  color: var(--aqua);
}
#hud-combo.pop {
  animation: comboPop 0.18s var(--ease);
}
@keyframes comboPop {
  0% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}
#hud-judgment {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 2px;
  height: 54px;
  opacity: 0;
  text-shadow: 3px 3px 2px rgba(0, 0, 0, 0.6);
}
#hud-judgment.show {
  animation: judgePop 0.55s var(--ease) forwards;
}
@keyframes judgePop {
  0% {
    opacity: 1;
    transform: scale(1.3);
  }
  30% {
    transform: scale(1);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
}
/* Judgment colors — same palette as original JSBeats. */
.j-perfect {
  color: cyan;
}
.j-great {
  color: lime;
}
.j-good {
  color: goldenrod;
}
.j-miss {
  color: crimson;
}
#hud-quithint {
  position: absolute;
  bottom: 14px;
  right: 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--faint);
}

#pause-overlay {
  position: absolute;
  inset: 0;
  display: none;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  z-index: 5;
}
#pause-overlay.visible {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  animation: fadeIn 0.3s var(--ease) both;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.pause-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 280px;
  text-align: center;
}
.pause-box h2 {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 4px;
}
#pause-song {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

/* ---------- results ---------- */
.results-wrap {
  position: relative;
  max-width: 700px;
  margin: 7vh auto 0;
  padding: 36px 42px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(8px);
  text-align: center;
  overflow: hidden;
}
.results-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--res-art, none) center / cover no-repeat;
  opacity: 0.14;
  filter: blur(6px) saturate(1.2);
  pointer-events: none;
}
.results-wrap > * {
  position: relative;
}
.results-wrap h2 {
  font-size: 26px;
  font-weight: 800;
}
#res-newbest {
  color: var(--yellow);
  font-weight: 700;
  margin-top: 8px;
  font-size: 14px;
}
.results-grid {
  display: flex;
  align-items: center;
  gap: 40px;
  margin: 24px 0;
}
.res-rank-box {
  flex: 0 0 190px;
}
#res-rank {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 128px;
  font-weight: 800;
  text-shadow: 6px 6px 4px rgba(0, 0, 0, 0.5);
  animation: rankIn 0.7s var(--ease) both;
}
@keyframes rankIn {
  from {
    opacity: 0;
    transform: scale(1.8);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.res-stats {
  flex: 1;
  text-align: left;
}
.res-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.res-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}
.res-row b {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 800;
}
#res-art {
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  background: var(--panel-solid);
}
#res-clear {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--muted);
  margin-bottom: 6px;
}
#res-fc {
  display: none;
  color: var(--yellow);
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 3px;
  margin-top: 10px;
  animation: fcPulse 1.2s ease-in-out infinite;
}
@keyframes fcPulse {
  0%, 100% { transform: scale(1); text-shadow: 0 0 10px rgba(255, 221, 28, 0.4); }
  50% { transform: scale(1.06); text-shadow: 0 0 24px rgba(255, 221, 28, 0.8); }
}
.res-place {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--aqua);
  letter-spacing: 2px;
  margin-top: 4px;
}
.res-bigscore {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 52px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 10px;
  text-shadow: 4px 4px 3px rgba(0, 0, 0, 0.5);
}
.res-judges {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
}
.rjbar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
}
.rjbar span {
  width: 72px;
  letter-spacing: 1px;
}
.rjbar-track {
  flex: 1;
  height: 9px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.rjbar-fill {
  height: 100%;
  width: 0;
  border-radius: 5px;
  background: currentColor;
  transition: width 0.9s var(--ease) 0.25s;
}
.rjbar b {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  width: 44px;
  text-align: right;
}
.results-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.results-buttons .big-btn {
  width: 190px;
}

/* ---------- editor ---------- */
#screen-editor {
  background: #07080f;
}
#screen-editor.yt {
  background: rgba(7, 8, 15, 0.55); /* let the video ghost through */
}
#screen-editor.yt #editor-panel {
  background: rgba(11, 13, 22, 0.9);
}
#ed-yt-row input {
  flex: 1;
}
#editor-layout {
  display: flex;
  width: 100%;
  height: 100%;
}
#editor-canvas-holder {
  flex: 1;
  position: relative;
  overflow: hidden;
}
#editor-canvas {
  display: block;
  cursor: crosshair;
}
#editor-panel {
  flex: 0 0 300px;
  background: var(--panel-solid);
  border-left: 1px solid var(--line);
  padding: 20px 18px 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#editor-panel h2 {
  font-size: 22px;
  font-weight: 800;
}
.ed-status {
  font-size: 12px;
  color: var(--yellow);
  min-height: 30px;
  line-height: 1.4;
  font-weight: 500;
}
.ed-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 14px;
}
#editor-panel select,
#editor-panel input[type="text"],
#editor-panel input[type="number"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.3s var(--ease);
}
#editor-panel select:focus,
#editor-panel input:focus {
  outline: none;
  border-color: var(--aqua);
}
#editor-panel input[type="range"] {
  width: 100%;
  accent-color: var(--aqua);
}
.ed-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ed-field {
  flex: 1;
}
.ed-field span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.ed-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.25s var(--ease);
  flex: 1;
}
.ed-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}
.ed-btn.sm {
  flex: 0 0 auto;
  padding: 9px 9px;
  font-size: 12px;
}
.ed-btn.primary {
  background: var(--aqua);
  color: #041018;
  font-weight: 700;
  border: none;
}
.ed-btn.primary:hover {
  filter: brightness(1.1);
}
.ed-btn.rec {
  flex: 0 0 auto;
  color: #ff7788;
  border-color: rgba(255, 100, 120, 0.4);
}
.ed-btn.rec.rec-on {
  background: #c22b40;
  color: #fff;
  border-color: transparent;
}
.ed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ed-menu-btn {
  background: rgba(255, 255, 255, 0.92);
  color: #10121c;
  border: none;
  border-radius: 999px;
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px;
  transition: all 0.25s var(--ease);
}
.ed-menu-btn:hover {
  transform: translateX(-3px);
  background: #fff;
}
.ed-btn.danger:hover {
  border-color: var(--crimson);
  color: var(--crimson);
}
.ed-btn.ghost {
  background: none;
  margin-top: 16px;
  color: var(--muted);
}
.ed-btn.ghost:hover {
  color: var(--ink);
}
.ed-file-label,
.ed-import-label {
  position: relative;
  overflow: hidden;
  display: block;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.ed-file-label:hover,
.ed-import-label:hover {
  border-color: var(--aqua);
  color: var(--ink);
}
.ed-file-label input,
.ed-import-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.ed-import-label {
  border-style: solid;
  flex: 1;
}
.check-label.sm {
  font-size: 12px;
  color: var(--muted);
}
#ed-drafts {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ed-draft-row {
  display: flex;
  gap: 5px;
}
.ed-draft-row button:first-child {
  flex: 1;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.25s var(--ease);
}
.ed-draft-row button:first-child:hover {
  border-color: var(--aqua);
}
.ed-del {
  background: none;
  border: 1px solid var(--line);
  color: var(--crimson);
  border-radius: 8px;
  width: 30px;
}
.ed-muted {
  color: var(--faint);
  font-size: 12px;
}
.ed-help {
  margin-top: 14px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--faint);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.ed-help b {
  color: var(--muted);
}

/* ---------- HUD judgment tally ---------- */
#hud-tally {
  position: absolute;
  left: 22px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tally {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 15px;
  font-weight: 700;
}
.tally span {
  width: 82px;
  letter-spacing: 1px;
  opacity: 0.85;
}
.tally b {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.6);
}

/* ---------- menu DJ widget ---------- */
#dj-widget {
  position: fixed;
  right: 28px;
  bottom: 26px;
  z-index: 10;
  display: none;
  align-items: center;
  flex-wrap: wrap; /* progress bar wraps to its own full-width line */
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 16px 10px 12px;
  backdrop-filter: blur(8px);
  transition: all 0.3s var(--ease);
}
body[data-screen="home"] #dj-widget,
body[data-screen="select"] #dj-widget,
body[data-screen="settings"] #dj-widget,
body[data-screen="results"] #dj-widget {
  display: flex;
}
#dj-art {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: var(--panel-solid);
  animation: djSpin 5s linear infinite;
  animation-play-state: paused;
}
#dj-art.spinning {
  animation-play-state: running;
}
@keyframes djSpin {
  to { transform: rotate(360deg); }
}
#dj-progress {
  flex: 1 0 100%; /* own row, aligned with the widget's content */
  height: 5px;
  margin-top: 2px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  cursor: pointer;
}
#dj-progress:hover {
  height: 7px;
  background: rgba(255, 255, 255, 0.2);
}
#dj-progress-fill {
  height: 100%;
  width: 0;
  background: var(--aqua);
}
#dj-text {
  display: flex;
  flex-direction: column;
  max-width: 240px;
}
#dj-title {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#dj-time {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
#dj-controls {
  display: flex;
  gap: 6px;
}
#dj-controls button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 12px;
  transition: all 0.25s var(--ease);
}
#dj-controls button:hover {
  border-color: var(--aqua);
  color: var(--aqua);
}
#dj-play {
  width: 40px !important;
  height: 40px !important;
  font-size: 14px !important;
}
#dj-select {
  max-width: 120px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
#dj-select:focus {
  outline: none;
  border-color: var(--aqua);
}

/* ---------- welcome overlay ---------- */
#welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 3, 10, 0.7);
  backdrop-filter: blur(10px);
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
#welcome-overlay.dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.welcome-box {
  width: min(520px, 90vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px 44px;
  text-align: center;
  animation: welcomeIn 0.6s var(--ease) both;
}
@keyframes welcomeIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.welcome-box h1 {
  font-size: 30px;
  font-weight: 800;
}
.welcome-box h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--aqua);
  text-transform: uppercase;
  margin: 22px 0 12px;
}
.welcome-box ul {
  list-style: none;
  margin-bottom: 28px;
}
.welcome-box li {
  padding: 7px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.welcome-box li:last-child {
  border-bottom: none;
}
.welcome-box .big-btn {
  width: 100%;
  font-size: 18px;
}

/* ---------- account + sign-in ---------- */
/* The control itself is the shared .ez-auth-* button from /login/button.css,
   so it looks identical everywhere on the site. Only placement lives here. */
#account-chip {
  position: fixed;
  top: 39px; /* floating (home/settings/results) */
  right: 42px;
  z-index: 20;
  display: none;
}
/* Docked in the select header: a plain flex item — alignment and overlap
   are the row's problem, solved once by flexbox. */
.screen-header #account-chip {
  position: static;
  margin-left: 14px;
}
body[data-screen="home"] #account-chip,
body[data-screen="select"] #account-chip,
body[data-screen="settings"] #account-chip,
body[data-screen="results"] #account-chip {
  display: flex;
}
/* Round the shared button to match JSBeats 2's pill-shaped header controls.
   Its own margin (4px 0) pushed it off the search/sort centerline — zero it
   and use the exact pill metrics (42px tall, 0 20px padding, like search). */
#account-chip .ez-auth-btn,
#account-chip .ez-auth-chip {
  border-radius: 999px;
  height: 42px;
  margin: 0;
  padding: 0 20px;
  box-sizing: border-box;
  backdrop-filter: blur(6px);
}
/* Sign-in UI lives on the eddyzow.net portal (/login) — nothing local. */

/* leaderboard tabs + name column */
.det-lb-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.lb-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  transition: all 0.25s var(--ease);
}
.lb-tab.active {
  background: var(--aqua);
  border-color: transparent;
  color: #041018;
}
.lb-name {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-row.you {
  border: 1px solid rgba(53, 224, 255, 0.5);
}

/* ---------- multiplayer mode ---------- */
#multi-body {
  max-width: 980px;
  margin: 26px auto 0;
  padding: 0 42px;
}
#multi-pre {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.multi-card {
  flex: 1 1 300px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 30px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  backdrop-filter: blur(6px);
}
.multi-card:hover {
  border-color: var(--aqua);
  transform: translateY(-3px);
}
.multi-card.gate {
  cursor: default;
  flex-basis: 100%;
  text-align: center;
}
.multi-card.gate .big-btn {
  margin-top: 14px;
}
/* The shared eddyzow.net button, centered on the gate. */
.multi-card.gate #multi-login-slot {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}
.multi-card.gate #multi-login-slot .ez-auth-btn {
  border-radius: 999px;
  padding: 14px 26px;
}
.multi-card h2 {
  font-size: 24px;
  font-weight: 800;
}
.multi-card p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
  font-weight: 500;
}
.multi-join-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.multi-join-row input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 10px 14px;
  font-family: ui-monospace, "SF Mono", Menlo, "Cascadia Code", Consolas, monospace;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 6px;
  text-transform: uppercase;
  text-align: center;
}
.multi-join-row input:focus {
  outline: none;
  border-color: var(--aqua);
}
#multi-error {
  flex-basis: 100%;
  color: var(--crimson);
  font-size: 13px;
  font-weight: 600;
  min-height: 18px;
}
#multi-songpick {
  flex-basis: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 26px;
  backdrop-filter: blur(6px);
}
#multi-songpick h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--muted);
  margin-bottom: 12px;
}
#multi-song-list {
  max-height: 46vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.multi-song-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-weight: 700;
  font-size: 15px;
}
.multi-song-row:hover {
  border-color: var(--aqua);
  transform: translateX(4px);
}
.multi-song-row i {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
#multi-lobby {
  display: flex;
  gap: 22px;
  align-items: stretch;
}
.multi-lobby-left {
  flex: 0 0 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(6px);
}
#multi-chart-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
#multi-code-big {
  /* Monospace with a slashed/dotted zero — a lobby code must never leave
     you guessing 0 vs O. */
  font-family: ui-monospace, "SF Mono", Menlo, "Cascadia Code", Consolas, monospace;
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 16px;
  text-align: center;
  color: var(--aqua);
  text-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
}
.multi-hint {
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
}
#multi-players {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.multi-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.multi-actions .big-btn {
  flex: 1;
}
#multi-chat {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(6px);
  min-height: 380px;
}
#multi-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.chat-msg b {
  color: var(--aqua);
  font-weight: 700;
}
.chat-msg.system {
  color: var(--faint);
  font-size: 12.5px;
  font-style: italic;
}
#multi-chat-form {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
}
#multi-chat-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14px;
}
#multi-chat-input:focus {
  outline: none;
  border-color: var(--aqua);
}
.live-player {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}
.live-player b {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--faint);
}
.live-player.ready b {
  color: var(--green);
}
.live-player.you {
  border-color: rgba(53, 224, 255, 0.5);
}
#hud-live {
  position: absolute;
  left: 24px;
  top: 110px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 200px;
}
.hud-live-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}
.hud-live-row.you {
  border-color: rgba(53, 224, 255, 0.55);
}
.hud-live-row b {
  font-family: "Work Sans", Helvetica, sans-serif;
  font-variant-numeric: tabular-nums;
}
#res-standings {
  margin: 6px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.res-standings-head {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--muted);
  margin-bottom: 4px;
}
.live-player.final b {
  font-size: 14px;
  color: var(--ink);
}

/* scrollbars */
::-webkit-scrollbar {
  width: 9px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ---- offset tester ---- */
#det-offset {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 9px 0;
  border-radius: 10px;
  border: 1px solid rgba(233, 244, 255, 0.14);
  background: rgba(233, 244, 255, 0.05);
  color: rgba(233, 244, 255, 0.72);
  font: 600 11px/1 "Work Sans", sans-serif;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.35, 0, 0.1, 1);
}
#det-offset:hover {
  background: rgba(233, 244, 255, 0.1);
  color: #e9f4ff;
}
#offset-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(10px);
}
#offset-card {
  width: min(440px, 92vw);
  background: rgba(10, 16, 28, 0.94);
  border: 1px solid rgba(233, 244, 255, 0.12);
  border-radius: 18px;
  padding: 30px 34px;
  text-align: center;
  animation: offset-in 0.3s cubic-bezier(0.35, 0, 0.1, 1);
}
@keyframes offset-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
#offset-card h2 {
  font: 700 12px/1 "Work Sans", sans-serif;
  letter-spacing: 0.24em;
  color: rgba(233, 244, 255, 0.55);
  margin: 0 0 8px;
}
#offset-song {
  font: 600 14px "Work Sans", sans-serif;
  color: #e9f4ff;
  margin: 0 0 16px;
}
#offset-value {
  font: 700 52px/1 "Work Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  color: #e9f4ff;
  margin: 4px 0 20px;
}
#offset-value span {
  font-size: 18px;
  font-weight: 600;
  color: rgba(233, 244, 255, 0.5);
}
#offset-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
}
#offset-btns button {
  width: 66px;
  padding: 13px 0;
  border-radius: 12px;
  border: 1px solid rgba(233, 244, 255, 0.16);
  background: rgba(233, 244, 255, 0.06);
  color: #e9f4ff;
  font: 700 15px "Work Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.35, 0, 0.1, 1);
}
#offset-btns button:hover {
  background: rgba(54, 226, 255, 0.14);
  border-color: rgba(54, 226, 255, 0.4);
}
.offset-hint {
  font: 500 12px/1.65 "Work Sans", sans-serif;
  color: rgba(233, 244, 255, 0.6);
  margin: 0 0 20px;
}
.offset-hint span {
  color: rgba(233, 244, 255, 0.35);
}
#offset-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
#offset-reset {
  padding: 12px 24px;
  border-radius: 12px;
  border: 1px solid rgba(233, 244, 255, 0.16);
  background: transparent;
  color: rgba(233, 244, 255, 0.7);
  font: 600 12px "Work Sans", sans-serif;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.35, 0, 0.1, 1);
}
#offset-reset:hover {
  border-color: rgba(233, 244, 255, 0.35);
  color: #e9f4ff;
}
#offset-done {
  min-width: 140px;
}

.res-standings-wait {
  font: 500 12px "Work Sans", sans-serif;
  color: rgba(233, 244, 255, 0.5);
  padding: 8px 0;
}
.live-player.dq b {
  color: #ff7a90;
  letter-spacing: 0.08em;
}

#offset-wave {
  display: block;
  width: 100%;
  height: 65px;
  margin: 4px 0 10px;
  border-radius: 10px;
  background: rgba(233, 244, 255, 0.04);
  border: 1px solid rgba(233, 244, 255, 0.08);
}

/* World dims and stills while the offset tester is open. */
body.offset-testing #gl {
  opacity: 0.25;
  transition: opacity 0.35s cubic-bezier(0.35, 0, 0.1, 1);
}

/* DJ volume bar */
#dj-vol {
  -webkit-appearance: none;
  appearance: none;
  width: 74px;
  height: 4px;
  border-radius: 2px;
  background: rgba(233, 244, 255, 0.18);
  outline: none;
  cursor: pointer;
}
#dj-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--aqua);
  border: none;
}
#dj-vol::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--aqua);
  border: none;
}

/* ================= RESPONSIVE / MOBILE ================================= */

/* Rotate gate: portrait handhelds (phones + tablets) turn landscape. */
#rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #05060c;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.rotate-box h2 {
  font: 800 22px "Work Sans", sans-serif;
  letter-spacing: 0.18em;
  margin: 22px 0 8px;
}
.rotate-box p {
  font: 500 14px "Work Sans", sans-serif;
  color: var(--muted);
}
.rotate-phone {
  width: 46px;
  height: 82px;
  margin: 0 auto;
  border: 3px solid var(--aqua);
  border-radius: 10px;
  animation: rotate-nudge 1.6s cubic-bezier(0.35, 0, 0.1, 1) infinite;
}
@keyframes rotate-nudge {
  0%, 20% { transform: rotate(0); }
  55%, 80% { transform: rotate(-90deg); }
  100% { transform: rotate(-90deg); }
}
@media (orientation: portrait) and (max-width: 920px) {
  #rotate-overlay { display: flex; }
}

/* ---- Mid screens (small laptops, iPads landscape) ---- */
@media (max-width: 1180px) {
  .screen-header { padding: 22px 28px 16px; }
  #account-chip { right: 28px; top: 31px; }
  #select-body { padding-left: 28px; gap: 28px; height: calc(100vh - 88px); }
  #select-detail { flex-basis: clamp(270px, 32vw, 340px); padding: 22px 22px 20px; gap: 14px; }
  .song-row-inner { padding: 16px 100px 16px 16px; min-height: 96px; gap: 16px; }
  #dj-widget { right: 18px; bottom: 16px; }
}

/* ---- Small screens: landscape phones + very short windows ---- */
@media (max-width: 900px), (max-height: 520px) {
  /* header compresses to one slim row */
  .screen-header { padding: 10px 14px 6px; gap: 10px; }
  .screen-header h2 { font-size: 15px; letter-spacing: 0.12em; }
  #song-search { width: min(200px, 30vw); height: 32px; padding: 0 12px; font-size: 12px; }
  #song-sort { height: 32px; padding: 0 10px; font-size: 11px; }
  .back-btn { padding: 6px 10px; font-size: 11px; }
  #account-chip { top: 10px; right: 12px; }
  #account-chip .ez-auth-btn,
  #account-chip .ez-auth-chip { height: 32px; padding: 0 12px; font-size: 0.72rem; gap: 6px; }

  /* home */
  .logo { font-size: clamp(34px, 7vw, 52px); margin-bottom: 16px; }
  .home-menu { gap: 8px; }
  .menu-row { padding: 10px 18px; }
  .menu-row h2 { font-size: 17px; }
  .menu-row p { font-size: 11px; }
  #home-stats { font-size: 10px; }

  /* song select */
  #select-body { padding: 4px 0 0 14px; gap: 12px; height: calc(100vh - 50px); }
  #select-detail {
    flex-basis: clamp(210px, 34vw, 260px);
    padding: 12px 12px 12px;
    gap: 8px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  .det-head { gap: 10px; }
  #det-art { flex-basis: 56px; width: 56px; height: 56px; border-radius: 8px; }
  #det-title { font-size: 17px; }
  #det-artist { font-size: 11px; }
  #det-stats { gap: 6px; }
  .det-stat span { font-size: 8px; }
  .det-stat b { font-size: 13px; }
  #det-best { padding: 8px 10px; }
  #det-offset { padding: 6px 0; font-size: 10px; margin-top: 6px; }
  #det-lb-list { max-height: 90px; overflow-y: auto; }
  #det-play { padding: 12px 0; font-size: 14px; }
  .det-charter { display: none; }
  .song-row-inner { padding: 8px 84px 8px 10px; min-height: 56px; gap: 10px; }
  .song-row-title { font-size: 14px; }
  .song-row-meta { font-size: 9px; gap: 8px; }
  .song-row-sub { font-size: 10px; }
  .song-row-diffblock { transform: scale(0.8); }
  .song-row-side { right: calc(56px + var(--arc, 0px)); transform: scale(0.8); }
  .song-row { margin-left: 18px; }
  .song-row.selected { margin-left: 0; }

  /* gameplay HUD */
  #hud-score { font-size: 30px; }
  #hud-scorewrap { margin-right: 34px; }
  #hud-combo { font-size: 52px; }
  #hud-combo-label { font-size: 9px; letter-spacing: 3px; }
  #hud-judgment { font-size: 22px; }
  #rankbar { right: 8px; top: 9vh; }
  #rankbar-outer { width: 10px; height: 56vh; }
  #hud-tally { font-size: 10px; }
  #skip-hint { font-size: 11px; }

  /* results */
  #screen-results { overflow-y: auto; }
  #res-art { width: 56px; height: 56px; margin-bottom: 8px; }
  .res-bigscore { font-size: 34px; }
  #res-title { font-size: 20px; }
  .res-row { font-size: 11px; }
  .res-row b { font-size: 14px; }

  /* settings + multiplayer scroll instead of clipping */
  .settings-body { overflow-y: auto; max-height: calc(100vh - 72px); padding-bottom: 40px; }
  #multi-body { padding: 0 14px; margin-top: 10px; max-height: calc(100vh - 60px); overflow-y: auto; }
  .multi-card { padding: 14px; }
  .multi-card h2 { font-size: 15px; }
  #multi-code-big { font-size: 38px; letter-spacing: 10px; }
  #multi-chat-log { max-height: 26vh; }

  /* DJ widget slims down; track picker is a desktop luxury */
  #dj-widget { right: 8px; bottom: 8px; gap: 8px; padding: 8px 10px; }
  #dj-select { display: none; }
  #dj-vol { width: 48px; }
  #dj-art { width: 30px; height: 30px; }
  #dj-title { max-width: 120px; font-size: 11px; }
  #dj-time { font-size: 9px; }

  /* editor is a desktop tool — usable, but give the panel scroll */
  #ed-panel { overflow-y: auto; }
}

/* ---- Touch lane guide (touch devices, during play only) ---- */
#touch-guide { display: none; }
@media (pointer: coarse) {
  body[data-screen="game"] #touch-guide {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
  }
  #touch-guide i {
    flex: 1;
    border-right: 1px dashed rgba(233, 244, 255, 0.14);
  }
  #touch-guide i:last-child { border-right: none; }
}

/* ---- Phone tier, round 2: declutter ---- */
@media (max-width: 900px), (max-height: 520px) {
  /* header: drop the redundant title; compact chip so nothing overlaps */
  #screen-select .screen-header h2 { display: none; }
  #song-search { width: min(150px, 24vw); }
  /* signed-out chip: icon only (font-size 0 hides the text node; the SVG
     icon has its own size and is unaffected) */
  #account-chip .ez-auth-btn {
    width: 40px;
    padding: 0;
    justify-content: center;
    font-size: 0;
    gap: 0;
  }
  #account-chip .ez-auth-chip-name { max-width: 7ch; }

  /* detail pane: PLAY moves up under the title; leaderboards are a
     desktop luxury — the pane stays short */
  #select-detail > * { order: 0; }
  #select-detail .det-head { order: -3; }
  #select-detail #det-play { order: -2; margin: 0; }
  #det-lb { display: none; }
  #det-best span { font-size: 8px; }
  #det-best-val { font-size: 11px; }

}

/* The DJ collapses to its art disc on anything smaller than a laptop —
   tap the disc to expand, tap again to tuck it away. */
@media (max-width: 1180px), (max-height: 520px) {
  #dj-widget { padding: 5px; gap: 8px; border-radius: 999px; }
  #dj-widget #dj-text,
  #dj-widget #dj-controls,
  #dj-widget #dj-vol,
  #dj-widget #dj-progress { display: none; }
  #dj-art { cursor: pointer; }
  #dj-select { display: none; }
  body.dj-open #dj-widget {
    padding: 8px 12px;
    border-radius: 14px;
  }
  body.dj-open #dj-widget #dj-text,
  body.dj-open #dj-widget #dj-controls,
  body.dj-open #dj-widget #dj-vol { display: flex; }
  body.dj-open #dj-widget #dj-progress { display: block; }
}

/* ---- Mobile browser realities ---------------------------------------- */
/* 100vh on mobile includes the URL-bar band; dvh tracks the real visible
   viewport so nothing hides behind browser chrome. */
@supports (height: 100dvh) {
  #select-body { height: calc(100dvh - 104px); }
  @media (max-width: 1180px) {
    #select-body { height: calc(100dvh - 88px); }
  }
  @media (max-width: 900px), (max-height: 520px) {
    #select-body { height: calc(100dvh - 50px); }
    #select-detail { max-height: calc(100dvh - 56px); }
    .settings-body { max-height: calc(100dvh - 72px); }
    #multi-body { max-height: calc(100dvh - 60px); }
  }
}

/* With viewport-fit=cover the page reaches into the notch/home-bar zones —
   the 3D world SHOULD go edge to edge, but UI keeps clear of the hardware. */
@media (pointer: coarse) {
  .screen-header {
    padding-left: calc(14px + env(safe-area-inset-left, 0px));
    padding-right: calc(14px + env(safe-area-inset-right, 0px));
  }
  #select-body { padding-left: calc(14px + env(safe-area-inset-left, 0px)); }
  #dj-widget {
    right: calc(8px + env(safe-area-inset-right, 0px));
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  #rankbar { right: calc(8px + env(safe-area-inset-right, 0px)); }
  #hud-tally { margin-left: env(safe-area-inset-left, 0px); }
  #multi-body {
    padding-left: calc(14px + env(safe-area-inset-left, 0px));
    padding-right: calc(14px + env(safe-area-inset-right, 0px));
  }
}

/* Mobile tap-to-start gate (browsers require a gesture to unmute) */
#tap-start {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 16, 0.35);
}
#tap-start span {
  font: 800 26px "Work Sans", sans-serif;
  letter-spacing: 0.22em;
  color: #e9f4ff;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  animation: tap-pulse 1.2s cubic-bezier(0.35, 0, 0.1, 1) infinite alternate;
}
@keyframes tap-pulse {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

/* ---- Mobile app-surface behavior ---- */
html, body {
  touch-action: manipulation; /* no double-tap zoom */
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
@supports (height: 100dvh) {
  html, body { height: 100dvh; } /* nothing to scroll under the page */
}
input, textarea { -webkit-user-select: text; user-select: text; }
body[data-screen="game"] { touch-action: none; } /* lanes own every touch */

/* Gameplay chrome must never eat lane taps. */
#hud, #skip-hint, #rankbar, #hud-live, #touch-guide {
  pointer-events: none;
}
#hud #pause-overlay { pointer-events: auto; }

/* Mobile pause button (coarse pointers, during play) */
#mobile-pause {
  display: none;
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: calc(10px + env(safe-area-inset-left, 0px));
  z-index: 30;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(233, 244, 255, 0.25);
  background: rgba(10, 16, 28, 0.55);
  color: rgba(233, 244, 255, 0.8);
  font: 800 13px "Work Sans", sans-serif;
  letter-spacing: 1px;
}
@media (pointer: coarse) {
  body[data-screen="game"] #mobile-pause { display: block; }
}

/* Phone song select: OFFSET rides right under PLAY */
@media (max-width: 900px), (max-height: 520px) {
  #select-detail #det-offset { order: -1; margin: 0; }
}

/* ---- Very short screens (superwide phones): everything fits ---- */
@media (max-height: 440px) {
  .welcome-box {
    max-height: 92dvh;
    overflow-y: auto;
    padding: 16px 22px;
  }
  .welcome-box h1 { font-size: 20px; margin-bottom: 4px; }
  .welcome-box h2 { font-size: 10px; margin-bottom: 8px; }
  .welcome-box li { font-size: 11px; padding: 4px 0; }
  .welcome-box .big-btn { padding: 10px 0; margin-top: 8px; }
  .logo { font-size: clamp(24px, 5vh, 34px); margin-bottom: 8px; }
  .home-wrap { padding: 8px 0; }
  .home-menu { gap: 5px; }
  .menu-row { padding: 6px 16px; }
  .menu-row h2 { font-size: 14px; }
  .menu-row p { font-size: 9px; }
  #home-stats { margin-top: 6px; font-size: 9px; }
  /* song select pane: only the essentials */
  #det-stats { display: none; }
  #det-best { padding: 5px 8px; }
  #select-detail { gap: 6px; padding: 10px; }
}

/* Offset tester fits any screen; scrolls internally rather than clipping */
#offset-card { max-height: 92dvh; overflow-y: auto; }
@media (max-height: 520px) {
  #offset-card { padding: 12px 18px; width: min(400px, 94vw); }
  #offset-card h2 { font-size: 10px; margin-bottom: 2px; }
  #offset-song { font-size: 12px; margin-bottom: 6px; }
  #offset-value { font-size: 30px; margin: 2px 0 8px; }
  #offset-value span { font-size: 12px; }
  #offset-wave { height: 42px; margin: 2px 0 8px; }
  #offset-btns { margin-bottom: 10px; gap: 8px; }
  #offset-btns button { width: 52px; padding: 9px 0; font-size: 13px; }
  .offset-hint { font-size: 10px; line-height: 1.5; margin-bottom: 10px; }
  .offset-hint span { display: none; }
  #offset-reset { padding: 9px 16px; font-size: 10px; }
  #offset-done { min-width: 110px; padding: 10px 0; font-size: 13px; }
}

/* ---- No-scroll mobile layouts: results + settings fit the viewport ---- */
@media (max-width: 900px), (max-height: 520px) {
  #screen-results { overflow: hidden; display: none; }
  #screen-results.active { display: flex; align-items: center; }
  .results-wrap {
    margin: 0 auto;
    padding: 14px 20px;
    max-width: min(620px, 94vw);
    max-height: 94dvh;
    text-align: left;
  }
  #res-art {
    width: 40px;
    height: 40px;
    margin: 0;
    position: absolute;
    top: 14px;
    left: 20px;
  }
  #res-clear { display: none; }
  #res-title { font-size: 16px; margin: 0 0 2px 52px; min-height: 40px; display: flex; align-items: center; }
  #res-fc, #res-newbest { font-size: 10px; letter-spacing: 2px; margin: 2px 0; }
  .results-grid { display: flex; gap: 18px; align-items: center; margin: 6px 0 4px; }
  #res-rank { font-size: 54px; line-height: 1; }
  .res-place { font-size: 9px; }
  .res-bigscore { font-size: 26px; margin-bottom: 2px; }
  .res-row { font-size: 10px; padding: 2px 0; }
  .res-row b { font-size: 12px; }
  .res-judges { margin-top: 4px; }
  .rjbar { font-size: 9px; margin: 2px 0; }
  .rjbar span { width: 52px; }
  .rjbar b { font-size: 10px; }
  .rjbar-track { height: 5px; }
  #res-standings { font-size: 10px; }
  .results-buttons { margin-top: 8px; display: flex; gap: 10px; }
  .results-buttons .big-btn { flex: 1; padding: 9px 0; font-size: 12px; }

  /* settings: two columns, no scroll */
  .settings-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 22px;
    max-width: min(640px, 94vw);
    margin: 8px auto;
    padding: 12px 18px;
    align-items: center;
  }
  .setting { margin: 0; }
  .setting > span, .setting label { font-size: 9px; letter-spacing: 1px; }
  .settings-body input[type="range"] { width: 110px; }
  .keybind-btn { width: 44px; height: 44px; font-size: 16px; }
  .setting input[type="color"] { width: 38px; height: 28px; }
  .setting button:not(.keybind-btn) { padding: 6px 12px; font-size: 10px; }
}
