:root {
  color-scheme: light;
  --ink: #18201a;
  --muted: #617069;
  --line: #d7ded8;
  --paper: #f7f3eb;
  --panel: #ffffff;
  --panel-soft: #fbfaf6;
  --panel-glass: rgba(255, 255, 255, 0.88);
  --score-glass: rgba(255, 255, 255, 0.82);
  --hover-soft: #fafcfb;
  --table-head: #f2f6f3;
  --drop-soft: #dfeee9;
  --tool-soft: #edf3ef;
  --bar-track: #e6e1d8;
  --result-soft: #f5f1e8;
  --accent: #21615a;
  --accent-dark: #123f3b;
  --accent-soft: #dbe9e6;
  --warn: #9c3c28;
  --warn-soft: #f7ded7;
  --ok: #2e6f43;
  --ok-soft: #dff0e4;
  --a2: #2f7a63;
  --b1: #a26d18;
  --b2: #7c3659;
  --shadow: 0 18px 45px rgba(28, 39, 34, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.dark-mode {
  color-scheme: dark;
  --ink: #f3f6ef;
  --muted: #b5c3ba;
  --line: #35453e;
  --paper: #101512;
  --panel: #18211d;
  --panel-soft: #202a25;
  --panel-glass: rgba(24, 33, 29, 0.92);
  --score-glass: rgba(24, 33, 29, 0.88);
  --hover-soft: #223029;
  --table-head: #202d27;
  --drop-soft: #193a34;
  --tool-soft: #202d27;
  --bar-track: #2d362f;
  --result-soft: #202a25;
  --accent: #79cdbf;
  --accent-dark: #a7e3d8;
  --accent-soft: #183c37;
  --warn: #ffab91;
  --warn-soft: #3b211c;
  --ok: #9ad8a9;
  --ok-soft: #183423;
  --a2: #80d5b9;
  --b1: #e4b15e;
  --b2: #e18bb4;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(33, 97, 90, 0.08), rgba(247, 243, 235, 0) 340px),
    var(--paper);
  color: var(--ink);
  transition: background 160ms ease, color 160ms ease;
}

body.dark-mode {
  background:
    radial-gradient(circle at top right, rgba(121, 205, 191, 0.2), transparent 320px),
    linear-gradient(180deg, rgba(121, 205, 191, 0.08), rgba(16, 21, 18, 0) 360px),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 44px;
}

.credits-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.credits-top a {
  color: var(--accent);
  text-decoration: none;
}

.credits-top a:hover {
  text-decoration: underline;
}

.credits-separator {
  color: var(--muted);
  opacity: 0.55;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.title-wrap {
  min-width: 0;
}

.header-side {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.eyebrow,
.task-type {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.02;
}

h1:empty {
  display: none;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.view-switch {
  display: flex;
  gap: 8px;
  align-self: stretch;
}

.view-switch .secondary-button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(135deg, var(--panel), var(--panel-soft)),
    var(--panel);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(28, 39, 34, 0.08);
  cursor: pointer;
  font-weight: 800;
}

.theme-toggle-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.score-card {
  min-width: 170px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--score-glass);
  box-shadow: 0 10px 24px rgba(28, 39, 34, 0.08);
  text-align: right;
}

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

.language-picker {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.language-select,
.theory-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.score-card .language-select {
  margin-bottom: 10px;
}

.score-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.score-card strong {
  margin-top: 4px;
  font-size: 1.08rem;
}

.theory-view,
.test-view {
  display: grid;
  gap: 18px;
}

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

.panel-band,
.finish-panel {
  padding: 24px;
}

.workspace {
  padding: 24px;
}

.theory-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 22px;
  align-items: stretch;
}

.hero-copy h2 {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
}

.hero-text {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.hero-actions,
.finish-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-stats {
  display: grid;
  gap: 12px;
}

.mini-stat,
.result-card,
.insight-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.mini-stat span,
.result-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-stat strong,
.result-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.3rem;
}

.settings-stat {
  display: grid;
  gap: 12px;
}

.settings-field-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-field-row .language-select {
  min-width: 120px;
}

.settings-manual-input {
  width: 120px;
  min-height: 46px;
}

.sentence-match-stage {
  position: relative;
  min-height: 320px;
}

.sentence-match-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.sentence-match-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 72px;
  align-items: start;
}

.match-column {
  display: grid;
  gap: 18px;
}

.match-button {
  --match-color: var(--accent);
  position: relative;
  overflow: visible;
  min-height: 62px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  box-shadow: 0 8px 20px rgba(28, 39, 34, 0.06);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.match-button:hover:not(:disabled),
.match-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.match-button.is-connected {
  border-color: var(--match-color);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--match-color) 18%, transparent);
}

.match-button.is-correct {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.match-button.is-incorrect {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.match-button.is-expected {
  border-color: var(--ok);
  box-shadow: inset 0 0 0 2px rgba(75, 164, 128, 0.24), 0 10px 24px rgba(75, 164, 128, 0.12);
}

.match-button:disabled {
  cursor: default;
}

.match-button--left {
  justify-content: space-between;
  padding-right: 34px;
}

.match-button--right {
  justify-content: space-between;
  padding-left: 34px;
}

.match-text {
  flex: 1;
  font-weight: 600;
  line-height: 1.35;
}

.match-dot {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 3px solid var(--match-color);
  flex: 0 0 auto;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--match-color) 10%, transparent);
}

.match-button--left .match-dot {
  right: -9px;
}

.match-button--right .match-dot {
  left: -9px;
}

.match-line {
  stroke: var(--match-color);
  stroke-width: 4.5;
  stroke-linecap: round;
  opacity: 0.95;
}

.match-line.is-correct {
  stroke-width: 5;
}

.match-line.is-incorrect {
  stroke-dasharray: 8 5;
}

.match-line.is-expected {
  stroke: var(--ok);
  stroke-width: 3.5;
  stroke-dasharray: 4 6;
  opacity: 0.9;
}

.mini-stat-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.theory-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.theory-select {
  width: 220px;
}

.theory-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.theory-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.theory-card.collapsible {
  padding-bottom: 64px;
}

.theory-card-header h3 {
  margin-bottom: 10px;
  font-size: 1.06rem;
}

.theory-card-header .short-rule {
  margin: 0;
  line-height: 1.5;
}

.theory-card-content {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.theory-text {
  white-space: pre-line;
  margin: 16px 0 !important;
  color: var(--ink);
  line-height: 1.6;
}

.mistake-box {
  padding: 12px;
  border-left: 4px solid var(--warn);
  background: var(--warn-soft);
  border-radius: 4px;
}

.example-box {
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
}

.theory-card-content ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.theory-card .toggle-details {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
}

.theory-card.is-expanded {
  background: var(--panel-soft);
}

.vocabulary-list,
.sentence-bank,
.review-list {
  display: grid;
  gap: 10px;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.vocab-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.vocab-table th,
.vocab-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.4;
}

.vocab-table thead th {
  background: var(--table-head);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.vocab-table tbody tr:last-child td {
  border-bottom: 0;
}

.vocab-table tbody tr:hover {
  background: var(--hover-soft);
}

.vocab-word-cell {
  font-size: 1rem;
  font-weight: 800;
}

.vocab-category-cell {
  color: var(--muted);
  white-space: nowrap;
}

.table-empty {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.vocab-item,
.sentence-item,
.review-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.vocab-head,
.sentence-head,
.review-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.vocab-main {
  display: grid;
  gap: 6px;
}

.vocab-form {
  font-size: 1.04rem;
  font-weight: 800;
}

.vocab-forms,
.vocab-translation,
.sentence-translation,
.review-line {
  margin: 4px 0 0;
  line-height: 1.45;
  white-space: pre-line;
}

.vocab-category,
.sentence-level,
.review-meta,
.result-card p,
.review-summary {
  color: var(--muted);
  font-size: 0.9rem;
}

.sentence-de {
  margin: 8px 0 0;
  font-size: 1.02rem;
  line-height: 1.5;
}

.progress-wrap {
  margin-bottom: 0;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bar-track);
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #21615a, #6f9d57);
  transition: width 220ms ease;
}

.review-title {
  margin: 24px 0 6px;
  font-size: 1.15rem;
}

.review-summary {
  margin-bottom: 0;
  font-weight: 700;
}

.review-item.mistake {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.review-item.correct {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.review-meta {
  margin-bottom: 8px;
  font-weight: 800;
}

.review-line strong {
  color: var(--ink);
}

.post-submit-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.translation-panel,
.rule-panel {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.translation-panel {
  white-space: pre-line;
}

.alternate-panel {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.alternate-title {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-weight: 800;
}

.alternate-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.alternate-list li {
  line-height: 1.45;
}

.dialog-solution-line {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.dialog-solution-line::marker {
  font-weight: 800;
}

.dialog-solution-line.is-misplaced {
  border-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

.dialog-solution-line .dialog-line-speaker {
  display: inline-block;
  margin-right: 8px;
}

.rule-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.rule-line {
  margin: 7px 0 0;
  line-height: 1.45;
}

.rule-more {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.rule-examples {
  display: grid;
  gap: 6px;
  margin: 10px 0 12px;
}

.rule-example-item {
  padding-left: 14px;
  color: var(--muted);
}

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

.task-help-wrap {
  margin: -6px 0 18px;
}

.task-help-toggle {
  width: auto;
}

.task-help-panel {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.task-help-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.task-help-line {
  margin: 0 0 8px;
  line-height: 1.5;
}

.task-help-line:last-child {
  margin-bottom: 0;
}

.sentence-grammar-box,
.sentence-grammar-more {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(27, 98, 93, 0.16);
  border-radius: 8px;
  background: rgba(232, 247, 244, 0.42);
}

.sentence-grammar-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sentence-grammar-list,
.sentence-grammar-more {
  display: grid;
  gap: 10px;
}

.sentence-grammar-item-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.sentence-grammar-item-text,
.sentence-grammar-item-example {
  margin: 0;
  line-height: 1.5;
}

.sentence-grammar-item-example {
  color: var(--muted);
}

.level-badge {
  display: inline-grid;
  gap: 8px;
  justify-items: end;
}

.level-badge-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.level-scale {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
}

.level-option {
  min-width: 74px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 32px;
  text-align: center;
}

.level-option.is-active {
  background: var(--panel);
}

.level-option.is-active.level-A2 {
  border-color: rgba(47, 122, 99, 0.26);
  color: var(--a2);
  box-shadow: inset 0 0 0 1px rgba(47, 122, 99, 0.18);
}

.level-option.is-active.level-B1 {
  border-color: rgba(162, 109, 24, 0.26);
  color: var(--b1);
  box-shadow: inset 0 0 0 1px rgba(162, 109, 24, 0.18);
}

.level-option.is-active.level-B2 {
  border-color: rgba(124, 54, 89, 0.26);
  color: var(--b2);
  box-shadow: inset 0 0 0 1px rgba(124, 54, 89, 0.18);
}

.sentence-zone {
  min-height: 132px;
  padding: 14px;
  border: 1px dashed #b9c6be;
  border-radius: 8px;
  background: var(--panel-soft);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.answer-area,
.word-bank {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}

.answer-area {
  position: relative;
  min-height: 100px;
}

.answer-area.sentence-builder:empty::before {
  content: "Ziehe die Wörter hierher.";
  color: #7a8a82;
  font-weight: 700;
}

.answer-area.dialog-order,
.word-bank.dialog-bank {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.answer-area.dialog-order {
  min-height: 360px;
}

.answer-area.dialog-order:empty::before {
  content: "Lege die Dialogzeilen hier in die richtige Reihenfolge.";
  color: #7a8a82;
  font-weight: 700;
}

.dialog-line-button {
  width: 100%;
  min-height: 58px;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  white-space: normal;
}

.dialog-line-speaker {
  min-width: 96px;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.dialog-line-text {
  flex: 1;
  line-height: 1.35;
}

.answer-area.drop-ready,
.word-bank.drop-ready {
  outline: 2px dashed rgba(33, 97, 90, 0.38);
  outline-offset: 4px;
}

.answer-area.drop-over,
.word-bank.drop-over {
  background: var(--drop-soft);
  outline-color: var(--accent);
}

.answer-area.choice-list,
.answer-area.gap-fill,
.answer-area.form-training,
.answer-area.error-search {
  display: grid;
}

.answer-area.choice-list {
  gap: 10px;
}

.answer-area.gap-fill,
.answer-area.form-training,
.answer-area.error-search {
  gap: 18px;
}

.error-sentence {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.5;
}

.error-word {
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.error-word:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.error-word.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 800;
}

.error-word.correct {
  border-color: #91c49d;
  background: var(--ok-soft);
}

.error-word.incorrect {
  border-color: #e2a99b;
  background: var(--warn-soft);
}

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

.form-card {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.form-value {
  font-size: 1.08rem;
  font-weight: 800;
}

.form-missing {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.gap-sentence {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.55;
}

.gap-hint {
  margin: 0;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1.4;
}

.gap-input {
  width: min(360px, 100%);
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid #c8d4cc;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.gap-input:focus,
.language-select:focus,
.theory-input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(33, 97, 90, 0.16);
}

.form-answer-stack {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.form-picker-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.form-aux-picker {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.aux-button {
  min-width: 72px;
}

.aux-button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.aux-button.correct {
  border-color: #91c49d;
  background: var(--ok-soft);
}

.aux-button.incorrect {
  border-color: #e2a99b;
  background: var(--warn-soft);
}

.char-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding: 10px;
  border-radius: 8px;
  background: var(--tool-soft);
}

.char-toolbar button {
  width: 42px;
  height: 38px;
  border: 1px solid #c8d4cc;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.char-toolbar button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.word-bank {
  min-height: 112px;
  margin-top: 18px;
  padding: 16px;
  border-radius: 8px;
  background: var(--tool-soft);
}

.word-button,
.choice-button {
  border: 1px solid #c8d4cc;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 0 rgba(24, 32, 26, 0.08);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.word-button {
  min-height: 42px;
  padding: 0 13px;
  cursor: pointer;
  user-select: none;
}

.word-button[draggable="true"] {
  cursor: grab;
}

.word-button.dragging {
  opacity: 0.45;
  transform: scale(0.96);
}

.choice-button {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  cursor: pointer;
  line-height: 1.35;
  text-align: left;
}

.word-button:hover,
.choice-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

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

.choice-button.correct {
  border-color: #91c49d;
  background: var(--ok-soft);
}

.choice-button.incorrect {
  border-color: #e2a99b;
  background: var(--warn-soft);
}

.answer-area .word-button {
  background: var(--accent-soft);
  border-color: #9fbdb8;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

body.dark-mode .primary-button {
  color: #0b1411;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.theme-toggle:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible {
  outline: 3px solid rgba(33, 97, 90, 0.22);
  outline-offset: 2px;
}

.feedback {
  margin-bottom: 18px;
  padding: 13px 15px;
  border-radius: 8px;
  font-weight: 700;
  line-height: 1.35;
}

.feedback.good {
  border: 1px solid #b6d8c0;
  background: var(--ok-soft);
  color: var(--ok);
}

.feedback.bad {
  border: 1px solid #ecbeb3;
  background: var(--warn-soft);
  color: var(--warn);
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  margin-top: 18px;
}

.overall-card {
  background: linear-gradient(180deg, rgba(33, 97, 90, 0.08), rgba(33, 97, 90, 0.02));
}

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

.level-stat-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.level-stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.2rem;
}

.stat-bar {
  height: 8px;
  overflow: hidden;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--bar-track);
}

.stat-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #21615a, #78a25c);
}

.insight-box {
  margin-top: 14px;
  background: var(--result-soft);
}

.insight-box h3 {
  margin-bottom: 8px;
}

.insight-box p {
  margin: 0;
  line-height: 1.55;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 32, 26, 0.42);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  background: var(--panel-glass);
  box-shadow: 0 28px 60px rgba(18, 27, 23, 0.28);
}

.modal-card h2 {
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.modal-text {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.finish-actions {
  margin-top: 18px;
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .topbar,
  .task-head,
  .section-head,
  .theory-hero {
    display: block;
  }

  .header-side {
    margin-top: 16px;
    display: block;
  }

  .view-switch {
    margin-bottom: 12px;
  }

  .theme-toggle {
    margin-bottom: 12px;
  }

  .score-card {
    text-align: left;
  }

  .theory-grid,
  .result-grid,
  .result-level-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0 28px;
  }

  h1 {
    font-size: 2.15rem;
  }

  .workspace,
  .panel-band,
  .finish-panel {
    padding: 16px;
  }

  .theory-tools {
    margin-top: 12px;
  }

  .theory-input,
  .theory-select {
    width: 100%;
  }

  .word-button {
    min-height: 40px;
    padding: 0 11px;
  }

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

  .actions,
  .finish-actions,
  .hero-actions,
  .modal-actions {
    flex-direction: column;
  }
}
