:root {
  --ink: #17324D;
  --blue: #4E74F9;
  --coral: #FF6B5E;
  --mint: #34B89A;
  --mist: #EEF5FF;
  --white: #FFFFFF;
  --line: #D6E2F2;
  --shadow: 0 18px 48px rgba(23, 50, 77, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--mist);
  color: var(--ink);
}

body {
  margin: 0;
  min-width: 0;
  font-family: "Avenir Next", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 8% 4%, rgba(78, 116, 249, 0.10), transparent 24rem),
    linear-gradient(180deg, #F8FBFF 0, var(--mist) 30rem);
}

button {
  font: inherit;
  color: inherit;
}

.page-shell {
  width: min(100% - 32px, 880px);
  margin: 0 auto;
  padding: 64px 0 40px;
}

.hero {
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 700px;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h1 span {
  display: block;
  margin-bottom: 9px;
  color: var(--coral);
  font-size: 0.38em;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.intro {
  margin: 20px 0 24px;
  font-size: 18px;
}

.playback-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px 10px 18px;
  color: var(--white);
  background: var(--ink);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(23, 50, 77, 0.18);
}

.playback-bar p {
  margin: 0;
  overflow-wrap: anywhere;
}

.status-dot {
  width: 9px;
  height: 9px;
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(255, 107, 94, 0.18);
}

#stop-button {
  min-height: 44px;
  padding: 0 16px;
  color: var(--white);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  cursor: pointer;
}

#stop-button:disabled {
  opacity: 0.38;
  cursor: default;
}

.lesson-list {
  display: grid;
  gap: 18px;
}

.lesson-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 72px 1fr;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.sequence {
  grid-row: 1 / 3;
  display: grid;
  place-items: start center;
  padding-top: 25px;
  color: var(--blue);
  font: 800 15px/1 "SFMono-Regular", Menlo, monospace;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(78, 116, 249, 0.06), transparent 70%);
}

.audio-trigger {
  position: relative;
  min-height: 44px;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.audio-trigger:hover {
  background: rgba(78, 116, 249, 0.055);
}

.audio-trigger:active {
  transform: scale(0.995);
}

.audio-trigger:focus-visible {
  z-index: 2;
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}

.word-track {
  min-height: 112px;
  border-bottom: 1px solid var(--line);
}

.track-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 50%;
}

.speaker {
  width: 22px;
  height: 22px;
}

.speaker svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.wave {
  display: none;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.wave i {
  width: 3px;
  height: 6px;
  background: currentColor;
  border-radius: 99px;
  animation: wave 680ms ease-in-out infinite alternate;
}

.wave i:nth-child(2) {
  animation-delay: -220ms;
}

.wave i:nth-child(3) {
  animation-delay: -440ms;
}

.word-copy,
.sentence-copy {
  display: grid;
  gap: 8px;
}

.word {
  font-family: "Avenir Next Rounded", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.word-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.ipa {
  color: var(--blue);
  font-family: "SFMono-Regular", Menlo, monospace;
}

.part {
  color: #60758B;
  font-weight: 700;
}

.meaning {
  font-weight: 600;
}

.track-label {
  color: #6D8196;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sentence {
  font-size: clamp(18px, 2.5vw, 22px);
  line-height: 1.45;
}

.track-message {
  grid-column: 2;
  min-height: 0;
  color: #B42318;
  font-size: 13px;
}

.is-loading .speaker {
  opacity: 0.45;
}

.is-playing {
  color: var(--ink);
  background: rgba(255, 107, 94, 0.095);
}

.is-playing .track-icon {
  color: var(--white);
  background: var(--coral);
  border-color: var(--coral);
}

.is-playing .speaker {
  display: none;
}

.is-playing .wave {
  display: flex;
}

.is-complete .track-icon {
  color: var(--white);
  background: var(--mint);
  border-color: var(--mint);
}

.has-error {
  background: #FFF4F2;
}

footer {
  padding: 28px 0 0;
  color: #6D8196;
  text-align: center;
  font-size: 13px;
}

@keyframes wave {
  from { height: 5px; }
  to { height: 17px; }
}

@media (max-width: 480px) {
  .page-shell {
    width: min(100% - 20px, 880px);
    padding-top: 34px;
  }

  .playback-bar {
    grid-template-columns: auto 1fr;
    border-radius: 16px;
  }

  #stop-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .lesson-card {
    grid-template-columns: 48px 1fr;
    border-radius: 17px;
  }

  .sequence {
    padding-top: 22px;
    font-size: 12px;
  }

  .audio-trigger {
    gap: 12px;
    padding: 18px 14px;
  }

  .track-icon {
    width: 40px;
    height: 40px;
  }

  .word {
    font-size: 30px;
  }

  .sentence {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }

  .wave i {
    height: 10px;
  }
}
