:root {
  --paper: #faf7f1;
  --paper-2: #f1f6f3;
  --ink: #17201b;
  --muted: #657069;
  --line: #dfe4dd;
  --panel: rgba(255, 255, 255, 0.86);
  --white: #ffffff;
  --blue: #294f9f;
  --blue-soft: #eaf0ff;
  --red: #9f1d24;
  --red-soft: #fff0ef;
  --green: #12633e;
  --green-soft: #eaf8f0;
  --gold: #a86a00;
  --gold-soft: #fff6df;
  --shadow: 0 24px 80px rgba(32, 43, 35, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  font-family:
    ui-serif, "Iowan Old Style", "Palatino Linotype", "Songti SC",
    "Noto Serif CJK SC", serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(233, 69, 54, 0.12), transparent 29rem),
    radial-gradient(circle at 84% 18%, rgba(41, 79, 159, 0.12), transparent 30rem),
    linear-gradient(135deg, var(--paper), var(--paper-2));
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
}

.tools-hidden .app-shell {
  grid-template-columns: 66px minmax(0, 1fr);
}

.tools-hidden .sidebar {
  padding: 14px 10px;
  align-items: center;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 18px;
  border-right: 1px solid rgba(23, 32, 27, 0.1);
  background: rgba(250, 247, 241, 0.76);
  backdrop-filter: blur(20px);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.tools-hidden .brand-copy,
.tools-hidden .tool-nav,
.tools-hidden .score-panel {
  display: none;
}

.tools-hidden .sidebar-head {
  justify-content: center;
}

.tools-hidden .brand {
  display: none;
}

.sidebar-toggle {
  flex: 0 0 auto;
}

.tools-hidden .sidebar-toggle {
  display: grid;
  margin-top: 0;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(23, 32, 27, 0.16);
  border-radius: 8px;
  color: var(--white);
  background: linear-gradient(135deg, #294f9f, #c92835);
  font-weight: 900;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

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

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tool-nav {
  display: grid;
  gap: 8px;
}

.tool-link {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.tool-link span:first-child {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 6px;
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
}

.tool-link strong,
.tool-link small {
  display: block;
}

.tool-link strong {
  font-size: 14px;
}

.tool-link small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tool-link.is-active {
  border-color: rgba(41, 79, 159, 0.2);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 36px rgba(41, 79, 159, 0.08);
}

.tool-link.is-locked {
  opacity: 0.58;
}

.clear-star {
  color: #c3c9c1;
  font-size: 18px;
  font-style: normal;
  line-height: 1;
}

.tool-link.is-cleared .clear-star {
  color: #d79b00;
  text-shadow: 0 1px 8px rgba(215, 155, 0, 0.32);
}

.score-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.score-panel strong,
.score-panel span {
  display: block;
}

.score-panel span {
  margin-top: 6px;
  color: var(--blue);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 14px clamp(14px, 2.4vw, 34px) 16px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.03;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 20px;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 8px;
  color: var(--white);
  background:
    linear-gradient(115deg, rgba(16, 27, 22, 0.92), rgba(25, 52, 105, 0.84)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 18px);
  box-shadow: 0 14px 42px rgba(32, 43, 35, 0.1);
}

.chapter {
  display: inline-block;
  margin-bottom: 6px;
  border-bottom: 2px solid #e8434f;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 900;
}

.hero-band h2 {
  display: grid;
  gap: 4px;
  margin-bottom: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.02;
}

.headline-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1;
}

.headline-stars {
  display: flex;
  gap: 3px;
}

.headline-stars i {
  color: rgba(255, 255, 255, 0.28);
  font-style: normal;
}

.headline-stars i.is-lit {
  color: #f4cf57;
  text-shadow: 0 1px 8px rgba(244, 207, 87, 0.45);
}

.headline-progress small {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 800;
}

.headline-title {
  display: block;
}

.hero-band p {
  max-width: 620px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 17px;
  line-height: 1.62;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 8px;
  min-width: min(430px, 44vw);
}

.stat-tile {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.stat-tile b,
.stat-tile span {
  display: block;
}

.stat-tile b {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 18px;
}

.stat-tile span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.tool-stage {
  display: grid;
  gap: 16px;
  min-height: 0;
  position: relative;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
}

.panel,
.practice-card,
.audio-box,
.help-box,
.settings-drawer {
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 36px rgba(32, 43, 35, 0.06);
}

.panel,
.audio-box,
.help-box,
.settings-drawer {
  padding: 16px;
}

.settings-drawer {
  position: absolute;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  transform: translateY(14px) scale(0.985);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.settings-drawer.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  border-radius: 8px;
  background: rgba(23, 32, 27, 0.24);
  backdrop-filter: blur(2px);
}

.settings-backdrop.is-open {
  display: block;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 850;
  margin-bottom: 14px;
}

.drawer-head strong,
.drawer-head small {
  display: block;
}

.drawer-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}

.settings-column .audio-box,
.settings-column .help-box {
  grid-column: 1 / -1;
}

.panel-title {
  margin-bottom: 10px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check {
  display: flex;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
}

.check input {
  margin-top: 4px;
  accent-color: var(--blue);
}

.check b,
.check span {
  display: block;
}

.check b {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
}

.check span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.form-row,
.audio-controls,
.range-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

select,
.small-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

select {
  min-width: 150px;
  padding: 8px 10px;
}

.small-button {
  padding: 8px 12px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 750;
}

.enable-button,
.primary-button {
  border: 0;
  border-radius: 8px;
  color: var(--white);
  background: var(--blue);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
}

.enable-button {
  min-height: 40px;
  padding: 9px 12px;
}

.voice-select {
  max-width: 100%;
  flex: 1;
}

.status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status.good {
  color: var(--green);
}

.status.warn {
  color: var(--gold);
}

input[type="range"] {
  width: min(170px, 100%);
  accent-color: var(--blue);
}

.practice-card {
  position: relative;
  min-height: 0;
  height: 100%;
  padding: clamp(18px, 3vw, 36px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.card-config {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.badge {
  margin-bottom: 10px;
  padding: 7px 11px;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 850;
}

.label {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 15px;
}

.prompt {
  min-height: 94px;
  margin-bottom: 14px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(64px, 10vw, 118px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.speaker {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 26px;
}

.speaker:active {
  transform: scale(0.97);
}

.practice-listenNumber .badge {
  color: #114d63;
  background: #e7f7fb;
}

.practice-listenNumber .speaker {
  color: #114d63;
  background: #e7f7fb;
}

.practice-listenNumber .answer {
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.practice-listenFrench .badge {
  color: #7a2f16;
  background: #fff0e8;
}

.practice-listenFrench .speaker {
  color: #7a2f16;
  background: #fff0e8;
}

.practice-listenFrench .answer {
  font-size: 20px;
  font-style: italic;
}

.audio-hint {
  min-height: 20px;
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.inline-gear {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  margin: 0 2px;
  border: 0;
  border-radius: 0;
  color: var(--blue);
  background: transparent;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  vertical-align: -3px;
}

.answer-row {
  display: flex;
  gap: 10px;
  width: min(580px, 100%);
}

.answer {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  padding: 13px 15px;
  border: 2px solid #d6ddd5;
  border-radius: 8px;
  outline: none;
  background: var(--white);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 20px;
}

.answer:focus {
  border-color: var(--blue);
}

.primary-button {
  min-width: 104px;
  min-height: 56px;
  padding: 0 18px;
}

.self-assess {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.self-assess button {
  min-height: 46px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
}

.good-button {
  color: var(--green);
}

.bad-button {
  color: var(--red);
}

.feedback {
  display: none;
  width: min(620px, 100%);
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: 8px;
  text-align: left;
  line-height: 1.55;
}

.feedback.good {
  display: block;
  color: var(--green);
  background: var(--green-soft);
}

.feedback.bad {
  display: block;
  color: var(--red);
  background: var(--red-soft);
}

.feedback.warn {
  display: block;
  color: var(--gold);
  background: var(--gold-soft);
}

.answer-number,
.answer-french {
  display: inline-block;
  margin: 0 2px;
  padding: 3px 7px;
  border-radius: 6px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 900;
}

.answer-number {
  color: #114d63;
  background: #dff5fb;
  font-variant-numeric: tabular-nums;
}

.answer-french {
  color: #7a2f16;
  background: #ffe9dc;
  font-style: italic;
}

.next-button {
  display: none;
  margin-top: 14px;
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
}

.help-box summary {
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
}

.help-box p {
  margin: 10px 0 0;
  color: #4e5a52;
  line-height: 1.75;
}

@media (max-width: 980px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .tools-hidden .app-shell {
    grid-template-columns: 66px minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .tool-nav {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .workspace {
    padding-top: 16px;
    overflow: visible;
  }

  .tool-grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .settings-drawer {
    position: fixed;
    top: 12px;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: none;
  }

  .settings-column {
    grid-template-columns: 1fr;
  }

  .settings-backdrop {
    position: fixed;
    border-radius: 0;
  }
}

@media (max-width: 700px) {
  .hero-band {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .quick-stats {
    grid-template-columns: repeat(2, 1fr);
    min-width: 0;
  }

  .practice-card {
    min-height: 520px;
  }

  .answer-row {
    flex-direction: column;
  }

  .primary-button {
    min-height: 50px;
  }
}

@media (max-width: 520px) {
  .workspace {
    padding-inline: 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  .tool-link {
    grid-template-columns: 34px 1fr auto;
  }

  .prompt {
    min-height: 92px;
  }
}
