:root {
  color-scheme: light;
  --space: #0b0714;
  --space-2: #16051c;
  --nebula-cyan: #22d3c5;
  --nebula-violet: #7c3aed;
  --star-gold: #f59e0b;
  --stardust: #f7f3ea;
  --silver: #b8c4cc;
  --bg: #f6f3ee;
  --panel: #fffdf8;
  --panel-alt: #f0ebe3;
  --text: #17131f;
  --muted: #6e6876;
  --border: #ded6cc;
  --primary: #0f766e;
  --primary-soft: #dcf7f3;
  --accent: var(--star-gold);
  --typing: var(--nebula-violet);
  --typing-soft: #eee7ff;
  --ink-soft: #78717f;
  --danger: #b54747;
  --danger-soft: #fbe6e6;
  --favorite: #b7791f;
  --correct: #176c3f;
  --correct-soft: #e2f6ea;
  --error: #c43c3c;
  --error-soft: #fde7e7;
  --shadow: 0 14px 36px rgba(20, 7, 31, 0.1);
  font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 20px;
  background: linear-gradient(180deg, var(--space) 0%, var(--space-2) 58%, #062d32 100%);
  color: var(--stardust);
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--nebula-violet) 0%, #2932a9 42%, var(--nebula-cyan) 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: 0 12px 28px rgba(124, 58, 237, 0.28);
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 1.25rem;
}

.brand p {
  color: rgba(247, 243, 234, 0.72);
  font-size: 0.92rem;
}

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

.nav-item {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 12px 14px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(34, 211, 197, 0.12);
}

.sync-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

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

.sync-header span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(237, 245, 243, 0.74);
  font-size: 0.82rem;
  white-space: nowrap;
}

.sync-header span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(237, 245, 243, 0.52);
  box-shadow: 0 0 0 3px rgba(237, 245, 243, 0.08);
}

.sync-panel[data-sync-state="ok"] .sync-header span {
  color: #bdf4dc;
}

.sync-panel[data-sync-state="ok"] .sync-header span::before {
  background: #48d597;
  box-shadow: 0 0 0 3px rgba(72, 213, 151, 0.16);
}

.sync-panel[data-sync-state="pending"] .sync-header span {
  color: #ffe1a3;
}

.sync-panel[data-sync-state="pending"] .sync-header span::before {
  background: #f5b84b;
  box-shadow: 0 0 0 3px rgba(245, 184, 75, 0.18);
}

.sync-panel[data-sync-state="busy"] .sync-header span {
  color: #b9d7ff;
}

.sync-panel[data-sync-state="busy"] .sync-header span::before {
  background: #7eb6ff;
  animation: syncPulse 1s ease-in-out infinite;
}

.sync-panel[data-sync-state="error"] .sync-header span {
  color: #ffc2c2;
}

.sync-panel[data-sync-state="error"] .sync-header span::before {
  background: #ff6b6b;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.18);
}

.sync-panel label {
  display: grid;
  gap: 5px;
  color: rgba(237, 245, 243, 0.84);
  font-size: 0.82rem;
}

.sync-panel input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 0.86rem;
}

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

.sync-actions button {
  min-width: 0;
  padding: 8px 9px;
  font-size: 0.86rem;
}

.settings-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  align-items: start;
}

.settings-panel {
  display: grid;
  gap: 16px;
}

.settings-panel h3,
.settings-panel p {
  margin: 0;
}

.settings-panel.sync-panel {
  padding: 20px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.settings-panel .sync-header {
  align-items: flex-start;
}

.settings-panel .sync-header span {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-alt);
}

.settings-panel[data-sync-state="ok"] .sync-header span {
  color: var(--correct);
}

.settings-panel[data-sync-state="pending"] .sync-header span {
  color: #946200;
}

.settings-panel[data-sync-state="busy"] .sync-header span {
  color: #1466a8;
}

.settings-panel[data-sync-state="error"] .sync-header span {
  color: var(--error);
}

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

.settings-panel.sync-panel label {
  color: var(--muted);
}

.settings-panel.sync-panel input {
  border-color: var(--border);
  background: #fff;
  padding: 11px 12px;
  font-size: 0.95rem;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.shortcut-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.shortcut-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.shortcut-list dt,
.shortcut-list dd {
  margin: 0;
}

.shortcut-list dt {
  color: var(--muted);
}

.shortcut-list dd {
  font-weight: 800;
  color: var(--text);
}

@keyframes syncPulse {
  0%,
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 3px rgba(126, 182, 255, 0.16);
  }

  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(126, 182, 255, 0.04);
  }
}

.main {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.utility-topbar {
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.topbar strong {
  font-size: 1.2rem;
}

.topbar-actions,
.button-row,
.control-row,
.panel-title-row,
.card-meta,
.trainer-footer,
.library-toolbar,
.bulk-toolbar,
.library-meta,
.library-actions,
.tag-list,
.tag-editor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 20px;
}

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

.section-head h2,
.panel-title-row h3 {
  margin: 0;
}

.practice-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.practice-mode-card {
  display: grid;
  gap: 8px;
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  text-align: left;
  box-shadow: var(--shadow);
}

.practice-mode-card strong {
  font-size: 1.08rem;
}

.practice-mode-card span {
  color: var(--muted);
  line-height: 1.45;
}

.practice-mode-card.active {
  border-color: var(--primary);
  background: linear-gradient(180deg, #fffdf8 0%, #e9fbf8 100%);
}

.practice-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
  align-items: end;
}

.practice-toolbar label,
.control-row label,
.library-toolbar label,
.compact label {
  display: grid;
  gap: 7px;
  min-width: 160px;
  line-height: 1.35;
}

.inline-field-group {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.inline-field-group label {
  min-width: 0;
}

.compact-action {
  min-height: 44px;
  padding-inline: 16px;
}

.practice-layout,
.import-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

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

.practice-panel {
  min-height: 520px;
  padding: clamp(20px, 2.4vw, 30px);
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96) 0%, rgba(247, 243, 234, 0.98) 100%),
    var(--panel);
}

.tool-panel,
.side-panel {
  padding: clamp(18px, 2vw, 24px);
}

.tool-panel {
  display: grid;
  gap: 16px;
  align-content: start;
}

.side-panel {
  align-self: start;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 28px 8px;
}

.empty-state h3,
.empty-state p,
.panel-note {
  margin: 0;
}

.trainer-card {
  width: min(760px, 100%);
  display: grid;
  gap: clamp(14px, 1.8vw, 20px);
  justify-items: center;
  align-content: center;
  padding-block: 6px;
}

.trainer-card > * {
  width: min(720px, 100%);
}

.card-meta {
  justify-content: space-between;
  color: var(--muted);
  align-items: center;
  min-height: 42px;
}

.prompt-block {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.prompt-label {
  margin: 0;
  color: var(--muted);
}

.word-prompt,
.sentence-prompt {
  margin: 0;
  max-width: 100%;
  font-size: clamp(2.15rem, 4.5vw, 3.5rem);
  line-height: 1.25;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.sentence-prompt {
  color: #243a49;
  font-weight: 800;
}

.answer-input,
.stacked-label input,
.stacked-label textarea,
.library-toolbar input,
.tag-edit-input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

textarea {
  resize: vertical;
}

.answer-input {
  display: block;
  max-width: 560px;
  margin: 0 auto;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  font-weight: 750;
  text-align: center;
  border: 0;
  border-bottom: 3px solid #cfd9dd;
  border-radius: 0;
  color: var(--ink-soft);
  caret-color: var(--typing);
  transition: color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.answer-input:focus {
  outline: 0;
  color: var(--typing);
  border-color: var(--typing);
  box-shadow: none;
  background: transparent;
}

#wordInputMode,
#wordReviewMode {
  display: grid;
  justify-items: center;
  gap: 16px;
}

#wordReviewFeedback {
  display: none;
}

.answer-feedback {
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  text-align: center;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.answer-feedback.success,
.answer-feedback.error,
.answer-feedback.hint {
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 8px 16px;
  animation: feedback-pop 220ms ease-out;
}

.answer-feedback.success {
  color: var(--correct);
  background: var(--correct-soft);
}

.answer-feedback.error {
  color: var(--error);
  background: var(--error-soft);
  animation: feedback-shake 260ms ease-out;
}

.answer-feedback.hint {
  color: var(--accent);
  background: #fff0df;
}

@keyframes feedback-pop {
  0% {
    transform: scale(0.94);
    opacity: 0.4;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes feedback-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-6px);
  }
  60% {
    transform: translateX(5px);
  }
}

.answer-reveal {
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-alt);
  text-align: center;
}

.meaning-reveal-card {
  width: min(420px, 100%);
  min-height: 64px;
  border: 1px solid rgba(222, 214, 204, 0.75);
  border-radius: 8px;
  padding: 16px 22px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.92), rgba(240, 235, 227, 0.72)),
    #fff;
  color: #5f5968;
  font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 760;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 28px rgba(20, 7, 31, 0.06);
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.meaning-reveal-card:hover,
.meaning-reveal-card:focus-visible {
  border-color: rgba(124, 58, 237, 0.32);
  color: var(--typing);
  outline: 0;
  transform: translateY(-1px);
}

.meaning-reveal-card.revealed {
  border-color: rgba(245, 158, 11, 0.34);
  background:
    linear-gradient(180deg, #fffaf0 0%, #fff5db 100%),
    #fff;
  color: var(--text);
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  box-shadow: 0 16px 34px rgba(245, 158, 11, 0.12);
  animation: meaning-float 220ms ease-out;
}

@keyframes meaning-float {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.answer-reveal {
  white-space: pre-wrap;
}

.word-builder,
.sentence-builder {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: end;
  gap: 14px 10px;
  width: min(620px, 100%);
  padding: 10px 12px 8px;
  min-height: 88px;
}

.word-piece,
.sentence-piece {
  height: 70px;
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
}

.word-token,
.sentence-token {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
}

.word-token input,
.sentence-token input {
  width: var(--token-width, 8ch);
  min-width: 74px;
  max-width: 190px;
  height: 54px;
  border: 0;
  border-bottom: 3px solid #cfd9dd;
  padding: 8px 4px 10px;
  text-align: center;
  background: transparent;
  color: #9aa0a6;
  caret-color: var(--typing);
  font-size: clamp(1.55rem, 3.2vw, 2.25rem);
  font-weight: 780;
  line-height: 1;
  outline: 0;
  overflow: hidden;
  text-overflow: clip;
  transition:
    color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.word-token input:focus,
.sentence-token input:focus {
  color: var(--typing);
  border-color: var(--typing);
  transform: translateY(-1px);
}

.word-token input.has-value:not(:focus):not(.correct):not(.error),
.sentence-token input.has-value:not(:focus):not(.correct):not(.error) {
  color: var(--ink-soft);
  border-color: #c9d1d6;
}

.word-token input.correct,
.sentence-token input.correct {
  color: var(--correct);
  border-color: var(--correct);
}

.word-token input.error,
.sentence-token input.error {
  color: var(--error);
  border-color: var(--error);
  animation: input-shake 220ms ease-out;
}

.word-separator,
.sentence-punctuation {
  display: inline-flex;
  align-items: flex-end;
  min-width: 8px;
  height: 58px;
  padding-bottom: 13px;
  color: #64727c;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  font-weight: 750;
  line-height: 1;
}

.word-separator {
  padding-inline: 1px;
  color: var(--typing);
}

@keyframes input-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-4px);
  }
  70% {
    transform: translateX(4px);
  }
}

.centered {
  justify-content: center;
  text-align: center;
}

.action-row {
  width: min(460px, 100%);
  justify-content: center;
  gap: 10px;
}

.action-row button {
  min-width: 104px;
  min-height: 44px;
}

.shortcut-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  width: min(560px, 100%);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.shortcut-strip span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid rgba(222, 214, 204, 0.7);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.78);
  white-space: nowrap;
}

#wordInputMode[data-split="false"] [data-shortcut="split-only"] {
  display: none;
}

kbd {
  font: inherit;
  font-weight: 800;
  color: var(--primary);
}

.metric-list {
  display: grid;
  gap: 14px;
  margin: 0 0 18px;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.metric-list dt,
.metric-list dd {
  margin: 0;
}

.metric-list dd {
  font-weight: 700;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-text-button,
.danger-ghost-button,
.text-button,
.file-button {
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  background: transparent;
}

.block-button {
  width: 100%;
  text-align: center;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary) 0%, #1466a8 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.18);
}

.secondary-button {
  background: var(--primary-soft);
  color: var(--primary);
}

.ghost-button,
.icon-text-button,
.file-button {
  border-color: var(--border);
  color: var(--text);
  background: #fff;
}

.danger-ghost-button {
  border-color: #efc7c7;
  color: var(--danger);
  background: var(--danger-soft);
}

.text-button {
  color: var(--primary);
  padding-inline: 0;
}

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

.switch {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
}

.switch input {
  width: 18px;
  height: 18px;
}

.stacked-label {
  display: grid;
  gap: 9px;
  line-height: 1.35;
}

.preview-list,
.library-list {
  display: grid;
  gap: 12px;
}

.preview-card,
.library-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.preview-card strong,
.library-item strong {
  display: block;
  margin-bottom: 6px;
}

.preview-card p,
.library-item p,
.library-item small {
  margin: 0;
}

.library-toolbar {
  align-items: end;
}

.bulk-toolbar {
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fbfcfc;
}

.bulk-toolbar #selectedCountLabel {
  color: var(--muted);
}

.library-item {
  display: grid;
  gap: 12px;
}

.library-item.paused {
  background: #f7f4ec;
  border-color: #ecd9a9;
}

.library-item.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(34, 211, 197, 0.16);
}

.library-item-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.library-select-box {
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.library-content {
  min-width: 0;
}

.library-content strong,
.library-content p {
  overflow-wrap: anywhere;
}

.tag-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fbfb;
}

.tag-edit-input {
  max-width: 420px;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.86rem;
  background: var(--panel-alt);
  color: var(--muted);
}

.tag.favorite {
  background: #fff5cc;
  color: var(--favorite);
}

.pill.paused {
  background: #fcefe0;
  color: var(--accent);
}

.keyboard-note {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.stat-card {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.stat-card span {
  color: var(--muted);
}

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

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  min-height: 220px;
  align-items: end;
}

.bar-column {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.bar {
  width: 100%;
  min-height: 6px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--nebula-cyan) 0%, var(--nebula-violet) 100%);
}

.bar-label,
.bar-value {
  color: var(--muted);
  font-size: 0.85rem;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--space-2);
  color: var(--stardust);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .app-shell,
  .practice-layout,
  .import-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: 16px;
  }

  .main {
    padding: 18px;
  }

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

@media (max-width: 720px) {
  .app-shell {
    min-height: 100dvh;
  }

  .sidebar {
    gap: 14px;
    padding: 14px 12px;
  }

  .main {
    gap: 12px;
    padding: 12px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 0.9rem;
  }

  .brand h1 {
    font-size: 1.05rem;
  }

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

  .section-head,
  .library-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    display: none;
  }

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

  #practiceView > .section-head {
    display: none;
  }

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

  .nav-item {
    min-width: 0;
    padding: 9px 4px;
    text-align: center;
    font-size: 0.9rem;
  }

  .practice-mode-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .practice-mode-card {
    min-height: 0;
    padding: 11px 10px;
    text-align: center;
    box-shadow: none;
  }

  .practice-mode-card span {
    display: none;
  }

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

  .practice-toolbar label {
    min-width: 0;
  }

  .control-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .control-row label {
    min-width: 0;
  }

  .inline-field-group {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .compact-action {
    min-width: 70px;
  }

  .practice-layout {
    gap: 12px;
  }

  .practice-panel {
    min-height: min(560px, calc(100dvh - 238px));
    padding: 16px 12px 18px;
  }

  .side-panel {
    display: none;
  }

  .trainer-card {
    gap: 12px;
  }

  .trainer-card > * {
    width: min(100%, 560px);
  }

  .card-meta {
    min-height: 34px;
    font-size: 0.88rem;
  }

  .icon-text-button {
    padding: 7px 10px;
  }

  .prompt-block {
    gap: 8px;
  }

  .prompt-label {
    font-size: 0.9rem;
  }

  .word-prompt,
  .sentence-prompt {
    font-size: clamp(2.25rem, 11vw, 3.35rem);
  }

  .word-builder,
  .sentence-builder {
    gap: 10px 8px;
    min-height: 72px;
    padding: 6px 2px 4px;
  }

  .word-token input,
  .sentence-token input {
    min-width: 58px;
    max-width: 112px;
    height: 48px;
    font-size: clamp(1.3rem, 7vw, 1.95rem);
    padding-bottom: 8px;
  }

  .sentence-piece,
  .word-piece {
    height: 56px;
  }

  .word-separator,
  .sentence-punctuation {
    height: 48px;
    padding-bottom: 10px;
    font-size: clamp(1.1rem, 5vw, 1.5rem);
  }

  .action-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .action-row button {
    min-width: 0;
    min-height: 46px;
    padding: 9px 8px;
  }

  .meaning-reveal-card {
    min-height: 58px;
    padding: 14px 18px;
  }

  .shortcut-strip {
    gap: 6px;
    font-size: 0.76rem;
  }

  .shortcut-strip span {
    padding: 4px 7px;
  }

  .trainer-footer {
    gap: 8px;
  }

  .danger-ghost-button,
  .text-button {
    padding: 8px 10px;
  }

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

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