:root {
  color-scheme: dark;
  --bg: #0f1416;
  --panel: #182023;
  --panel-2: #20292d;
  --panel-3: #263238;
  --line: #52626a;
  --text: #f4f1e8;
  --muted: #98a4a7;
  --soft: #d9cfb8;
  --gold: #f0b84d;
  --amber: #d8843b;
  --teal: #41c7b0;
  --green: #8bd46f;
  --red: #f36f61;
  --rose: #d66a92;
  --blue: #72a8ff;
  --ink: #080a0b;
  --shadow: 0 22px 52px rgba(0, 0, 0, 0.48);
  --radius: 8px;
  --timeline-gutter: 22px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1100px;
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(65, 199, 176, 0.1) 0 18%, transparent 18% 100%),
    linear-gradient(245deg, rgba(214, 106, 146, 0.09) 0 16%, transparent 16% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 76px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 300px),
    var(--bg);
  color: var(--text);
  overflow-x: auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 0 68%, rgba(0, 0, 0, 0.42) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
  opacity: 0.45;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid rgba(244, 241, 232, 0.13);
  border-radius: 7px;
  background: #20292d;
  color: var(--text);
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(240, 184, 77, 0.7);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  position: relative;
}

.topbar {
  display: grid;
  grid-template-columns: 240px 1fr 330px;
  gap: 14px;
  align-items: stretch;
}

.brand,
.run-meter,
.map-strip,
.battle-stage,
.timeline-shell,
.hand-panel,
.side-panel,
.reward-panel,
.rehearsal-panel,
.result-panel {
  border: 1px solid rgba(244, 241, 232, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.006)),
    rgba(24, 32, 35, 0.94);
  box-shadow: var(--shadow);
}

.brand {
  border-radius: var(--radius);
  padding: 14px 16px;
  background:
    linear-gradient(90deg, rgba(240, 184, 77, 0.18), transparent 58%),
    linear-gradient(180deg, #252a26, #151c1f);
  border-color: rgba(240, 184, 77, 0.36);
  position: relative;
  overflow: hidden;
}

.brand::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--teal), var(--rose));
}

.brand-kicker {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 3px 0 0;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
  text-shadow: 0 4px 14px rgba(0, 0, 0, 0.46);
}

.brand-sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.map-strip {
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(65, 199, 176, 0.08), transparent 70%),
    #151d20;
}

.map-node {
  min-width: 106px;
  padding: 9px 10px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, #28343a, #151b1d);
  color: var(--muted);
  position: relative;
  overflow: hidden;
}

.map-node.current {
  color: var(--text);
  border-color: var(--gold);
  background: linear-gradient(180deg, #544022, #202a2e);
  box-shadow: inset 0 -3px 0 rgba(240, 184, 77, 0.5);
}

.map-node.done {
  color: #baecdc;
  border-color: rgba(65, 199, 176, 0.46);
}

.map-node-label {
  font-size: 11px;
  color: inherit;
}

.map-node-type {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
}

.run-meter {
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 10px;
  background:
    linear-gradient(90deg, rgba(139, 212, 111, 0.14), transparent 55%),
    #151d20;
}

.meter-row {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.meter-bar {
  height: 12px;
  background: #171614;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--teal));
  transition: width 260ms ease;
}

.meter-fill.danger {
  background: linear-gradient(90deg, var(--red), var(--amber));
}

.stat-pills {
  display: flex;
  gap: 8px;
}

.stat-pill {
  flex: 1;
  border-radius: 7px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stat-value {
  margin-top: 3px;
  font-weight: 800;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) 340px;
  gap: 14px;
  min-height: 0;
  align-items: start;
}

.play-area {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 12px;
  min-width: 0;
  align-self: start;
  position: relative;
}

.session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.session-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.session-title h2 {
  margin: 0;
  font-size: 28px;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.48);
}

.session-title span {
  color: var(--muted);
  font-size: 13px;
}

.transport {
  display: flex;
  gap: 8px;
  align-items: center;
}

.battle-stage {
  border-radius: var(--radius);
  min-height: 230px;
  padding: 13px 16px 14px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 22% 78%, rgba(240, 184, 77, 0.13), transparent 35%),
    radial-gradient(ellipse at 76% 32%, rgba(65, 199, 176, 0.13), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 26%),
    linear-gradient(180deg, #1d282b, #101517);
  border-color: rgba(240, 184, 77, 0.22);
}

.battle-stage::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 74px;
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.34)),
    repeating-linear-gradient(90deg, rgba(244, 241, 232, 0.055) 0 1px, transparent 1px 82px);
  pointer-events: none;
}

.battle-topline {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.battlefield {
  position: relative;
  z-index: 1;
  min-height: 168px;
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(220px, 1fr) minmax(220px, 1fr);
  align-items: end;
  gap: 20px;
  padding-top: 8px;
}

.combatant {
  position: relative;
  min-height: 142px;
}

.player-combatant {
  padding-left: 16px;
}

.enemy-combatant {
  justify-self: end;
  width: min(280px, 100%);
  text-align: right;
  padding-right: 18px;
}

.combatant-tag {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.combatant-name {
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 950;
  text-shadow: 0 5px 14px rgba(0, 0, 0, 0.48);
}

.combatant-status {
  margin-top: 8px;
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.combatant-status span {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--soft);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
}

.avatar {
  position: relative;
  width: 112px;
  height: 104px;
  margin-top: 4px;
}

.player-avatar {
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.42));
}

.avatar-head {
  position: absolute;
  left: 42px;
  top: 14px;
  width: 31px;
  height: 31px;
  border-radius: 50% 50% 46% 46%;
  background: linear-gradient(180deg, #efd8b0, #b7784f);
  border: 1px solid rgba(255, 244, 215, 0.34);
}

.avatar-body {
  position: absolute;
  left: 26px;
  top: 43px;
  width: 62px;
  height: 56px;
  border-radius: 42% 42% 18% 18%;
  background:
    linear-gradient(90deg, rgba(65, 199, 176, 0.24), transparent 52%),
    linear-gradient(180deg, #345055, #152022);
  border: 1px solid rgba(65, 199, 176, 0.44);
}

.baton {
  position: absolute;
  left: 80px;
  top: 25px;
  width: 58px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), rgba(255, 239, 181, 0.2));
  transform: rotate(-24deg);
  transform-origin: left center;
  box-shadow: 0 0 14px rgba(240, 184, 77, 0.52);
}

.enemy-avatar {
  margin-left: auto;
  width: 138px;
  height: 116px;
  filter: drop-shadow(0 20px 22px rgba(0, 0, 0, 0.5));
}

.enemy-core {
  position: absolute;
  right: 28px;
  top: 30px;
  width: 76px;
  height: 60px;
  border-radius: 42% 58% 48% 52%;
  background:
    linear-gradient(135deg, rgba(240, 184, 77, 0.2), transparent 44%),
    linear-gradient(180deg, #48545a, #192226);
  border: 1px solid rgba(240, 184, 77, 0.42);
}

.enemy-core::before,
.enemy-core::after {
  content: "";
  position: absolute;
  top: 21px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(240, 184, 77, 0.72);
}

.enemy-core::before {
  left: 21px;
}

.enemy-core::after {
  right: 21px;
}

.enemy-stem {
  position: absolute;
  width: 3px;
  border-radius: 99px;
  background: rgba(65, 199, 176, 0.72);
  box-shadow: 0 0 12px rgba(65, 199, 176, 0.45);
}

.stem-a {
  right: 98px;
  top: 8px;
  height: 58px;
  transform: rotate(-16deg);
}

.stem-b {
  right: 58px;
  top: 3px;
  height: 72px;
}

.stem-c {
  right: 23px;
  top: 16px;
  height: 54px;
  transform: rotate(17deg);
}

.battle-center {
  position: relative;
  min-height: 136px;
  align-self: stretch;
  display: grid;
  place-items: center;
}

.stage-line {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 55%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(240, 184, 77, 0.54), rgba(65, 199, 176, 0.44), transparent);
}

.wave-badge {
  position: relative;
  z-index: 2;
  max-width: 210px;
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--soft);
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(240, 184, 77, 0.22);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.pulse-lanes {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pulse-lanes span {
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(244, 241, 232, 0.1);
  background: linear-gradient(90deg, rgba(240, 184, 77, 0.22), rgba(65, 199, 176, 0.16));
}

.primary-btn {
  background: linear-gradient(180deg, #ffd16d, #d8843b);
  color: #19120b;
  font-weight: 900;
  padding: 10px 14px;
  border-color: rgba(255, 221, 134, 0.72);
}

.ghost-btn {
  padding: 9px 12px;
  background: #1e282c;
}

.timeline-shell {
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(240, 184, 77, 0.08), transparent 62%),
    linear-gradient(90deg, rgba(65, 199, 176, 0.06), rgba(214, 106, 146, 0.04)),
    #141c20;
  border-color: rgba(240, 184, 77, 0.18);
}

.timeline-shell::before {
  content: "LIVE CHART";
  position: absolute;
  right: 18px;
  top: 11px;
  color: rgba(240, 184, 77, 0.18);
  font-weight: 950;
  font-size: 34px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.timeline-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.timeline-caption {
  color: var(--muted);
  font-size: 12px;
}

.timeline {
  --timeline-gutter-left: 22px;
  --timeline-gutter-right: 22px;
  position: relative;
  min-height: 300px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(65, 199, 176, 0.1), transparent 28%),
    linear-gradient(180deg, #202b30, #111719);
  border: 1px solid rgba(240, 184, 77, 0.18);
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    inset 0 -20px 50px rgba(0, 0, 0, 0.28);
}

.timeline.has-prev {
  --timeline-gutter-left: 96px;
}

.step-grid,
.bar-markers {
  position: absolute;
  left: var(--timeline-gutter-left);
  right: var(--timeline-gutter-right);
  top: 0;
  bottom: 0;
  pointer-events: none;
}

.step-grid {
  z-index: 1;
  background: repeating-linear-gradient(
    90deg,
    rgba(244, 241, 232, 0.055) 0,
    rgba(244, 241, 232, 0.055) 1px,
    transparent 1px,
    transparent calc(100% / var(--step-count))
  );
}

.bar-markers {
  z-index: 2;
}

.bar-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-1px);
  background: rgba(240, 184, 77, 0.46);
  box-shadow: 0 0 14px rgba(240, 184, 77, 0.2);
}

.bar-marker.edge {
  background: rgba(240, 184, 77, 0.64);
}

.timeline-lanes {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 86px 1fr 52px;
  z-index: 3;
}

.lane {
  position: relative;
  border-bottom: 1px solid rgba(244, 241, 232, 0.08);
}

.lane:last-child {
  border-bottom: 0;
}

.lane-label {
  position: absolute;
  left: 10px;
  top: 8px;
  z-index: 2;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.melody-note {
  position: absolute;
  top: 32px;
  height: 22px;
  min-width: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0a8, #f0b84d);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    0 0 18px rgba(240, 184, 77, 0.24),
    0 8px 18px rgba(0, 0, 0, 0.28);
}

.melody-note::before {
  content: "";
  position: absolute;
  left: 0;
  top: -18px;
  bottom: -12px;
  width: 2px;
  background: rgba(255, 238, 173, 0.95);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.26),
    0 0 12px rgba(240, 184, 77, 0.48);
}

.music-grid {
  position: absolute;
  left: var(--timeline-gutter-left);
  right: var(--timeline-gutter-right);
  top: 0;
  bottom: 0;
}

.melody-note span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: #1c150d;
  font-weight: 900;
}

.slots-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  padding: 38px var(--timeline-gutter-right) 22px var(--timeline-gutter-left);
  gap: 0;
}

.prev-card-peek {
  position: absolute;
  left: -52px;
  top: 48px;
  width: 86px;
  z-index: 4;
  opacity: 0.7;
  transform: none;
}

.next-hint {
  position: absolute;
  right: var(--timeline-gutter-right);
  top: 60px;
  width: 54px;
  height: 126px;
  border-radius: var(--radius);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  opacity: 0.36;
}

.slot {
  position: relative;
  min-width: 0;
  height: 150px;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  transition:
    border-color 130ms ease,
    background 130ms ease,
    transform 130ms ease;
}

.slot:hover,
.slot.drop-target {
  background: transparent;
  box-shadow: none;
}

.slot-index {
  position: absolute;
  top: 8px;
  left: 12px;
  color: var(--muted);
  font-size: 11px;
}

.slot-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  padding: 0;
  z-index: 5;
}

.slot-card-frame {
  width: 100px;
  aspect-ratio: 5 / 7;
  border-radius: var(--radius);
  border: 1px dashed rgba(244, 241, 232, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(0, 0, 0, 0.2);
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.22);
}

.slot-card-frame::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -18px;
  bottom: -18px;
  width: 2px;
  z-index: 2;
  background: rgba(255, 238, 173, 0.88);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.28),
    0 0 13px rgba(240, 184, 77, 0.44);
  pointer-events: none;
}

.slot-card-frame .card,
.slot-card-frame .slot-placeholder {
  position: relative;
  z-index: 1;
}

.slot:hover .slot-card-frame,
.slot.drop-target .slot-card-frame {
  border-color: rgba(240, 184, 77, 0.75);
  background:
    linear-gradient(180deg, rgba(240, 184, 77, 0.13), transparent),
    rgba(0, 0, 0, 0.22);
}

.slot-placeholder {
  color: rgba(242, 238, 231, 0.42);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  text-align: center;
  line-height: 1.35;
  width: min-content;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--timeline-gutter-left);
  width: 2px;
  background: var(--teal);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.25),
    0 0 22px rgba(65, 199, 176, 0.82);
  transform: translateX(0);
  z-index: 10;
  pointer-events: none;
}

.playhead::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 13px;
  height: 13px;
  transform: translate(-50%, -1px) rotate(45deg);
  background: var(--teal);
  border: 1px solid rgba(234, 255, 250, 0.62);
  box-shadow: 0 0 16px rgba(65, 199, 176, 0.68);
}

.beat-readout {
  position: absolute;
  left: 12px;
  bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.countdown {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 82px;
  font-weight: 950;
  color: var(--gold);
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  z-index: 20;
  pointer-events: none;
}

.countdown.show {
  display: flex;
  animation: pop 260ms ease both;
}

@keyframes pop {
  from {
    transform: scale(0.84);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.hand-panel {
  border-radius: var(--radius);
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(214, 106, 146, 0.06), transparent 70%),
    #141c20;
}

.hand-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.hand-title {
  font-weight: 900;
}

.pile-readout {
  color: var(--muted);
  font-size: 12px;
}

.hand {
  display: flex;
  gap: 10px;
  min-height: 138px;
  align-items: stretch;
  padding-bottom: 4px;
}

.card {
  width: 124px;
  aspect-ratio: 5 / 7;
  min-height: 0;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(244, 241, 232, 0.18);
  background:
    linear-gradient(135deg, rgba(240, 184, 77, 0.13), transparent 40%),
    linear-gradient(180deg, #313b3f, #171d20);
  box-shadow:
    0 16px 30px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
  user-select: none;
}

.slot-card-frame .card {
  width: 100%;
  height: 100%;
  min-height: 0;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.32),
    inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(240, 184, 77, 0.72);
  background:
    linear-gradient(135deg, rgba(240, 184, 77, 0.2), transparent 46%),
    linear-gradient(180deg, #3b464a, #1a2225);
}

.card.selected {
  border-color: var(--gold);
  box-shadow:
    0 0 0 2px rgba(240, 184, 77, 0.22),
    0 16px 30px rgba(0, 0, 0, 0.3);
}

.card.locked {
  cursor: pointer;
  opacity: 0.86;
  background: linear-gradient(180deg, #293236, #171d20);
}

.card.reward {
  width: 166px;
  min-height: 0;
}

.card.upgraded {
  border-color: rgba(65, 199, 176, 0.54);
  background:
    linear-gradient(135deg, rgba(65, 199, 176, 0.18), transparent 42%),
    linear-gradient(180deg, #334246, #171d20);
}

.card-base {
  font-size: 32px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
}

.card.reward .card-base {
  font-size: 40px;
}

.slot-card-frame .card-base {
  font-size: 28px;
}

.slot-card-frame .card-type {
  font-size: 9px;
}

.slot-card-frame .variant-pill {
  font-size: 10px;
  padding: 3px 5px;
}

.card-type {
  margin-top: 5px;
  font-size: 10px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.variants {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.variant-pill {
  padding: 4px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(0, 0, 0, 0.2);
  color: var(--soft);
  font-size: 11px;
}

.variant-pill.active {
  color: #17110b;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 900;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin-top: 10px;
}

.side-panel {
  border-radius: var(--radius);
  padding: 12px;
  min-height: 0;
  height: min(420px, calc(100vh - 176px));
  max-height: calc(100vh - 176px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    linear-gradient(180deg, rgba(114, 168, 255, 0.06), transparent 60%),
    #141c20;
}

.side-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.side-tab {
  padding: 8px 10px;
  font-size: 12px;
}

.side-tab.active {
  background: #403720;
  border-color: var(--gold);
}

.log-list {
  min-height: 0;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.log-item {
  padding: 7px 8px;
  border-radius: 7px;
  background: #20292d;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.log-item.bad {
  border-color: rgba(243, 111, 97, 0.58);
  background: rgba(91, 34, 30, 0.46);
}

.log-meta {
  color: var(--muted);
  font-size: 10px;
}

.log-main {
  margin-top: 2px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
  font-size: 13px;
}

.log-reason {
  margin-top: 2px;
  color: var(--soft);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.judge-pop {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: 28px;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 7px;
  background: rgba(20, 19, 17, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow);
  min-width: 170px;
  pointer-events: none;
  animation: judgeFloat 1200ms ease both;
}

.judge-pop.good {
  border-color: rgba(65, 199, 176, 0.6);
}

.judge-pop.bad {
  border-color: rgba(243, 111, 97, 0.75);
}

.judge-title {
  font-weight: 950;
}

.judge-reason {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

@keyframes judgeFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.96);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -24px) scale(0.98);
  }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 11, 0.72);
  backdrop-filter: blur(8px);
  padding: 28px;
}

.reward-panel,
.rehearsal-panel,
.result-panel {
  border-radius: var(--radius);
  width: min(760px, calc(100vw - 56px));
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(240, 184, 77, 0.12), rgba(65, 199, 176, 0.06)),
    #151d20;
}

.modal-title {
  margin: 0 0 4px;
  font-size: 24px;
}

.modal-sub {
  color: var(--muted);
  margin-bottom: 16px;
}

.reward-grid {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.choice-card {
  padding: 16px;
  text-align: left;
  min-height: 128px;
}

.choice-card strong {
  display: block;
  font-size: 20px;
  margin-bottom: 8px;
}

.choice-card span {
  color: var(--muted);
}

.deck-grid {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.upgrade-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.upgrade-option {
  flex: 1;
  padding: 13px;
  font-weight: 900;
}

.audio-gate {
  text-align: center;
}

.audio-gate h2 {
  margin: 0 0 8px;
  font-size: 34px;
}

.audio-gate p {
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 18px;
}

.empty-note {
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

@media (max-height: 820px) {
  .app-shell {
    padding: 12px;
    gap: 10px;
  }

  .topbar {
    grid-template-columns: 230px 1fr 300px;
    gap: 10px;
  }

  .brand {
    padding: 10px 12px;
  }

  .brand h1 {
    font-size: 23px;
  }

  .brand-sub {
    display: none;
  }

  .map-strip,
  .run-meter {
    padding: 8px;
  }

  .map-node {
    min-width: 92px;
    padding: 7px 8px;
  }

  .map-node-type {
    font-size: 12px;
  }

  .stat-pill {
    padding: 6px;
  }

  .main-grid {
    gap: 10px;
    grid-template-columns: minmax(760px, 1fr) 320px;
  }

  .play-area {
    gap: 10px;
  }

  .battle-stage {
    min-height: 146px;
    padding: 10px 14px 11px;
  }

  .battlefield {
    min-height: 96px;
    gap: 14px;
    padding-top: 3px;
  }

  .combatant {
    min-height: 92px;
  }

  .combatant-name {
    margin-top: 4px;
    font-size: 15px;
  }

  .combatant-status {
    margin-top: 5px;
  }

  .avatar {
    width: 76px;
    height: 58px;
  }

  .avatar-head {
    left: 30px;
    top: 4px;
    width: 21px;
    height: 21px;
  }

  .avatar-body {
    left: 20px;
    top: 25px;
    width: 42px;
    height: 34px;
  }

  .baton {
    left: 56px;
    top: 13px;
    width: 40px;
  }

  .enemy-avatar {
    width: 92px;
    height: 60px;
  }

  .enemy-core {
    right: 18px;
    top: 12px;
    width: 50px;
    height: 38px;
  }

  .enemy-stem {
    width: 2px;
  }

  .stem-a {
    right: 66px;
    top: 1px;
    height: 34px;
  }

  .stem-b {
    right: 39px;
    top: 0;
    height: 42px;
  }

  .stem-c {
    right: 15px;
    top: 5px;
    height: 32px;
  }

  .pulse-lanes {
    bottom: 8px;
  }

  .pulse-lanes span {
    height: 10px;
  }

  .timeline-shell {
    padding: 10px;
  }

  .timeline-shell::before {
    font-size: 25px;
    top: 8px;
  }

  .timeline-top {
    margin-bottom: 7px;
  }

  .timeline {
    min-height: 180px;
  }

  .timeline-lanes {
    grid-template-rows: 52px 1fr 32px;
  }

  .lane-label {
    top: 6px;
  }

  .melody-note {
    top: 22px;
    height: 18px;
  }

  .melody-note::before {
    top: -14px;
    bottom: -8px;
  }

  .slots-wrap {
    padding-top: 22px;
    padding-bottom: 9px;
  }

  .slot {
    height: 96px;
  }

  .slot-card-frame {
    width: 72px;
  }

  .slot-index {
    top: 6px;
    left: 10px;
  }

  .prev-card-peek {
    top: 36px;
    width: 72px;
  }

  .next-hint {
    top: 40px;
    height: 84px;
  }

  .beat-readout {
    bottom: 7px;
    font-size: 11px;
  }

  .hand-panel {
    padding: 10px;
  }

  .hand-head {
    margin-bottom: 8px;
  }

  .hand {
    min-height: 130px;
  }

  .card {
    width: 92px;
    padding: 9px;
  }

  .card-base {
    font-size: 26px;
  }

  .slot-card-frame .card-base {
    font-size: 23px;
  }

  .variant-pill {
    font-size: 10px;
    padding: 3px 5px;
  }

  .card-footer {
    font-size: 10px;
  }

  .side-panel {
    width: 320px;
    height: min(360px, calc(100vh - 142px));
    max-height: calc(100vh - 142px);
  }
}

.groove-hit {
  animation: grooveHit 420ms ease;
}

@keyframes grooveHit {
  0% {
    filter: brightness(1);
  }
  40% {
    filter: brightness(1.9) saturate(1.4);
  }
  100% {
    filter: brightness(1);
  }
}
