:root {
  color-scheme: light;
  --ink: #111111;
  --muted: #6f6f6f;
  --paper: #ffffff;
  --page: #efefef;
  --blue-dot: #33aeea;
  --red: #ff2d34;
  --green: #05bd66;
  --blue: #2daeee;
  --gold: #ffe264;
  --orange: #ffa11a;
  --silver: #eceaed;
  --black: #050505;
  --violet: #7d5bf4;
  --lime: #cfff75;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", "Microsoft YaHei", sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  min-height: 100vh;
  overflow-x: hidden;
  padding: clamp(10px, 2.5vw, 28px);
}

.practice-card {
  width: min(100%, 820px);
  margin: 0 auto;
  background: var(--paper);
  border-radius: clamp(24px, 5vw, 46px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  padding: clamp(18px, 4vw, 48px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  text-align: center;
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.brand-mark {
  display: none;
}

h1,
p {
  margin: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 10vw, 92px);
  font-style: italic;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0;
}

.brand-lockup p,
.level-summary {
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(12px, 2.4vw, 16px);
  font-weight: 700;
}

.level-summary {
  position: absolute;
  opacity: 0.001;
  pointer-events: none;
}

.beat-dots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(20px, 7vw, 86px);
  width: min(82%, 650px);
  margin: clamp(34px, 7vw, 70px) auto clamp(24px, 5vw, 48px);
}

.beat-dots span {
  justify-self: center;
  width: clamp(34px, 8vw, 76px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--blue-dot);
  box-shadow: inset -5px -8px 0 rgba(0, 0, 0, 0.08), 0 3px 7px rgba(0, 0, 0, 0.18);
}

.stage-panel,
.library-panel,
.level-panel {
  border: 0;
  background: transparent;
}

.chain-area {
  display: grid;
  gap: 16px;
}

.chain-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.chain-label strong {
  color: var(--ink);
  font-size: 13px;
}

.player-label {
  margin-top: 10px;
}

.chain-row,
.pattern-library {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 2.8vw, 26px);
}

.target-chain {
  margin-bottom: 8px;
}

.player-chain {
  padding-top: 2px;
}

.rhythm-card,
.empty-slot {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  border: 0;
  border-radius: clamp(9px, 2vw, 16px);
  box-shadow: 0 5px 11px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  overflow: hidden;
}

.rhythm-card {
  display: grid;
  place-items: center;
  color: var(--ink);
  padding: 8px;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.rhythm-card::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: clamp(7px, 1.7vw, 12px);
  pointer-events: none;
}

.rhythm-card:hover,
.rhythm-card.active {
  transform: translateY(-2px);
  filter: saturate(1.08);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

.target-chain .rhythm-card,
.player-chain .rhythm-card,
.empty-slot {
  min-height: clamp(64px, 17vw, 132px);
}

.pattern-library .rhythm-card {
  min-height: clamp(72px, 17vw, 126px);
}

.pattern-library .wide-rhythm {
  grid-column: span 2;
  aspect-ratio: 2.08 / 1;
}

.empty-slot {
  display: grid;
  place-items: center;
  border: 2px dashed #d5d5d5;
  background: #f6f6f6;
  color: #b4b4b4;
  font-size: clamp(22px, 7vw, 38px);
  font-weight: 900;
}

.combo-number,
.card-label,
.syllables {
  position: relative;
  z-index: 1;
}

.target-chain .combo-number,
.player-chain .combo-number,
.target-chain .card-label,
.player-chain .card-label,
.pattern-library .card-label,
.target-chain .syllables,
.player-chain .syllables,
.pattern-library .syllables {
  display: none;
}

.combo-number {
  position: absolute;
  top: 7px;
  left: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  min-width: 28px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.note-symbol {
  position: relative;
  z-index: 1;
  color: #111111;
  font-family: "Arial Unicode MS", "Noto Music", "Segoe UI Symbol", serif;
  font-size: clamp(34px, 10vw, 78px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.pattern-library .note-symbol {
  font-size: clamp(30px, 8vw, 58px);
}

.card-label {
  align-self: end;
  justify-self: start;
  color: inherit;
  font-size: clamp(10px, 2.5vw, 13px);
  font-weight: 900;
  line-height: 1.15;
}

.syllables {
  display: none;
}

.rhythm-card.mismatch {
  outline: 4px solid #111;
  outline-offset: -4px;
}

.color-red {
  background: var(--red);
}

.color-green {
  background: var(--green);
}

.color-blue {
  background: var(--blue);
}

.color-gold {
  background: var(--gold);
}

.color-orange {
  background: var(--orange);
}

.color-silver {
  background: var(--silver);
}

.color-black {
  background: var(--black);
  color: #ffffff;
}

.color-black .note-symbol {
  color: #ffffff;
}

.color-violet {
  background: var(--violet);
  color: #ffffff;
}

.color-lime {
  background: var(--lime);
}

.drill-footer {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: clamp(24px, 5vw, 44px) 0 18px;
}

.drill-footer strong {
  font-size: clamp(34px, 9vw, 64px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.status-strip,
.drill-footer span {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.drill-footer span[data-variant="success"] {
  color: var(--green);
}

.drill-footer span[data-variant="warn"] {
  color: var(--red);
}

.drill-footer span[data-variant="playing"] {
  color: var(--blue-dot);
}

.stage-toolbar {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

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

.readouts div {
  border-radius: 12px;
  background: #f3f3f3;
  padding: 8px 10px;
  text-align: center;
}

.readouts span,
.panel-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.readouts strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

.transport,
.library-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button,
.icon-only,
.ghost-button {
  border: 0;
  border-radius: 999px;
  background: #f1f1f1;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  min-height: 40px;
  transition: transform 120ms ease, background 120ms ease;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
}

.icon-button.check,
.icon-only.next {
  background: var(--blue-dot);
  color: #ffffff;
}

.icon-only {
  width: 40px;
  font-size: 22px;
  line-height: 1;
}

.ghost-button {
  padding: 8px 15px;
}

.icon-button:hover,
.icon-only:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  background: #e6e6e6;
}

.icon-button.check:hover,
.icon-only.next:hover {
  background: #229fdc;
}

.icon-button:disabled,
.icon-only:disabled,
.ghost-button:disabled,
.rhythm-card:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.target-chain .rhythm-card:disabled {
  opacity: 1;
}

.library-panel {
  margin-top: clamp(18px, 4vw, 32px);
}

.library-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.library-head strong {
  font-size: 14px;
}

.level-panel {
  margin-top: clamp(18px, 4vw, 28px);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.level-button {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: #eeeeee;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.level-button.active {
  background: var(--gold);
}

.level-button.passed {
  background: #d7f6e5;
}

@media (min-width: 760px) {
  .practice-card {
    padding-left: clamp(42px, 7vw, 74px);
    padding-right: clamp(42px, 7vw, 74px);
  }

  .library-panel {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 520px) {
  .practice-card {
    border-radius: 28px;
    padding: 18px 14px 20px;
  }

  h1 {
    font-size: clamp(36px, 11vw, 52px);
  }

  .beat-dots {
    width: 90%;
    gap: 16px;
    margin-top: 26px;
  }

  .chain-row,
  .pattern-library {
    gap: 9px;
  }

  .chain-label {
    padding: 0 2px;
  }

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

  .icon-button span:last-child {
    display: none;
  }
}
