:root {
  --tile-size: 106px;
  --gap: 10px;
  --dock-height: clamp(196px, 30vh, 238px);
  --dock-bg-height: clamp(74px, 12vh, 98px);
  --bank-note-size: 96px;
  --bank-note-gap: 8px;
  --bg1: #eef1f5;
  --bg2: #eef1f5;
  --ink: #1b233e;
  --panel: #ffffff;
  --panel-border: #e4edff;
  --teal: #099695;
  --teal-dark: #007777;
  --green: #6abb4a;
  --green-soft: #a8d58c;
  --line: #d7e2f2;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: "Nunito", "Avenir Next Rounded", "Trebuchet MS", "Verdana", sans-serif;
  color: var(--ink);
  background: #eef1f5;
  padding: 0;
  overflow-x: hidden;
}

.app {
  width: min(1020px, 100%);
  margin: 0 auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  position: relative;
}

.screen {
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(20px + env(safe-area-inset-top)) 14px calc(var(--dock-height) + env(safe-area-inset-bottom) + 24px);
  position: relative;
  background: #eef1f5;
}

.app-menu-link {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 36px;
  padding: 7px 11px 7px 8px;
  border-radius: 999px;
  background: #399b9b;
  color: #ffffff;
  font-weight: 900;
  font-size: 0.88rem;
  line-height: 1;
  text-decoration: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.app-menu-link svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.boot-loader {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  gap: 10px;
  background: rgba(249, 252, 255, 0.9);
  transition: opacity 0.18s ease;
}

.boot-loader.done {
  opacity: 0;
}

.boot-loader-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #c8d7f6;
  border-top-color: #099695;
  animation: bootSpin 0.82s linear infinite;
}

.boot-loader-text {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: #446196;
}

@keyframes bootSpin {
  to { transform: rotate(360deg); }
}

button {
  border: 0;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

.app-title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.52rem, 7vw, 2.2rem);
  font-weight: 900;
  color: var(--ink);
  line-height: 1.1;
  white-space: nowrap;
}

.top-ui {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 76px;
  margin-bottom: 8px;
  position: relative;
}

.play-center {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-height) + env(safe-area-inset-bottom) + 8px);
  z-index: 69;
  width: min(1020px, calc(100% - 28px));
  display: grid;
  place-items: center;
  gap: 6px;
  margin: 0;
  transform: translateX(-50%);
}

.settings-btn {
  position: absolute;
  right: 0;
  top: 0;
  transform: none;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
}

.settings-glyph {
  display: inline-block;
  font-size: 1.5rem;
  line-height: 1;
  transform: translateY(1px);
}

.settings-btn.active {
  background: #099695;
  color: #fff;
  border-color: #007d7d;
  box-shadow: none;
}

.settings-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(760px, calc(100vw - 44px));
  z-index: 34;
}

.settings {
  width: 100%;
  margin: 0;
  padding: 7px 9px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  display: grid;
  gap: 6px;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(88px, 118px) 1fr;
  align-items: center;
  gap: 8px;
}

.setting-row-slider {
  grid-template-columns: minmax(88px, 118px) 1fr minmax(42px, 50px);
}

.setting-label {
  font-weight: 900;
  color: #2a4478;
  font-size: 0.81rem;
}

.setting-value {
  text-align: center;
  font-weight: 900;
  color: #0f4474;
  background: #ffffff;
  border: 2px solid #d8e6ff;
  border-radius: 999px;
  padding: 1px 4px;
  font-size: 0.74rem;
}

.settings input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.mode-toggle {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mode-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

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

.mode-group-label {
  font-size: 0.78rem;
  font-weight: 900;
  color: #2a4478;
  min-width: 42px;
}

.mode-btn {
  color: #23416e;
  background: #f2f6ff;
  border: 2px solid #d3e1ff;
  min-height: 30px;
  min-width: 72px;
  padding: 5px 9px;
  font-size: 0.76rem;
  border-radius: 10px;
}

.mode-btn.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal-dark);
  box-shadow: none;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 250px);
  justify-content: center;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.transport-btn {
  min-height: 64px;
  border: 3px solid var(--green);
  border-radius: 18px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #17366a;
  background: #ffffff;
  box-shadow: none;
  font-size: 1.24rem;
  font-weight: 900;
}

.play-circle {
  width: 100%;
  height: auto;
}

.play-triangle {
  width: 0;
  height: 0;
  border-left: 17px solid var(--green);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 4px;
}

.transport-label {
  color: inherit;
  font-size: inherit;
  line-height: 1;
  font-weight: 900;
}

.replay-btn {
  position: relative;
}

.tool-icon-btn,
.score-skip-btn {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  border-radius: 15px;
  padding: 0;
  background: #fff;
  border: 2px solid var(--line);
  color: #4f6796;
  box-shadow: none;
}

.tool-icon-btn svg,
.score-skip-btn svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.score-skip-btn {
  width: auto;
  min-width: 0;
  display: inline-grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  font: inherit;
}

.score-skip-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.replay-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

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

.round-chip,
.last-chip {
  display: none;
}

.score-chip,
.score-skip-btn {
  border: 1px solid #e2e9f4;
  border-radius: 999px;
  background: transparent;
  padding: 6px 6px;
  text-align: center;
  box-shadow: none;
}

.chip-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 900;
  color: #5e6780;
  text-transform: uppercase;
  letter-spacing: 0;
}

.chip-value {
  display: block;
  font-size: 1rem;
  font-weight: 900;
  color: var(--ink);
}

.tries-value {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 2px;
}

.try-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #c8d7f7;
  background: #eef1f5;
}

.try-dot.is-available {
  border-color: var(--green);
  background: var(--green);
}

.outcome-track {
  margin: 2px 0 8px;
  padding: 0 2px 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.outcome-track-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.outcome-track-label {
  font-size: 0.7rem;
  font-weight: 900;
  color: #5e6780;
  text-transform: uppercase;
  letter-spacing: 0;
}

.outcome-track-value {
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--ink);
}

.outcome-track-rail {
  position: relative;
  padding: 2px 0;
}

.outcome-track-rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 999px;
  background: #dde7fb;
}

.outcome-track-fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6ec4ff, #57a8ef);
  transition: width 260ms ease;
}

.outcome-dots {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.outcome-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid #c8d7f7;
  background: #eef1f5;
  transition: transform 0.18s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.outcome-dot.is-correct {
  background: #58d36f;
  border-color: #2ea448;
}

.outcome-dot.is-half {
  background: #ffd95b;
  border-color: #e3b62f;
}

.outcome-dot.is-wrong {
  background: #ff7171;
  border-color: #d74f4f;
}

.outcome-dot.is-filled {
  transform: scale(1.03);
}

.message {
  min-height: 30px;
  margin: 4px 0 8px;
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  color: #1d7b45;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.message.show {
  opacity: 1;
  transform: translateY(0);
}

.question-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 8px 0 0;
  box-shadow: none;
}

.question-prompt {
  display: none;
  margin: 0;
  text-align: center;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  font-weight: 900;
  color: #22457f;
}

.question-grid {
  width: max-content;
  margin: 0 auto;
  display: grid;
  gap: var(--gap);
}

.question-grid.melody-stack {
  width: min(100%, 430px);
  height: 246px;
  display: block;
  position: relative;
}

.melody-stack .question-slot {
  position: absolute;
  left: calc(50% - (var(--tile-size) / 2) + var(--stack-x, 0px));
  bottom: var(--stack-y, 0px);
  z-index: var(--stack-z, 1);
  transform: rotate(var(--stack-rotate, 0deg));
}

.melody-stack .question-card {
  box-shadow: 0 14px 24px rgba(27, 35, 62, 0.13);
}

.melody-stack .question-slot.revealed .question-card {
  transform: rotateY(180deg);
}

.question-grid.slots-3 {
  --tile-size: clamp(118px, 35vw, 150px);
  --gap: 10px;
}

.question-grid.slots-4 {
  --tile-size: clamp(98px, 28vw, 122px);
  --gap: 9px;
}

.question-grid.slots-5 {
  --tile-size: clamp(82px, 23vw, 102px);
  --gap: 8px;
}

.question-slot {
  width: var(--tile-size);
  height: var(--tile-size);
  perspective: 1000px;
  position: relative;
}

.question-card {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  border: 3px dashed #cfd9f6;
  background: #f8fbff;
  box-shadow: none;
  transform-style: preserve-3d;
  transition: transform 0.36s ease;
  position: relative;
}

.question-slot.revealed .question-card {
  transform: rotateY(180deg);
}

.question-slot.playing .question-card {
  border-color: #cfd9f6;
  box-shadow: none;
}

.question-slot.playing .question-face-front {
  animation: questionJiggle 280ms ease;
  color: #40639f;
}

.question-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
}

.question-face-front {
  font-size: 2.1rem;
  font-weight: 900;
  color: #5e75a5;
}

.question-face-back {
  transform: rotateY(180deg);
}

.question-face-back .question-note {
  width: calc(var(--tile-size) - 8px);
  height: calc(var(--tile-size) - 8px);
  border-radius: 16px;
  pointer-events: none;
}

.question-slot.first-note-hint .question-note-hint {
  opacity: 0.5;
  filter: saturate(0.82);
}

.bank-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: calc(var(--dock-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: transparent;
  padding: 8px 10px 10px;
  z-index: 70;
}

.bank-dock::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--dock-bg-height) + env(safe-area-inset-bottom));
  background: #eef1f5;
  box-shadow: none;
  pointer-events: none;
}

.bank-dock-inner,
.bank-area {
  height: 100%;
}

.bank-dock-inner {
  width: min(1020px, 100%);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.bank-area {
  border-radius: 0;
  border: 0;
  background: transparent;
  max-height: calc(var(--dock-height) - 8px);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.bank-area.chromatic-bank-area {
  border-radius: 14px;
  border: 1px solid #cfdcf3;
  background: #ffffff;
  padding: 0 2px 10px;
}

.bank-grid {
  width: max-content;
  margin: 0 auto;
}

.bank-grid.bank-strip {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: var(--bank-note-gap);
  padding: 2px 6px 0;
}

.bank-grid.c-major-strip {
  width: calc((8 * var(--bank-note-size)) + (7 * var(--bank-note-gap)) + 14px);
  margin-top: calc(var(--dock-height) - var(--dock-bg-height) - (var(--bank-note-size) * 0.67));
}

.bank-grid.chromatic-piano {
  width: max-content;
  padding: 10px 4px 12px;
  margin-bottom: 4px;
}

.chromatic-piano-strip {
  position: relative;
  width: calc((var(--white-count) * var(--bank-note-size)) + ((var(--white-count) - 1) * var(--bank-note-gap)));
  padding-top: calc(var(--bank-note-size) * 0.72);
}

.chromatic-white-row {
  display: flex;
  gap: var(--bank-note-gap);
  align-items: flex-end;
}

.chromatic-black-row {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--bank-note-size) * 0.86);
  pointer-events: none;
}

.chromatic-black-wrap {
  position: absolute;
  top: -10px;
  transform: translateX(-50%);
  pointer-events: auto;
  z-index: 4;
}

.chromatic-black-wrap .bank-note {
  width: calc(var(--bank-note-size) * 0.9);
  height: calc(var(--bank-note-size) * 1.18);
  min-width: calc(var(--bank-note-size) * 0.9);
  min-height: calc(var(--bank-note-size) * 1.18);
}

.note {
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: 22px;
  border: 3px solid transparent;
  margin: 0;
  padding: 0;
  background: var(--note-color, #ff7a7a);
  color: #fff;
  font-size: clamp(1.75rem, 4.8vw, 2.2rem);
  font-weight: 900;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  box-shadow: none;
  display: grid;
  place-items: center;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  position: relative;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.note.has-image {
  background: #ffffff;
  border-color: var(--note-color, #8fa3d8);
  color: #20315f;
  text-shadow: none;
}

.bank-note {
  width: var(--bank-note-size);
  height: calc(var(--bank-note-size) * 1.22);
  min-width: var(--bank-note-size);
  min-height: calc(var(--bank-note-size) * 1.22);
  border: 3px solid var(--note-color, #c9d7f5);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: none;
  color: #1f3668;
  font-size: 0.98rem;
  font-weight: 900;
  text-shadow: none;
}

.bank-note .note-art {
  width: 88%;
  height: 82%;
  margin-top: -6px;
  filter: none;
}

.chromatic-white-note .note-art {
  margin-top: -5px;
}

.bank-note .note-label {
  bottom: 8px;
  min-width: 0;
  padding: 0;
  font-size: 0.7rem;
  line-height: 1.2;
  color: #223e75;
  background: transparent;
  border: 0;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.66);
  box-shadow: none;
}

.bank-grid.c-major-strip .bank-note .note-label {
  font-size: 0.82rem;
}

.chromatic-white-note .note-label {
  bottom: 5px;
}

.chromatic-black-note {
  border: 0;
  background: #35425b;
  box-shadow: none;
  color: #eef2ff;
}

.chromatic-black-note .note-label {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.38);
}

.bank-note.chromatic-black-note.has-image {
  border: 0;
  background: #35425b;
  color: #eef2ff;
  box-shadow: none;
}

.bank-note.chromatic-black-note.has-image .note-label,
.bank-note.chromatic-black-note .note-label {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.38);
}

.note-art {
  width: 74%;
  height: 74%;
  object-fit: contain;
  margin-top: -8px;
  pointer-events: none;
  filter: none;
}

.note-label {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  min-width: 36px;
  padding: 1px 4px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #173065;
  background: transparent;
  text-shadow:
    0 1px 1px rgba(255, 255, 255, 0.8),
    0 0 2px rgba(255, 255, 255, 0.6);
  pointer-events: none;
  white-space: nowrap;
}

.note.note-playing,
.bank-note.note-playing {
  transform: translateY(1px) scale(1.03);
  filter: brightness(1.04);
}

.bank-note.first-note-hint-key {
  border-color: #8bcfef;
  box-shadow: 0 0 0 3px rgba(71, 177, 230, 0.2);
}

.bank-note.chromatic-black-note.first-note-hint-key {
  border: 0;
  box-shadow: 0 0 0 3px rgba(71, 177, 230, 0.28);
}

.bank-note.next-hint-key {
  animation: nextHintPulse 680ms ease;
}

.question-slot.hinting .question-card {
  animation: nextHintGlow 680ms ease;
}

.confetti-layer {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confettiDrop 900ms ease forwards;
}

.firework-flash {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.96) 0%, rgba(255, 247, 191, 0.82) 36%, rgba(255, 152, 86, 0.35) 66%, rgba(255, 152, 86, 0) 100%);
  box-shadow:
    0 0 0 2px rgba(255, 213, 136, 0.34),
    0 0 28px rgba(255, 226, 166, 0.7);
  opacity: 0;
  animation: fireworkFlash 820ms ease-out forwards;
}

@keyframes confettiDrop {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--dx, 0px), var(--dy, 120px), 0) rotate(var(--rot, 240deg));
  }
}

@keyframes fireworkFlash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.9);
  }
}

@keyframes questionJiggle {
  0% { transform: translateX(0) rotate(0deg); }
  22% { transform: translateX(-5px) rotate(-4deg); }
  48% { transform: translateX(4px) rotate(3deg); }
  72% { transform: translateX(-2px) rotate(-2deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

@keyframes nextHintPulse {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.06); filter: brightness(1.08); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes nextHintGlow {
  0% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.85); }
  35% {
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.9),
      0 0 0 4px rgba(87, 168, 239, 0.25);
  }
  100% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.85); }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  :root {
    --tile-size: clamp(58px, 15vw, 76px);
    --bank-note-size: 84px;
    --bank-note-gap: 6px;
  }

  .top-ui {
    justify-content: center;
  }

  .toolbar {
    justify-content: center;
  }

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

  .outcome-dot {
    width: 16px;
    height: 16px;
  }

  .question-wrap {
    padding-inline: 4px;
  }
}

@media (max-width: 640px) {
  :root {
    --tile-size: clamp(54px, 17vw, 66px);
    --gap: 8px;
    --bank-note-size: clamp(64px, 19vw, 76px);
    --bank-note-gap: 8px;
    --dock-height: clamp(204px, 31vh, 226px);
    --dock-bg-height: clamp(72px, 12vh, 92px);
  }

  body {
    padding: 0;
  }

  .app {
    border-radius: 20px;
  }

  .screen {
    padding: calc(20px + env(safe-area-inset-top)) 14px calc(var(--dock-height) + env(safe-area-inset-bottom) + 12px);
  }

  .app-title {
    max-width: 100%;
    margin: 0 auto;
  }

  .settings-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    top: calc(66px + env(safe-area-inset-top));
    width: auto;
  }

  .play-center {
    margin: 0;
  }

  .play-circle {
    width: 100%;
    min-height: 64px;
  }

  .score-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .score-chip {
    min-width: 0;
    padding: 6px 4px;
  }

  .score-skip-btn {
    min-height: 52px;
    padding: 6px 4px;
  }

  .chip-label {
    font-size: 0.58rem;
  }

  .chip-value {
    font-size: 0.96rem;
  }

  .outcome-track {
    margin-bottom: 7px;
  }

  .outcome-track-head {
    margin-bottom: 7px;
  }

  .outcome-dot {
    width: 14px;
    height: 14px;
  }

  .message {
    min-height: 26px;
    margin: 3px 0 7px;
    font-size: 0.92rem;
  }

  .question-wrap {
    padding: 8px 0 0;
  }

  .question-grid.slots-3 {
    --tile-size: clamp(116px, 36vw, 130px);
    --gap: 9px;
  }

  .question-grid.melody-stack {
    height: 226px;
  }

  .question-grid.slots-4 {
    --tile-size: clamp(94px, 29vw, 108px);
    --gap: 7px;
  }

  .question-grid.slots-5 {
    --tile-size: clamp(76px, 23vw, 88px);
    --gap: 6px;
  }

  .question-card {
    border-radius: 15px;
  }

  .question-face-front {
    font-size: 1.7rem;
  }

  .setting-row {
    grid-template-columns: 74px 1fr;
    gap: 6px;
  }

  .setting-row-slider {
    grid-template-columns: 74px 1fr 42px;
  }

  .mode-btn {
    min-width: 64px;
    padding-inline: 7px;
    font-size: 0.72rem;
  }

  .bank-grid.c-major-strip .bank-note .note-label {
    font-size: 0.66rem;
  }

  .bank-grid.c-major-strip {
    width: min(100%, calc((4 * var(--bank-note-size)) + (3 * var(--bank-note-gap))));
    margin-top: 0;
    display: grid;
    grid-template-columns: repeat(4, var(--bank-note-size));
    gap: var(--bank-note-gap);
    align-items: end;
    justify-content: center;
    padding: 0;
  }

  .bank-area:not(.chromatic-bank-area) {
    display: grid;
    place-items: center;
    overflow: visible;
    padding-top: 4px;
  }

  .bank-note {
    border-radius: 17px;
  }

  .bank-note .note-art {
    width: 90%;
    height: 84%;
    margin-top: -4px;
  }

  .bank-note .note-label {
    bottom: 4px;
  }

  .bank-area.chromatic-bank-area {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .bank-grid.chromatic-piano {
    padding-top: 8px;
  }
}

@media (max-width: 360px) {
  :root {
    --tile-size: 51px;
    --gap: 6px;
    --bank-note-size: 68px;
    --bank-note-gap: 8px;
  }

  .question-grid.slots-3 {
    --tile-size: 116px;
    --gap: 9px;
  }

  .question-grid.melody-stack {
    height: 218px;
  }

  .question-grid.slots-4 {
    --tile-size: 92px;
    --gap: 7px;
  }

  .question-grid.slots-5 {
    --tile-size: 74px;
    --gap: 6px;
  }

  .app-title {
    font-size: 1.42rem;
  }

  .app-menu-link {
    left: 8px;
    padding-inline: 8px 9px;
  }

  .settings-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --tile-size: clamp(48px, 11vh, 62px);
    --bank-note-size: clamp(52px, 15vh, 68px);
    --dock-height: clamp(132px, 34vh, 166px);
    --dock-bg-height: 52px;
  }

  .screen {
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  .score-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .question-wrap {
    max-width: 520px;
    margin: 0 auto;
  }
}
