@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #173b36;
  --ink-soft: #31524d;
  --forest: #145047;
  --forest-deep: #0d3933;
  --mint: #dceba2;
  --mint-soft: #eef4d5;
  --cream: #f4f1ea;
  --paper: #fffdf9;
  --paper-warm: #fbf9f4;
  --line: #e4e2da;
  --line-dark: #d4d4c9;
  --muted: #8b928d;
  --muted-deep: #69736e;
  --coral: #d78367;
  --coral-soft: #f6e4da;
  --blue: #7195a2;
  --shadow: 0 24px 70px rgba(35, 54, 48, 0.07);
  --small-shadow: 0 8px 22px rgba(35, 54, 48, 0.06);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 11px;
  --mono: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
  --sans: 'Manrope', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
input[type='range'] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(113, 149, 162, 0.35);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  min-height: 100vh;
  overflow: hidden;
}

.topbar {
  height: 76px;
  padding: 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 59, 54, 0.08);
  background: rgba(250, 248, 242, 0.92);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  padding: 8px 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 12px;
  background: var(--forest);
  transform: rotate(-8deg);
  box-shadow: 4px 5px 0 rgba(23, 59, 54, 0.1);
}

.brand-mark span {
  width: 3px;
  border-radius: 4px;
  background: var(--mint);
  transform: rotate(8deg);
}

.brand-mark span:nth-child(1) { height: 8px; }
.brand-mark span:nth-child(2) { height: 15px; }
.brand-mark span:nth-child(3) { height: 11px; }

.brand-copy {
  display: grid;
  gap: 0;
}

.brand-copy strong {
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.brand-copy small,
.eyebrow,
.control-label,
.audio-status,
.tiny-key,
.difficulty-badge,
.muted-count,
.sentence-length,
.lesson-tag,
.sentence-queue small,
.result-summary p,
.answer-topline,
.diff-line > span,
.diff-legend,
.typing-footer,
.card-kicker,
.detail-grid span,
.dialog-note {
  font-family: var(--mono);
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.13em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.save-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-deep);
  font-family: var(--mono);
  font-size: 10px;
}

.save-pill i {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: #9cbf79;
  box-shadow: 0 0 0 4px rgba(156, 191, 121, 0.14);
}

.icon-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  background: transparent;
  color: var(--muted-deep);
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 16px;
  transition: 160ms ease;
}

.icon-button:hover {
  border-color: var(--forest);
  color: var(--forest);
  background: var(--mint-soft);
}

.app-grid {
  width: min(1680px, 100%);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 274px minmax(550px, 1fr) 320px;
  align-items: start;
}

.library-panel,
.insights-panel {
  min-height: calc(100vh - 76px);
  padding: 34px 22px 28px;
}

.library-panel {
  border-right: 1px solid rgba(23, 59, 54, 0.08);
  background: #f8f6f0;
}

.insights-panel {
  border-left: 1px solid rgba(23, 59, 54, 0.08);
  background: #f8f6f0;
}

.practice-panel {
  min-width: 0;
  padding: 42px clamp(26px, 4vw, 68px) 48px;
  background: var(--cream);
}

.library-intro {
  padding: 2px 4px 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.11em;
  line-height: 1.4;
  text-transform: uppercase;
}

.library-intro h1 {
  max-width: 230px;
  margin: 14px 0 10px;
  color: var(--forest-deep);
  font-size: 29px;
  line-height: 1.18;
  letter-spacing: -0.06em;
}

.library-intro h1 em {
  color: var(--coral);
  font-style: normal;
}

.library-intro p {
  max-width: 222px;
  margin: 0;
  color: var(--muted-deep);
  font-size: 12px;
  line-height: 1.75;
}

.library-tools {
  padding: 0 0 14px;
}

.search-box {
  height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 249, 0.85);
  transition: 160ms ease;
}

.search-box:focus-within {
  border-color: rgba(20, 80, 71, 0.45);
  box-shadow: 0 0 0 3px rgba(20, 80, 71, 0.06);
}

.search-box svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.search-box input::placeholder,
textarea::placeholder {
  color: #a1a6a0;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 13px;
}

.filter-tab {
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  transition: 160ms ease;
}

.filter-tab:hover,
.filter-tab.active {
  color: var(--forest);
  background: var(--mint-soft);
}

.lesson-list {
  min-height: 240px;
  display: grid;
  gap: 7px;
}

.lesson-item {
  position: relative;
  width: 100%;
  padding: 12px 12px 11px;
  display: block;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 180ms ease;
}

.lesson-item:hover {
  border-color: var(--line);
  background: rgba(255, 253, 249, 0.72);
}

.lesson-item.active {
  border-color: rgba(20, 80, 71, 0.16);
  background: var(--paper);
  box-shadow: var(--small-shadow);
}

.lesson-item.unavailable {
  opacity: 0.72;
}

.lesson-item.active::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--coral);
  content: '';
}

.lesson-item-top,
.lesson-item-bottom,
.card-title-row,
.player-topline,
.progress-caption,
.sentence-heading,
.answer-topline,
.dialog-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lesson-item-top {
  align-items: flex-start;
}

.lesson-item h3 {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.lesson-item p {
  overflow: hidden;
  margin: 3px 0 10px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-item-bottom {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.lesson-item-progress {
  width: 47px;
  height: 3px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--line);
}

.lesson-item-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
}

.lesson-item-check {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.lesson-item-check.done {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--mint);
}

.empty-state {
  padding: 24px 9px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.library-footnote {
  margin: 27px 4px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.7;
}

.tiny-key {
  padding: 2px 4px;
  border: 1px solid var(--line-dark);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--muted-deep);
  font-size: 8px;
}

.practice-header {
  max-width: 980px;
  margin: 0 auto 26px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.practice-header h2 {
  margin: 9px 0 2px;
  color: var(--forest-deep);
  font-size: clamp(22px, 2.4vw, 31px);
  line-height: 1.18;
  letter-spacing: -0.055em;
}

.practice-header p {
  margin: 0;
  color: var(--muted-deep);
  font-size: 12px;
}

.eyebrow-dot {
  width: 5px;
  height: 5px;
  display: inline-block;
  border-radius: 50%;
  background: var(--coral);
}

.header-progress {
  width: 150px;
  flex: none;
  padding-bottom: 1px;
}

.progress-caption {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.progress-caption strong {
  color: var(--forest);
  font-weight: 500;
}

.progress-track,
.mini-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 20px;
  background: #e4e4db;
}

.progress-track {
  margin-top: 8px;
}

.progress-track i,
.mini-progress i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), #e6ac7b);
  transition: width 280ms ease;
}

.header-progress small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.player-card,
.sentence-card {
  max-width: 980px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.player-card {
  padding: 20px 23px 18px;
}

.player-topline {
  min-height: 24px;
}

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

.audio-status {
  color: var(--muted);
  font-size: 9px;
}

.audio-pulse {
  height: 15px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.audio-pulse i {
  width: 2px;
  display: block;
  border-radius: 4px;
  background: var(--coral);
  animation: pulse 1.2s ease-in-out infinite;
}

.audio-pulse i:nth-child(1) { height: 6px; animation-delay: -0.3s; }
.audio-pulse i:nth-child(2) { height: 12px; animation-delay: -0.1s; }
.audio-pulse i:nth-child(3) { height: 8px; animation-delay: -0.5s; }
.audio-pulse i:nth-child(4) { height: 14px; animation-delay: -0.7s; }

.audio-pulse.paused i {
  animation-play-state: paused;
  opacity: 0.55;
}

@keyframes pulse {
  0%, 100% { transform: scaleY(0.7); }
  50% { transform: scaleY(1.15); }
}

.text-button,
.link-button,
.queue-expand,
.answer-topline button,
.note-save,
.nav-sentence-button,
.small-action,
.round-control,
.tool-button,
.speed-options button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.text-button {
  padding: 4px 0;
  color: var(--muted-deep);
  font-family: var(--mono);
  font-size: 10px;
}

.text-button:hover,
.link-button:hover,
.queue-expand:hover,
.answer-topline button:hover {
  color: var(--forest);
}

.waveform {
  width: 100%;
  height: 73px;
  margin: 15px 0 6px;
  padding: 14px 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  border: 0;
  border-radius: 11px;
  background: var(--mint-soft);
  cursor: pointer;
}

.wave-bar {
  min-width: 2px;
  flex: 1;
  border-radius: 8px;
  background: #bdd080;
  opacity: 0.78;
  transition: background 120ms ease, opacity 120ms ease;
}

.wave-bar.played {
  background: var(--forest);
  opacity: 0.9;
}

.time-row {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.time-row input[type='range'] {
  width: 100%;
}

input[type='range'] {
  height: 4px;
  margin: 0;
  accent-color: var(--forest);
  cursor: pointer;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 10px;
  background: #dfe4ca;
}

input[type='range']::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4px;
  appearance: none;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--forest);
  box-shadow: 0 1px 4px rgba(20, 80, 71, 0.3);
}

.player-controls {
  min-height: 40px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.round-control {
  width: 29px;
  height: 29px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted-deep);
  font-family: var(--mono);
  font-size: 9px;
  transition: 160ms ease;
}

.round-control:hover {
  border-color: var(--forest);
  color: var(--forest);
  background: var(--mint-soft);
}

.play-button {
  width: 43px;
  height: 43px;
  display: inline-grid;
  place-items: center;
  padding-left: 2px;
  border: 0;
  border-radius: 50%;
  background: var(--forest);
  color: var(--mint);
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(20, 80, 71, 0.2);
  font-size: 15px;
  transition: 160ms ease;
}

.play-button:hover {
  background: var(--forest-deep);
  transform: translateY(-1px);
}

.play-button.is-playing {
  padding-left: 0;
  font-size: 12px;
}

.control-divider {
  width: 1px;
  height: 25px;
  margin: 0 7px;
  background: var(--line);
}

.control-label {
  color: var(--muted);
  font-size: 9px;
}

.speed-options {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: #f0f1e9;
}

.speed-options button {
  min-width: 34px;
  padding: 4px 5px;
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  transition: 140ms ease;
}

.speed-options button:hover,
.speed-options button.active {
  background: var(--paper);
  color: var(--forest);
  box-shadow: 0 2px 5px rgba(35, 54, 48, 0.08);
}

.tool-button {
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  transition: 150ms ease;
}

.tool-button:hover,
.tool-button.active {
  color: var(--forest);
  background: var(--mint-soft);
}

.tool-button.active span {
  color: var(--coral);
}

.sentence-card {
  margin-top: 18px;
  padding: 26px 29px 22px;
}

.sentence-heading {
  align-items: flex-start;
}

.sentence-heading-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 8px;
}

.sentence-number {
  color: var(--coral);
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.08em;
}

.section-name {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.sentence-length {
  color: var(--muted);
  font-size: 9px;
}

.sentence-actions {
  display: flex;
  gap: 5px;
}

.small-action {
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  transition: 150ms ease;
}

.small-action:hover,
.small-action[aria-pressed='true'] {
  color: var(--coral);
  background: var(--coral-soft);
}

.sentence-prompt {
  margin: 25px 0 17px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.listen-orb {
  width: 45px;
  height: 45px;
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--mint-soft);
}

.listen-orb::before,
.listen-orb::after {
  position: absolute;
  border: 1px solid #bfd17f;
  border-radius: 50%;
  content: '';
}

.listen-orb::before { inset: 8px; }
.listen-orb::after { inset: 13px; border-color: #9eb56a; }
.listen-orb span,
.listen-orb i,
.listen-orb b { position: absolute; width: 3px; border-radius: 3px; background: var(--forest); content: ''; }
.listen-orb span { height: 14px; transform: translateX(-7px); }
.listen-orb i { height: 20px; }
.listen-orb b { height: 10px; transform: translateX(7px); }

.sentence-prompt h3 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: -0.025em;
}

.sentence-prompt p {
  margin: 0;
  color: var(--muted-deep);
  font-size: 11px;
}

#dictationInput,
#noteInput {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: var(--paper-warm);
  color: var(--ink);
  line-height: 1.8;
  transition: 160ms ease;
}

#dictationInput {
  min-height: 136px;
  padding: 15px 17px;
  font-size: 14px;
}

#noteInput {
  min-height: 77px;
  padding: 10px 12px;
  font-size: 11px;
}

#dictationInput:focus,
#noteInput:focus {
  border-color: rgba(20, 80, 71, 0.45);
  background: #fffefa;
  box-shadow: 0 0 0 4px rgba(20, 80, 71, 0.05);
}

.typing-footer {
  min-height: 42px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 9px;
}

.typing-actions {
  display: flex;
  gap: 7px;
}

.button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: 160ms ease;
}

.button-primary {
  background: var(--forest);
  color: var(--mint);
  box-shadow: 0 4px 10px rgba(20, 80, 71, 0.12);
}

.button-primary:hover {
  background: var(--forest-deep);
  transform: translateY(-1px);
}

.button-secondary {
  border-color: var(--line-dark);
  background: transparent;
  color: var(--muted-deep);
}

.button-secondary:hover {
  border-color: var(--forest);
  color: var(--forest);
  background: var(--mint-soft);
}

.hidden {
  display: none !important;
}

.result-panel {
  margin-top: 17px;
  padding: 16px;
  border: 1px solid #e8e6da;
  border-radius: 12px;
  background: #fbf8ed;
}

.result-summary {
  display: flex;
  align-items: center;
  gap: 13px;
}

.score-circle {
  width: 57px;
  height: 57px;
  flex: none;
  display: grid;
  place-content: center;
  border: 3px solid var(--mint);
  border-radius: 50%;
  background: var(--paper);
  text-align: center;
}

.score-circle strong {
  color: var(--forest);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1;
}

.score-circle span {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
}

.result-summary h4 {
  margin: 3px 0 2px;
  color: var(--ink);
  font-size: 12px;
}

.result-summary p {
  margin: 0;
  color: var(--muted-deep);
  font-size: 9px;
  line-height: 1.6;
}

.diff-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-dark);
}

.diff-line {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 9px;
  align-items: start;
  margin: 8px 0;
}

.diff-line > span {
  padding-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.diff-line p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.9;
}

.diff-token {
  padding: 1px 3px;
  border-radius: 4px;
}

.diff-token.match { background: #e8f0cc; color: #31604f; }
.diff-token.wrong { background: #fae4dc; color: #a94e37; text-decoration: underline; text-decoration-style: wavy; }
.diff-token.missing { background: #e5edf0; color: #537985; text-decoration: underline; text-decoration-style: dotted; }

.diff-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 8px;
}

.diff-legend i {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-left: 6px;
  border-radius: 2px;
}

.diff-legend i.match { margin-left: 0; background: #c9d99a; }
.diff-legend i.wrong { background: #efb7a4; }
.diff-legend i.missing { background: #bbd0d6; }

.answer-panel {
  margin-top: 13px;
  padding: 15px 16px 16px;
  border: 1px solid #dfe7c3;
  border-radius: 12px;
  background: var(--mint-soft);
}

.answer-topline {
  color: var(--forest);
  font-family: var(--mono);
  font-size: 9px;
}

.answer-topline button {
  padding: 0;
  color: var(--muted-deep);
  font-family: var(--mono);
  font-size: 9px;
}

.answer-mark {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--mint);
  font-size: 8px;
}

.answer-panel p {
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.8;
}

.sentence-navigation {
  max-width: 980px;
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: 135px 1fr 135px;
  align-items: center;
  gap: 15px;
}

.nav-sentence-button {
  min-width: 0;
  padding: 7px 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  text-align: left;
  transition: 150ms ease;
}

.nav-sentence-button.next {
  justify-content: flex-end;
  text-align: right;
}

.nav-sentence-button > span:first-child:not(:only-child) {
  font-size: 19px;
}

.nav-sentence-button:hover:not(:disabled) {
  color: var(--forest);
  transform: translateX(-2px);
}

.nav-sentence-button.next:hover:not(:disabled) {
  transform: translateX(2px);
}

.nav-sentence-button small,
.nav-sentence-button strong {
  display: block;
}

.nav-sentence-button small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.nav-sentence-button strong {
  max-width: 104px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sentence-dots {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.sentence-dot {
  width: 5px;
  height: 5px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d4d7cc;
  cursor: pointer;
  transition: 160ms ease;
}

.sentence-dot.done { background: #9eb56a; }
.sentence-dot.active { width: 18px; border-radius: 5px; background: var(--coral); }
.sentence-dot:hover { transform: scale(1.4); }

.stats-card,
.lesson-info-card,
.queue-card,
.note-card {
  margin-bottom: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--small-shadow);
}

.card-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.spark {
  color: var(--coral);
  font-size: 15px;
}

.stats-grid {
  margin: 16px 0 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.stats-grid div {
  padding-right: 6px;
  border-right: 1px solid var(--line);
}

.stats-grid div:last-child {
  border-right: 0;
}

.stats-grid strong,
.stats-grid span {
  display: block;
}

.stats-grid strong {
  color: var(--forest);
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.08em;
}

.stats-grid span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.mini-progress {
  height: 4px;
}

.lesson-info-card p {
  margin: 11px 0 13px;
  color: var(--muted-deep);
  font-size: 11px;
  line-height: 1.7;
}

.card-title-row h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: -0.025em;
}

.difficulty-badge {
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--mint-soft);
  color: var(--forest);
  font-size: 8px;
}

.tag-row {
  min-height: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.lesson-tag {
  padding: 4px 6px;
  border-radius: 5px;
  background: #f1f0e9;
  color: var(--muted-deep);
  font-size: 8px;
}

.detail-grid {
  margin-top: 16px;
  padding-top: 13px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  border-top: 1px solid var(--line);
}

.detail-grid span,
.detail-grid strong {
  display: block;
}

.detail-grid span {
  color: var(--muted);
  font-size: 8px;
}

.detail-grid strong {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

.link-button {
  margin-top: 15px;
  padding: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.queue-card {
  padding-bottom: 12px;
}

.muted-count {
  color: var(--muted);
  font-size: 9px;
}

.sentence-queue {
  margin: 13px -5px 0;
  display: grid;
  gap: 2px;
}

.queue-item {
  width: 100%;
  min-width: 0;
  padding: 7px 7px;
  display: grid;
  grid-template-columns: 23px 1fr 17px;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-deep);
  cursor: pointer;
  text-align: left;
  transition: 150ms ease;
}

.queue-item:hover,
.queue-item.active {
  background: var(--mint-soft);
  color: var(--forest);
}

.queue-item-number {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.queue-item.active .queue-item-number {
  color: var(--coral);
}

.queue-item-label {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item-status {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.queue-item.done .queue-item-status { color: var(--forest); }
.queue-item.difficult .queue-item-status { color: var(--coral); }

.queue-expand {
  width: 100%;
  margin-top: 6px;
  padding: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
}

.queue-expand:hover {
  background: #f5f4ed;
}

.note-icon {
  color: var(--coral);
  font-size: 14px;
}

.note-save {
  margin-top: 8px;
  padding: 0;
  color: var(--forest);
  font-family: var(--mono);
  font-size: 9px;
}

.note-save:hover {
  color: var(--coral);
}

.coach-tip-card {
  padding: 12px 13px;
  display: flex;
  gap: 10px;
  border: 1px dashed #cfd5b5;
  border-radius: var(--radius-lg);
  background: var(--mint-soft);
}

.tip-symbol {
  color: var(--coral);
  font-size: 18px;
  line-height: 1;
}

.coach-tip-card strong {
  color: var(--forest);
  font-size: 10px;
}

.coach-tip-card p {
  margin: 3px 0 0;
  color: var(--muted-deep);
  font-size: 10px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(310px, calc(100vw - 48px));
  padding: 10px 13px;
  border: 1px solid rgba(20, 80, 71, 0.15);
  border-radius: 9px;
  background: var(--forest);
  color: var(--mint);
  box-shadow: 0 12px 28px rgba(20, 80, 71, 0.2);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: 180ms ease;
}

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

.help-dialog {
  width: min(470px, calc(100% - 32px));
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 25px 90px rgba(20, 50, 45, 0.25);
}

.help-dialog::backdrop {
  background: rgba(23, 59, 54, 0.25);
  backdrop-filter: blur(3px);
}

.help-dialog h2 {
  margin: 17px 0 7px;
  color: var(--forest-deep);
  font-size: 24px;
  letter-spacing: -0.05em;
}

.help-dialog > p {
  margin: 0;
  color: var(--muted-deep);
  font-size: 12px;
  line-height: 1.8;
}

.help-steps {
  margin: 20px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.help-steps div {
  padding: 10px 8px;
  border-radius: 9px;
  background: var(--mint-soft);
}

.help-steps b,
.help-steps span {
  display: block;
}

.help-steps b {
  color: var(--coral);
  font-family: var(--mono);
  font-size: 10px;
}

.help-steps span {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.4;
}

.dialog-note {
  margin-top: 17px !important;
  padding-top: 13px;
  border-top: 1px dashed var(--line-dark);
  font-size: 9px !important;
}

@media (max-width: 1280px) {
  .app-grid {
    grid-template-columns: 246px minmax(510px, 1fr) 286px;
  }

  .library-panel,
  .insights-panel {
    padding-right: 17px;
    padding-left: 17px;
  }

  .practice-panel {
    padding-right: 30px;
    padding-left: 30px;
  }

  .tool-button {
    padding-right: 5px;
    padding-left: 5px;
  }
}

@media (max-width: 1060px) {
  .app-grid {
    grid-template-columns: 226px minmax(0, 1fr);
  }

  .insights-panel {
    grid-column: 1 / -1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 14px;
    padding: 20px 25px 30px;
    border-top: 1px solid rgba(23, 59, 54, 0.08);
    border-left: 0;
  }

  .insights-panel > * {
    margin-bottom: 0;
  }

  .coach-tip-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  .topbar {
    height: 64px;
    padding: 0 18px;
  }

  .brand-copy small,
  .save-pill {
    display: none;
  }

  .app-grid {
    display: block;
  }

  .library-panel,
  .insights-panel {
    min-height: 0;
    border: 0;
  }

  .library-panel {
    padding: 26px 18px 20px;
  }

  .library-intro {
    padding-bottom: 18px;
  }

  .library-intro h1 {
    max-width: none;
    margin-top: 9px;
    font-size: 27px;
  }

  .library-intro p {
    max-width: 500px;
  }

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

  .library-footnote {
    display: none;
  }

  .practice-panel {
    padding: 27px 18px 34px;
  }

  .practice-header {
    display: block;
  }

  .header-progress {
    width: 100%;
    margin-top: 18px;
  }

  .header-progress small {
    text-align: left;
  }

  .player-card {
    padding: 17px;
  }

  .player-controls {
    gap: 6px;
  }

  .control-divider {
    display: none;
  }

  .sentence-card {
    padding: 22px 18px 18px;
  }

  .sentence-heading {
    display: block;
  }

  .sentence-actions {
    margin-top: 12px;
  }

  .sentence-navigation {
    grid-template-columns: 1fr 1fr;
  }

  .sentence-dots {
    display: none;
  }

  .nav-sentence-button.next {
    grid-column: 2;
  }

  .insights-panel {
    display: block;
    padding: 20px 18px 30px;
  }

  .insights-panel > * {
    margin-bottom: 14px;
  }
}

@media (max-width: 480px) {
  .lesson-list {
    grid-template-columns: 1fr;
  }

  .filter-tabs {
    overflow-x: auto;
  }

  .filter-tab {
    flex: none;
  }

  .waveform {
    height: 62px;
  }

  .audio-status {
    display: none;
  }

  .player-controls {
    position: relative;
    padding-bottom: 37px;
  }

  .tool-button {
    position: absolute;
    bottom: 0;
  }

  #loopBtn { left: 0; }
  #autoNextBtn { left: 84px; }

  .control-label {
    margin-left: auto;
  }

  .typing-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .typing-actions {
    width: 100%;
  }

  .typing-actions .button {
    flex: 1;
  }

  .help-steps {
    grid-template-columns: 1fr;
  }
}
