:root {
  color-scheme: dark;
  --black: #000;
  --white-key: #7c7c7a;
  --white-key-end: #74736f;
  --white-key-down: #6c8078;
  --black-key: #050505;
  --black-key-top: #0e0e0e;
  --black-key-down: #0a241f;
  --black-key-down-top: #14382f;
  --glow: rgba(110, 225, 186, 0.42);
  --glow-soft: rgba(110, 225, 186, 0.14);
  --line: #1d1d1d;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--black);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
}

.practice-shell {
  display: grid;
  grid-template-rows: 1fr min(25.2vh, 216px);
  width: 100vw;
  height: 100vh;
  background: var(--black);
}

.black-space {
  position: relative;
  overflow: hidden;
  background: var(--black);
}

.connect-button {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  min-width: 180px;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid rgba(126, 255, 211, 0.22);
  border-radius: 8px;
  color: rgba(226, 255, 243, 0.92);
  background: rgba(8, 18, 15, 0.86);
  box-shadow:
    0 0 22px rgba(110, 225, 186, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-size: 18px;
  font-weight: 700;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.connect-button.connected {
  opacity: 0;
  pointer-events: none;
}

.song-panel {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 14px;
  justify-items: center;
  width: min(880px, calc(100vw - 48px));
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease;
}

.song-panel.ready {
  opacity: 1;
  pointer-events: auto;
}

.panel-title {
  display: grid;
  gap: 4px;
  justify-items: center;
  color: rgba(226, 255, 243, 0.92);
  text-align: center;
}

.panel-title strong {
  font-size: 26px;
  letter-spacing: 0;
}

.panel-title span {
  color: rgba(184, 208, 198, 0.62);
  font-size: 13px;
  font-weight: 700;
}

.difficulty-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: min(560px, 100%);
}

.difficulty-tab {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: rgba(184, 208, 198, 0.72);
  background: rgba(4, 4, 4, 0.72);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.difficulty-tab.active {
  color: #f2fff9;
  border-color: rgba(126, 255, 211, 0.52);
  background: rgba(14, 42, 34, 0.9);
  box-shadow: 0 0 22px rgba(110, 225, 186, 0.16);
}

.upload-midi {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px dashed rgba(126, 255, 211, 0.28);
  border-radius: 8px;
  color: rgba(226, 255, 243, 0.9);
  background: rgba(8, 18, 15, 0.64);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.upload-midi:hover {
  border-color: rgba(126, 255, 211, 0.52);
  background: rgba(14, 42, 34, 0.74);
}

.upload-midi small {
  color: rgba(184, 208, 198, 0.56);
  font-size: 11px;
  font-weight: 800;
}

.upload-midi input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.song-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(128px, 1fr));
  gap: 10px;
  width: 100%;
  max-height: min(44vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid rgba(126, 255, 211, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(126, 255, 211, 0.04), transparent),
    rgba(0, 0, 0, 0.34);
  scrollbar-color: rgba(126, 255, 211, 0.35) rgba(255, 255, 255, 0.04);
}

.song-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
  padding: 10px;
  border: 1px solid rgba(126, 255, 211, 0.24);
  border-radius: 8px;
  color: rgba(226, 255, 243, 0.92);
  background: rgba(8, 18, 15, 0.86);
  box-shadow:
    0 0 22px rgba(110, 225, 186, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 180ms ease;
  cursor: pointer;
}

.song-grid::-webkit-scrollbar {
  width: 8px;
}

.song-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.035);
  border-radius: 999px;
}

.song-grid::-webkit-scrollbar-thumb {
  background: rgba(126, 255, 211, 0.28);
  border-radius: 999px;
}

.song-button small {
  color: rgba(184, 208, 198, 0.68);
  font-size: 13px;
  font-weight: 700;
}

.song-button .stars {
  color: rgba(255, 207, 95, 0.86);
  font-size: 12px;
  line-height: 1.25;
}

.song-button .song-source {
  color: rgba(184, 208, 198, 0.48);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.preview-control {
  min-width: 66px;
  min-height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border: 1px solid rgba(126, 255, 211, 0.22);
  border-radius: 7px;
  color: rgba(226, 255, 243, 0.9);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 900;
}

.song-button.previewing {
  border-color: rgba(255, 207, 95, 0.58);
  box-shadow:
    0 0 30px rgba(255, 207, 95, 0.18),
    0 0 22px rgba(110, 225, 186, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.song-button.previewing .preview-control {
  border-color: rgba(255, 207, 95, 0.52);
  color: #fff6d7;
  background: rgba(255, 207, 95, 0.12);
}

.song-button:disabled {
  color: rgba(128, 143, 137, 0.62);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(8, 8, 8, 0.82);
  box-shadow: none;
  cursor: default;
}

.song-button:not(:disabled):hover {
  border-color: rgba(126, 255, 211, 0.46);
  box-shadow:
    0 0 30px rgba(110, 225, 186, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.song-button.selected {
  color: #f2fff9;
  border-color: rgba(126, 255, 211, 0.72);
  background: rgba(14, 42, 34, 0.92);
  box-shadow:
    0 0 34px rgba(110, 225, 186, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.song-button.playing {
  opacity: 1;
}

.song-panel.playing {
  opacity: 0;
  pointer-events: none;
}

.speed-control {
  display: grid;
  grid-template-columns: auto minmax(170px, 240px) 42px;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: rgba(196, 211, 205, 0.72);
  background: rgba(4, 4, 4, 0.72);
  font-size: 13px;
  font-weight: 700;
}

.speed-control input {
  width: 100%;
  accent-color: #77f0c7;
}

.speed-control strong {
  color: rgba(226, 255, 243, 0.86);
  text-align: right;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.start-button {
  min-width: 180px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(126, 255, 211, 0.34);
  border-radius: 8px;
  color: rgba(226, 255, 243, 0.94);
  background: rgba(8, 18, 15, 0.88);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.free-practice-button {
  min-width: 148px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 207, 95, 0.32);
  border-radius: 8px;
  color: rgba(255, 246, 215, 0.94);
  background: rgba(32, 24, 6, 0.72);
  box-shadow: 0 0 22px rgba(255, 207, 95, 0.08);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.free-practice-button:hover {
  border-color: rgba(255, 207, 95, 0.58);
  box-shadow: 0 0 28px rgba(255, 207, 95, 0.16);
}

.start-button:disabled {
  color: rgba(128, 143, 137, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(8, 8, 8, 0.72);
  cursor: default;
}

.result-panel {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  width: min(430px, calc(100vw - 40px));
  padding: 24px;
  border: 1px solid rgba(126, 255, 211, 0.18);
  border-radius: 8px;
  color: rgba(226, 255, 243, 0.92);
  background: rgba(4, 10, 8, 0.9);
  box-shadow:
    0 0 34px rgba(110, 225, 186, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  transform: translate(-50%, -50%);
}

.result-panel[hidden] {
  display: none;
}

.game-hud {
  position: absolute;
  z-index: 6;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 8px 0 12px;
  border: 1px solid rgba(126, 255, 211, 0.14);
  border-radius: 8px;
  background: rgba(4, 10, 8, 0.78);
  box-shadow: 0 0 24px rgba(110, 225, 186, 0.08);
}

.game-hud[hidden] {
  display: none;
}

.game-hud span {
  max-width: 220px;
  overflow: hidden;
  color: rgba(226, 255, 243, 0.82);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-hud > small {
  color: rgba(126, 255, 211, 0.62);
  font-size: 11px;
  font-weight: 800;
  min-width: 48px;
}

.game-hud > small[data-level="ok"] {
  color: rgba(255, 207, 95, 0.72);
}

.game-hud > small[data-level="low"] {
  color: rgba(255, 122, 168, 0.72);
}

.hud-metrics {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 6px;
  align-items: center;
  padding: 0 4px;
}

.hud-metrics small {
  min-width: 52px;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  color: rgba(184, 208, 198, 0.68);
  background: rgba(255, 255, 255, 0.035);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
}

.hud-metrics strong {
  display: block;
  margin-top: 2px;
  color: rgba(226, 255, 243, 0.9);
  font-size: 12px;
}

.game-hud button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  color: rgba(196, 211, 205, 0.82);
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.game-hud button.active {
  color: #fff6d7;
  border-color: rgba(255, 207, 95, 0.52);
  background: rgba(255, 207, 95, 0.14);
  box-shadow: 0 0 18px rgba(255, 207, 95, 0.16);
}

.pause-overlay {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: 50%;
  min-width: 168px;
  min-height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(126, 255, 211, 0.18);
  border-radius: 8px;
  color: rgba(226, 255, 243, 0.92);
  background: rgba(4, 10, 8, 0.82);
  box-shadow:
    0 0 32px rgba(110, 225, 186, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-size: 22px;
  font-weight: 900;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.pause-overlay[hidden] {
  display: none;
}

.countdown-overlay {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.countdown-overlay[hidden] {
  display: none;
}

.countdown-overlay::before {
  content: "";
  position: absolute;
  width: min(420px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 35%),
    radial-gradient(circle, rgba(126, 255, 211, 0.22), transparent 64%);
  filter: blur(2px);
  opacity: 0;
  transform: scale(0.7);
  animation: countdown-halo 760ms ease-out forwards;
}

.countdown-overlay span {
  position: relative;
  color: #f5fff9;
  font-size: clamp(56px, 11vw, 132px);
  font-weight: 950;
  letter-spacing: 0;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.58),
    0 0 34px rgba(126, 255, 211, 0.72),
    0 0 78px rgba(107, 199, 255, 0.34);
  transform: translateY(8px) scale(0.72);
  animation: countdown-pop 760ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.countdown-overlay.go span {
  color: #fff6d7;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.7),
    0 0 36px rgba(255, 207, 95, 0.8),
    0 0 84px rgba(126, 255, 211, 0.48);
}

.result-panel > span {
  display: block;
  color: rgba(184, 208, 198, 0.72);
  font-size: 13px;
  font-weight: 700;
}

.result-panel h2 {
  margin: 8px 0 20px;
  font-size: 28px;
  letter-spacing: 0;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.result-grid div {
  min-height: 76px;
  padding: 12px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.result-grid small {
  display: block;
  color: rgba(184, 208, 198, 0.68);
  font-size: 12px;
  font-weight: 700;
}

.result-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.restart-button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(126, 255, 211, 0.28);
  border-radius: 8px;
  color: rgba(226, 255, 243, 0.94);
  background: rgba(8, 18, 15, 0.88);
  cursor: pointer;
}

.status-text {
  position: absolute;
  z-index: 6;
  top: calc(50% + 38px);
  left: 50%;
  color: #5f5f5f;
  font-size: 13px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.black-space.ready .status-text {
  top: 27px;
  left: 18px;
  transform: none;
}

.game-layer {
  position: absolute;
  contain: layout paint size;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hit-line {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 18px;
  left: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(87, 219, 255, 0.9),
    rgba(134, 255, 198, 0.95),
    rgba(255, 207, 92, 0.9),
    transparent
  );
  box-shadow:
    0 0 16px rgba(99, 231, 213, 0.7),
    0 0 40px rgba(99, 231, 213, 0.28);
  opacity: 0.88;
}

.note-block {
  position: absolute;
  z-index: 1;
  top: 0;
  contain: layout paint;
  border-radius: 8px;
  background:
    radial-gradient(90% 34% at 50% 100%, rgba(255, 255, 255, 0.9), transparent 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, var(--note-color) 58%, #f7fff9 100%);
  box-shadow:
    0 0 18px var(--note-glow),
    inset 0 -18px 24px rgba(255, 255, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  opacity: 0.86;
  will-change: transform, height, opacity;
}

.note-block[data-hand="left"] {
  border: 1px solid rgba(120, 190, 255, 0.22);
  box-shadow:
    0 0 18px rgba(107, 199, 255, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.note-block[data-hand="left"]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: rgba(178, 226, 255, 0.58);
}

.note-block[data-hand="right"]::before {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 4px;
  border-radius: 0 8px 8px 0;
  background: rgba(178, 255, 220, 0.5);
}

.note-block::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: min(42px, 44%);
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.46), transparent),
    radial-gradient(70% 90% at 50% 100%, rgba(255, 255, 255, 0.62), transparent 70%);
  mix-blend-mode: screen;
  opacity: 0.78;
}

.note-block.hit {
  filter: brightness(1.25) saturate(1.2);
}

.note-block.free-note-float {
  z-index: 2;
  top: 0;
  height: var(--free-note-height, 4px);
  opacity: 0.9;
  transform: translate3d(0, var(--free-note-y, 0px), 0);
}

.note-block.free-note-float.released {
  animation: free-note-rise var(--free-note-release-duration, 1400ms) linear forwards;
}

.feedback-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.hit-burst {
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(163, 255, 218, 0.52), transparent 68%);
  transform: translate(-50%, -50%) scale(0.3);
  animation: hit-burst 520ms ease-out forwards;
}

.electric-flash {
  position: absolute;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.82), rgba(121, 246, 255, 0.34) 24%, transparent 66%);
  mix-blend-mode: screen;
  transform: translate(-50%, -50%) scale(0.3);
  animation: electric-flash 420ms ease-out forwards;
}

.electric-bolt {
  position: absolute;
  width: 3px;
  height: 92px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, #ffffff 22%, #7ef7ff 55%, transparent);
  box-shadow:
    0 0 8px rgba(255, 255, 255, 0.9),
    0 0 18px rgba(87, 234, 255, 0.88),
    0 0 36px rgba(126, 255, 211, 0.42);
  transform-origin: 50% 100%;
  animation: electric-bolt 360ms steps(3, end) forwards;
}

.feedback-text {
  position: absolute;
  color: rgba(220, 255, 239, 0.86);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(113, 255, 203, 0.72);
  transform: translate(-50%, -50%);
  animation: feedback-float 720ms ease-out forwards;
}

.practice-keyboard {
  position: relative;
  isolation: isolate;
  width: 100vw;
  height: 100%;
  background: var(--black);
}

.practice-keyboard::before {
  content: "";
  position: absolute;
  inset: -28px 0 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(55% 90% at 50% 100%, rgba(92, 190, 158, 0.16), transparent 64%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.035) 100%);
  opacity: 0.8;
}

.practice-keyboard::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.055) 47%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.055) 53%,
    transparent 100%
  );
  mix-blend-mode: screen;
  opacity: 0.34;
  transform: translateX(-58%);
  animation: keyboard-sheen 8s ease-in-out infinite;
}

.key {
  position: absolute;
  user-select: none;
  touch-action: none;
  border: 0;
  padding: 0;
  overflow: hidden;
  transition:
    background 150ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    transform 120ms ease;
}

.key::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.key.white::after {
  background:
    radial-gradient(78% 42% at 50% 100%, rgba(126, 255, 211, 0.36), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 40%);
}

.key.black::after {
  background:
    radial-gradient(90% 44% at 50% 100%, rgba(104, 231, 190, 0.32), transparent 64%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 46%);
}

.key.white {
  z-index: 1;
  bottom: 0;
  height: 100%;
  border-right: 1px solid #686865;
  background: linear-gradient(180deg, var(--white-key), var(--white-key-end));
}

.key.black {
  z-index: 2;
  top: 0;
  height: 62%;
  border-right: 1px solid #0e0e0e;
  border-left: 1px solid #0e0e0e;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg, var(--black-key-top), var(--black-key));
}

.key.white.active {
  background: linear-gradient(180deg, var(--white-key-down), #436d5f);
  box-shadow:
    inset 0 -14px 26px var(--glow-soft),
    0 -10px 34px var(--glow-soft);
  filter: brightness(1.1);
  transform: translateY(1px);
}

.key.black.active {
  background: linear-gradient(180deg, var(--black-key-down-top), var(--black-key-down));
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.45),
    0 -8px 24px var(--glow-soft),
    inset 0 -12px 18px rgba(103, 255, 204, 0.16);
  filter: brightness(1.22);
  transform: translateY(1px);
}

.key.active::after {
  opacity: 1;
}

.key.success {
  box-shadow:
    0 -16px 44px rgba(123, 255, 207, 0.42),
    0 -3px 18px rgba(255, 255, 255, 0.5),
    inset 0 -18px 30px rgba(123, 255, 207, 0.3);
  filter: brightness(1.42) saturate(1.2);
}

.key.success::after {
  opacity: 1;
  animation: success-pulse 420ms ease-out forwards;
}

@keyframes keyboard-sheen {
  0%,
  26% {
    transform: translateX(-62%);
    opacity: 0;
  }

  42%,
  58% {
    opacity: 0.28;
  }

  74%,
  100% {
    transform: translateX(62%);
    opacity: 0;
  }
}

@keyframes countdown-pop {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.62);
  }

  24% {
    opacity: 1;
    transform: translateY(0) scale(1.08);
  }

  72% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-10px) scale(1.16);
  }
}

@keyframes countdown-halo {
  0% {
    opacity: 0;
    transform: scale(0.62);
  }

  28% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes hit-burst {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.22);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.35);
  }
}

@keyframes free-note-rise {
  0% {
    opacity: 0.92;
    transform: translate3d(0, var(--free-note-release-y, 0px), 0);
  }

  100% {
    opacity: 0;
    transform: translate3d(0, var(--free-note-travel, -320px), 0);
  }
}

@keyframes electric-flash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.22);
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes electric-bolt {
  0% {
    opacity: 0;
    transform: translate(-50%, -92%) rotate(var(--bolt-angle)) scaleY(0.2);
  }

  18%,
  52% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -106%) rotate(var(--bolt-angle)) scaleY(1);
  }
}

@keyframes feedback-float {
  0% {
    opacity: 0;
    transform: translate(-50%, -10%) scale(0.92);
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -150%) scale(1.05);
  }
}

@keyframes success-pulse {
  0% {
    opacity: 0;
  }

  24% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .practice-shell {
    grid-template-rows: 1fr 20.4vh;
  }

  .song-panel {
    width: calc(100vw - 24px);
    max-height: calc(100% - 32px);
    overflow: auto;
  }

  .difficulty-tabs {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
  }

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

  .song-button {
    min-height: 78px;
    font-size: 15px;
  }

  .speed-control {
    grid-template-columns: auto minmax(120px, 1fr) 42px;
    width: min(360px, 100%);
  }

  .game-hud {
    top: 10px;
    right: 10px;
    max-width: calc(100vw - 20px);
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 8px;
  }

  .hud-metrics {
    order: 2;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hud-metrics small {
    min-width: 0;
  }

  .status-text {
    top: calc(50% + 38px);
    left: 50%;
  }

  .black-space.ready .status-text {
    top: 21px;
    left: 12px;
  }
}
