/* spanish-ira — single global stylesheet. CSS variables for theming. */

:root {
  --color-bg: #ffffff;
  --color-surface: #f7f7f9;
  --color-border: #e2e2e8;
  --color-text: #1a1a1f;
  --color-text-muted: #5b5b66;
  --color-accent: #b4254a;
  --color-accent-fg: #ffffff;
  --color-success: #2f7d32;
  --color-error: #b3261e;
  --color-info: #1f5fd1;

  --font-sans:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
    'Helvetica Neue', Arial, sans-serif;
  --radius: 6px;
  --gap: 16px;
  --max-width: 1080px;
}

[data-theme="dark"] {
  --color-bg: #15151a;
  --color-surface: #1f1f26;
  --color-border: #2c2c34;
  --color-text: #f1f1f5;
  --color-text-muted: #a1a1ad;
  --color-accent: #ef6385;
  --color-accent-fg: #15151a;
  --color-success: #66bb6a;
  --color-error: #ef5350;
  --color-info: #64b5f6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
}

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

a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Header / Footer */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 0 var(--gap);
  height: 56px;
  flex-wrap: nowrap;
}

.header__brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.header__brand:hover {
  text-decoration: none;
  opacity: 0.85;
}

.header__nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.header__nav a {
  color: var(--color-text);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.header__nav a:hover {
  background: var(--color-bg);
  text-decoration: none;
}

.header__nav a.header__nav--active {
  color: var(--color-accent);
  background: var(--color-bg);
  font-weight: 600;
}

.header__right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

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

.header form {
  margin-bottom: 0;
}

.header__logout button {
  background: none;
  border: none;
  color: var(--color-accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--color-bg);
  border-color: var(--color-accent);
}

.theme-toggle__icon--sun,
.theme-toggle__icon--moon {
  width: 18px;
  height: 18px;
}

[data-theme="dark"] .theme-toggle__icon--sun {
  display: none;
}

:root:not([data-theme="dark"]) .theme-toggle__icon--moon {
  display: none;
}

/* Locale picker in header */
.locale-picker select {
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.footer {
  border-top: 1px solid var(--color-border);
  padding: 32px 0;
  margin-top: 64px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.footer__nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.footer__nav a {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.footer__nav a:hover {
  color: var(--color-accent);
}

.footer p {
  margin: 0;
}

/* Header collapsible — desktop */
.header__collapsible {
  display: flex;
  align-items: center;
  gap: var(--gap);
  flex: 1;
}

/* Responsive header */
.header__menu-toggle {
  display: none;
}

@media (max-width: 640px) {
  .header__inner {
    flex-wrap: wrap;
    height: auto;
    padding: 12px var(--gap);
  }

  .header__menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    width: 36px;
    height: 36px;
    cursor: pointer;
    color: var(--color-text);
    padding: 0;
    margin-left: auto;
    order: 2;
  }

  .header__collapsible {
    display: none;
    width: 100%;
    order: 10;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    margin-top: 8px;
  }

  .header__collapsible.header__collapsible--open {
    display: block;
  }

  .header__nav {
    flex-direction: column;
    gap: 0;
  }

  .header__nav a {
    padding: 10px 12px;
  }

  .header__right {
    padding-top: 8px;
    width: 100%;
    justify-content: flex-start;
  }

  .header__brand {
    order: 1;
  }

  .theme-toggle {
    order: 3;
  }
}

.main {
  min-height: 60vh;
  padding: 32px 16px;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

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

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

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

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Form fields */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  max-width: 420px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field__label {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.field__input {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s;
}

.field__input:focus {
  outline: none;
  border-color: var(--color-accent);
}

textarea.field__input {
  height: auto;
  padding: 10px 12px;
  min-height: 80px;
}

.form__error {
  color: var(--color-error);
  margin: 0;
}

/* Cards */
.card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 16px;
  color: inherit;
}

.card--link:hover {
  border-color: var(--color-accent);
  text-decoration: none;
}

.card__title {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.card__body p {
  color: var(--color-text-muted);
  margin: 8px 0 0;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--color-border);
  color: var(--color-text);
}

.badge--level {
  background: var(--color-accent);
  color: var(--color-accent-fg);
}

.badge--status {
  background: var(--color-info);
  color: #ffffff;
}

.badge--success {
  background: var(--color-success, #16a34a);
  color: #ffffff;
}

.badge--warning {
  background: var(--color-warning, #f59e0b);
  color: #ffffff;
}

/* Lesson card completed state */
.card--completed {
  border-left: 3px solid var(--color-success, #16a34a);
}

.card--updated {
  border-left: 3px solid var(--color-warning, #f59e0b);
}

/* Lesson updated notice */
.lesson-updated-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--color-warning, #f59e0b);
  border-radius: var(--radius);
}

.lesson-updated-notice p {
  margin: 0;
  flex: 1;
  font-size: 0.9rem;
  color: var(--color-text);
}

.lesson-card__check {
  color: var(--color-success, #16a34a);
  font-weight: 700;
  font-size: 1.1em;
  margin-left: 4px;
}

/* Lesson practice complete section */
.lesson-practice__complete {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.lesson-practice__done {
  color: var(--color-success, #16a34a);
  font-weight: 600;
  font-size: 1.1em;
}

.btn--success {
  background: var(--color-success, #16a34a);
  color: #ffffff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
}

.btn--success:hover {
  opacity: 0.9;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 16px 0;
}

.pagination__link {
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* Empty state */
.empty-state {
  border: 1px dashed var(--color-border);
  padding: 32px;
  border-radius: var(--radius);
  text-align: center;
  color: var(--color-text-muted);
}

.empty-state__title {
  color: var(--color-text);
  margin: 0 0 8px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.alert--success {
  border-color: var(--color-success);
  background: rgba(47, 125, 50, 0.1);
}

.alert--error {
  border-color: var(--color-error);
  background: rgba(179, 38, 30, 0.1);
}

.alert--info {
  border-color: var(--color-info);
  background: rgba(31, 95, 209, 0.1);
}

/* Lessons */
.lesson-list,
.word-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
}

.lesson-card__meta,
.word-card__meta,
.lesson-header__meta,
.word-header__meta {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.lesson-card__desc,
.word-card__translation,
.topic-card__desc {
  color: var(--color-text-muted);
}

.lesson-header__title,
.word-header__lemma {
  margin: 0 0 8px;
}

.lesson-header__order {
  color: var(--color-text-muted);
  margin-right: 6px;
}

.lesson-header__time {
  color: var(--color-text-muted);
}

.lesson-theory {
  margin-top: 32px;
}

.lesson-theory__examples {
  list-style: square;
  padding-left: 24px;
}

.lesson-practice {
  margin-top: 32px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.lesson-practice--gated {
  opacity: 0.55;
  pointer-events: none;
}

.lesson-practice__hint {
  color: var(--color-text-muted);
}

.lesson-practice__blocks {
  display: grid;
  gap: var(--gap);
}

/* Tasks */
.task {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--color-bg);
}

.task__title {
  margin: 0 0 8px;
  font-size: 1rem;
}

.task__choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task__pairs,
.task__tokens {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task__token {
  background: var(--color-surface);
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
}

.task__token--used {
  opacity: 0.35;
  pointer-events: none;
}

.task__answer-area {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  margin-top: 8px;
  padding: 8px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
}

.task__placed-token {
  background: var(--color-primary);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
}

.task__reset {
  margin-left: 8px;
}

/* Topics */
.topic-tree {
  list-style: none;
  padding-left: 16px;
}

.topic-tree__node {
  margin: 4px 0;
}

/* Words — detail page */
.word-translation {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  margin-top: 16px;
}

.word-translation__locale {
  margin: 0 0 4px;
  color: var(--color-accent);
}

.word-translation__alternates,
.word-translation__note {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Words — catalog filters */
.words-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.words-filters__search {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.95rem;
}

.words-filters__select {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9rem;
}

.words-filters__btn {
  padding: 8px 16px;
  font-size: 0.9rem;
}

/* Words — catalog list (accordion) */
.word-list-v2 {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.word-entry {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.word-entry[open] {
  border-color: var(--color-accent);
}

.word-entry__summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.word-entry__summary::-webkit-details-marker {
  display: none;
}

.word-entry__summary::before {
  content: '\25B6';
  font-size: 0.6em;
  color: var(--color-text-muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.word-entry[open] > .word-entry__summary::before {
  transform: rotate(90deg);
}

.word-entry__lemma {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text);
}

.word-entry__translation {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-entry__tags {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.word-entry__pos,
.word-entry__level {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.word-entry__level {
  background: var(--color-accent);
  color: var(--color-accent-fg);
  border-color: transparent;
}

.word-entry__body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--color-border);
}

.word-entry__ipa {
  color: var(--color-text-muted);
  font-family: monospace;
  font-size: 0.95rem;
  margin: 10px 0 4px;
}

.word-entry__gender {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-style: italic;
  margin: 2px 0;
}

.word-entry__alternates {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 6px 0 0;
}

.word-entry__note {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-style: italic;
  margin: 6px 0 0;
  padding: 6px 10px;
  background: var(--color-surface);
  border-radius: var(--radius);
}

.word-entry__examples {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.word-entry__example {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--color-surface);
  border-radius: var(--radius);
  border-left: 3px solid var(--color-accent);
}

.word-entry__example-es {
  font-weight: 500;
  font-size: 0.95rem;
}

.word-entry__example-tr {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.word-entry__link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--color-accent);
}

/* Word Matching Game */
.match-game {
  max-width: 700px;
  margin: 0 auto;
}

.match-game__header {
  margin-bottom: 20px;
}

.match-game__header h1 {
  margin: 0 0 12px;
}

.match-game__stats {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.match-game__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.match-game__stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.2;
}

.match-game__stat-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 480px) {
  .match-game__stat-value {
    font-size: 1.1rem;
  }

  .match-game__stat {
    padding: 6px 2px;
  }

  .match-game__stat-label {
    font-size: 0.55rem;
  }
}

.match-game__stat--errors .match-game__stat-value {
  color: var(--color-error, #dc2626);
}

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

.match-game__col {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.match-game__item {
  padding: 10px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, opacity 0.3s, transform 0.3s;
  font-size: 0.95rem;
  text-align: center;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.match-game__item:hover {
  border-color: var(--color-accent);
}

.match-game__item--selected {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-fg);
}

.match-game__item--matched {
  border-color: var(--color-success, #16a34a);
  background: var(--color-success, #16a34a);
  color: #fff;
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

.match-game__item--wrong {
  border-color: var(--color-error, #dc2626);
  background: rgba(220, 38, 38, 0.1);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.match-game__empty {
  text-align: center;
  padding: 40px 20px;
}

.match-game__empty p {
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

/* Word Practice Game */
.practice {
  max-width: 520px;
  margin: 0 auto;
}

.practice__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.practice__header h1 {
  margin: 0;
}

.practice__score {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.practice__streak {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
}

.practice__streak-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.practice__card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--color-surface);
}

.practice__word {
  text-align: center;
  margin-bottom: 20px;
}

.practice__lemma {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
}

.practice__meta {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.practice__pos,
.practice__level,
.practice__gender {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  text-transform: uppercase;
}

.practice__level {
  background: var(--color-accent);
  color: var(--color-accent-fg);
  border-color: transparent;
}

.practice__ipa {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.practice__input-row {
  display: flex;
  gap: 8px;
}

.practice__input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s;
}

.practice__input:focus {
  border-color: var(--color-accent);
}

.practice__feedback {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 12px 0 0;
}

.practice__feedback--correct {
  color: var(--color-success, #16a34a);
}

.practice__feedback--wrong {
  color: var(--color-error, #dc2626);
}

.practice__reveal {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.practice__answer-main {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 4px;
  text-align: center;
}

.practice__answer-alt {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-align: center;
  margin: 0 0 4px;
}

.practice__answer-note {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  margin: 4px 0 0;
}

.practice__examples {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.practice__example {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--color-bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--color-accent);
}

.practice__example-es {
  font-weight: 500;
  font-size: 0.95rem;
}

.practice__example-tr {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.practice__next {
  display: block;
  width: 100%;
  margin-top: 16px;
}

.practice__empty {
  text-align: center;
  padding: 40px 20px;
}

.practice__empty p {
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

/* Progress + dashboard */
.progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress__track {
  flex: 1;
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  background: var(--color-accent);
}

.due-reviews__count {
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
}

.vocab-stats {
  display: grid;
  gap: 4px;
  margin: 0;
}

.vocab-stats__row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  padding: 4px 0;
}

.vocab-stats__row dt,
.vocab-stats__row dd {
  margin: 0;
}

.icon {
  display: inline-block;
  vertical-align: middle;
}

/* Flashcards */
.flashcards__ui {
  margin-top: 16px;
}

.flashcard {
  perspective: 800px;
  min-height: 220px;
  position: relative;
  cursor: pointer;
}

.flashcard__inner {
  position: relative;
  width: 100%;
  min-height: 220px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard--flipped .flashcard__inner {
  transform: rotateY(180deg);
}

.flashcard__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
}

.flashcard:hover .flashcard__face {
  border-color: var(--color-accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.flashcard__face--front .flashcard__word {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
}

.flashcard__face--front .flashcard__hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.flashcard__face--back {
  transform: rotateY(180deg);
  background: var(--color-bg);
}

.flashcard__face--back .flashcard__word {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-accent);
}

/* Progress dots */
.flashcards__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.flashcards__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 0.2s, transform 0.2s;
}

.flashcards__dot--active {
  background: var(--color-accent);
  transform: scale(1.3);
}

.flashcards__dot--done {
  background: var(--color-success);
}

/* Navigation */
.flashcards__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

/* Rating buttons */
.flashcards__rating {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.flashcards__rating .btn {
  flex: 1;
  max-width: 180px;
}

.btn--know {
  background: var(--color-success);
  color: #ffffff;
  border-color: var(--color-success);
}

.btn--learning {
  background: var(--color-error);
  color: #ffffff;
  border-color: var(--color-error);
}

/* Task input (fill-blank, translate) */
.task__input {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s;
}

.task__input:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Task check button + feedback */
.task__check {
  vertical-align: top;
  margin-left: 8px;
}

.task__feedback {
  margin: 8px 0 0;
  font-weight: 500;
}

.task__explanation {
  margin: 4px 0 0;
  font-size: 0.9em;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Matching game */
.matching__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.matching__col {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.matching__item {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.matching__item:hover:not(.matching__item--matched) {
  border-color: var(--color-accent);
}

.matching__item--selected {
  border-color: var(--color-accent);
  background: rgba(180, 37, 74, 0.08);
}

.matching__item--matched {
  border-color: var(--color-success);
  background: rgba(47, 125, 50, 0.08);
  cursor: default;
  opacity: 0.75;
}

.matching__item--wrong {
  border-color: var(--color-error);
  background: rgba(179, 38, 30, 0.08);
}

/* Lesson theory mark-read button */
.lesson-theory__mark-read {
  margin-top: 24px;
}
