:root {
  color-scheme: light;
  --bg: #eef2f3;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --ink: #1f2726;
  --muted: #667370;
  --line: #d7e0de;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --amber: #c87912;
  --rose: #a13545;
  --green: #187447;
  --button-bg: #e8f3f1;
  --shadow: 0 18px 50px rgba(31, 39, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 34%),
    linear-gradient(225deg, rgba(200, 121, 18, 0.12), transparent 38%),
    var(--bg);
  color: var(--ink);
}

button {
  font: inherit;
}

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

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

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 18px rgba(31, 39, 38, 0.16));
}

.brand-block {
  min-width: 0;
}

.eyebrow,
.topic-kicker,
.score-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-size: 2.25rem;
  line-height: 1.05;
}

h2 {
  margin-top: 4px;
  font-size: 1.55rem;
  line-height: 1.2;
}

h3 {
  font-size: 0.96rem;
  line-height: 1.25;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
  min-width: min(100%, 360px);
}

.score-strip > div,
.side-panel,
.trainer-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.score-strip > div {
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 8px;
}

.score-strip strong {
  display: block;
  margin-top: 3px;
  font-size: 1.35rem;
}

.topic-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.project-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 12px 14px;
}

.project-strip p {
  max-width: 680px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.4;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.project-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-size: 0.84rem;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.project-link:hover,
.project-link:focus-visible {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.project-link-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.project-link-primary:hover,
.project-link-primary:focus-visible {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
}

.tab-button,
.choice-button,
.filter-button,
.primary-button,
.ghost-button,
.favorite-button,
.favorite-remove-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.tab-button,
.filter-button {
  background: rgba(255, 255, 255, 0.78);
  padding: 0 16px;
  white-space: nowrap;
}

.tab-button:hover,
.filter-button:hover,
.choice-button:hover,
.ghost-button:hover,
.favorite-button:hover,
.favorite-remove-button:hover {
  border-color: var(--teal);
}

.tab-button.active,
.filter-button.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

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

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

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

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

.trainer-panel,
.side-panel {
  border-radius: 8px;
}

.trainer-panel {
  min-height: 610px;
  padding: 22px;
}

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

.trainer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 999px;
  background: #eef8f6;
  color: var(--teal-dark);
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.modal-filters {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef8f6;
  padding: 14px;
}

.modal-filter-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.modal-filter-heading h3 {
  margin-top: 3px;
}

.modal-filter-heading > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.question-box {
  display: grid;
  align-content: start;
  gap: 18px;
  min-height: 368px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 20px;
}

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

.meta-item {
  min-height: 58px;
  border-left: 4px solid var(--teal);
  background: var(--surface);
  padding: 8px 10px;
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.meta-item strong {
  display: block;
  margin-top: 2px;
  font-size: 0.98rem;
  line-height: 1.25;
}

.learning-intro {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.learning-pattern {
  margin: 0;
  color: var(--teal-dark);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.learning-pattern:not(.hidden) + .prompt {
  min-height: 0;
  margin: 0;
}

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

.example-translation {
  margin: -10px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.45;
}

.prompt {
  display: block;
  min-height: 96px;
  font-size: 2rem;
  line-height: 1.28;
  text-wrap: pretty;
}

.blank {
  display: inline-block;
  width: 1.65em;
  height: 0.72em;
  margin: 0 0.06em;
  overflow: hidden;
  border-bottom: 0.12em solid var(--teal-dark);
  color: transparent;
  font-weight: 800;
  vertical-align: baseline;
}

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

.choice-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  background: var(--surface);
  padding: 10px 12px;
  font-weight: 800;
  text-align: center;
}

.choice-button.selected {
  border-color: var(--teal);
  background: var(--button-bg);
  color: var(--teal-dark);
}

.choice-button.correct {
  border-color: var(--green);
  background: #eaf7ef;
  color: var(--green);
}

.choice-button.incorrect {
  border-color: var(--rose);
  background: #faecef;
  color: var(--rose);
}

.translation-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.translation-row {
  display: grid;
  gap: 2px;
}

.translation-row span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.translation-row strong {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
}

.feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.feedback {
  min-height: 46px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.35;
}

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

.feedback.bad {
  color: var(--rose);
}

.actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.actions.immediate-actions {
  justify-content: flex-end;
}

.primary-button,
.ghost-button {
  min-width: 96px;
  padding: 0 16px;
  font-weight: 850;
}

.primary-button {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.ghost-button {
  background: var(--surface);
}

.favorite-button {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.favorite-button.active {
  border-color: rgba(200, 121, 18, 0.46);
  background: #fff6e8;
  color: var(--amber);
}

.side-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

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

.hidden {
  display: none;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.search-field {
  display: grid;
  gap: 6px;
}

.search-field label,
.select-field label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.select-field {
  display: grid;
  gap: 6px;
}

.select-field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

.select-field select:focus {
  border-color: var(--teal);
  outline: 2px solid rgba(15, 118, 110, 0.18);
}

.search-field input,
.search-field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

.search-field textarea {
  min-height: 82px;
  resize: vertical;
}

.search-field input:focus,
.search-field textarea:focus {
  border-color: var(--teal);
  outline: 2px solid rgba(15, 118, 110, 0.18);
}

.selected-verb-list,
.verb-search-results,
.favorite-list {
  display: grid;
  gap: 8px;
}

.selected-verb-list,
.favorite-list {
  grid-template-columns: 1fr;
}

.selected-verb-empty,
.verb-result-empty,
.favorite-empty {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.selected-verb-chip,
.verb-result-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.selected-verb-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  min-height: 52px;
  padding: 8px 10px;
}

.selected-verb-chip strong,
.verb-result-button strong {
  overflow-wrap: anywhere;
}

.selected-verb-chip span,
.verb-result-button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.selected-verb-chip .remove-mark {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--rose);
  font-size: 1rem;
  font-weight: 900;
}

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

.compact-button {
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  font-size: 0.84rem;
}

.verb-bulk-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.35;
}

.verb-bulk-status.good {
  color: var(--green);
}

.verb-bulk-status.bad {
  color: var(--rose);
}

.verb-search-results {
  margin: 0;
  padding: 0;
  list-style: none;
}

.verb-result-button {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px 10px;
}

.selected-verb-chip:hover,
.verb-result-button:hover,
.verb-result-button.selected {
  border-color: var(--teal);
  background: #eef8f6;
}

.verb-result-button.selected strong {
  color: var(--teal-dark);
}

.favorite-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

.favorite-practice-button {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.favorite-practice-button:hover {
  border-color: var(--teal);
  background: #eef8f6;
}

.favorite-practice-button strong {
  overflow-wrap: anywhere;
}

.favorite-practice-button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.favorite-remove-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  min-height: 52px;
  padding: 0;
  background: var(--surface);
  color: var(--rose);
  font-weight: 900;
}

.meter {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 750;
}

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

.meter-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 160ms ease;
}

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

.mini-stats div {
  min-height: 64px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.mini-stats dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

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

.miss-list li {
  padding-left: 2px;
  color: var(--muted);
  line-height: 1.35;
}

.miss-list strong {
  color: var(--ink);
}

.miss-button {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px 10px;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.miss-button:hover {
  border-color: var(--teal);
  background: #eef8f6;
}

.miss-button span {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
}

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

  .topbar,
  .project-strip,
  .feedback-row {
    align-items: stretch;
    flex-direction: column;
  }

  .project-actions {
    justify-content: stretch;
  }

  .project-link {
    flex: 1 1 150px;
  }

  .brand-logo {
    width: 60px;
    height: 60px;
  }

  h1 {
    font-size: 1.85rem;
  }

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

  .trainer-panel {
    min-height: 0;
    padding: 16px;
  }

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

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

  .modal-filter-grid {
    grid-template-columns: 1fr;
  }

  .prompt {
    min-height: 78px;
    font-size: 1.3rem;
    line-height: 1.34;
  }

  .blank {
    width: 1.5em;
  }
}

@media (max-width: 520px) {
  .score-strip,
  .answer-grid,
  .project-actions,
  .mini-stats {
    grid-template-columns: 1fr;
  }

  .project-actions {
    display: grid;
  }

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

  .modal-filter-heading {
    align-items: start;
    flex-direction: column;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .actions .ghost-button,
  .actions .primary-button {
    min-width: 0;
    width: 100%;
  }
}
