:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #65716c;
  --line: #d9e1dd;
  --soft: #f3f7f5;
  --panel: #ffffff;
  --accent: #1c7c54;
  --accent-2: #276fbf;
  --warn: #b84a31;
  --gold: #c98a19;
  --shadow: 0 14px 36px rgba(20, 33, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f8faf9;
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 249, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

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

.playback-control {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.playback-rate {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
}

.playback-rate.active {
  background: var(--accent);
  color: white;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  white-space: nowrap;
}

.nav-separator {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 6px;
  opacity: 0.5;
}

.nav a.active,
.nav a:hover {
  background: #e8f2ee;
  color: var(--accent);
}

.lesson-subnav {
  position: sticky;
  top: 64px;
  z-index: 9;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 28px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lesson-subnav::-webkit-scrollbar {
  display: none;
}

.lesson-subnav a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.lesson-subnav a.active,
.lesson-subnav a:hover {
  background: #e8f2ee;
  color: var(--accent);
}

.manage-menu {
  position: relative;
}

.manage-trigger {
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 8px;
  background: transparent;
  white-space: nowrap;
}

.manage-menu.active .manage-trigger,
.manage-trigger:hover {
  background: #e8f2ee;
  color: var(--accent);
}

.manage-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: none;
  min-width: 120px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.manage-menu:hover .manage-dropdown,
.manage-menu:focus-within .manage-dropdown {
  display: grid;
}

.manage-dropdown a {
  display: block;
}

.progress-menu {
  flex: 0 0 auto;
}

.progress-trigger {
  min-width: 38px;
  min-height: 38px;
  padding: 0 10px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
}

.progress-dropdown {
  min-width: 96px;
}

.progress-dropdown button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 740;
}

.progress-dropdown button:hover {
  background: #e8f2ee;
  color: var(--accent);
}

.main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  align-items: stretch;
  min-height: calc(100vh - 150px);
  padding: 22px 0 10px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-weight: 760;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  font-size: 28px;
  line-height: 1.16;
  margin-bottom: 18px;
}

h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.lead {
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.lesson-board {
  display: grid;
  align-content: center;
  gap: 18px;
}

.course-home,
.lesson-dashboard {
  display: grid;
  gap: 22px;
}

.course-home h1,
.lesson-dashboard h1,
.pending-lesson h1 {
  max-width: 760px;
  font-size: 42px;
  line-height: 1.08;
}

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

.course-card,
.module-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.module-card {
  cursor: pointer;
}

.module-card:hover {
  border-color: #92c7ad;
}

.course-card.pending {
  opacity: 0.68;
  box-shadow: none;
}

.course-card.invalid {
  border-color: #e3b36f;
  box-shadow: none;
}

.course-card-head,
.module-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.course-card h2,
.module-card h3 {
  margin-bottom: 0;
}

.overall-progress {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

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

.overall-progress-head > div {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.overall-progress-head span,
.overall-progress-head small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.overall-progress-head strong {
  font-size: 26px;
  line-height: 1;
}

.overall-progress-bar {
  height: 12px;
  border-radius: 999px;
  background: #e6ece9;
  overflow: hidden;
}

.overall-progress-bar > span {
  display: block;
  height: 100%;
  width: var(--value);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

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

.overall-progress-metrics div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.overall-progress-metrics span,
.overall-progress-metrics small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.overall-progress-metrics strong {
  font-size: 15px;
  text-align: right;
}

.overall-progress-metrics small {
  grid-column: 1 / -1;
}

.course-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #edf2ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.course-status.learning {
  background: #eef4ff;
  color: #3457a8;
}

.course-status.review {
  background: #fff2df;
  color: #9b641d;
}

.course-status.done {
  background: #e6f5eb;
  color: var(--accent);
}

.course-status.pending {
  background: #edf2ef;
  color: var(--muted);
}

.course-status.invalid {
  background: #fff2df;
  color: #9b641d;
}

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

.course-metric {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.course-metric span,
.course-metric small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.course-metric strong {
  font-size: 18px;
}

.course-placeholder {
  padding: 12px;
  border-radius: 8px;
  background: #f3f6f4;
  color: var(--muted);
  font-weight: 760;
}

.course-mini-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
}

.course-mini-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  position: relative;
}

.course-mini-progress-bar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--value, 0%);
  border-radius: 3px;
  background: var(--blue-primary, #3b82f6);
  transition: width 0.4s ease;
}

.course-mini-progress.pending-bar .course-mini-progress-bar::after {
  background: var(--border);
}

.course-mini-progress small {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 2.5em;
  text-align: right;
  font-weight: 760;
}

.dashboard-summary {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.progress-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

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

.bar > span {
  display: block;
  height: 100%;
  width: var(--value);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 740;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary.emphasis {
  background: var(--gold);
}

.secondary {
  background: #e9f0ec;
  color: var(--ink);
}

.ghost {
  background: transparent;
  color: var(--accent);
}

.danger {
  background: #faebe7;
  color: var(--warn);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.page-head p {
  color: var(--muted);
  margin-bottom: 0;
}

.home-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 300px;
}

.page-number-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.page-number {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-weight: 800;
}

.page-number.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.home-pagination button:disabled {
  cursor: default;
  opacity: 0.48;
}

.focus-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.word-focus {
  position: relative;
  min-height: 370px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 14px;
}

.word-count {
  position: absolute;
  top: 16px;
  left: 16px;
  min-width: 58px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #edf4f8;
  color: #245d8f;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.jp-large {
  font-size: clamp(56px, 10vw, 112px);
  line-height: 1;
  font-weight: 850;
}

.kana {
  font-size: 26px;
  color: var(--accent-2);
  font-weight: 760;
}

.meaning {
  color: var(--muted);
  font-size: 22px;
}

.word-diagnostic-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.word-diagnostic-line strong,
.diagnostic-tag {
  border-radius: 999px;
  padding: 6px 10px;
  background: #e8f2ee;
  color: var(--accent);
  font-size: 13px;
  font-weight: 820;
}

.diagnostic-tag {
  background: #fff4de;
  color: var(--gold);
}

.shadow-box,
.recall-box,
.locked-panel {
  width: min(560px, 100%);
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  text-align: left;
}

.recall-box h3 {
  margin: 0;
  font-size: 22px;
}

.pronunciation-box {
  gap: 10px;
}

.hold-record-button {
  min-width: 132px;
  min-height: 44px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 1px solid #bdd0c6;
  background: #e9f0ec;
  color: var(--ink);
  user-select: none;
  touch-action: none;
}

.hold-record-button .record-icon {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: #8a9a92;
}

.hold-record-button.preparing {
  background: #fff4de;
  border-color: #e1bd7c;
  color: #7a570e;
}

.hold-record-button.preparing .record-icon {
  background: transparent;
  border: 2px solid #d49b35;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}

.hold-record-button.recording {
  background: #faebe7;
  border-color: #d97566;
  color: #9f3327;
}

.hold-record-button.recording .record-icon {
  background: #d54a3d;
  box-shadow: 0 0 0 5px rgba(213, 74, 61, 0.14);
}

.hold-record-button.stopping {
  opacity: 0.72;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pronunciation-result {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.pronunciation-result.passed {
  border-color: #92c7ad;
  background: #f0faf5;
}

.pronunciation-result.failed {
  border-color: #e1a092;
  background: #fff3f0;
}

.pronunciation-result span,
.pronunciation-result small {
  color: var(--muted);
}

.vocab-reveal {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.vocab-reveal.passed {
  border-color: #92c7ad;
  background: #f0faf5;
}

.vocab-reveal.failed {
  border-color: #e1a092;
  background: #fff3f0;
}

.vocab-reveal strong {
  font-size: 18px;
}

.vocab-reveal span,
.vocab-reveal small {
  color: var(--muted);
}

.debug-recording {
  display: grid;
  gap: 5px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
}

.debug-recording audio {
  width: 100%;
  height: 32px;
}

.danger-text {
  color: var(--warn);
}

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

.locked-panel {
  color: var(--muted);
  border-style: dashed;
}

.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 2px 4px;
}

.rail button {
  flex: 0 0 auto;
  min-width: 82px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #edf2ef;
  color: #74817b;
  border: 1px solid transparent;
}

.rail button.current {
  background: #e5f4ed;
  color: var(--accent);
  border-color: #93c7ae;
  transform: translateY(-4px);
}

.rail button.done {
  color: var(--ink);
}

.rail button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.status-item.current {
  color: var(--ink);
}

.status-item.current span {
  font-weight: 700;
}

.status-familiar {
  color: var(--accent);
}

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

.status-unseen {
  color: #8a9691;
}

.text-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 22px;
  align-items: start;
}

.text-page-head {
  align-items: flex-start;
}

.text-head-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.text-tab-switch,
.text-prompt-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.text-tab,
.text-lang {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
}

.text-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.text-tab span {
  color: inherit;
  font-size: 11px;
  opacity: 0.8;
}

.text-tab.active,
.text-lang.active {
  background: var(--accent);
  color: white;
}

.text-stage {
  display: grid;
  gap: 16px;
}

.text-stage-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.text-stage-summary.complete {
  border-color: #92c7ad;
  background: #f0faf5;
}

.text-stage-summary strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.text-stage-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

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

.text-section {
  display: grid;
  gap: 14px;
}

.text-section h3 {
  margin: 0;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.text-group {
  display: grid;
  gap: 8px;
}

.text-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 820;
}

.text-group-title span:first-child {
  display: grid;
  gap: 3px;
}

.text-group-title small {
  color: var(--soft);
  font-size: 11px;
  font-weight: 720;
}

.text-group-progress {
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.statement-group,
.dialogue-group {
  display: grid;
  gap: 8px;
}

.dialogue-group {
  gap: 4px;
}

.sentence-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.sentence-card.new {
  opacity: 0.72;
}

.sentence-card.current {
  border-color: #92c7ad;
  background: #f0faf5;
  box-shadow: var(--shadow);
  opacity: 1;
}

.sentence-card.done {
  border-color: #92c7ad;
}

.sentence-card.failed {
  border-color: #e1a092;
  background: #fff7f4;
  opacity: 1;
}

.sentence-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.sentence-card.statement .sentence-card-head {
  grid-template-columns: minmax(0, 1fr) auto;
}

.sentence-text {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.sentence-jp {
  color: var(--ink);
  background: white;
  font-size: 17px;
  line-height: 1.55;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.sentence-translations {
  display: grid;
  gap: 3px;
}

.sentence-translation {
  color: var(--ink);
  background: white;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sentence-translation.primary {
  color: var(--ink);
  font-weight: 760;
}

.sentence-translation.secondary {
  font-size: 12px;
}

.sentence-card-body {
  display: grid;
  gap: 8px;
  padding-left: 44px;
}

.sentence-card.statement .sentence-card-body {
  padding-left: 0;
}

.sentence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.text-recording-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.text-recording-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.text-recording-row audio {
  width: 100%;
  height: 30px;
}

.text-weak-hint {
  padding: 7px 9px;
  border-radius: 8px;
  background: #fff0ec;
  color: var(--warn);
  font-size: 12px;
  font-weight: 780;
}

.text-group.dialogue {
  gap: 6px;
}

.sentence {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  color: #7a8580;
  opacity: 0.58;
  user-select: text;
}

.sentence.new {
  opacity: 0.54;
}

.sentence.done {
  border-color: #92c7ad;
  background: #f4fcf7;
  color: var(--ink);
}

.sentence.failed {
  border-color: #e1a092;
  background: #fff7f4;
  color: var(--ink);
}

.sentence.dialogue {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 4px 8px;
  background: transparent;
  border-color: transparent;
}

.sentence.dialogue.current {
  background: #f0faf5;
  border-color: #92c7ad;
}

.speaker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 820;
}

.bubble {
  display: block;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  line-height: 1.55;
}

.hover-translation {
  display: inline;
  user-select: text;
}

.hover-translation .cn-text {
  display: none;
  color: var(--accent);
}

.hover-translation:has(.translation-switch:hover) .jp-text {
  display: none;
}

.hover-translation:has(.translation-switch:hover) .cn-text {
  display: inline;
}

.translation-switch {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf8;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  vertical-align: 2px;
  cursor: help;
}

.translation-switch:hover {
  border-color: #92c7ad;
  background: #eaf7ef;
  color: var(--accent);
}

.selection-bubble {
  position: fixed;
  z-index: 40;
  width: min(300px, calc(100vw - 20px));
  padding: 12px;
  border: 1px solid #92c7ad;
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 44px rgba(20, 33, 29, 0.16);
}

.selection-bubble[hidden] {
  display: none;
}

.selection-bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.selection-bubble-head strong {
  min-width: 0;
  color: var(--ink);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.selection-bubble-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
  align-items: start;
}

.selection-bubble-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.selection-bubble-row b {
  font-weight: 760;
  overflow-wrap: anywhere;
}

.selection-bubble-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 760;
}

.sentence.dialogue.current .bubble {
  border-color: #92c7ad;
  background: white;
}

.sentence.current {
  color: var(--ink);
  opacity: 1;
  border-color: #92c7ad;
  background: #f0faf5;
  box-shadow: var(--shadow);
}

.sentence small {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.sentence-status {
  grid-column: 1 / -1;
  justify-self: end;
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 820;
  background: #edf2ef;
  color: var(--muted);
}

.sentence-status.new {
  background: #edf2ef;
  color: var(--muted);
}

.sentence-status.done {
  background: #e6f5eb;
  color: var(--accent);
}

.sentence-status.failed {
  background: #fde7e1;
  color: var(--warn);
}

.sentence-card .sentence-status {
  grid-column: auto;
  align-self: start;
  justify-self: end;
  margin-top: 0;
}

.text-pronunciation-box .hint {
  min-width: 0;
  display: block;
}

.text-pronunciation-box .pronunciation-result {
  padding: 8px 10px;
  gap: 4px;
}

.text-pronunciation-box .pronunciation-result strong {
  font-size: 13px;
}

.text-pronunciation-box .pronunciation-result span,
.text-pronunciation-box .pronunciation-result small {
  font-size: 12px;
  line-height: 1.4;
}

.detail-panel {
  position: sticky;
  top: 86px;
}

.meta-list {
  display: grid;
  gap: 20px;
  margin: 22px 0;
}

.meta-line {
  display: grid;
  gap: 9px;
}

.label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

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

.tag {
  border-radius: 999px;
  padding: 7px 10px;
  background: #edf4f8;
  color: #245d8f;
}

button.tag {
  border: 0;
}

.word-chip {
  border-radius: 8px;
  padding: 8px 10px;
  background: #f0f3f1;
  color: var(--ink);
}

.split {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
}

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

.list-nav button {
  text-align: left;
  border-radius: 8px;
  padding: 7px 10px;
  background: #edf2ef;
  color: var(--muted);
}

.list-nav button.active {
  background: #e5f4ed;
  color: var(--accent);
  font-weight: 760;
}

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

.grammar-nav-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.nav-divider {
  height: 1px;
  margin: 8px 0;
  background: var(--line);
}

.numbered-nav-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  width: 100%;
  text-align: left;
}

.nav-number {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: white;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.numbered-nav-item.active .nav-number {
  background: var(--accent);
  color: white;
}

.nav-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-title {
  min-width: 0;
  line-height: 1.35;
  word-break: break-word;
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 820;
  white-space: nowrap;
}

.nav-progress {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}

.nav-status.new {
  background: #edf2ef;
  color: #74817b;
}

.nav-status.learning {
  background: #fff4de;
  color: #9b6810;
}

.nav-status.failed {
  background: #fde7e1;
  color: var(--warn);
}

.nav-status.done {
  background: #e6f5eb;
  color: var(--accent);
}

.nav-status.empty {
  background: #edf2ef;
  color: var(--muted);
}

.grammar-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.grammar-summary-item {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.grammar-summary-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.grammar-summary-item strong {
  font-size: 18px;
  line-height: 1.1;
}

.exercise-box {
  max-width: 1060px;
  margin: 0 auto;
}

.question {
  font-size: 22px;
  line-height: 1.5;
  margin: 10px 0 20px;
}

.exercise-context {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.group-score {
  width: max-content;
  border: 1px solid #c8ded2;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f4faf6;
  color: var(--accent);
  font-size: 13px;
  font-weight: 820;
}

.exercise-badge {
  width: max-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: #e8f2ee;
  color: var(--accent);
  font-size: 13px;
  font-weight: 820;
}

.related-exercise-list {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.related-exercise-row {
  display: grid;
  grid-template-columns: 30px auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.related-exercise-no {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.related-exercise-title {
  min-width: 0;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-action {
  padding: 7px 10px;
  white-space: nowrap;
}

.exercise-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 14px;
  align-items: start;
}

.exercise-main-panel {
  min-width: 0;
}

.exercise-action-panel {
  padding: 12px;
}

.exercise-action-sticky {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 8px;
}

.exercise-action-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.exercise-action-sticky strong {
  font-size: 18px;
  line-height: 1.2;
}

.exercise-action-sticky small {
  color: var(--muted);
  line-height: 1.4;
}

.exercise-action-buttons {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.exercise-action-buttons button {
  width: 100%;
  justify-content: center;
}

.exercise-notes-area {
  margin-top: 12px;
  display: grid;
  gap: 4px;
}

.exercise-notes-textarea {
  height: 80px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  overflow-y: auto;
  box-sizing: border-box;
  outline: none;
  white-space: pre-wrap;
}

.exercise-notes-textarea:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.exercise-notes-textarea h2,
.exercise-notes-textarea h3,
.exercise-notes-textarea h4 {
  margin: 4px 0;
  font-size: 14px;
}

.exercise-notes-textarea code {
  background: #f0f0f0;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
}

.exercise-notes-textarea ul {
  margin: 4px 0;
  padding-left: 16px;
}

.exercise-progress-overview {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.exercise-progress-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
}

.exercise-progress-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.exercise-progress-summary strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.exercise-progress-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
}

.exercise-progress-chip {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 44px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.exercise-progress-chip.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(45, 122, 79, 0.13);
}

.progress-chip-no {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #edf2ef;
  color: var(--muted);
  font-size: 16px;
  font-weight: 950;
  line-height: 1;
}

.progress-chip-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exercise-progress-chip.passed .progress-chip-no {
  background: #e6f5eb;
  color: var(--accent);
}

.exercise-progress-chip.passed .progress-chip-state {
  color: var(--accent);
}

.exercise-progress-chip.wrong .progress-chip-no {
  background: #fde7e1;
  color: var(--warn);
}

.exercise-progress-chip.wrong .progress-chip-state {
  color: var(--warn);
}

.exercise-group-list,
.exercise-feedback-list {
  display: grid;
  gap: 8px;
}

.exercise-item,
.exercise-feedback-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.exercise-item.passed,
.exercise-feedback-row.passed {
  border-color: #b7dac5;
  background: #f3fbf6;
}

.exercise-item.wrong,
.exercise-feedback-row.wrong {
  border-color: #e5b2a7;
  background: #fff7f4;
}

.exercise-item-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.exercise-item-head .question {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.answer-guidance {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.exercise-feedback-row .meta-line {
  margin: 0;
}

.exercise-example-section {
  display: grid;
  gap: 6px;
  padding: 4px 2px 10px;
}

.exercise-example-section span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.exercise-example-lines {
  display: grid;
  gap: 8px;
}

.exercise-example {
  color: var(--ink);
  font-size: 18px;
  font-weight: 760;
  line-height: 1.6;
}

.example-arrow {
  color: var(--muted);
  font-weight: 820;
}

.exercise-box ruby,
.dialog ruby,
.sentence-card ruby,
.grammar-practice-card ruby,
.related-exercise-title ruby,
.supplemental-preview ruby {
  ruby-position: over;
}

.exercise-box rt,
.dialog rt,
.sentence-card rt,
.grammar-practice-card rt,
.related-exercise-title rt,
.supplemental-preview rt {
  color: var(--muted);
  font-size: 0.68em;
  font-weight: 760;
  line-height: 1;
}

.example-underline {
  color: var(--accent);
  font-family: inherit;
  font-size: inherit;
  font-style: inherit;
  font-synthesis: none;
  font-weight: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 2.5px;
  text-underline-offset: 5px;
}

.exercise-item .answer-input {
  min-height: 40px;
  padding: 9px 10px;
}

.choice-select {
  max-width: 260px;
}

.exercise-item .choices {
  gap: 6px;
}

.exercise-item .choice {
  padding: 9px 10px;
}

.grammar-progress {
  margin-bottom: 10px;
  font-size: 12px;
}

.grammar-practice-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.grammar-practice-card.collapsed {
  gap: 4px;
}

.grammar-practice-card.pending {
  border-color: #d7e0db;
}

.grammar-practice-card.passed {
  border-color: #92c7ad;
  background: #f0faf5;
}

.grammar-practice-card.failed {
  border-color: #e1a092;
  background: #fff3f0;
}

.grammar-practice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.grammar-practice-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.grammar-pronunciation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.grammar-pronunciation-head .label {
  margin: 0;
}

.grammar-practice-head-main {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
}

.grammar-practice-no {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.grammar-practice-head strong {
  display: block;
  font-size: 15px;
  line-height: 1.3;
}

.grammar-practice-head small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.practice-status {
  align-self: flex-start;
  border-radius: 999px;
  padding: 4px 8px;
  background: #edf2ef;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  white-space: nowrap;
}

.practice-status.success {
  background: #e6f5eb;
  color: var(--accent);
}

.practice-status.danger {
  background: #fde7e1;
  color: var(--warn);
}

.grammar-practice-cloze {
  padding: 7px 9px;
  border: 1px dashed #c9d4cf;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  line-height: 1.5;
  word-break: break-word;
}

.grammar-practice-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
}

.grammar-practice-form .answer-input {
  min-height: 38px;
  padding: 9px 10px;
}

.grammar-answer-inline {
  display: grid;
  gap: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.grammar-answer-inline.passed {
  border-color: #92c7ad;
  background: #f0faf5;
}

.grammar-answer-inline.failed {
  border-color: #e1a092;
  background: #fff3f0;
}

.grammar-answer-inline .diff-line {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.45;
  font-size: 13px;
}

.grammar-practice-result {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}

.grammar-practice-result.passed {
  border-color: #92c7ad;
  background: #f0faf5;
}

.grammar-practice-result.failed {
  border-color: #e1a092;
  background: #fff3f0;
}

.grammar-practice-result strong {
  font-size: 13px;
}

.grammar-practice-result span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.grammar-pronunciation-box {
  width: 100%;
  padding: 9px 10px;
  gap: 6px;
}

.grammar-practice-body.collapsed {
  display: none;
}

.grammar-pronunciation-box .button-row {
  gap: 6px;
}

.grammar-reset-button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.grammar-toggle-button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.grammar-pronunciation-box .hold-record-button {
  min-width: 120px;
  min-height: 40px;
}

.grammar-pronunciation-box .pronunciation-result {
  padding: 8px 9px;
  gap: 4px;
}

.grammar-pronunciation-box .pronunciation-result strong {
  font-size: 13px;
}

.grammar-pronunciation-box .pronunciation-result span,
.grammar-pronunciation-box .pronunciation-result small {
  font-size: 12px;
  line-height: 1.4;
}

.grammar-pronunciation-box .debug-recording {
  padding: 6px;
  gap: 4px;
}

.grammar-pronunciation-box .debug-recording audio {
  height: 28px;
}

.supplemental-example-card {
  padding: 0;
  border: 0;
  background: transparent;
}

.supplemental-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  opacity: 1;
  color: var(--ink);
  box-shadow: none;
  line-height: 1.65;
}

.audio-layout {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.audio-voice-panel,
.audio-assets-panel {
  display: grid;
  gap: 14px;
}

.voice-list {
  display: grid;
  gap: 6px;
}

.voice-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.voice-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  min-width: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.voice-main span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.voice-main strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-main small {
  color: var(--muted);
  white-space: normal;
}

.voice-option.active {
  border-color: #92c7ad;
  background: #f0faf5;
}

.voice-option.active span {
  background: var(--accent);
  color: white;
}

.set-default-voice {
  align-self: center;
  opacity: 0;
  pointer-events: none;
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
}

.voice-option:hover .set-default-voice,
.voice-option:focus-within .set-default-voice {
  opacity: 1;
  pointer-events: auto;
}

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

.audio-summary div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.audio-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.audio-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
}

.audio-item-list {
  display: grid;
  gap: 6px;
}

.audio-asset-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 64px auto auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.audio-asset-row.ready {
  border-color: #c9e3d5;
}

.audio-type,
.audio-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.audio-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-asset-row.ready .audio-state {
  color: var(--accent);
}

.audio-asset-row.missing .audio-state {
  color: var(--warn);
}

.audio-placeholder {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px dashed #b8c5bf;
  border-radius: 8px;
  background: #fbfcfb;
}

.choices {
  display: grid;
  gap: 10px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.choice-key {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #edf2ef;
  color: var(--muted);
  font-size: 13px;
  font-weight: 860;
}

.choice.selected {
  border-color: var(--accent);
  background: #effaf4;
}

.choice.correct {
  border-color: #92c7ad;
  background: #f0faf5;
  color: #196844;
}

.choice.correct .choice-key {
  background: #dff3e8;
  color: #196844;
}

.choice.wrong {
  border-color: #e1a092;
  background: #fff3f0;
  color: #9f3327;
}

.choice.wrong .choice-key {
  background: #fae1dc;
  color: #9f3327;
}

.choice.correct:disabled,
.choice.wrong:disabled {
  opacity: 1;
}

.answer-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

textarea.answer-input {
  min-height: 130px;
  resize: vertical;
}

.feedback {
  margin-top: 18px;
  display: grid;
  gap: 12px;
  border-left: 4px solid var(--accent);
}

.feedback.passed {
  border-color: #88c7a3;
  background: #effaf4;
}

.feedback.wrong {
  border-left-color: var(--warn);
  border-color: #e1a092;
  background: #fff3f0;
}

.feedback-verdict {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.feedback-verdict strong {
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--accent);
  color: white;
  font-size: 18px;
}

.feedback.wrong .feedback-verdict strong {
  background: var(--warn);
}

.feedback-verdict span {
  color: var(--muted);
  font-weight: 760;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  font-size: 34px;
}

.stack {
  display: grid;
  gap: 12px;
}

.practice-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.practice-item p {
  margin: 0;
  line-height: 1.55;
}

.example-practice {
  display: grid;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.example-practice.pending .sentence {
  background: #f5f7f6;
  border-color: #dce4e0;
  color: #76837d;
  opacity: 1;
  box-shadow: none;
}

.example-practice.mastered {
  background: transparent;
}

.example-practice.mastered .sentence {
  border-color: #92c7ad;
  background: #f0faf5;
}

.weak-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.weak-item span,
.weak-item small {
  color: var(--muted);
}

.compact-shadow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.compact-status {
  min-width: 64px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
}

.compact-status.success {
  color: var(--accent);
}

.mini-button {
  min-height: 30px;
  border-radius: 7px;
  padding: 0 10px;
  background: #edf2ef;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

.mini-button.primary {
  background: var(--accent);
  color: white;
}

.mini-button.danger {
  background: #faebe7;
  color: var(--warn);
}

.example-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: stretch;
}

.example-row .sentence {
  margin: 0;
}

.icon-button {
  width: 42px;
  min-height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #edf4f8;
  color: #245d8f;
  border: 1px solid var(--line);
  font-size: 18px;
}

.icon-button:hover {
  background: #dfeef7;
}

.muted {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}

.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-right: 4px;
  border: 1px solid var(--line);
  border-bottom-color: #b9c6c0;
  border-radius: 6px;
  background: #f7faf8;
  color: var(--ink);
  font-weight: 780;
}

.diff-box {
  display: grid;
  gap: 10px;
}

.diff-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.diff-line {
  min-height: 42px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  line-height: 1.9;
  word-break: break-all;
}

.diff-line mark {
  display: inline-block;
  min-width: 1.25em;
  margin: 0 1px;
  padding: 0 3px;
  border-radius: 5px;
  color: inherit;
}

.diff-wrong {
  background: #ffd8cf;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: #bd4a35;
}

.diff-missing {
  background: #dff2e6;
  outline: 1px solid #94c8a7;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 21, 0.42);
}

.command-box {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #18201d;
  color: white;
  white-space: pre-wrap;
  word-break: break-all;
}

.dialog {
  width: min(560px, 100%);
}

.hidden {
  display: none;
}

.init-page {
  display: grid;
  gap: 10px;
}

.init-page .page-head {
  margin-bottom: 8px;
}

.init-page-head h1 {
  font-size: 34px;
}

.init-page-head .lead {
  max-width: 860px;
  font-size: 14px;
  line-height: 1.45;
}

.init-steps {
  display: grid;
  gap: 12px;
}

.init-step {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.init-step.locked {
  opacity: 0.72;
}

.init-step-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.init-step-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

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

.init-upload-box {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 150px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.init-upload-box.inferred {
  background: rgba(76, 120, 92, 0.08);
}

.init-upload-box h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
}

.init-upload-box h3 small {
  color: var(--accent);
  font-size: 11px;
  font-weight: 820;
}

.init-upload-button {
  justify-self: start;
}

.init-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.init-image-list {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.init-image-list a {
  display: flex;
  gap: 6px;
  overflow: hidden;
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.init-image-list a span {
  color: var(--muted);
  flex: 0 0 auto;
  font-weight: 820;
}

.init-task-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.init-task-box h3 {
  margin: 0;
}

.init-task-box a {
  color: var(--accent);
  word-break: break-all;
}

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

.init-summary.audio-summary {
  gap: 8px;
}

.init-summary.audio-summary > div {
  padding: 10px;
}

.init-draft-json {
  width: 100%;
  min-height: 220px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.init-import-json {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.init-preview-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.init-preview-line strong {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
}

.init-audio-list {
  max-height: 360px;
}

.init-busy-panel {
  width: 100%;
  max-width: none;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #c6d3cd;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

@media (max-width: 880px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 18px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .lesson-subnav {
    position: static;
    top: auto;
    min-height: 40px;
    padding: 0 18px;
  }

  .main {
    padding: 18px;
  }

  .hero,
  .course-grid,
  .module-grid,
  .focus-layout,
  .text-layout,
  .audio-layout,
  .init-upload-grid,
  .split,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .course-home h1,
  .lesson-dashboard h1,
  .pending-lesson h1 {
    font-size: 34px;
  }

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

  .overall-progress-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .exercise-workspace {
    grid-template-columns: 1fr;
  }

  .exercise-action-panel {
    order: -1;
  }

  .exercise-action-sticky {
    position: static;
  }

  .detail-panel {
    position: static;
  }

  .page-head {
    flex-direction: column;
  }

  .page-head .button-row {
    width: 100%;
  }

  .home-pagination {
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
  }

  .page-head .button-row > button {
    flex: 1 1 140px;
  }

  .focus-layout {
    gap: 14px;
  }

  .word-focus {
    min-height: auto;
    align-content: start;
    gap: 10px;
    padding: 18px 14px;
  }

  .word-count {
    position: static;
    justify-self: start;
    min-width: 0;
    padding: 5px 9px;
    font-size: 13px;
  }

  .kana {
    order: 1;
    font-size: 20px;
    line-height: 1.35;
  }

  .jp-large {
    order: 2;
    max-width: 100%;
    font-size: clamp(42px, 17vw, 72px);
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  .meaning {
    order: 3;
    font-size: 18px;
    line-height: 1.45;
  }

  .word-focus > .hint {
    order: 4;
    font-size: 12px;
  }

  .word-diagnostic-line {
    order: 5;
    justify-content: flex-start;
    width: 100%;
  }

  .pronunciation-box,
  .word-focus .recall-box {
    order: 6;
    width: 100%;
    padding: 12px;
  }

  .pronunciation-box > .hint {
    display: none;
  }

  .pronunciation-box .button-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .pronunciation-box .button-row > button,
  .pronunciation-box .hold-record-button {
    width: 100%;
    min-height: 48px;
  }

  .debug-recording small {
    display: none;
  }

  .rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
    padding: 10px 0 4px;
    overflow: visible;
  }

  .rail button {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .rail button:disabled {
    display: none;
  }

  .focus-layout > aside.panel {
    padding: 14px;
  }

  .focus-layout > aside.panel .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .status-list {
    max-height: 220px;
    overflow: auto;
    padding: 8px;
  }

  .status-item {
    align-items: flex-start;
    font-size: 13px;
  }

  .choices.compact {
    grid-template-columns: 1fr;
  }

  .text-head-actions {
    justify-items: stretch;
    width: 100%;
  }

  .text-tab-switch,
  .text-prompt-switch {
    flex-wrap: wrap;
  }

  .text-stage-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .sentence-card-head,
  .sentence-card.statement .sentence-card-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .sentence-card-body {
    padding-left: 0;
  }

  .sentence-actions {
    justify-content: flex-start;
  }

  .text-recording-row {
    grid-template-columns: 1fr;
  }

  .grammar-summary-grid,
  .grammar-practice-form {
    grid-template-columns: 1fr;
  }

  .related-exercise-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
  }

  .related-exercise-row .exercise-badge {
    display: none;
  }

  .audio-asset-row {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .audio-asset-row .audio-state {
    display: none;
  }

  .init-step-head {
    flex-direction: column;
  }

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