body.topic-vocab-page {
  min-height: 100vh;
  background: #f4f7fb;
  color: #182338;
}

.topic-vocab-main {
  width: min(100% - 2rem, 920px);
  margin: 2.5rem auto 4rem;
}

.topic-vocab-breadcrumb {
  margin: 0 0 1.25rem;
  color: #52627a;
  font-size: 0.95rem;
}

.topic-vocab-breadcrumb a {
  color: #4f46e5;
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.topic-vocab-heading {
  margin-bottom: 1.75rem;
  text-align: center;
}

.topic-vocab-heading h1 {
  margin: 0 0 0.65rem;
  color: #182338;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
}

.topic-vocab-heading p {
  max-width: 650px;
  margin: 0 auto;
  color: #52627a;
  font-size: 1.08rem;
  line-height: 1.65;
}

.topic-vocab-panel {
  padding: clamp(1rem, 4vw, 2rem);
  border: 1px solid #dce4f0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 48px rgb(26 44 78 / 9%);
}

.topic-vocab-stats {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  color: #52627a;
  font-size: 0.95rem;
  font-weight: 700;
}

.topic-vocab-progress {
  width: 100%;
  height: 0.7rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
  border-radius: 999px;
  background: #e8edf5;
}

.topic-vocab-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f46e5, #0ea5e9);
  transition: width 180ms ease;
}

.topic-vocab-card {
  display: flex;
  width: 100%;
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(140deg, #4338ca, #0284c7);
  color: #fff;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 12px 28px rgb(67 56 202 / 22%);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.topic-vocab-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgb(67 56 202 / 28%);
}

.topic-vocab-card:focus-visible,
.topic-vocab-controls button:focus-visible,
.topic-vocab-toolbar button:focus-visible,
.topic-vocab-complete button:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 4px;
}

.topic-vocab-card.is-flipped {
  background: linear-gradient(140deg, #0f766e, #15803d);
}

.topic-vocab-card-label {
  margin-bottom: 0.8rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}

.topic-vocab-word {
  font-size: clamp(2rem, 7vw, 3.3rem);
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.topic-vocab-definition {
  max-width: 650px;
  margin-top: 1rem;
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  line-height: 1.55;
}

.topic-vocab-example {
  max-width: 650px;
  margin-top: 0.8rem;
  font-size: 1rem;
  line-height: 1.55;
  opacity: 0.92;
}

.topic-vocab-hint {
  margin: 1rem 0 0;
  color: #63718a;
  font-size: 0.9rem;
  text-align: center;
}

.topic-vocab-controls,
.topic-vocab-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.topic-vocab-controls button,
.topic-vocab-toolbar button,
.topic-vocab-complete button {
  min-height: 44px;
  padding: 0.7rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #26334a;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  transition:
    transform 150ms ease,
    background-color 150ms ease;
}

.topic-vocab-controls button:hover,
.topic-vocab-toolbar button:hover,
.topic-vocab-complete button:hover {
  transform: translateY(-1px);
  background: #f1f5f9;
}

.topic-vocab-controls .is-known {
  border-color: #15803d;
  background: #15803d;
  color: #fff;
}

.topic-vocab-controls .needs-practice {
  border-color: #b45309;
  background: #b45309;
  color: #fff;
}

.topic-vocab-toolbar {
  justify-content: space-between;
}

.topic-vocab-toolbar .topic-vocab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.topic-vocab-toolbar a {
  align-self: center;
  color: #4f46e5;
  font-weight: 750;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.topic-vocab-complete {
  padding: 2rem 1rem;
  text-align: center;
}

.topic-vocab-complete[hidden] {
  display: none;
}

.topic-vocab-complete h2 {
  margin-top: 0;
  color: #182338;
  font-size: 2rem;
}

.topic-vocab-complete p {
  color: #52627a;
  line-height: 1.6;
}

.topic-vocab-footer {
  padding: 1.5rem 1rem;
  background: #172033;
  color: #e2e8f0;
  text-align: center;
}

.topic-vocab-footer p {
  margin: 0;
}

@media (max-width: 600px) {
  .topic-vocab-main {
    margin-top: 1.5rem;
  }

  .topic-vocab-card {
    min-height: 250px;
    padding: 1.5rem;
  }

  .topic-vocab-toolbar {
    align-items: center;
    flex-direction: column;
  }

  .topic-vocab-toolbar .topic-vocab-nav {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topic-vocab-card,
  .topic-vocab-progress span,
  .topic-vocab-controls button,
  .topic-vocab-toolbar button,
  .topic-vocab-complete button {
    transition: none;
  }
}

:root.dark-mode body.topic-vocab-page {
  background: #111827;
  color: #e5e7eb;
}

:root.dark-mode .topic-vocab-heading h1,
:root.dark-mode .topic-vocab-complete h2 {
  color: #f8fafc;
}

:root.dark-mode .topic-vocab-heading p,
:root.dark-mode .topic-vocab-breadcrumb,
:root.dark-mode .topic-vocab-hint,
:root.dark-mode .topic-vocab-complete p {
  color: #cbd5e1;
}

:root.dark-mode .topic-vocab-panel {
  border-color: #374151;
  background: #1f2937;
}

:root.dark-mode .topic-vocab-stats {
  color: #cbd5e1;
}

:root.dark-mode .topic-vocab-controls button,
:root.dark-mode .topic-vocab-toolbar button,
:root.dark-mode .topic-vocab-complete button {
  border-color: #475569;
  background: #273449;
  color: #f8fafc;
}

:root.dark-mode .topic-vocab-controls .is-known {
  border-color: #15803d;
  background: #15803d;
}

:root.dark-mode .topic-vocab-controls .needs-practice {
  border-color: #b45309;
  background: #b45309;
}
