:root {
  color-scheme: light;
  --ink: #1e2430;
  --muted: #647084;
  --line: #d9e0ea;
  --paper: #fbfcff;
  --panel: #ffffff;
  --mint: #cfeee5;
  --mint-strong: #2f9d7e;
  --coral: #ff8b73;
  --coral-soft: #ffe2dc;
  --gold: #f5c85b;
  --blue: #4f7ecf;
  --blue-soft: #dce8ff;
  --shadow: 0 18px 45px rgba(28, 38, 56, 0.12);
  --radius: 8px;
}

#googleSafariDialog {
  width: min(32rem, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

#googleSafariDialog input {
  display: block;
  width: 100%;
  margin: 8px 0 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(135deg, #f8fbff 0%, #fff9f6 55%, #f1fbf7 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.88);
  border-right: 1px solid var(--line);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: white;
  background: var(--mint-strong);
  border-radius: var(--radius);
  font-weight: 900;
  font-size: 1.45rem;
}

.brand span,
.eyebrow,
.metric span,
.streak-pill small,
.subtle {
  color: var(--muted);
}

.brand span {
  display: block;
  margin-top: 2px;
  font-size: 0.84rem;
}

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

.nav-item,
.quiet-button,
.primary-button,
.choice,
.chip-button,
.flag-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

.nav-item {
  min-height: 44px;
  text-align: left;
  padding: 0 14px;
  font-weight: 750;
}

.nav-item.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.utility-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress-status {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.35;
}

.sync-controls {
  display: grid;
  gap: 6px;
  padding-top: 4px;
}

.sync-controls select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 0 8px;
}

.quiet-button,
.primary-button,
.chip-button,
.flag-button {
  min-height: 40px;
  padding: 0 14px;
  font-weight: 750;
}

.primary-button {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

.primary-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.flag-button {
  white-space: nowrap;
}

.flag-button.is-flagged {
  border-color: var(--gold);
  background: #fff1b8;
  color: #765300;
}

.main-panel {
  padding: 28px;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 0 auto 24px;
  max-width: 1180px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 3vw, 3.1rem);
}

h2 {
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 8px;
}

.streak-pill {
  min-width: 112px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.streak-pill span {
  display: block;
  font-size: 1.7rem;
  font-weight: 900;
}

.view {
  display: none;
  max-width: 1180px;
  margin: 0 auto;
}

.active-view {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.55fr);
}

.panel,
.word-card,
.question-card,
.metric {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  background: #edf2f7;
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--mint-strong), var(--gold));
}

.action-row,
.toolbar,
.answer-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar {
  margin-bottom: 16px;
}

.toolbar input,
.toolbar select {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.word-card {
  padding: 20px;
}

.word-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.word-title strong {
  font-size: 1.75rem;
}

.word-card .learn-definition,
.word-card .learn-secondary-definition {
  margin-top: 6px;
  font-weight: 400;
}

.tag,
.result-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #214a92;
  font-size: 0.82rem;
  font-weight: 800;
}

.tag.good,
.result-tag.correct {
  background: var(--mint);
  color: #176850;
}

.tag.warn,
.result-tag.wrong {
  background: var(--coral-soft);
  color: #9a321e;
}

.result-tag.flagged {
  background: #fff1b8;
  color: #765300;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.mini-word {
  padding: 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.mini-word strong {
  display: block;
  margin-bottom: 4px;
}

.question-card {
  padding: 22px;
}

.question-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.prompt {
  font-size: 1.35rem;
  line-height: 1.45;
  font-weight: 500;
}

.target-word {
  padding: 0 3px;
  background: #ffe58f;
  color: var(--ink);
  font-weight: 850;
}

.explain-label {
  font-weight: 750;
}

.question-sound {
  margin-bottom: 12px;
}

.task-banner {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #b9d0ff;
  border-left: 6px solid var(--blue);
  border-radius: var(--radius);
  background: var(--blue-soft);
}

.task-banner strong {
  font-size: 1rem;
}

.task-banner span {
  color: #24436f;
  font-weight: 750;
}

.choices {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.choice {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 8px 12px 8px 8px;
  text-align: left;
}

.choice .letter {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: #eef3fa;
  font-weight: 900;
}

.choice.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.choice.correct {
  border-color: var(--mint-strong);
  background: var(--mint);
}

.choice.wrong {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.explanation {
  display: none;
  margin-top: 16px;
  padding: 16px;
  border-left: 5px solid var(--gold);
  background: #fff8e7;
  border-radius: var(--radius);
}

.explanation.visible {
  display: block;
}

.test-grid {
  display: grid;
  gap: 12px;
}

.previous-result {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbff;
}

.previous-result h3,
.previous-result p {
  margin-bottom: 4px;
}

.test-progress-panel {
  margin-top: 16px;
}

.test-progress-table {
  display: grid;
  gap: 6px;
}

.test-progress-row {
  display: grid;
  grid-template-columns: 80px 92px 110px 72px minmax(170px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  font-size: 0.92rem;
}

.test-progress-head {
  background: var(--blue-soft);
  color: #214a92;
  font-weight: 850;
}

.test-question {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.test-question-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.test-question p {
  font-weight: 800;
}

.timer {
  font-size: 1.5rem;
  font-weight: 950;
}

.empty-state {
  padding: 28px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.badge,
.sound-button {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff6d8;
  color: #6b4b00;
  font-weight: 850;
  font-size: 0.82rem;
}

.sound-button,
.search-link {
  margin-left: 6px;
  background: white;
  color: var(--ink);
}

.search-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #214a92;
  font-weight: 850;
  font-size: 0.82rem;
  text-decoration: none;
}

.text-answer {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1.1rem;
}

.match-grid {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.5fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.match-row small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  text-transform: capitalize;
}

.match-row select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.explain-grid {
  display: grid;
  gap: 8px;
}

.explain-grid ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.mini-bar {
  display: block;
  height: 9px;
  margin-top: 6px;
  overflow: hidden;
  background: #edf2f7;
  border-radius: 999px;
}

.mini-bar i {
  display: block;
  height: 100%;
  background: var(--mint-strong);
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    z-index: 5;
    padding: 14px;
  }

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

  .nav-item {
    text-align: center;
    padding: 0 6px;
    font-size: 0.9rem;
  }

  .dashboard-grid,
  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .main-panel {
    padding: 18px;
  }

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

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

  .question-top,
  .word-title,
  .match-row {
    display: grid;
  }

  .test-progress-row {
    grid-template-columns: 1fr 1fr;
  }

  .test-progress-head {
    display: none;
  }
}

/* Visual refinement: shared layout, typography, and component treatment. */
:root {
  --ink: #182230;
  --muted: #66758a;
  --line: #d9e2ec;
  --paper: #f5f7fa;
  --panel: #ffffff;
  --mint: #e5f4ee;
  --mint-strong: #237b63;
  --coral: #b14f43;
  --coral-soft: #fbe9e6;
  --gold: #b88422;
  --blue: #2f5f86;
  --blue-soft: #e8f0f7;
  --shadow: 0 3px 14px rgba(24, 34, 48, 0.06);
  --radius: 12px;
}

body {
  background: var(--paper);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select {
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.search-link:focus-visible {
  outline: 3px solid rgba(47, 95, 134, 0.28);
  outline-offset: 2px;
}

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

.sidebar {
  gap: 20px;
  padding: 22px 16px;
  background: #fbfcfe;
  border-right-color: #dfe6ee;
}

.brand {
  padding: 2px 8px 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--blue);
  font-size: 1.2rem;
}

.brand strong {
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.brand span {
  font-size: 0.78rem;
}

.nav-list {
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: #3a4859;
  font-size: 0.91rem;
  font-weight: 680;
}

.nav-count {
  min-width: 1.55em;
  padding: 1px 5px;
  border-radius: 999px;
  background: #edf1f5;
  color: #536274;
  font-size: 0.78em;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
}

.nav-item.active .nav-count {
  background: rgba(79, 126, 207, 0.16);
  color: #1f4d71;
}

.nav-item:hover {
  background: #eef3f7;
  color: var(--ink);
}

.nav-item.active {
  background: var(--blue-soft);
  border-color: #c9d9e7;
  color: #1f4d71;
  font-weight: 800;
}

.sidebar-footer {
  gap: 6px;
  padding: 12px 8px 0;
  border-top: 1px solid #e3e9f0;
}

.progress-status {
  font-size: 0.76rem;
  font-weight: 650;
}

.main-panel {
  padding: clamp(20px, 3.2vw, 42px);
  overflow: visible;
}

.topbar {
  margin-bottom: 26px;
  max-width: 1120px;
}

.eyebrow {
  margin-bottom: 5px;
  color: #718198;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.075em;
}

h1,
h2,
h3 {
  color: #152132;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(1.85rem, 3.2vw, 2.55rem);
  line-height: 1.16;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
  line-height: 1.25;
}

h3 {
  font-size: 1.04rem;
}

.streak-pill {
  min-width: 96px;
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: none;
}

.streak-pill span {
  color: var(--blue);
  font-size: 1.45rem;
}

.view,
.topbar {
  max-width: 1120px;
}

.grid {
  gap: 18px;
}

.panel,
.word-card,
.question-card,
.metric {
  border-color: #dfe6ee;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel,
.word-card,
.question-card {
  padding: clamp(18px, 2.5vw, 26px);
}

.metric {
  min-height: 122px;
  padding: 18px;
  box-shadow: none;
}

.metric span {
  font-size: 0.83rem;
  font-weight: 700;
}

.metric strong {
  margin-top: 8px;
  color: var(--blue);
  font-size: 1.8rem;
  line-height: 1.15;
}

.subtle {
  line-height: 1.6;
}

.progress-track,
.mini-bar {
  background: #eaf0f4;
}

.progress-track {
  height: 9px;
}

.progress-fill {
  background: var(--blue);
}

.primary-button,
.quiet-button,
.chip-button,
.flag-button {
  min-height: 40px;
  border-radius: 8px;
  font-size: 0.91rem;
  font-weight: 720;
}

.primary-button {
  background: var(--blue);
  border-color: var(--blue);
}

.primary-button:hover:not(:disabled) {
  background: #244d70;
  border-color: #244d70;
}

.quiet-button,
.chip-button,
.flag-button {
  background: #fff;
  color: #35465a;
}

.quiet-button:hover,
.chip-button:hover,
.flag-button:hover {
  border-color: #b7c8d8;
  background: #f7fafc;
}

.toolbar {
  gap: 10px;
}

.toolbar input,
.toolbar select,
.text-answer,
.match-row select {
  min-height: 44px;
  border-color: #ccd8e4;
  border-radius: 8px;
  color: var(--ink);
}

.word-list {
  gap: 14px;
}

.word-card,
.mini-word {
  background: #fff;
}

.mini-word {
  padding: 16px;
  border-color: #dfe6ee;
  border-radius: 10px;
}

.word-title {
  margin-bottom: 16px;
}

.word-title strong {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.15;
}

.tag,
.result-tag,
.badge,
.sound-button,
.search-link {
  min-height: 25px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 720;
}

.tag,
.result-tag {
  background: #edf3f8;
  color: #335975;
}

.tag.good,
.result-tag.correct {
  background: var(--mint);
  color: #1d6653;
}

.tag.warn,
.result-tag.wrong {
  background: var(--coral-soft);
  color: #943d33;
}

.result-tag.flagged,
.flag-button.is-flagged {
  border-color: #e3c77b;
  background: #fff7dc;
  color: #72560e;
}

.question-card {
  border-top: 3px solid #9ab5cb;
}

.question-top {
  align-items: flex-start;
  margin-bottom: 18px;
}

.prompt {
  max-width: 760px;
  font-size: clamp(1.12rem, 2.2vw, 1.35rem);
  line-height: 1.6;
  font-weight: 550;
}

.target-word {
  padding: 0 2px;
  background: transparent;
  border-bottom: 3px solid #88abc5;
  color: #183d5e;
  font-weight: 800;
}

.task-banner {
  gap: 2px;
  margin-bottom: 18px;
  padding: 11px 13px;
  border: 1px solid #d6e1eb;
  border-left: 3px solid #6288a8;
  border-radius: 8px;
  background: #f4f8fb;
}

.task-banner strong {
  font-size: 0.94rem;
}

.task-banner span {
  color: #52687d;
  font-size: 0.9rem;
  font-weight: 550;
}

.choices {
  gap: 9px;
  margin: 22px 0;
}

.choice {
  min-height: 58px;
  padding: 9px 14px 9px 9px;
  border-color: #d5e0e9;
  border-radius: 10px;
  background: #fff;
  font-size: 1rem;
}

.choice:hover:not(.correct):not(.wrong) {
  border-color: #afc5d7;
  background: #f8fbfd;
}

.choice .letter {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #eff4f8;
  color: #3f586f;
  font-size: 0.9rem;
}

.choice.selected {
  border-color: #5a86aa;
  background: #eff6fb;
}

.choice.selected .letter {
  background: #d8e8f4;
  color: #1f5075;
}

.choice.correct {
  border-color: #70a794;
  background: #edf8f3;
}

.choice.correct .letter {
  background: #d5eee3;
  color: #1d6653;
}

.choice.wrong {
  border-color: #d89990;
  background: #fdf0ee;
}

.choice.wrong .letter {
  background: #f7deda;
  color: #943d33;
}

.explanation {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #eadbb2;
  border-left: 3px solid #c39a40;
  border-radius: 8px;
  background: #fffbf1;
  line-height: 1.65;
}

.test-grid {
  gap: 16px;
}

.test-question {
  padding: 18px;
  border-color: #dce5ed;
  border-radius: 10px;
}

.test-question p {
  line-height: 1.6;
}

.test-question .action-row label {
  flex: 1 1 210px;
  padding: 10px 12px;
  border: 1px solid #d8e2eb;
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
}

.test-question .action-row label:has(input:checked) {
  border-color: #6d96b5;
  background: #f0f7fb;
}

.previous-result,
.empty-state {
  border-color: #dbe5ed;
  background: #f8fafc;
}

.test-progress-row {
  padding: 11px 13px;
  border-color: #e0e7ee;
  border-radius: 8px;
}

.test-progress-head {
  background: #edf3f8;
  color: #345a76;
}

.badge {
  background: #fff8e7;
  color: #765c1b;
}

.mini-bar i {
  background: #4e8a73;
}

@media (max-width: 920px) {
  .sidebar {
    gap: 14px;
    padding: 14px 18px;
  }

  .brand {
    padding: 0;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .nav-item {
    min-height: 38px;
    font-size: 0.84rem;
  }

  .sidebar-footer {
    grid-template-columns: repeat(3, minmax(0, max-content));
    align-items: center;
    margin-top: 0;
    padding: 10px 0 0;
  }

  .utility-label {
    grid-column: 1 / -1;
  }

  .progress-status {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .main-panel {
    padding: 18px 14px 28px;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .streak-pill {
    min-width: 76px;
    padding: 8px 10px;
  }

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

  .nav-item {
    padding: 6px 8px;
    line-height: 1.15;
  }

  .sidebar-footer {
    grid-template-columns: 1fr 1fr;
  }

  .progress-status {
    grid-column: 1 / -1;
  }

  .panel,
  .word-card,
  .question-card {
    padding: 16px;
  }

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

  .metric {
    min-height: 104px;
    padding: 14px;
  }

  .metric strong {
    font-size: 1.55rem;
  }

  .question-top,
  .test-question-header {
    gap: 10px;
  }

  .choice {
    grid-template-columns: 32px 1fr;
    gap: 10px;
    min-height: 54px;
    padding-right: 10px;
  }

  .choice .letter {
    width: 32px;
    height: 32px;
  }

  .test-question .action-row label {
    flex-basis: 100%;
  }

  .toolbar > * {
    width: 100%;
  }
}

/* Review and explanation refinement: keep meanings readable and grouped. */
.test-question p {
  font-weight: 400;
}

.explain-grid {
  gap: 0;
}

.explain-grid > p {
  margin: 0;
  font-weight: 400;
}

.explain-grid > p:nth-child(1),
.explain-grid > p:nth-child(3) {
  margin-bottom: 8px;
}

.explain-grid > p:nth-child(2),
.explain-grid > p:nth-child(4) {
  margin-bottom: 22px;
}

.explain-label,
.explain-grid strong {
  font-weight: 600;
}

.choice-meanings {
  margin-top: 22px;
}

.choice-meanings > .explain-label {
  margin: 0 0 8px;
}

.explain-grid ul {
  display: grid;
  gap: 20px;
  margin: 0;
}

.choice-meanings li {
  font-weight: 400;
  line-height: 1.6;
}

.choice-meanings li strong {
  font-weight: 600;
}

/* Keep target-word pronunciation with its question without changing the button itself. */
.task-banner.concise-task {
  margin-bottom: 14px;
}

.inline-pronunciation {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  vertical-align: middle;
  white-space: nowrap;
}

.inline-pronunciation .question-sound {
  margin-bottom: 0;
}

/* Preserve the app's original single-column layout on narrow screens. */
@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

/* Keep the learning navigation and Utilities independent from tall page content. */
@media (min-width: 921px) {
  .app-shell {
    align-items: start;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

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

/* iPad touch refinement: preserve the approved look while keeping controls practical to tap. */
@media (max-width: 920px) {
  .nav-item,
  .quiet-button,
  .primary-button,
  .chip-button,
  .flag-button,
  .sound-button {
    min-height: 44px;
  }

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