:root {
  --ink: #172026;
  --muted: #63717a;
  --line: #d7e0e5;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --mist: #edf5f3;
  --red: #c83f49;
  --red-dark: #8f2631;
  --green: #26735f;
  --amber: #c27a25;
  --shadow: 0 18px 50px rgba(23, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(200, 63, 73, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(38, 115, 95, 0.14), transparent 38%),
    var(--paper);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand-block h1,
.top-bar h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 3rem;
  line-height: 0.95;
}

.brand-copy {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-nav a,
.site-footer a {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--red-dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.eyebrow,
.panel-label {
  display: block;
  margin: 0 0 8px;
  color: var(--red-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-panel,
.phrase-panel,
.builder-panel,
.review-row article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.progress-panel {
  padding: 18px;
}

.progress-panel > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.progress-panel strong {
  font-size: 2rem;
}

.meter {
  height: 10px;
  overflow: hidden;
  background: #e8eef0;
  border-radius: 999px;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--green));
  transition: width 180ms ease;
}

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

.stats-grid div {
  padding: 10px;
  background: var(--mist);
  border-radius: 6px;
}

.stats-grid dt {
  color: var(--muted);
  font-size: 0.76rem;
}

.stats-grid dd {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.secondary-action {
  width: 100%;
  min-height: 38px;
  margin-top: 14px;
  color: var(--ink);
  background: #f4f6f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.level-list,
.mission-list {
  display: grid;
  gap: 10px;
}

.level-button,
.mission-button {
  display: grid;
  gap: 4px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  background: #f4f6f3;
  border: 1px solid transparent;
  border-radius: 8px;
}

.level-button span,
.mission-button span {
  color: var(--red-dark);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.level-button strong,
.mission-button strong {
  font-size: 0.98rem;
}

.level-button em,
.mission-button em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.level-button.active,
.mission-button.active {
  background: #fff;
  border-color: var(--red);
}

.level-button.locked {
  opacity: 0.72;
}

.mode-tabs,
.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.kana-controls {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.mode-tabs button,
.segmented-control button {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.mode-tabs button.active,
.segmented-control button.active {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.lesson-area {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 28px;
}

.top-bar,
.scenario-band,
.section-heading,
.builder-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-bar h2 {
  font-size: 2.8rem;
}

.view-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.view-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
}

.scenario-band {
  padding: 18px;
  background: #172026;
  color: #fff;
  border-radius: 8px;
}

.foundation-band {
  background: #24352f;
}

.study-tracker {
  display: grid;
  gap: 10px;
  width: min(420px, 100%);
  padding: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
}

.study-timer-display {
  font-variant-numeric: tabular-nums;
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.study-duration-picker,
.study-actions,
.study-stats {
  display: grid;
  gap: 8px;
}

.study-duration-picker {
  grid-template-columns: repeat(4, 1fr);
}

.study-actions {
  grid-template-columns: repeat(3, 1fr);
}

.study-tracker .study-duration-picker button,
.study-tracker .study-actions button {
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 8px;
  font-weight: 900;
}

.study-tracker .study-duration-picker button {
  color: var(--ink);
  background: var(--mist);
  border: 1px solid var(--line);
}

.study-tracker .study-duration-picker button.active,
.study-tracker .study-actions button {
  color: #fff;
  background: var(--red);
}

.study-tracker button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.study-tracker p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.study-stats {
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
}

.study-stats div {
  padding: 8px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.study-stats dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.study-stats dd {
  margin: 3px 0 0;
  font-size: 0.98rem;
  font-weight: 900;
}

.study-horizon {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff8f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.study-horizon > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.study-horizon span {
  color: var(--red-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.study-horizon strong {
  font-size: 0.9rem;
}

.study-horizon p {
  color: var(--muted);
  font-size: 0.82rem;
}

.scenario-band p {
  max-width: 820px;
  margin: 0;
  line-height: 1.55;
}

.scenario-tag {
  display: inline-block;
  margin-bottom: 8px;
  color: #ffd9d9;
  font-weight: 800;
}

.scenario-band button,
.builder-actions button,
.review-row button,
.section-heading button {
  min-height: 40px;
  padding: 9px 14px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 800;
}

.section-heading button,
.builder-actions button:nth-child(2) {
  color: var(--ink);
  background: var(--mist);
}

.section-heading .segmented-control button.active {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.start-here-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: 16px;
  align-items: stretch;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.start-here-panel h3 {
  margin: 4px 0 8px;
  font-size: 1.45rem;
  line-height: 1.15;
}

.start-here-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.start-here-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.start-here-actions button {
  display: grid;
  gap: 5px;
  min-height: 112px;
  padding: 11px;
  color: var(--ink);
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.start-here-actions button.recommended {
  background: #fff8f4;
  border-color: #f0d5cd;
}

.start-here-actions span {
  color: var(--red-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.start-here-actions strong {
  font-size: 1rem;
  line-height: 1.18;
}

.start-here-actions em {
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
  line-height: 1.3;
}

.onboarding-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.onboarding-panel h3 {
  margin: 0;
  font-size: 1.7rem;
}

.onboarding-panel .section-heading > strong {
  padding: 8px 12px;
  color: var(--green);
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.onboarding-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.onboarding-choices button {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 12px;
  color: var(--ink);
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.onboarding-choices button.active {
  background: #fff8f4;
  border-color: #f0d5cd;
}

.onboarding-choices span {
  color: var(--red-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.onboarding-choices strong {
  font-size: 1.03rem;
  line-height: 1.2;
}

.onboarding-choices em {
  color: var(--muted);
  font-size: 0.86rem;
  font-style: normal;
  line-height: 1.35;
}

.onboarding-route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.onboarding-route span {
  color: var(--muted);
  font-weight: 800;
}

.onboarding-route button {
  min-height: 42px;
  padding: 10px 14px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.focus-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.focus-intro span {
  color: var(--red-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.focus-intro h4 {
  margin: 4px 0 8px;
  font-size: 1.2rem;
}

.focus-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.focus-intro-examples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.focus-intro-examples section {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 10px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.focus-intro-examples strong {
  font-size: 1.45rem;
  line-height: 1;
}

.focus-intro-examples span {
  color: var(--ink);
  font-size: 0.84rem;
  letter-spacing: 0;
  text-transform: none;
}

.focus-intro-examples p {
  font-size: 0.78rem;
  line-height: 1.3;
}

.mini-session-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-session-head,
.mini-session-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-session-head h4 {
  margin: 2px 0 0;
  font-size: 1.15rem;
}

.mini-session-head > strong {
  padding: 7px 10px;
  color: var(--green);
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: nowrap;
}

.mini-session-question {
  display: grid;
  gap: 7px;
  min-height: 118px;
  padding: 14px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-session-question span {
  color: var(--red-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mini-session-question strong {
  font-size: 1.6rem;
  line-height: 1.12;
}

.mini-session-question p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.mini-session-actions button {
  min-height: 40px;
  padding: 9px 12px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 900;
}

.mini-session-actions button:nth-child(2),
.mini-session-actions button:nth-child(3) {
  color: var(--ink);
  background: var(--mist);
  border: 1px solid var(--line);
}

.mini-session-actions button:disabled {
  cursor: default;
  opacity: 0.55;
}

.practice-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 20px;
}

.app-section {
  scroll-margin-top: 24px;
}

.app-section:focus {
  outline: none;
}

.phrase-panel,
.builder-panel,
.quiz-panel,
.chart-panel,
.typing-panel,
.name-helper-panel,
.coverage-panel,
.checkpoint-panel,
.sprint-panel,
.n5-practice-panel,
.review-queue-panel,
.today-panel,
.n5-grid article,
.scenario-note {
  padding: 18px;
}

.quiz-panel,
.chart-panel,
.typing-panel,
.name-helper-panel,
.coverage-panel,
.checkpoint-panel,
.sprint-panel,
.n5-practice-panel,
.review-queue-panel,
.today-panel,
.n5-grid article,
.scenario-note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.today-panel h3 {
  margin: 0;
  font-size: 1.7rem;
}

.today-panel .section-heading > strong {
  padding: 8px 12px;
  color: var(--green);
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.resume-snapshot {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.9fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.resume-snapshot h4 {
  margin: 2px 0 6px;
  font-size: 1.1rem;
}

.resume-snapshot p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.resume-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.resume-stats span {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px;
  color: var(--muted);
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.76rem;
}

.resume-stats strong {
  color: var(--ink);
  font-size: 1rem;
}

.resume-snapshot button {
  min-height: 42px;
  padding: 10px 14px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.today-focus-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.today-focus-stats button {
  display: grid;
  gap: 4px;
  min-height: 88px;
  padding: 10px;
  color: var(--ink);
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.today-focus-stats button.active {
  background: #fff8f4;
  border-color: #f0d5cd;
}

.today-focus-stats span {
  color: var(--red-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.today-focus-stats strong {
  font-size: 1.35rem;
  line-height: 1;
}

.today-focus-stats em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  line-height: 1.3;
}

.today-step-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.today-step {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 178px;
  padding: 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.today-step.complete {
  background: var(--mist);
}

.today-step span {
  color: var(--red-dark);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.today-step strong {
  font-size: 1.05rem;
  line-height: 1.2;
}

.today-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.today-step button {
  align-self: end;
  min-height: 40px;
  padding: 9px 12px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 900;
}

.today-step.complete button {
  color: var(--green);
  background: #fff;
  border: 1px solid var(--line);
  cursor: default;
}

.today-step button:disabled {
  cursor: default;
  opacity: 0.8;
}

.session-reflection {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr) minmax(180px, 0.7fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.session-reflection h4 {
  margin: 2px 0 6px;
  font-size: 1.05rem;
}

.session-reflection p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.reflection-stats,
.reflection-weak-areas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.reflection-weak-areas {
  grid-template-columns: 1fr;
}

.reflection-stats span,
.reflection-weak-areas span {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px;
  color: var(--muted);
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.78rem;
}

.reflection-stats strong,
.reflection-weak-areas strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.session-reflection button {
  min-height: 42px;
  padding: 10px 14px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.checkpoint-panel h3,
.sprint-panel h3 {
  margin: 0;
  font-size: 1.7rem;
}

.checkpoint-panel .section-heading > strong,
.sprint-panel .section-heading > strong {
  padding: 8px 12px;
  color: var(--amber);
  background: #fff8f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checkpoint-panel .section-heading > strong.checkpoint-ready,
.sprint-panel .section-heading > strong.checkpoint-ready {
  color: var(--green);
  background: var(--mist);
}

.sprint-panel {
  margin-top: 20px;
}

.sprint-question-card strong {
  font-size: 2rem;
}

.sprint-history {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.sprint-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sprint-history-item strong,
.sprint-history-item span {
  min-width: 0;
}

.sprint-history-item span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.sprint-history-score {
  color: var(--green);
  font-weight: 900;
}

.sprint-history-score.retry {
  color: var(--amber);
}

.checkpoint-meter {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.checkpoint-meter > span {
  color: var(--muted);
  font-weight: 800;
}

.checkpoint-criteria {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.checkpoint-criteria section {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checkpoint-criteria section > strong {
  min-width: 58px;
  padding: 6px 8px;
  color: var(--amber);
  text-align: center;
  background: #fff8f4;
  border-radius: 999px;
  font-size: 0.78rem;
}

.checkpoint-criteria section.complete > strong {
  color: #fff;
  background: var(--green);
}

.checkpoint-criteria h4,
.checkpoint-criteria p {
  margin: 0;
}

.checkpoint-criteria p {
  color: var(--muted);
  margin-top: 4px;
}

.coverage-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  margin-bottom: 20px;
}

.coverage-panel h3 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.coverage-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.coverage-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.coverage-stats div {
  padding: 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.coverage-stats dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.coverage-stats dd {
  margin: 4px 0;
  font-size: 1.7rem;
  font-weight: 900;
}

.coverage-stats span {
  color: var(--muted);
  font-size: 0.78rem;
}

.n5-practice-panel {
  margin-bottom: 20px;
}

.review-queue-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.review-category-stats {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.review-category-stats span {
  padding: 8px 10px;
  color: var(--muted);
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.review-category-stats strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 1.05rem;
}

.review-queue-panel h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.review-queue-actions {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 10px;
  align-items: center;
}

.review-queue-actions strong {
  padding: 8px 10px;
  color: var(--amber);
  background: #fff8f4;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: nowrap;
}

.review-queue-actions button {
  min-height: 40px;
  padding: 9px 12px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 900;
}

.review-queue-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.n5-practice-panel h3 {
  margin: 0;
  font-size: 1.6rem;
}

.name-helper-panel {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.name-helper-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.name-helper-row .input-label {
  grid-column: 1 / -1;
  margin: 0;
}

.name-helper-row button {
  min-height: 48px;
  padding: 10px 14px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 800;
}

.name-result section {
  padding: 16px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.name-result span {
  color: var(--red-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.name-result strong {
  display: block;
  margin-top: 6px;
  font-size: 3rem;
  line-height: 1.1;
}

.name-result p,
.name-result small {
  display: block;
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.kana-quiz-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 24px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kana-quiz-card span {
  color: var(--muted);
  font-weight: 800;
}

.kana-quiz-card strong {
  font-size: 6rem;
  line-height: 1;
}

.kana-quiz-card strong.sound-card {
  font-size: 4.5rem;
}

.kana-quiz-card p,
.section-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.choice-grid button {
  min-height: 48px;
  color: var(--ink);
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 900;
}

.choice-grid button:disabled,
.quiz-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.n5-question-card {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 18px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.n5-question-card span {
  color: var(--red-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.n5-question-card strong {
  font-size: 2.7rem;
  line-height: 1.15;
}

.n5-question-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.deck-progress {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  background: #fff8f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.deck-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.deck-progress strong {
  font-size: 1rem;
}

.deck-progress p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 14px;
}

.quiz-actions button {
  min-height: 40px;
  padding: 9px 14px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 800;
}

.kana-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 8px;
  margin-top: 14px;
  max-height: 420px;
  overflow: auto;
}

.kana-chart div {
  display: grid;
  place-items: center;
  min-height: 64px;
  padding: 8px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kana-chart strong {
  font-size: 1.75rem;
}

.kana-chart span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.input-label {
  display: block;
  margin-top: 18px;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

input[type="text"] {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.typing-output {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 14px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.typing-output span {
  color: var(--muted);
  font-weight: 800;
}

.typing-output strong {
  min-height: 36px;
  font-size: 2rem;
}

.typing-check {
  margin-top: 14px;
  padding: 14px;
  background: #fff8f4;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.typing-check p {
  margin: 0;
  line-height: 1.45;
}

.target-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.target-list button {
  display: grid;
  gap: 4px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.target-list span {
  color: var(--muted);
}

.target-list small {
  color: var(--green);
  font-size: 1.15rem;
  font-weight: 900;
}

.n5-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.mini-card-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mini-card-grid section {
  padding: 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-card-grid strong {
  display: block;
  font-size: 1.35rem;
}

.mini-card-grid span,
.mini-card-grid small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.mini-card-grid p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.scenario-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.phrase-panel h3 {
  margin: 12px 0 8px;
  font-size: 1.7rem;
}

.phrase-cards {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.phrase-card {
  padding: 16px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.phrase-card strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1.35;
}

.phrase-card p {
  margin: 8px 0 0;
}

.phrase-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.4;
}

.hidden {
  display: none;
}

.builder-prompt {
  margin: 12px 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.answer-slots,
.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border: 1px dashed #aebbc1;
  border-radius: 8px;
}

.answer-slots {
  background: #fff8f4;
}

.answer-slots span {
  color: var(--muted);
  align-self: center;
}

.answer-slots button,
.word-bank button {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.word-bank {
  margin-top: 12px;
  background: var(--mist);
}

.builder-actions {
  justify-content: flex-start;
  margin-top: 16px;
}

.feedback {
  min-height: 28px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.feedback.success {
  color: var(--green);
}

.feedback.needs-review {
  color: var(--amber);
}

.trust-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.trust-panel article {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.trust-panel h3 {
  margin: 4px 0 10px;
  font-size: 1.2rem;
  line-height: 1.2;
}

.trust-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.review-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.review-row article {
  padding: 18px;
}

.backup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.backup-actions button,
.backup-actions label {
  display: inline-grid;
  place-items: center;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  color: #fff;
  background: var(--red);
  border-radius: 8px;
  font-weight: 900;
  text-align: center;
  cursor: pointer;
}

.backup-actions button {
  margin-top: 0;
}

.backup-actions input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.backup-actions input[type="file"]:focus-visible + label {
  outline: 3px solid rgba(36, 88, 77, 0.32);
  outline-offset: 3px;
}

.local-data-list {
  display: grid;
  gap: 7px;
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.reset-confirm {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.reset-confirm input {
  margin-top: 3px;
}

.review-row button.danger-action {
  color: #fff;
  background: var(--amber);
}

.review-row button.danger-action:disabled {
  cursor: default;
  opacity: 0.45;
}

.review-row p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  padding: 12px;
  color: var(--ink);
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.review-row button {
  margin-top: 12px;
}

.review-row .backup-actions button {
  margin-top: 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.static-page {
  display: grid;
  gap: 20px;
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.static-nav {
  justify-content: flex-end;
}

.static-hero {
  padding: 26px;
  color: #fff;
  background: #92303b;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.static-hero .panel-label {
  color: #ffd9d9;
}

.static-hero h1 {
  margin: 0;
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: 0;
}

.static-hero p {
  max-width: 760px;
  margin: 14px 0 0;
  line-height: 1.55;
}

.static-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.static-grid article {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.static-grid h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.static-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.static-footer {
  margin-top: 4px;
}

@media (max-width: 980px) {
  .app-shell,
  .practice-grid,
  .start-here-panel,
  .review-row,
  .trust-panel,
  .static-grid,
  .review-queue-panel,
  .coverage-panel,
  .onboarding-choices,
  .start-here-actions,
  .focus-intro,
  .mini-session-actions,
  .today-focus-stats,
  .today-step-list,
  .resume-snapshot,
  .session-reflection,
  .n5-grid,
  .scenario-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mission-list,
  .level-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .focus-intro-examples {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  body {
    background: var(--paper);
  }

  .sidebar,
  .lesson-area {
    padding: 16px;
  }

  .brand-block h1 {
    font-size: 2.1rem;
    line-height: 1;
  }

  .top-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: -16px -16px 0;
    padding: 14px 16px;
    background: rgba(251, 250, 247, 0.96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }

  .app-section {
    scroll-margin-top: 170px;
  }

  .top-bar h2 {
    font-size: 1.8rem;
    line-height: 1.12;
  }

  .top-bar,
  .scenario-band,
  .start-here-panel,
  .onboarding-route,
  .resume-snapshot,
  .mini-session-head,
  .mini-session-actions,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .static-nav {
    justify-content: flex-start;
  }

  .static-hero h1 {
    font-size: 2.1rem;
  }

  .view-controls {
    justify-content: flex-start;
  }

  .mode-tabs,
  .segmented-control,
  .kana-controls {
    justify-content: flex-start;
    justify-items: stretch;
  }

  .mode-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-content: start;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .mode-tabs button {
    min-width: 94px;
    white-space: nowrap;
  }

  .mission-list,
  .level-list {
    grid-template-columns: 1fr;
  }

  .scenario-band button,
  .builder-actions button,
  .review-row button,
  .section-heading button,
  .quiz-actions button,
  .name-helper-row button,
  .segmented-control button {
    width: 100%;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .choice-grid button {
    min-height: 54px;
  }

  .kana-quiz-card strong {
    font-size: 4.8rem;
  }

  .kana-quiz-card strong.sound-card {
    font-size: 3.6rem;
  }

  .n5-question-card strong,
  .typing-output strong,
  .name-result strong {
    font-size: 2rem;
  }

  .study-timer-display {
    font-size: 2.6rem;
  }

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

  .name-helper-row {
    grid-template-columns: 1fr;
  }

  .study-duration-picker,
  .study-actions,
  .study-stats,
  .today-focus-stats,
  .review-queue-actions,
  .review-category-stats,
  .backup-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-queue-actions strong {
    grid-column: 1 / -1;
    text-align: center;
  }
}
