@import url("https://fonts.googleapis.com/css2?family=Black+Han+Sans&family=Noto+Sans+KR:wght@400;500;700;900&display=swap");

:root {
  color-scheme: dark;
  --ink: #07060d;
  --panel: rgba(15, 12, 27, 0.88);
  --panel-solid: #120f20;
  --line: rgba(231, 221, 255, 0.18);
  --text: #f8f4ff;
  --muted: #aaa2ba;
  --cyan: #5ff6ff;
  --violet: #aa72ff;
  --pink: #ff67bf;
  --gold: #ffd36e;
  --danger: #ff496c;
  --success: #70ffbc;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Noto Sans KR", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(120, 45, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 90% 0%, rgba(0, 236, 255, 0.1), transparent 24rem),
    linear-gradient(135deg, #07060d 0%, #0e0918 52%, #05050b 100%);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.global-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 4, 11, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 211, 110, 0.62);
  border-radius: 50% 50% 44% 44%;
  color: var(--gold);
  font-size: 22px;
  background: radial-gradient(circle at 50% 30%, #412f5d, #120d1b 70%);
  box-shadow: 0 0 28px rgba(170, 114, 255, 0.25);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(18px, 2.4vw, 27px);
  font-weight: 400;
  letter-spacing: 0.035em;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
}

.back-link {
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.05);
}

.back-link:hover {
  border-color: var(--violet);
  background: rgba(170, 114, 255, 0.13);
}

.stage-select {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(44px, 7vw, 86px) 0 80px;
}

.select-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.52fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: end;
  margin-bottom: 34px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.select-copy h1 {
  max-width: 730px;
  margin: 0;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(42px, 8vw, 92px);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.select-copy h1 em {
  display: block;
  color: transparent;
  font-size: 0.72em;
  font-style: normal;
  white-space: nowrap;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.8);
  text-shadow: 0 0 30px rgba(170, 114, 255, 0.35);
}

.select-description {
  margin: 0;
  color: #c6bed2;
  font-size: 15px;
  line-height: 1.9;
  text-wrap: pretty;
}

.career {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 1px;
  margin-bottom: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}

.career-item {
  padding: 15px 20px;
  background: rgba(15, 12, 27, 0.96);
}

.career-item span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.career-item strong {
  font-size: 18px;
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.stage-card {
  position: relative;
  display: grid;
  grid-template-columns: 165px minmax(0, 1fr);
  min-height: 198px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
  background: var(--panel-solid);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.stage-card:not(.is-locked):hover {
  z-index: 2;
  border-color: rgba(95, 246, 255, 0.7);
  transform: translateY(-4px);
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.42), 0 0 35px rgba(95, 246, 255, 0.09);
}

.stage-card.is-locked {
  color: #8e8798;
  cursor: not-allowed;
  filter: saturate(0.25);
}

.stage-card-image {
  position: relative;
  min-height: 100%;
  background-position: center;
  background-size: cover;
}

.stage-card-image::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent 55%, var(--panel-solid));
}

.stage-number {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  color: white;
  font-family: "Black Han Sans", sans-serif;
  font-size: 18px;
  background: rgba(8, 6, 16, 0.72);
  backdrop-filter: blur(9px);
}

.stage-card-copy {
  display: flex;
  min-width: 0;
  padding: 23px 22px 19px 8px;
  flex-direction: column;
}

.stage-card-copy small {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.stage-card-copy h2 {
  margin: 7px 0 3px;
  overflow: hidden;
  font-family: "Black Han Sans", sans-serif;
  font-size: 23px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-card-copy p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.stage-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 8px;
  margin-top: auto;
  padding-top: 13px;
}

.stage-target {
  color: #ddd5e8;
  font-size: 10px;
  font-weight: 700;
}

.stage-best {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.stage-lock {
  margin-top: auto;
  color: #b2aabd;
  font-size: 11px;
  font-weight: 900;
}

.play-screen {
  position: relative;
  display: none;
  min-height: calc(100vh - 76px);
  isolation: isolate;
}

.play-screen.is-visible {
  display: block;
}

.stage-backdrop {
  position: fixed;
  z-index: -3;
  inset: 76px 0 0;
  background-position: center;
  background-size: cover;
  filter: none;
  transform: none;
}

.play-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 15px clamp(18px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 4, 11, 0.76);
  backdrop-filter: none;
}

.song-meta {
  min-width: 0;
}

.song-meta small {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.17em;
}

.song-meta h2 {
  margin: 3px 0 0;
  overflow: hidden;
  font-size: clamp(15px, 2vw, 21px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-cluster {
  display: flex;
  gap: clamp(16px, 3vw, 42px);
  text-align: right;
}

.score-cluster span,
.health-label span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.score-cluster strong {
  display: block;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  font-size: 18px;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(390px, 1.25fr) minmax(210px, 0.72fr);
  gap: clamp(14px, 2vw, 28px);
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
  align-items: start;
}

.broadcast-panel,
.resonance-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: none;
}

.broadcast-panel {
  padding: 14px;
}

.panel-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  color: #d8d1e2;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 12px var(--danger);
  animation: livePulse 1.3s ease-in-out infinite;
}

.live-window {
  position: relative;
  min-height: 245px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background-position: center;
  background-size: cover;
}

.live-window::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(0deg, rgba(6, 4, 12, 0.85), transparent 55%);
}

.viewer-line {
  position: absolute;
  z-index: 1;
  right: 10px;
  bottom: 9px;
  left: 10px;
  display: flex;
  justify-content: space-between;
  color: white;
  font-size: 10px;
  font-weight: 900;
  text-shadow: 0 2px 5px black;
}

.health-block {
  margin-top: 16px;
}

.health-label {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 7px;
}

.health-label strong {
  color: var(--success);
  font-size: 16px;
}

.health-track,
.resonance-track,
.song-progress {
  position: relative;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.health-fill,
.resonance-fill,
.song-progress-fill {
  width: 100%;
  height: 100%;
  transform-origin: left;
  background: linear-gradient(90deg, #2ee9a8, #8bffce);
  box-shadow: 0 0 15px rgba(112, 255, 188, 0.42);
}

.rhythm-machine {
  position: relative;
  min-width: 0;
}

.canvas-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 24px 24px 10px 10px;
  background: rgba(5, 4, 12, 0.88);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5), 0 0 40px rgba(170, 114, 255, 0.12);
}

#noteCanvas {
  display: block;
  width: 100%;
  height: min(64vh, 690px);
  min-height: 470px;
  touch-action: none;
}

.judgment-text {
  position: absolute;
  z-index: 4;
  top: 55%;
  right: 0;
  left: 0;
  color: white;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 25px currentColor, 0 4px 0 rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px) scale(0.75);
  pointer-events: none;
}

.judgment-text.is-pop-a,
.judgment-text.is-pop-b {
  animation: judgmentPop 260ms ease-out;
}

.judgment-text.is-pop-b {
  animation-name: judgmentPopAlt;
}

.judgment-text.tone-perfect {
  color: var(--gold);
}

.judgment-text.tone-great {
  color: var(--cyan);
}

.judgment-text.tone-good {
  color: var(--violet);
}

.judgment-text.tone-miss {
  color: var(--danger);
}

.combo-burst {
  position: absolute;
  z-index: 4;
  top: 64%;
  right: 0;
  left: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.12em;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.combo-burst.is-visible-a,
.combo-burst.is-visible-b {
  opacity: 1;
  transform: none;
  animation: comboBurstPop 360ms ease-out;
}

.combo-burst.is-visible-b {
  animation-name: comboBurstPopAlt;
}

.countdown {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: none;
  place-items: center;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(80px, 18vw, 180px);
  background: rgba(5, 4, 12, 0.56);
  text-shadow: 0 0 45px var(--violet);
}

.countdown.is-visible {
  display: grid;
}

.lane-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  padding-top: 7px;
}

.lane-keys button {
  min-width: 0;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 15px 15px;
  color: white;
  font-family: "Black Han Sans", sans-serif;
  font-size: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 -5px rgba(0, 0, 0, 0.28);
  touch-action: manipulation;
}

.lane-keys button:nth-child(1).is-pressed {
  border-color: var(--cyan);
  background: rgba(95, 246, 255, 0.32);
  box-shadow: 0 0 22px rgba(95, 246, 255, 0.46);
}

.lane-keys button:nth-child(2).is-pressed {
  border-color: var(--violet);
  background: rgba(170, 114, 255, 0.33);
  box-shadow: 0 0 22px rgba(170, 114, 255, 0.46);
}

.lane-keys button:nth-child(3).is-pressed {
  border-color: var(--pink);
  background: rgba(255, 103, 191, 0.33);
  box-shadow: 0 0 22px rgba(255, 103, 191, 0.46);
}

.lane-keys button:nth-child(4).is-pressed {
  border-color: var(--gold);
  background: rgba(255, 211, 110, 0.3);
  box-shadow: 0 0 22px rgba(255, 211, 110, 0.46);
}

.song-progress {
  height: 4px;
  margin-top: 11px;
}

.song-progress-fill {
  width: 0;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
}

.resonance-panel {
  padding: 18px;
}

.resonance-panel h3 {
  margin: 0 0 6px;
  font-family: "Black Han Sans", sans-serif;
  font-size: 22px;
  font-weight: 400;
}

.resonance-panel > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.resonance-core {
  --resonance: 0;
  position: relative;
  display: grid;
  width: min(160px, 80%);
  aspect-ratio: 1;
  margin: 24px auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(7, 6, 13, 0.2) 25%, rgba(7, 6, 13, 0.92) 65%),
    conic-gradient(var(--pink) calc(var(--resonance) * 1%), rgba(255, 255, 255, 0.07) 0);
  box-shadow: 0 0 calc(8px + var(--resonance) * 0.25px) rgba(255, 103, 191, calc(0.1 + var(--resonance) * 0.006));
}

.resonance-core::before {
  position: absolute;
  width: 73%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  content: "";
  background: #0b0913;
}

.resonance-core strong {
  position: relative;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(25px, 4vw, 38px);
  font-weight: 400;
}

.resonance-track {
  height: 13px;
  overflow: visible;
}

.resonance-fill {
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  box-shadow: 0 0 16px rgba(255, 103, 191, 0.4);
}

.sweet-zone {
  position: absolute;
  z-index: 2;
  top: -4px;
  bottom: -4px;
  left: 60%;
  width: 25%;
  border-right: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
  background: rgba(255, 211, 110, 0.16);
}

.release-button,
.primary-button,
.secondary-button {
  width: 100%;
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.release-button {
  margin-top: 14px;
  color: #0b0913;
  background: linear-gradient(135deg, var(--gold), #ff8f72);
  box-shadow: 0 12px 30px rgba(255, 128, 107, 0.2);
}

.release-button:disabled {
  color: #817a8b;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: none;
  cursor: default;
}

.fever-state {
  margin-top: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.12em;
}

.fever-state.is-active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255, 211, 110, 0.09);
  box-shadow: 0 0 25px rgba(255, 211, 110, 0.13);
}

body.is-overheated {
  animation: overheatShake 220ms linear;
}

body.is-overheated .resonance-panel {
  border-color: var(--danger);
  box-shadow: 0 0 45px rgba(255, 73, 108, 0.27);
}

.modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: none;
  padding: 20px;
  place-items: center;
  background: rgba(4, 3, 9, 0.79);
  backdrop-filter: blur(15px);
}

.modal.is-visible {
  display: grid;
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  background:
    linear-gradient(150deg, rgba(34, 25, 54, 0.98), rgba(12, 10, 22, 0.98)),
    var(--panel-solid);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.65);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.briefing-card h2,
.pause-card h2,
.result-card h2 {
  margin: 5px 0 8px;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(29px, 6vw, 46px);
  font-weight: 400;
  line-height: 1.05;
}

.briefing-card > p,
.pause-card > p,
.result-card > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.difficulty {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 22px 0;
}

.difficulty span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #d9d1e4;
  font-size: 10px;
  font-weight: 900;
}

.control-guide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.control-guide div {
  padding: 12px;
  border-radius: 10px;
  color: #cfc7db;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
}

.control-guide strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.primary-button {
  color: #090710;
  background: linear-gradient(135deg, var(--cyan), #9c87ff);
  box-shadow: 0 14px 32px rgba(95, 246, 255, 0.17);
}

.secondary-button {
  margin-top: 8px;
  border-color: var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.result-card {
  text-align: center;
}

.result-rank {
  margin: 0 auto 12px;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(76px, 18vw, 132px);
  font-weight: 400;
  line-height: 0.82;
  text-shadow: 0 0 35px currentColor;
}

.result-rank.rank-s {
  color: var(--gold);
}

.result-rank.rank-a {
  color: var(--cyan);
}

.result-rank.rank-b {
  color: var(--violet);
}

.result-rank.rank-c {
  color: var(--success);
}

.result-rank.rank-f {
  color: var(--danger);
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 20px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.result-summary div {
  padding: 13px 8px;
  background: rgba(9, 7, 16, 0.92);
}

.result-summary span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

.result-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.result-breakdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 14px;
}

.result-breakdown div {
  padding: 10px 4px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.05);
}

.result-stars {
  min-height: 40px;
  color: var(--gold);
  font-size: 28px;
  letter-spacing: 0.15em;
  text-shadow: 0 0 18px rgba(255, 211, 110, 0.55);
}

.result-reward {
  min-height: 24px;
  margin-bottom: 18px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

@keyframes livePulse {
  50% {
    opacity: 0.4;
    transform: scale(0.75);
  }
}

@keyframes judgmentPop {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.7);
  }
  35% {
    opacity: 1;
    transform: translateY(0) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-13px) scale(1);
  }
}

@keyframes overheatShake {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@media (max-width: 980px) {
  .play-hud {
    grid-template-columns: 1fr auto;
  }

  .play-hud .back-link {
    display: none;
  }

  .play-layout {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 0.42fr);
  }

  .broadcast-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  .global-header {
    min-height: 64px;
    padding: 10px 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand span {
    display: none;
  }

  .back-link {
    padding-inline: 12px;
    font-size: 11px;
  }

  .stage-select {
    width: min(100% - 24px, 560px);
    padding-top: 36px;
  }

  .select-copy {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .select-copy h1 {
    font-size: clamp(45px, 16vw, 72px);
  }

  .select-copy h1 em {
    font-size: 0.58em;
  }

  .career {
    grid-template-columns: repeat(3, 1fr);
  }

  .career-item {
    padding: 12px 8px;
    text-align: center;
  }

  .career-item strong {
    font-size: 14px;
  }

  .stage-grid {
    grid-template-columns: 1fr;
  }

  .stage-card {
    grid-template-columns: 126px minmax(0, 1fr);
    min-height: 160px;
  }

  .stage-card-copy {
    padding: 17px 15px 15px 3px;
  }

  .stage-card-copy h2 {
    font-size: 19px;
  }

  .stage-backdrop {
    inset-top: 64px;
  }

  .play-hud {
    padding: 9px 12px;
  }

  .score-cluster {
    gap: 12px;
  }

  .score-cluster strong {
    font-size: 14px;
  }

  .play-layout {
    display: flex;
    width: min(100% - 16px, 560px);
    padding: 10px 0 24px;
    flex-direction: column;
  }

  .rhythm-machine {
    width: 100%;
  }

  #noteCanvas {
    height: min(59vh, 550px);
    min-height: 390px;
  }

  .lane-keys button {
    min-height: 54px;
  }

  .resonance-panel {
    position: sticky;
    z-index: 10;
    bottom: 6px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    width: 100%;
    padding: 11px;
    gap: 6px 12px;
    align-items: center;
  }

  .resonance-panel h3,
  .resonance-panel > p,
  .resonance-core,
  .fever-state {
    display: none;
  }

  .resonance-track {
    grid-column: 1;
    height: 14px;
  }

  .release-button {
    grid-column: 2;
    grid-row: 1;
    min-height: 48px;
    margin: 0;
  }

  .control-guide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .brand strong {
    font-size: 16px;
  }

  .stage-card {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .stage-card-copy p {
    font-size: 11px;
  }

  .result-breakdown {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Runtime DOM bindings */
.brand > span {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0;
  place-items: center;
  border: 1px solid rgba(255, 211, 110, 0.62);
  border-radius: 50% 50% 44% 44%;
  color: var(--gold);
  font-family: "Black Han Sans", sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  background: radial-gradient(circle at 50% 30%, #412f5d, #120d1b 70%);
  box-shadow: 0 0 28px rgba(170, 114, 255, 0.25);
}

.career {
  display: grid;
  grid-template-columns: auto auto;
  min-width: 156px;
  margin: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  gap: 0 12px;
}

.career > span {
  grid-column: 1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.career > strong {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  color: var(--gold);
  font-size: 12px;
}

.career > div {
  grid-column: 1 / -1;
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.career > div > i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transition: width 260ms ease;
}

.select-copy {
  grid-template-columns: minmax(0, 1.35fr) minmax(230px, 0.65fr);
}

.select-copy > p:first-child {
  grid-column: 1 / -1;
  margin: 0 0 -26px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.select-intro {
  margin: 0;
  color: #c6bed2;
  font-size: 14px;
  line-height: 1.8;
}

.control-legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-legend span {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.control-legend b {
  color: var(--gold);
}

.stage-card > img {
  width: 100%;
  height: 100%;
  min-height: 198px;
  object-fit: cover;
}

.stage-card__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 15%, rgba(18, 15, 32, 0.55) 36%, var(--panel-solid) 55%);
  pointer-events: none;
}

.stage-card__number {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  font-family: "Black Han Sans", sans-serif;
  background: rgba(8, 6, 16, 0.72);
  backdrop-filter: blur(9px);
}

.stage-card__copy {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 20px;
  left: 46%;
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.stage-card__copy small {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.stage-card__copy strong {
  margin: 7px 0 3px;
  overflow: hidden;
  font-family: "Black Han Sans", sans-serif;
  font-size: 22px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-card__copy em {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-card__footer {
  position: absolute;
  z-index: 2;
  right: 20px;
  bottom: 17px;
  left: 46%;
  display: flex;
  justify-content: space-between;
  align-items: end;
}

.stage-card__footer > i:first-child {
  color: var(--violet);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.04em;
}

.stage-card__footer > i:last-child {
  font-family: "Black Han Sans", sans-serif;
  font-size: 25px;
  font-style: normal;
}

.stage-card:disabled {
  filter: grayscale(0.8) brightness(0.5);
  cursor: not-allowed;
}

.stage-backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.backdrop-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(4, 3, 9, 0.88), rgba(4, 3, 9, 0.28) 48%, rgba(4, 3, 9, 0.84)),
    linear-gradient(0deg, #07060d, transparent 45%);
}

.play-screen[data-phase="0"] .backdrop-shade {
  background:
    linear-gradient(90deg, rgba(4, 3, 9, 0.9), rgba(35, 18, 70, 0.2) 48%, rgba(4, 3, 9, 0.84)),
    linear-gradient(0deg, #07060d, transparent 48%);
}

.play-screen[data-phase="1"] .backdrop-shade {
  background:
    linear-gradient(90deg, rgba(8, 3, 15, 0.88), rgba(122, 22, 104, 0.14) 48%, rgba(8, 3, 15, 0.82)),
    linear-gradient(0deg, #09050e, rgba(255, 70, 180, 0.05) 55%, transparent);
}

.play-screen[data-phase="2"] .backdrop-shade {
  background:
    linear-gradient(90deg, rgba(8, 5, 8, 0.84), rgba(207, 128, 31, 0.1) 48%, rgba(8, 5, 8, 0.8)),
    linear-gradient(0deg, #09070a, rgba(255, 211, 110, 0.06) 58%, transparent);
}

#pauseButton {
  justify-self: end;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: white;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.song-meta strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  font-size: clamp(15px, 2vw, 21px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-window img {
  width: 100%;
  height: 245px;
  object-fit: cover;
}

.live-window > span {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 10px;
  padding: 5px 8px;
  border-radius: 999px;
  color: white;
  font-size: 9px;
  font-weight: 900;
  background: rgba(255, 73, 108, 0.9);
  box-shadow: 0 0 14px rgba(255, 73, 108, 0.45);
}

.health-block > span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.health-block > span strong {
  color: var(--success);
}

.health-block > div,
.resonance-bar {
  position: relative;
  height: 9px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.health-block > div > i,
.resonance-bar > i {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, #2ee9a8, #8bffce);
  transition: transform 90ms linear;
  will-change: transform;
}

.broadcast-panel > p {
  margin: 14px 2px 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.rhythm-machine {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 24px 24px 10px 10px;
  background: rgba(5, 4, 12, 0.88);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5), 0 0 40px rgba(170, 114, 255, 0.12);
}

.lane-keys {
  padding: 7px;
}

.resonance-core > span,
.resonance-core > small {
  position: relative;
  z-index: 2;
}

.resonance-core > span {
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(25px, 4vw, 38px);
}

.resonance-core > small {
  position: absolute;
  bottom: 42px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.resonance-bar {
  height: 13px;
  overflow: visible;
}

.resonance-bar > i {
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  box-shadow: 0 0 16px rgba(255, 103, 191, 0.4);
}

.song-progress > i {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  will-change: transform;
}

#releaseButton {
  display: flex;
  width: 100%;
  min-height: 58px;
  margin-top: 14px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #0b0913;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold), #ff8f72);
  cursor: pointer;
  touch-action: manipulation;
}

#releaseButton > span,
#releaseButton > small {
  font-size: 8px;
  font-weight: 900;
}

#releaseButton > strong {
  font-size: 14px;
}

#releaseButton:disabled {
  color: #817a8b;
  background: rgba(255, 255, 255, 0.09);
  cursor: default;
}

.briefing-card > strong {
  color: var(--cyan);
  font-size: 12px;
}

.briefing-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0;
}

.briefing-card dl > div {
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.briefing-card dt {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

.briefing-card dd {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 700;
}

.result-score {
  margin: 16px 0 10px;
}

.result-score span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.result-score strong {
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
}

.result-actions .secondary-button {
  margin-top: 0;
}

@media (max-width: 760px) {
  .career {
    display: none;
  }

  .select-copy {
    grid-template-columns: 1fr;
  }

  .select-copy > p:first-child {
    margin-bottom: -8px;
  }

  .stage-card {
    min-height: 160px;
  }

  .stage-card > img {
    min-height: 160px;
  }

  .stage-card__copy {
    top: 16px;
    right: 13px;
    left: 41%;
  }

  .stage-card__copy strong {
    font-size: 19px;
  }

  .stage-card__footer {
    right: 13px;
    bottom: 13px;
    left: 41%;
  }

  .stage-backdrop {
    inset: 64px 0 0;
  }

  .resonance-panel > p,
  .resonance-core,
  .fever-state {
    display: none;
  }

  .resonance-bar {
    grid-column: 1;
    height: 14px;
  }

  #releaseButton {
    grid-column: 2;
    grid-row: 1;
    min-height: 48px;
    margin: 0;
  }
}

@media (max-width: 390px) {
  .stage-card {
    min-height: 150px;
  }

  .stage-card > img {
    min-height: 150px;
  }

  .stage-card__copy em {
    font-size: 9px;
  }
}

/* DEMON BEAT LIVE V2 — selectable charts, hold notes, and live phase CGs */
.difficulty-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 10px;
}

.difficulty-modes button {
  min-height: 66px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.difficulty-modes button:hover,
.difficulty-modes button.is-selected {
  border-color: var(--cyan);
  background: linear-gradient(145deg, rgba(95, 246, 255, 0.13), rgba(170, 114, 255, 0.14));
  box-shadow: 0 0 24px rgba(95, 246, 255, 0.09);
  transform: translateY(-1px);
}

.difficulty-modes strong,
.difficulty-modes small {
  display: block;
}

.difficulty-modes strong {
  color: var(--gold);
  font-family: "Black Han Sans", sans-serif;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.difficulty-modes small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.chart-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
}

.chart-summary span {
  padding: 8px 5px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
}

.chart-summary b {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 14px;
}

.phase-flash {
  position: absolute;
  z-index: 7;
  top: 22px;
  right: 18px;
  display: grid;
  min-width: 155px;
  padding: 10px 14px;
  border: 1px solid rgba(95, 246, 255, 0.42);
  border-radius: 10px;
  text-align: right;
  background: linear-gradient(135deg, rgba(7, 6, 13, 0.9), rgba(44, 25, 74, 0.82));
  box-shadow: 0 0 28px rgba(95, 246, 255, 0.15);
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

.phase-flash.is-visible-a,
.phase-flash.is-visible-b {
  animation: phaseSignal 2.1s ease both;
}

.phase-flash.is-visible-b {
  animation-name: phaseSignalAlt;
}

.phase-flash small {
  color: var(--cyan);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.phase-flash strong {
  margin-top: 2px;
  font-family: "Black Han Sans", sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.stage-backdrop img,
.live-window img {
  transition: opacity 360ms ease, transform 800ms ease;
}

.stage-backdrop img.is-phase-changing-a,
.stage-backdrop img.is-phase-changing-b,
.live-window img.is-phase-changing-a,
.live-window img.is-phase-changing-b {
  animation: liveCgReveal 850ms ease both;
}

.backdrop-shade.is-phase-changing-a,
.backdrop-shade.is-phase-changing-b {
  animation: phaseWash 1100ms ease both;
}

.stage-backdrop img.is-phase-changing-b,
.live-window img.is-phase-changing-b {
  animation-name: liveCgRevealAlt;
}

.lane-keys button.is-hit {
  transform: translateY(2px) scale(0.98);
  filter: brightness(1.35);
}

@keyframes phaseSignal {
  0% {
    opacity: 0;
    transform: translateX(20px);
  }
  15%,
  72% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateX(-8px);
  }
}

@keyframes liveCgReveal {
  0% {
    opacity: 0.06;
    transform: scale(1.045);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes phaseWash {
  0% {
    opacity: 1;
  }
  42% {
    opacity: 0.25;
  }
  100% {
    opacity: 1;
  }
}

@keyframes phaseSignalAlt {
  0% {
    opacity: 0;
    transform: translateX(20px);
  }
  15%,
  72% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateX(-8px);
  }
}

@keyframes liveCgRevealAlt {
  0% {
    opacity: 0.06;
    transform: scale(1.045);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes judgmentPopAlt {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.75);
  }
  22% {
    opacity: 1;
    transform: translateY(0) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px) scale(1);
  }
}

@keyframes comboBurstPop {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
  }
  35%,
  72% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes comboBurstPopAlt {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
  }
  35%,
  72% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (max-width: 700px) {
  .play-hud,
  .broadcast-panel,
  .resonance-panel {
    backdrop-filter: none;
  }

  .rhythm-machine {
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.46);
  }
}

@media (max-width: 560px) {
  .difficulty-modes {
    grid-template-columns: 1fr;
  }

  .difficulty-modes button {
    min-height: 54px;
  }

  .chart-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phase-flash {
    top: 12px;
    right: 10px;
    min-width: 125px;
    padding: 8px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .phase-flash.is-visible-a,
  .phase-flash.is-visible-b,
  .stage-backdrop img.is-phase-changing-a,
  .stage-backdrop img.is-phase-changing-b,
  .live-window img.is-phase-changing-a,
  .live-window img.is-phase-changing-b,
  .backdrop-shade.is-phase-changing-a,
  .backdrop-shade.is-phase-changing-b {
    animation-duration: 1ms;
  }
}

/* V3 — landing free play, speed control, and A-rank bonus cut archive */
.stage-collection,
.bonus-gallery {
  margin-top: 34px;
}

.collection-heading {
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
  justify-content: space-between;
  align-items: end;
}

.collection-heading small {
  color: var(--cyan);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.collection-heading h2 {
  margin: 3px 0 0;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 400;
}

.collection-heading > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: right;
}

.collection-heading > span b {
  color: var(--gold);
  font-size: 14px;
}

.stage-collection--freeplay {
  margin-top: 58px;
  padding-top: 30px;
  border-top: 1px solid rgba(170, 114, 255, 0.28);
}

.stage-card--freeplay {
  border-color: rgba(170, 114, 255, 0.32);
  background: linear-gradient(145deg, rgba(39, 24, 65, 0.96), rgba(14, 11, 25, 0.98));
}

.stage-card--freeplay .stage-card__number {
  width: 48px;
  border-color: rgba(255, 211, 110, 0.6);
  color: var(--gold);
  border-radius: 12px;
  font-size: 14px;
}

.stage-card--freeplay.has-reward {
  border-color: rgba(95, 246, 255, 0.65);
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.35), 0 0 34px rgba(95, 246, 255, 0.12);
}

.stage-card--freeplay.has-s-frame {
  border-color: rgba(255, 211, 110, 0.85);
  box-shadow: 0 0 0 1px rgba(255, 211, 110, 0.18), 0 0 38px rgba(255, 211, 110, 0.16);
}

.stage-collection--special {
  margin-top: 58px;
  padding: 30px;
  border: 1px solid rgba(255, 91, 166, 0.32);
  border-radius: 24px;
  background:
    radial-gradient(circle at 80% 15%, rgba(255, 91, 166, 0.13), transparent 36%),
    linear-gradient(145deg, rgba(31, 12, 35, 0.92), rgba(9, 7, 17, 0.96));
}

.stage-grid--special {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stage-card--special {
  min-height: 250px;
  border-color: rgba(255, 91, 166, 0.48);
  background: linear-gradient(145deg, rgba(45, 17, 48, 0.96), rgba(12, 9, 22, 0.98));
  box-shadow: 0 24px 80px rgba(255, 54, 150, 0.09);
}

.stage-card--special .stage-card__number {
  width: 52px;
  border-color: rgba(255, 211, 110, 0.72);
  border-radius: 12px;
  color: var(--gold);
  font-size: 15px;
}

.stage-card--special:not(:disabled)::after {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 211, 110, 0.4);
  border-radius: 999px;
  color: var(--gold);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
  content: "ORIGINAL VOICE";
  background: rgba(8, 5, 13, 0.72);
}

.bonus-gallery {
  margin-top: 58px;
  padding: 28px;
  border: 1px solid rgba(95, 246, 255, 0.16);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(22, 16, 38, 0.78), rgba(8, 7, 15, 0.78));
}

.bonus-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.gallery-card {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  border: 1px solid rgba(95, 246, 255, 0.32);
  border-radius: 16px;
  background: #080713;
}

.gallery-card > img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
  transition: filter 300ms ease, transform 500ms ease;
}

.gallery-card:hover > img {
  transform: scale(1.025);
}

.gallery-card__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(6, 5, 12, 0.98), rgba(6, 5, 12, 0.08) 66%);
}

.gallery-card__copy {
  position: absolute;
  z-index: 2;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
}

.gallery-card__copy small {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.gallery-card__copy strong {
  margin-top: 5px;
  font-size: 15px;
}

.gallery-card__copy span {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-card.is-locked > img {
  filter: grayscale(1) brightness(0.2) blur(7px);
  transform: scale(1.08);
}

.gallery-card.is-locked .gallery-card__copy small {
  color: var(--muted);
}

.gallery-card.has-s-frame {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 2px rgba(255, 211, 110, 0.18), 0 0 28px rgba(255, 211, 110, 0.16);
}

.song-meta em {
  display: block;
  margin-top: 3px;
  color: var(--gold);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.speed-heading {
  display: flex;
  margin-top: 16px;
  justify-content: space-between;
  align-items: center;
}

.speed-heading span {
  color: var(--gold);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.speed-heading small {
  color: var(--muted);
  font-size: 9px;
}

.speed-modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0 14px;
}

.speed-modes button {
  min-height: 58px;
  padding: 8px 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  touch-action: manipulation;
}

.speed-modes button:hover,
.speed-modes button.is-selected {
  border-color: var(--gold);
  background: rgba(255, 211, 110, 0.1);
  box-shadow: 0 0 18px rgba(255, 211, 110, 0.08);
}

.speed-modes strong,
.speed-modes small {
  display: block;
}

.speed-modes strong {
  color: var(--gold);
  font-size: 15px;
}

.speed-modes small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.result-card.has-bonus-cg {
  width: min(900px, 100%);
}

.bonus-cg-reward {
  position: relative;
  overflow: hidden;
  margin: 8px 0 18px;
  border: 1px solid rgba(95, 246, 255, 0.55);
  border-radius: 16px;
  text-align: left;
  background: #080713;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.35);
}

.bonus-cg-reward[hidden] {
  display: none;
}

.bonus-cg-reward > img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.bonus-cg-reward > div {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  padding: 40px 18px 16px;
  flex-direction: column;
  background: linear-gradient(0deg, rgba(5, 4, 10, 0.98), transparent);
}

.bonus-cg-reward small {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.bonus-cg-reward strong {
  margin-top: 4px;
  font-size: 18px;
}

.bonus-cg-reward span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.bonus-cg-reward.is-new {
  animation: bonusCutReveal 850ms ease both;
}

.bonus-cg-reward.has-s-frame {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 2px rgba(255, 211, 110, 0.18), 0 0 38px rgba(255, 211, 110, 0.2);
}

.bonus-cg-reward.has-s-frame small {
  color: var(--gold);
}

.result-breakdown span,
.result-breakdown strong {
  display: block;
}

.result-breakdown span {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.05em;
}

.result-breakdown strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 11px;
}

@keyframes bonusCutReveal {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(18px);
    filter: brightness(2);
  }
  100% {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (max-width: 820px) {
  .stage-grid--special {
    grid-template-columns: minmax(0, 1fr);
  }

  .bonus-gallery__grid {
    grid-template-columns: 1fr;
  }

  .gallery-card,
  .gallery-card > img {
    min-height: 240px;
  }
}

@media (max-width: 560px) {
  .collection-heading {
    align-items: start;
    flex-direction: column;
  }

  .collection-heading > span {
    text-align: left;
  }

  .bonus-gallery {
    padding: 16px;
  }

  .gallery-card,
  .gallery-card > img {
    min-height: 190px;
  }

  .speed-modes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .difficulty-modes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .difficulty-modes button {
    min-height: 58px;
    text-align: center;
  }

  .difficulty-modes small {
    display: none;
  }

  .result-card.has-bonus-cg {
    padding: 22px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bonus-cg-reward.is-new {
    animation-duration: 1ms;
  }
}

/* V5 — global top-three podium and frame-stable gameplay */
.player-name-button {
  display: flex;
  min-width: 132px;
  min-height: 46px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  flex-direction: column;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.player-name-button small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.player-name-button strong {
  max-width: 130px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--gold);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-name-button.is-set {
  border-color: rgba(255, 211, 110, 0.38);
  background: rgba(255, 211, 110, 0.07);
}

.world-board {
  margin-top: 34px;
  padding: 22px;
  border: 1px solid rgba(255, 211, 110, 0.24);
  border-radius: 22px;
  background:
    radial-gradient(circle at 80% 0, rgba(255, 211, 110, 0.09), transparent 38%),
    rgba(10, 8, 18, 0.82);
}

.world-board__filters {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
  margin-bottom: 16px;
}

.world-board__filters > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.world-board__filters > div:last-child {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.world-board__filters button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.world-board__filters button.is-selected {
  border-color: var(--gold);
  color: #140e1b;
  background: linear-gradient(135deg, var(--gold), #ff9f7a);
}

.world-board__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.world-board__row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(156px, auto);
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  align-items: center;
  background: rgba(255, 255, 255, 0.035);
}

.world-board__row > b {
  color: var(--gold);
  font-family: "Black Han Sans", sans-serif;
  font-size: 18px;
  font-weight: 400;
}

.world-board__row > div:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.world-board__row small {
  color: var(--cyan);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.world-board__row strong {
  margin-top: 2px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-board__podium,
.briefing-world-best__podium {
  display: grid;
  min-width: 0;
  margin: 0;
  padding: 0;
  gap: 3px;
  list-style: none;
}

.world-board__podium li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  gap: 8px;
  align-items: center;
  text-align: right;
}

.world-board__podium span {
  overflow: hidden;
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-board__podium em {
  color: var(--text);
  font-size: 9px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.world-board__podium li[data-rank="2"] span {
  color: #d7dde8;
}

.world-board__podium li[data-rank="3"] span {
  color: #d89465;
}

.world-board__podium li.is-vacant span,
.world-board__podium li.is-vacant em {
  color: #756e80;
}

.briefing-world-best,
.result-world-best {
  display: flex;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 211, 110, 0.25);
  border-radius: 12px;
  flex-direction: column;
  background: rgba(255, 211, 110, 0.06);
}

.briefing-world-best small {
  color: var(--gold);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.briefing-world-best__podium {
  margin-top: 8px;
  gap: 5px;
}

.briefing-world-best__podium li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.briefing-world-best__podium strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.briefing-world-best__podium span {
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.briefing-world-best__podium li.is-vacant strong,
.briefing-world-best__podium li.is-vacant span {
  color: #756e80;
}

.result-world-best {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.result-world-best.is-new {
  border-color: var(--gold);
  color: #160f1d;
  background: linear-gradient(135deg, var(--gold), #ff9f7a);
  box-shadow: 0 0 30px rgba(255, 211, 110, 0.16);
}

.result-world-best.is-offline {
  border-color: var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.nickname-card {
  width: min(430px, 100%);
}

.nickname-card > label {
  display: block;
  margin: 16px 0 7px;
  color: var(--muted);
  font-size: 10px;
}

.nickname-card > input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  color: var(--text);
  font-size: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.nickname-card > input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(95, 246, 255, 0.09);
}

#nicknameError {
  display: block;
  min-height: 18px;
  margin-top: 6px;
  color: var(--danger);
  font-size: 9px;
}

@media (max-width: 760px) {
  .global-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .back-link {
    order: 1;
  }

  .brand {
    min-width: 0;
    flex: 1;
    order: 2;
  }

  .brand strong {
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .player-name-button {
    min-width: 96px;
    max-width: 112px;
    min-height: 44px;
    order: 3;
  }

  .career {
    width: 100%;
    order: 4;
  }

  .world-board__filters {
    grid-template-columns: 1fr;
  }

  .world-board__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .world-board {
    padding: 15px;
  }

  .world-board__row {
    grid-template-columns: 28px minmax(0, 1fr) minmax(142px, auto);
    padding: 10px 8px;
  }

  .world-board__podium span {
    font-size: 9px;
  }

  .world-board__podium em {
    font-size: 8px;
  }

  .world-board__filters button {
    min-height: 46px;
  }
}
