:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182019;
  background: #f7f8f4;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid #258849; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.shell {
  width: min(100%, 540px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: #33483a;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.back-link:focus-visible { outline: 3px solid #258849; outline-offset: 3px; }
.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-title h1 { margin: 0; font-size: clamp(22px, 6vw, 29px); line-height: 1.1; letter-spacing: -.04em; }
#progress-label { color: #657268; font-size: 13px; white-space: nowrap; }
.mistakes-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 48px;
  padding: 6px 10px;
  border: 1px solid #cdd9cf;
  border-radius: 9px;
  background: #fff;
  color: #27372b;
  font-size: 13px;
  font-weight: 650;
}
#mistakes-count { min-width: 14px; text-align: center; }
[hidden] { display: none !important; }

.card-stage { position: relative; }

.flashcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(320px, 55vh, 460px);
  padding: 32px 50px;
  border: 1px solid #d9e1d8;
  border-radius: 20px;
  background: #fff;
  color: #182019;
  text-align: center;
  box-shadow: 0 8px 28px #17221a08;
}

.account-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(320px, 55vh, 460px);
  padding: 36px 44px;
  border: 1px solid #d9e1d8;
  border-radius: 20px;
  background: #fff;
  text-align: center;
  box-shadow: 0 8px 28px #17221a08;
}
.account-gate h2 { margin: 0 0 12px; font-size: clamp(25px, 6vw, 34px); line-height: 1.15; }
.account-gate p { max-width: 32ch; margin: 0 0 24px; line-height: 1.5; color: #526358; }
.account-gate a, .account-gate button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: #285d39;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.card-word {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: clamp(40px, 11vw, 64px);
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: -.05em;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.reflexive-verbs .card-word,
.s-verbs .card-word,
.verb-prepositions .card-word,
.verb-meaning-pairs .card-word,
.adjective-agreement .card-word {
  max-width: min(100%, 26ch);
  font-size: clamp(32px, 8vw, 48px);
  overflow-wrap: normal;
  white-space: normal;
}

.adjective-agreement .practice-instruction {
  margin: -4px 0 20px;
  color: #526358;
  font-size: 15px;
  line-height: 1.5;
}

.adjective-agreement .flashcard { padding-inline: 40px; }
.adjective-agreement .previous-button { left: -8px; }
.adjective-agreement .next-button { right: -8px; }

.flashcard.is-revealed .card-word { background: #d9f2d5; color: #12371e; }
.card-alternative { margin-top: 14px; font-size: 17px; font-weight: 600; line-height: 1.3; }
.nav-button {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 48px;
  height: 56px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #253b2b;
  font-size: 28px;
  font-weight: 500;
}
.previous-button { left: 8px; }
.next-button { right: 8px; }
.grade-actions {
  position: absolute;
  right: 12px;
  bottom: 18px;
  left: 12px;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.grade-button {
  min-width: 98px;
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid #cbd7cd;
  border-radius: 10px;
  background: #fff;
  color: #27372b;
  font-weight: 680;
}
.correct-button { background: #d9f2d5; border-color: #b5dfb1; color: #12371e; }
.nav-button:disabled { opacity: .35; cursor: default; }

:root:where([data-theme="dark"]) { color: #f1f5f0; background: #111914; }

:where([data-theme="dark"]) .back-link { color: #d7e7d9; }

:where([data-theme="dark"]) #progress-label { color: #a7b7aa; }

:where([data-theme="dark"]) .flashcard { background: #1c2820; color: #f1f5f0; border-color: #37463a; }

:where([data-theme="dark"]) .account-gate { background: #1c2820; color: #f1f5f0; border-color: #37463a; }

:where([data-theme="dark"]) .account-gate p { color: #a7b7aa; }

:where([data-theme="dark"]) .adjective-agreement .practice-instruction { color: #a7b7aa; }

:where([data-theme="dark"]) .nav-button { color: #d7e7d9; }

:where([data-theme="dark"]) .mistakes-button, :where([data-theme="dark"]) .grade-button { background: #1c2820; border-color: #506354; color: #e2ece3; }

:where([data-theme="dark"]) .correct-button { background: #d9f2d5; border-color: #d9f2d5; color: #12371e; }
