:root {
  color-scheme: light;
  --paper: #f4f3ed;
  --panel: #fffefa;
  --ink: #202b25;
  --muted: #737b73;
  --line: #dedfd5;
  --green: #265b45;
  --green-dark: #193f30;
  --lime: #d7ed78;
  --coral: #e56e52;
  --gold: #efbd56;
  --mono: "DM Mono", "Courier New", monospace;
  --sans: "Manrope", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

button,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 27px 18px 20px;
  background: var(--green-dark);
  color: #f7f6ef;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1px 9px 27px;
  border-bottom: 1px solid #ffffff27;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  background: var(--lime);
  color: var(--green-dark);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  transform: rotate(-4deg);
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
}

.brand-sub {
  margin-top: 2px;
  color: #bdc9bd;
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}

.nav-label {
  margin: 25px 10px 9px;
  color: #a9b8aa;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.topic-list {
  display: grid;
  gap: 3px;
}

.topic-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #d9e0d9;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  transition: background .16s, color .16s;
}

.topic-button:hover {
  background: #ffffff10;
  color: #fff;
}

.topic-button.active {
  background: var(--lime);
  color: var(--green-dark);
  font-weight: 700;
}

.topic-count {
  font-family: var(--mono);
  font-size: 10px;
  opacity: .7;
}

.sidebar-foot {
  margin-top: auto;
  padding: 17px 9px 0;
  border-top: 1px solid #ffffff27;
  color: #bdc9bd;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.7;
}

.main {
  min-width: 0;
  padding: 25px clamp(18px, 4vw, 56px) 50px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line);
}

.crumb {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.top-meta {
  color: var(--muted);
  font-size: 11px;
}

.top-meta strong {
  color: var(--ink);
  font-weight: 700;
}

.heading-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin: 32px 0 24px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.1;
  font-weight: 700;
}

.word-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.word-total strong {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 400;
}

.word-total span {
  color: var(--muted);
  font-size: 11px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.controls-left,
.controls-right {
  display: flex;
  align-items: center;
  gap: 9px;
}

.field-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

select {
  min-width: 140px;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
  cursor: pointer;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #eaeae2;
}

.segmented button {
  padding: 7px 12px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.segmented button.active {
  background: var(--panel);
  color: var(--green-dark);
  box-shadow: 0 1px 3px #202b2514;
}

.study-area {
  max-width: 850px;
  margin: 27px auto 0;
}

.study-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.set-name {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.counter {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.progress {
  height: 3px;
  margin-bottom: 16px;
  background: #e1e2d9;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--coral);
  transition: width .2s ease;
}

.flashcard {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 365px;
  padding: clamp(24px, 5vw, 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  cursor: pointer;
}

.flashcard::after {
  position: absolute;
  right: -52px;
  bottom: -96px;
  width: 235px;
  height: 235px;
  border: 1px solid #265b451a;
  border-radius: 50%;
  content: "";
}

.flashcard::before {
  position: absolute;
  right: 3px;
  bottom: -49px;
  width: 145px;
  height: 145px;
  border: 1px solid #265b451a;
  border-radius: 50%;
  content: "";
}

.card-label {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.card-center {
  position: relative;
  z-index: 1;
  padding: 28px 0;
  text-align: center;
}

.card-word {
  font-size: clamp(32px, 7vw, 58px);
  font-weight: 700;
  line-height: 1.13;
  overflow-wrap: anywhere;
}

.part-of-speech {
  width: fit-content;
  margin: 10px auto 0;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f0f3e7;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.card-answer {
  min-height: 28px;
  margin-top: 15px;
  color: var(--green);
  font-size: 17px;
  font-weight: 600;
}

.card-answer.hidden {
  visibility: hidden;
}

.card-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.card-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
}

.action {
  min-height: 39px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: transform .12s, background .12s;
}

.action:hover {
  transform: translateY(-1px);
  background: #f0f3e7;
}

.action.primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.action.primary:hover {
  background: var(--green-dark);
}

.action:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

.key-note {
  margin-top: 14px;
  color: #8a9088;
  text-align: center;
  font-family: var(--mono);
  font-size: 9px;
}

.quiz {
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
}

.quiz-kicker {
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.quiz-prompt {
  min-height: 74px;
  margin: 18px 0 20px;
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  line-height: 1.25;
}

.quiz-input {
  display: block;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #b9c3b6;
  border-radius: 3px;
  background: #fff;
  font-size: 15px;
  outline: none;
}

.quiz-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px #265b451c;
}

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

.choice {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}

.choice:hover:not(:disabled) {
  border-color: var(--green);
  background: #f4f7ed;
}

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

.choice.incorrect {
  border-color: var(--coral);
  background: #fbede8;
}

.quiz-feedback {
  min-height: 22px;
  margin: 13px 0 4px;
  font-size: 12px;
  font-weight: 700;
}

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

.quiz-feedback.bad {
  color: #bb4e38;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.quiz-score {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.results {
  padding: 42px 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: center;
}

.results-score {
  margin: 12px 0 5px;
  font-family: var(--mono);
  font-size: 48px;
}

.results-copy {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  padding: 40px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .brand {
    padding: 0 3px 12px;
    border-bottom: 0;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .nav-label,
  .sidebar-foot {
    display: none;
  }

  .topic-list {
    display: flex;
    min-width: 0;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 1px 7px;
    scrollbar-width: thin;
  }

  .topic-button {
    flex: 0 0 auto;
    width: auto;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid #ffffff20;
    font-size: 10px;
  }

  .main {
    padding: 14px 15px 34px;
  }

  .topbar {
    padding-bottom: 13px;
  }

  .heading-row {
    margin: 24px 0 18px;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .controls-left,
  .controls-right {
    width: 100%;
    justify-content: space-between;
  }

  .controls-left select {
    flex: 1;
  }

  .controls-right {
    justify-content: flex-start;
  }

  .flashcard {
    min-height: 310px;
  }

  .card-actions {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}