:root {
  --bg: #fff;
  --surface: #fafafa;
  --ink: #171717;
  --muted: #666;
  --line: #e5e5e5;
  --hover: #f2f2f2;
  --good: #008a38;
  --close: #946000;
  --wrong: #c42b35;
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #111;
  --ink: #ededed;
  --muted: #a1a1a1;
  --line: #292929;
  --hover: #1c1c1c;
  --good: #50e384;
  --close: #edba57;
  --wrong: #ff8088;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 80px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
}
.site-mark { display: flex; align-items: center; gap: 12px; }
.site-mark-link { color: inherit; text-decoration: none; }
.site-logo { display: block; width: 28px; height: 28px; object-fit: contain; }
.site-name { font-size: 15px; font-weight: 600; letter-spacing: -0.035em; }
.header-actions { display: flex; align-items: center; gap: 24px; }
.site-nav { display: flex; align-items: center; gap: 20px; }
.site-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.site-nav-link:hover, .site-nav-link.is-active { color: var(--ink); }
.site-nav-link.is-active { text-decoration: underline; text-underline-offset: 8px; }

input, button { font: inherit; border-radius: 0; }
button {
  min-height: 52px;
  padding: 14px 22px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
button:hover { background: color-mix(in srgb, var(--ink) 85%, var(--bg)); }
button:disabled { cursor: default; opacity: 0.6; }
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}
.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  min-height: 40px;
  flex: 0 0 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--bg);
  color: var(--muted);
}
.theme-toggle:hover { background: var(--hover); color: var(--ink); }
.theme-toggle-icon, .theme-toggle-icon svg { display: block; width: 16px; height: 16px; }

.practice-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 800px);
  margin: 0 auto;
  padding: 32px 48px 28px;
  border-inline: 1px solid var(--line);
}
.progress-track { height: 2px; overflow: hidden; background: var(--line); }
.progress-fill { width: 0; height: 100%; background: var(--ink); transition: width 260ms ease; }
.gamification-note {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.practice-stage { margin: auto 0; padding: 64px 0; }
.question-meta {
  margin: 0;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.question-word {
  margin: 18px 0 16px;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -0.055em;
  overflow-wrap: anywhere;
}
.phonetic-hint {
  min-height: 1.4em;
  margin: 0 0 36px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.4;
}
.answer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
input {
  min-width: 0;
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
input::placeholder { color: var(--muted); }
input:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.feedback-box {
  min-height: 24px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 180ms ease;
}
.feedback-box.is-good, .feedback-box.is-close, .feedback-box.is-wrong { opacity: 1; }
.feedback-box.is-exit { opacity: 0; }
.is-good { --feedback: var(--good); }
.is-close { --feedback: var(--close); }
.is-wrong { --feedback: var(--wrong); }
.feedback-box, .gamification-note { color: var(--feedback, var(--muted)); }
.feedback-box.is-good, .gamification-note.is-good { font-weight: 700; }
.answer-row:is(.is-good, .is-close, .is-wrong) input {
  border-color: var(--feedback);
  box-shadow: 0 0 0 1px var(--feedback);
}
.previous-round { min-height: 76px; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.previous-round.is-empty .previous-card-button { opacity: 0; visibility: hidden; pointer-events: none; }
.previous-card-button {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
}
.previous-card-button:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.previous-text { display: block; margin: 0; font-size: 13px; font-weight: 400; line-height: 1.6; }
.previous-text em { color: var(--ink); }

.score-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); }
.score-pill { padding: 16px; }
.score-pill + .score-pill { border-left: 1px solid var(--line); }
.score-label { display: block; color: var(--muted); font-size: 12px; }
.score-value { display: block; margin-top: 8px; font-size: 20px; font-variant-numeric: tabular-nums; }
.about-shell {
  flex: 1;
  width: min(100%, 800px);
  margin: 0 auto;
  padding: 64px 48px 80px;
  border-inline: 1px solid var(--line);
}
.about-card h1, .about-card h2 { margin: 0; font-weight: 500; letter-spacing: -0.045em; }
.about-card h1 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.15; }
.about-card > p, .verb-card-top p { margin: 24px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.about-card a { color: var(--ink); text-underline-offset: 3px; }
.about-card .about-note { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 13px; }
.verb-shell { width: min(100%, 1000px); }
.verb-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.verb-card-top p { max-width: 54ch; margin-top: 16px; }
.verb-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.verb-stat { display: inline-flex; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; white-space: nowrap; }
.verb-stat strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.verb-practice-stage { padding-top: 32px; }
.verb-prompt-field { margin: 0 0 16px; font-size: 15px; font-weight: 500; }
.verb-prompt-hint { margin: 0 0 36px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.verb-paradigm { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.verb-paradigm h2 { margin-bottom: 16px; font-size: 18px; }
.verb-paradigm-box { overflow-x: auto; }
.verb-paradigm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.verb-paradigm-table th, .verb-paradigm-table td { text-align: left; vertical-align: top; padding: 14px 12px; border-bottom: 1px solid var(--line); line-height: 1.6; }
.verb-paradigm-table thead th { background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 500; }
.verb-paradigm-table tbody th { width: 190px; font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 640px) {
  .site-header { min-height: 72px; padding: 14px 20px; gap: 12px; flex-wrap: wrap; }
  .site-mark { gap: 8px; }
  .site-logo { width: 24px; height: 24px; }
  .site-name { font-size: 14px; }
  .header-actions { gap: 12px; }
  .site-nav { gap: 12px; }
  .site-nav-link { font-size: 13px; }
  .practice-shell { padding: 24px 24px 20px; border: 0; }
  .practice-stage { padding: 48px 0; }
  .question-word { font-size: clamp(2.5rem, 10vw, 4rem); }
  .answer-row { grid-template-columns: 1fr; }
  .about-shell { padding: 40px 24px 56px; border: 0; }
  .verb-card-top { flex-direction: column; }
  .score-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-pill:nth-child(3) { border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
