:root {
  color-scheme: dark;
  --ink: #f5fbf8;
  --muted: #8ba2a9;
  --muted-strong: #b6c7ca;
  --bg: #061820;
  --bg-deep: #041218;
  --surface: #0b232c;
  --surface-2: #102e37;
  --line: rgba(196, 236, 229, 0.12);
  --lime: #c9f45b;
  --lime-soft: rgba(201, 244, 91, 0.12);
  --cyan: #59e1d2;
  --error: #ff716c;
  --success: #79e69b;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Avenir Next", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 16%, rgba(54, 154, 150, 0.12), transparent 26rem),
    radial-gradient(circle at 15% 78%, rgba(121, 230, 155, 0.06), transparent 24rem),
    var(--bg);
}

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

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(201, 244, 91, 0.46);
  outline-offset: 3px;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  color: #071b25;
  background: var(--lime);
  border-radius: 10px;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  width: min(1180px, calc(100% - 48px));
  height: 96px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
}

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

.brand {
  display: inline-flex;
  padding: 0;
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.maker-credit {
  padding-left: 12px;
  color: #587178;
  border-left: 1px solid var(--line);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.maker-credit a {
  color: var(--muted-strong);
  font-weight: 700;
  text-decoration: none;
}

.maker-credit a:hover,
.maker-credit a:focus-visible {
  color: var(--lime);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.brand-mark {
  display: flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(201, 244, 91, 0.06);
}

.brand-mark i {
  display: block;
  width: 3px;
  height: 12px;
  background: #071b25;
  border-radius: 3px;
}

.brand-mark i:first-child { height: 6px; }
.brand-mark i:last-child { height: 18px; }

.brand > span:last-child {
  display: flex;
  align-items: baseline;
  letter-spacing: -0.04em;
}

.brand strong {
  font-size: 20px;
  font-weight: 800;
}

.brand small {
  color: var(--lime);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-pill {
  display: none;
  padding: 9px 13px;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.has-started .lesson-pill {
  display: inline-flex;
}

.lesson-pill:hover,
.lesson-pill[aria-expanded="true"] {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(201, 244, 91, 0.25);
}

.lesson-pill svg {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}

.lesson-pill[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.lesson-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 54px;
  z-index: 40;
  width: min(330px, calc(100vw - 28px));
  max-height: min(520px, calc(100dvh - 110px));
  padding: 10px;
  background: rgba(10, 35, 43, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  overflow: auto;
  backdrop-filter: blur(18px);
}

.lesson-menu[hidden] {
  display: none;
}

.lesson-menu-header {
  display: flex;
  padding: 9px 10px 12px;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}

.lesson-menu-header strong {
  font-size: 13px;
}

.lesson-menu-header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

#lesson-menu-items {
  display: grid;
  padding-top: 7px;
  gap: 3px;
}

.lesson-option {
  display: grid;
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--muted-strong);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
}

.lesson-option:hover,
.lesson-option.is-current {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
}

.lesson-option.is-current {
  box-shadow: inset 0 0 0 1px rgba(201, 244, 91, 0.16);
}

.lesson-option-index {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--lime);
  background: var(--lime-soft);
  border-radius: 9px;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 11px;
}

.lesson-option-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.lesson-option-copy strong {
  font-size: 12px;
}

.lesson-option-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.lesson-option-score {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 10px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 11px;
  place-items: center;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  transform: rotate(12deg);
}

.view {
  display: none;
}

.view.is-active {
  display: flex;
  animation: view-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.home-view {
  width: min(760px, calc(100% - 48px));
  min-height: calc(100dvh - 96px);
  margin: 0 auto;
  padding: 52px 0 110px;
  align-items: flex-start;
  justify-content: center;
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: 100%;
}

.utility-console {
  padding: clamp(24px, 5vw, 42px);
  background:
    linear-gradient(180deg, rgba(16, 46, 55, 0.88), rgba(8, 29, 37, 0.94));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.utility-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.utility-heading .eyebrow {
  margin: 0;
}

.utility-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.utility-status i {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(121, 230, 155, 0.65);
}

.eyebrow {
  display: flex;
  margin: 0 0 21px;
  align-items: center;
  gap: 9px;
  color: var(--lime);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow > span {
  display: inline-block;
  width: 22px;
  height: 1px;
  background: currentColor;
}

.hero-copy h1 {
  margin: 30px 0 0;
  font-size: clamp(38px, 6vw, 58px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 1;
}

.hero-lead {
  max-width: 590px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.trainer-readout {
  display: grid;
  margin-top: 30px;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.trainer-readout > div {
  display: flex;
  min-width: 0;
  padding: 18px 15px;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.trainer-readout > div:first-child {
  padding-left: 0;
}

.trainer-readout > div:last-child {
  padding-right: 0;
  border-right: 0;
}

.trainer-readout span {
  color: #668087;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.trainer-readout strong {
  margin-top: 7px;
  color: var(--muted-strong);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.hero-actions {
  display: flex;
  margin-top: 28px;
  align-items: center;
  gap: 24px;
}

.primary-button {
  display: inline-flex;
  min-height: 56px;
  padding: 0 22px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: #0c241e;
  background: var(--lime);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(201, 244, 91, 0.13);
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover {
  background: #dcff7f;
  box-shadow: 0 12px 34px rgba(201, 244, 91, 0.2);
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(0) scale(0.985);
}

.primary-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.4;
}

.primary-button.wide {
  width: 100%;
}

.text-button {
  padding: 9px 0;
  color: var(--muted-strong);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.text-button:hover {
  color: var(--lime);
  border-color: var(--lime);
}

.privacy-note {
  display: flex;
  margin-top: 28px;
  align-items: center;
  gap: 9px;
  color: #587178;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 8px;
  letter-spacing: 0.08em;
}

.privacy-note i {
  width: 3px;
  height: 3px;
  background: #587178;
  border-radius: 50%;
}

.hero-visual {
  position: relative;
  display: grid;
  width: min(39vw, 430px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
}

.signal-orbit {
  position: absolute;
  border: 1px solid rgba(121, 230, 155, 0.13);
  border-radius: 50%;
}

.orbit-one { inset: 4%; }
.orbit-two { inset: 21%; border-style: dashed; }

.signal-orbit::before,
.signal-orbit::after {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 14px var(--lime);
  content: "";
}

.orbit-one::before { top: 20%; left: 7%; }
.orbit-one::after { right: 11%; bottom: 16%; }
.orbit-two::before { top: -3px; left: 50%; }
.orbit-two::after { right: 4%; bottom: 28%; background: var(--cyan); }

.signal-core {
  position: relative;
  display: flex;
  width: 50%;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 25px;
  background:
    radial-gradient(circle at center, rgba(201, 244, 91, 0.08), transparent 64%),
    #09222b;
  border: 1px solid rgba(201, 244, 91, 0.18);
  border-radius: 50%;
  box-shadow: 0 0 70px rgba(46, 166, 152, 0.11), inset 0 0 36px rgba(0, 0, 0, 0.25);
}

.signal-core::before {
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: inherit;
  content: "";
}

.signal-core > span {
  color: #66858b;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
}

.wave-bars {
  display: flex;
  height: 64px;
  align-items: center;
  gap: 5px;
}

.wave-bars i {
  display: block;
  width: 4px;
  height: 25%;
  background: var(--lime);
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(201, 244, 91, 0.25);
  animation: signal 1.15s ease-in-out infinite alternate;
}

.wave-bars i:nth-child(2),
.wave-bars i:nth-child(8) { height: 52%; animation-delay: -0.3s; }
.wave-bars i:nth-child(3),
.wave-bars i:nth-child(7) { height: 78%; animation-delay: -0.65s; }
.wave-bars i:nth-child(4),
.wave-bars i:nth-child(6) { height: 43%; animation-delay: -0.85s; }
.wave-bars i:nth-child(5) { height: 100%; animation-delay: -0.15s; }
.wave-bars i:nth-child(9) { animation-delay: -0.5s; }

@keyframes signal {
  to { transform: scaleY(0.45); opacity: 0.7; }
}

.floating-card {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  color: var(--muted-strong);
  background: rgba(10, 35, 43, 0.82);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
}

.floating-card strong {
  color: var(--ink);
}

.floating-card span {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  line-height: 1.35;
  letter-spacing: 0.08em;
}

.card-speed {
  top: 15%;
  right: -2%;
}

.card-speed strong {
  color: var(--lime);
  font-size: 20px;
}

.card-method {
  bottom: 11%;
  left: -2%;
}

.card-method i {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--success);
}

.learn-view {
  width: min(680px, calc(100% - 32px));
  min-height: calc(100dvh - 96px);
  margin: 0 auto;
  padding: 42px 0 90px;
  align-items: center;
  justify-content: center;
}

.learn-card {
  width: 100%;
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
  background: linear-gradient(145deg, rgba(16, 46, 55, 0.92), rgba(8, 29, 37, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.learn-card .eyebrow {
  justify-content: center;
}

.learn-card h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  letter-spacing: -0.05em;
}

.learn-card h1 strong {
  display: inline-block;
  color: var(--lime);
  white-space: nowrap;
}

.learn-card > p:not(.eyebrow) {
  max-width: 460px;
  margin: 16px auto 30px;
  color: var(--muted);
  line-height: 1.6;
}

.tone-stage {
  position: relative;
  display: flex;
  width: min(100%, 320px);
  min-height: 240px;
  margin: 0 auto 28px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(3, 18, 24, 0.68);
  border: 1px solid rgba(201, 244, 91, 0.14);
  border-radius: 24px;
  cursor: pointer;
  overflow: hidden;
}

.tone-stage::before {
  position: absolute;
  width: 180px;
  aspect-ratio: 1;
  background: rgba(201, 244, 91, 0.05);
  border-radius: 50%;
  content: "";
}

.pulse-ring {
  position: absolute;
  width: 120px;
  aspect-ratio: 1;
  border: 1px solid rgba(201, 244, 91, 0.18);
  border-radius: 50%;
}

.tone-stage.is-playing .pulse-ring {
  animation: pulse-ring 1s ease-out infinite;
}

@keyframes pulse-ring {
  to { opacity: 0; transform: scale(1.65); }
}

.tone-letter {
  position: relative;
  color: var(--lime);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 78px;
  font-weight: 500;
  line-height: 1;
}

.tone-caption {
  position: absolute;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.tone-caption svg {
  width: 18px;
  height: 18px;
}

.practice-view {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 calc(80px + var(--safe-bottom));
}

.practice-shell {
  width: 100%;
}

.practice-heading {
  display: flex;
  margin-bottom: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.practice-heading .eyebrow {
  margin-bottom: 10px;
}

.practice-heading h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  letter-spacing: -0.05em;
}

.accuracy-ring {
  --accuracy: 0;
  position: relative;
  display: grid;
  width: 84px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  background: conic-gradient(var(--lime) calc(var(--accuracy) * 1%), rgba(255, 255, 255, 0.08) 0);
  border-radius: 50%;
}

.accuracy-ring::before {
  position: absolute;
  inset: 5px;
  background: var(--bg);
  border-radius: 50%;
  content: "";
}

.accuracy-ring > div {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
}

.accuracy-ring strong {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 17px;
}

.accuracy-ring span {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.player-card,
.answer-card,
.lesson-progress-card {
  background: linear-gradient(145deg, rgba(15, 44, 53, 0.92), rgba(8, 28, 35, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.player-card {
  position: relative;
  display: grid;
  min-height: 132px;
  padding: 24px 28px 27px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  overflow: hidden;
}

.player-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-status > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.player-status strong {
  font-size: 14px;
}

.player-status span:last-child {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.live-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  background: #5b7075;
  border-radius: 50%;
}

.is-playing .live-dot {
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(201, 244, 91, 0.1), 0 0 12px var(--lime);
  animation: live-pulse 1.25s ease-in-out infinite;
}

@keyframes live-pulse {
  50% { opacity: 0.42; }
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.round-button {
  display: grid;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.round-button:active {
  transform: scale(0.95);
}

.round-button.secondary {
  width: 42px;
  height: 42px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.06);
}

.round-button.secondary:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
}

.round-button svg {
  width: 19px;
  height: 19px;
}

.round-button.play {
  width: 66px;
  height: 66px;
  color: #09221c;
  background: var(--lime);
  box-shadow: 0 0 0 8px rgba(201, 244, 91, 0.06);
}

.round-button.play:hover {
  background: #dcff7f;
  transform: scale(1.025);
}

.pause-icon,
.is-playing .play-icon {
  display: none;
}

.is-playing .pause-icon {
  display: block;
}

.block-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.035);
}

.block-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--lime);
  box-shadow: 0 0 10px rgba(201, 244, 91, 0.4);
  transition: width 220ms ease;
}

.answer-card {
  margin-top: 13px;
  padding: 18px 22px 22px;
}

.answer-header {
  display: flex;
  margin-bottom: 15px;
  justify-content: space-between;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.answer-groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.answer-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.answer-cell {
  position: relative;
  display: grid;
  min-width: 0;
  height: 37px;
  place-items: center;
  color: #587077;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 8px;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 16px;
}

.answer-cell.is-current {
  border-color: rgba(201, 244, 91, 0.55);
  box-shadow: inset 0 0 0 1px rgba(201, 244, 91, 0.12);
}

.answer-cell.is-transmitting {
  border-color: rgba(89, 225, 210, 0.82);
  box-shadow: inset 0 0 0 1px rgba(89, 225, 210, 0.22), 0 0 14px rgba(89, 225, 210, 0.12);
}

.answer-cell.is-transmitting::before {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 7px;
  height: 7px;
  background: var(--cyan);
  border: 2px solid #0b2932;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(89, 225, 210, 0.75);
  content: "";
  transform: translateX(-50%);
}

.answer-cell.is-correct {
  color: var(--success);
  background: rgba(121, 230, 155, 0.09);
  border-color: rgba(121, 230, 155, 0.18);
}

.answer-cell.is-wrong {
  color: var(--error);
  background: rgba(255, 113, 108, 0.09);
  border-color: rgba(255, 113, 108, 0.2);
}

.answer-cell small {
  position: absolute;
  right: 2px;
  bottom: -2px;
  color: var(--muted-strong);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 8px;
}

.playback-position-legend {
  margin-top: 12px;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.playback-position-legend:not([hidden]) {
  display: flex;
}

.playback-position-legend span {
  width: 6px;
  height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 7px rgba(89, 225, 210, 0.65);
}

.input-area {
  display: flex;
  margin-top: 18px;
  align-items: stretch;
  gap: 12px;
}

.character-pad {
  display: grid;
  min-width: 0;
  flex: 1;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 10px;
}

.character-key {
  position: relative;
  min-height: 74px;
  padding: 6px;
  color: var(--ink);
  background: linear-gradient(145deg, #173d45, #0d2c35);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-bottom-color: rgba(0, 0, 0, 0.45);
  border-radius: 15px;
  box-shadow: 0 5px 0 #06171d, 0 10px 24px rgba(0, 0, 0, 0.16);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 28px;
  cursor: pointer;
  transition: transform 90ms ease, background 140ms ease, border-color 140ms ease;
}

.character-key:hover {
  background: linear-gradient(145deg, #1d4a52, #11353d);
  border-color: rgba(201, 244, 91, 0.26);
}

.character-key:active {
  box-shadow: 0 2px 0 #06171d;
  transform: translateY(3px);
}

.skip-button {
  display: flex;
  min-width: 125px;
  padding: 10px 15px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.035);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 15px;
  cursor: pointer;
}

.skip-button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.skip-button.is-catching-up {
  color: var(--cyan);
  background: rgba(89, 225, 210, 0.06);
  border-color: rgba(89, 225, 210, 0.35);
}

.skip-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.skip-button svg {
  width: 21px;
  height: 21px;
}

.skip-button span {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
}

.skip-button strong { font-size: 12px; }
.skip-button small { color: var(--muted); font-size: 9px; }

.lesson-progress-card {
  display: grid;
  margin-top: 26px;
  padding: 18px 20px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px 20px;
}

.lesson-progress-card > div:first-child {
  display: flex;
  flex-direction: column;
}

.lesson-progress-card > div:first-child span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.lesson-progress-card > div:first-child strong {
  margin-top: 3px;
  font-size: 13px;
}

.lesson-progress-track {
  height: 5px;
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  overflow: hidden;
}

.lesson-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--lime);
  border-radius: inherit;
  transition: width 300ms ease;
}

.next-lesson-button {
  display: inline-flex;
  min-height: 39px;
  padding: 0 14px;
  align-items: center;
  gap: 8px;
  color: #09221c;
  background: var(--lime);
  border: 0;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.next-lesson-button:disabled {
  color: #789097;
  background: rgba(255, 255, 255, 0.06);
  cursor: not-allowed;
}

.next-lesson-button svg {
  width: 15px;
  height: 15px;
}

.sheet {
  width: min(560px, calc(100% - 30px));
  max-height: calc(100dvh - 30px);
  padding: 0;
  color: var(--ink);
  background: #0b252e;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 26px;
  box-shadow: var(--shadow);
  overflow: auto;
}

.sheet::backdrop {
  background: rgba(0, 8, 12, 0.72);
  backdrop-filter: blur(7px);
}

.sheet[open] {
  animation: dialog-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sheet form {
  position: relative;
  padding: 38px;
}

.sheet-handle {
  display: none;
}

.sheet-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 38px;
  height: 38px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.055);
  border: 0;
  border-radius: 50%;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.sheet h2 {
  max-width: 380px;
  margin: 0 0 28px;
  font-size: 31px;
  letter-spacing: -0.045em;
}

.steps {
  display: grid;
  margin: 0 0 30px;
  padding: 0;
  gap: 20px;
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 13px;
}

.steps li > strong {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--lime);
  background: var(--lime-soft);
  border-radius: 12px;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
}

.steps li span {
  display: flex;
  color: var(--muted);
  flex-direction: column;
  font-size: 13px;
  line-height: 1.55;
}

.steps li b {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 14px;
}

.range-setting {
  display: block;
  margin-top: 24px;
}

.range-setting > span {
  display: flex;
  margin-bottom: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.range-setting b {
  font-size: 13px;
}

.range-setting output {
  color: var(--lime);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.range-setting input {
  width: 100%;
  height: 4px;
  margin: 6px 0 10px;
  accent-color: var(--lime);
}

.range-setting small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.toggle-setting {
  position: relative;
  display: flex;
  margin-top: 26px;
  padding: 15px 0;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  cursor: pointer;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.toggle-setting > span {
  display: flex;
  flex-direction: column;
}

.toggle-setting b {
  font-size: 13px;
}

.toggle-setting small {
  max-width: 310px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.toggle-setting input {
  position: absolute;
  right: 0;
  z-index: 1;
  width: 43px;
  height: 24px;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.toggle-setting i {
  position: relative;
  width: 43px;
  height: 24px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 99px;
  transition: background 160ms ease, border-color 160ms ease;
}

.toggle-setting i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--muted-strong);
  border-radius: 50%;
  content: "";
  transition: background 160ms ease, transform 160ms ease;
}

.toggle-setting input:checked + i {
  background: rgba(89, 225, 210, 0.18);
  border-color: rgba(89, 225, 210, 0.48);
}

.toggle-setting input:checked + i::after {
  background: var(--cyan);
  transform: translateX(19px);
}

.toggle-setting input:focus-visible + i {
  outline: 3px solid rgba(201, 244, 91, 0.46);
  outline-offset: 3px;
}

.settings-actions {
  display: flex;
  margin-top: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.danger-zone {
  display: flex;
  margin-top: 32px;
  padding-top: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid rgba(255, 113, 108, 0.16);
}

.danger-zone > div {
  display: flex;
  flex-direction: column;
}

.danger-zone strong {
  font-size: 12px;
}

.danger-zone span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.danger-zone button,
.danger-button {
  min-height: 40px;
  padding: 0 13px;
  flex: 0 0 auto;
  color: #ffaaa6;
  background: rgba(255, 113, 108, 0.08);
  border: 1px solid rgba(255, 113, 108, 0.24);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.danger-zone button:hover,
.danger-button:hover {
  color: #fff;
  background: rgba(255, 113, 108, 0.18);
}

.danger-eyebrow {
  color: var(--error);
}

.confirm-copy {
  margin: -12px 0 28px;
  color: var(--muted-strong);
  font-size: 13px;
  line-height: 1.65;
}

.confirm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
}

.danger-button {
  min-height: 48px;
  padding: 0 17px;
  color: #190909;
  background: var(--error);
  border: 0;
  font-size: 12px;
}

.danger-button:hover {
  color: #190909;
  background: #ff928e;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--safe-bottom));
  z-index: 80;
  max-width: calc(100% - 40px);
  padding: 12px 16px;
  color: var(--ink);
  background: #173941;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .home-view {
    padding-top: 26px;
    justify-content: center;
  }

  .player-card {
    grid-template-columns: 1fr auto;
  }

  .player-status {
    grid-column: 1;
  }

  .player-controls {
    grid-column: 2;
  }
}

@media (max-width: 600px) {
  .topbar {
    width: calc(100% - 28px);
    height: 72px;
  }

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

  .brand strong {
    font-size: 18px;
  }

  .brand-lockup {
    position: relative;
  }

  .maker-credit {
    position: absolute;
    top: 29px;
    left: 45px;
    padding: 0;
    border: 0;
    font-size: 7px;
  }

  .lesson-pill {
    max-width: 120px;
    padding: 7px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lesson-menu {
    position: fixed;
    top: 66px;
    right: 14px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
    padding: 10px;
  }

  .home-view {
    width: calc(100% - 34px);
    min-height: calc(100dvh - 72px);
    padding: 26px 0 calc(40px + var(--safe-bottom));
    align-items: flex-start;
  }

  .utility-console {
    padding: 22px 19px;
    border-radius: 18px;
  }

  .hero-copy h1 {
    margin-top: 25px;
    font-size: 42px;
    line-height: 1;
  }

  .hero-lead {
    margin-top: 12px;
    font-size: 13px;
  }

  .trainer-readout {
    margin-top: 24px;
    grid-template-columns: repeat(2, 1fr);
  }

  .trainer-readout > div,
  .trainer-readout > div:first-child,
  .trainer-readout > div:last-child {
    padding: 14px 10px;
  }

  .trainer-readout > div:nth-child(2) {
    border-right: 0;
  }

  .trainer-readout > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .hero-actions {
    margin-top: 24px;
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .hero-actions .primary-button {
    width: 100%;
  }

  .hero-actions .text-button {
    align-self: center;
  }

  .privacy-note {
    margin-top: 22px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .learn-view {
    min-height: calc(100dvh - 72px);
    padding: 20px 0 calc(50px + var(--safe-bottom));
  }

  .learn-card {
    padding: 28px 20px 22px;
    border-radius: 22px;
  }

  .learn-card h1 {
    font-size: 31px;
  }

  .tone-stage {
    min-height: 220px;
  }

  .practice-view {
    width: calc(100% - 24px);
    padding: 14px 0 calc(42px + var(--safe-bottom));
  }

  .practice-heading {
    margin-bottom: 16px;
  }

  .practice-heading h1 {
    font-size: 29px;
  }

  .practice-heading .eyebrow {
    margin-bottom: 7px;
  }

  .accuracy-ring {
    width: 72px;
  }

  .player-card {
    min-height: 168px;
    padding: 18px 18px 23px;
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .player-status {
    grid-column: 1;
    justify-self: center;
  }

  .player-controls {
    grid-column: 1;
  }

  .round-button.play {
    width: 62px;
    height: 62px;
  }

  .answer-card {
    padding: 16px 12px 17px;
  }

  .answer-groups {
    gap: 8px;
  }

  .answer-group {
    gap: 3px;
  }

  .answer-cell {
    height: 36px;
    border-radius: 7px;
    font-size: 14px;
  }

  .input-area {
    flex-direction: column;
  }

  .character-pad {
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  }

  .character-key {
    min-height: 68px;
    font-size: 25px;
  }

  .skip-button {
    min-height: 52px;
  }

  .skip-button span {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .lesson-progress-card {
    margin-top: 20px;
    grid-template-columns: 1fr;
  }

  .next-lesson-button {
    width: 100%;
    justify-content: center;
  }

  .sheet {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 18px);
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
  }

  .sheet[open] {
    animation-name: sheet-in;
  }

  @keyframes sheet-in {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
  }

  .sheet form {
    padding: 35px 22px calc(24px + var(--safe-bottom));
  }

  .sheet-handle {
    position: absolute;
    top: 9px;
    left: 50%;
    display: block;
    width: 42px;
    height: 4px;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 3px;
    transform: translateX(-50%);
  }

  .sheet-close {
    top: 21px;
    right: 18px;
  }

  .danger-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .danger-zone button {
    width: 100%;
  }

  .confirm-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .confirm-actions .text-button,
  .confirm-actions .danger-button {
    width: 100%;
  }
}

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