/* ── Page layout ────────────────────────────────────────────────── */
body {
  --page-bg: var(--paper);
  background: var(--paper);
  color: var(--ink);
  transition: background-color 0.6s ease;
}
body.nav-active {
  --page-bg: var(--paper-deep);
  background: var(--paper-deep);
}

.page-header {
  text-align: center;
  padding: 5rem 1.5rem 2.5rem;
  animation: fadeUp 0.6s ease both;
}

.page-header h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}

.page-header h1 em {
  font-style: italic;
  font-weight: 300;
}

.page-header p {
  margin-top: 0.9rem;
  font-size: 1rem;
  font-weight: 300;
  color: var(--ink-soft);
  max-width: 480px;
  margin-inline: auto;
  line-height: 1.6;
}

.page-header::after {
  content: '';
  display: block;
  width: 48px;
  height: 2px;
  background: var(--ink);
  margin: 1.6rem auto 0;
  opacity: 0.25;
}

/* ── Tabs ───────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0 1rem 2rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}

.tab {
  padding: 0.55rem 1.4rem;
  border: none;
  background: transparent;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 4px;
  transition:
    color 0.2s,
    background 0.2s;
  position: relative;
  bottom: -1px;
  border-bottom: 2px solid transparent;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ── Main content wrapper ───────────────────────────────────────── */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
}

.site-footer {
  padding: 1.4rem 0 2.6rem;
  column-gap: 2rem;
  row-gap: 0.75rem;
}

/* ── Position note (above particle grid) ────────────────────────── */
.position-note {
  background: #fff;
  border-radius: 8px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.4rem;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule);
  animation: fadeUp 0.5s ease both;
}

.position-note h2 {
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 0.5rem;
}

.position-note p {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.6;
  margin: 0;
}

.position-note em {
  font-style: italic;
  font-weight: 400;
}

.position-note strong {
  font-weight: 600;
}

/* ── Reference: particle grid ───────────────────────────────────── */
.particle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  animation: fadeUp 0.5s ease both;
}

.particle-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--rule);
  cursor: pointer;
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}

.particle-card:hover {
  box-shadow: 0 3px 18px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.particle-card .particle-name {
  font-size: 2rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 2px;
  line-height: 1;
}

.particle-card .particle-function {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.75rem;
}

.particle-card .particle-contexts {
  font-size: 0.82rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.particle-card .particle-meaning {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.example-box {
  padding: 0.6rem 0;
  border-top: 1px solid rgba(26, 22, 20, 0.08);
}

.example-box:first-of-type {
  border-top: none;
  padding-top: 0;
}

.example-box .example-type {
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 3px;
}

.example-box .de {
  font-size: 0.95rem;
  font-style: italic;
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 2px;
  line-height: 1.4;
}

.example-box .de .highlight {
  font-style: normal;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.example-box .en {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--ink-mute);
}

.particle-card .tip {
  margin-top: 0.9rem;
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--ink);
  background: var(--paper-deep);
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  line-height: 1.55;
  display: none;
}

.particle-card.expanded .tip {
  display: block;
}

.expand-hint {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 0.75rem;
  opacity: 0.7;
}

.particle-card.expanded .expand-hint {
  display: none;
}

/* ── Quiz ───────────────────────────────────────────────────────── */
.quiz-area {
  max-width: 700px;
  margin: 0 auto;
  animation: fadeUp 0.5s ease both;
}

.quiz-filter {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.4rem;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.quiz-filter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.filter-title {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.filter-count {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--ink-mute);
}

.filter-actions {
  display: flex;
  gap: 0.45rem;
}

.filter-action,
.particle-filter {
  border: 1px solid rgba(26, 22, 20, 0.24);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.filter-action {
  padding: 0.32rem 0.65rem;
  font-size: 0.86rem;
}

.particle-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.particle-filter {
  padding: 0.46rem 0.78rem;
  font-size: 1rem;
  line-height: 1;
}

.filter-action:hover,
.particle-filter:hover {
  border-color: var(--ink);
  background: rgba(26, 22, 20, 0.05);
}

.particle-filter.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.quiz-empty {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  color: var(--ink-mute);
  font-weight: 300;
}

.quiz-progress {
  display: flex;
  gap: 5px;
  margin-bottom: 2rem;
  justify-content: center;
}

.quiz-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(26, 22, 20, 0.15);
  transition: background 0.3s;
}

.quiz-dot.correct {
  background: #27ae60;
}

.quiz-dot.wrong {
  background: #c0392b;
}

.quiz-dot.current {
  background: var(--ink);
}

.quiz-card {
  background: #fff;
  border-radius: 8px;
  padding: 2.5rem 2rem;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--rule);
  text-align: center;
}

.quiz-card .q-number {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 1.2rem;
}

.quiz-card .q-sentence {
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.quiz-card .q-sentence .blank {
  display: inline-block;
  min-width: 72px;
  border-bottom: 2px solid var(--ink);
  color: var(--ink-mute);
  font-style: italic;
  font-weight: 300;
  padding: 0 3px;
  margin: 0 3px;
  transition: color 0.2s;
}
.quiz-card .q-sentence .blank.is-answered {
  border-bottom: none;
  font-style: normal;
}
.quiz-card .q-sentence .blank.is-correct {
  color: #27ae60;
}
.quiz-card .q-sentence .blank.is-wrong {
  color: #c0392b;
}

.quiz-card .q-translation {
  font-size: 0.9rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-mute);
  margin-bottom: 1.5rem;
}

.quiz-card .q-context {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
  background: var(--paper-deep);
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  text-align: left;
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 1.2rem;
}

.option-btn {
  padding: 0.85rem 1rem;
  border: 1px solid rgba(26, 22, 20, 0.3);
  background: transparent;
  border-radius: 6px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 400;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
  color: var(--ink);
}

.option-btn:hover {
  background: rgba(26, 22, 20, 0.05);
  border-color: var(--ink);
}

.option-btn.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.option-btn.correct {
  background: #d5f5e3;
  border-color: #27ae60;
  color: #1a5c38;
}

.option-btn.wrong {
  background: #fceae8;
  border-color: #c0392b;
  color: #7a1a1a;
  opacity: 0.7;
}

.option-btn.disabled {
  pointer-events: none;
}

.explanation-box {
  background: var(--paper-deep);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin-top: 1rem;
  text-align: left;
  font-size: 0.92rem;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.6;
  display: none;
}

.explanation-box.visible {
  display: block;
  animation: fadeUp 0.25s ease both;
}

.explanation-box ul {
  margin: 0.55rem 0 0;
  padding-left: 1.2rem;
}

.explanation-box li + li {
  margin-top: 0.45rem;
}

.answer-name {
  font-weight: 600;
  color: var(--ink);
}

.action-btn {
  margin-top: 1.4rem;
  padding: 0.75rem 2.2rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
  display: none;
}

.action-btn:hover {
  background: var(--paper);
  color: var(--ink);
}

.action-btn.visible {
  display: inline-block;
}

/* ── Results ─────────────────────────────────────────────────────── */
.results-card {
  background: #fff;
  border-radius: 8px;
  padding: 3rem 2rem;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--rule);
  text-align: center;
  animation: fadeUp 0.4s ease both;
}

.results-card h2 {
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.results-card .score {
  font-size: 3.5rem;
  font-weight: 300;
  color: var(--ink);
  margin: 1rem 0;
  letter-spacing: -0.02em;
}

.results-card .score-label {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

/* ── Cheat sheet ─────────────────────────────────────────────────── */
.cheat-sheet {
  max-width: 680px;
  margin: 0 auto;
  animation: fadeUp 0.5s ease both;
}

.cs-group {
  margin-bottom: 2rem;
}

.cs-group h3 {
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.cs-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  gap: 12px;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(26, 22, 20, 0.06);
  align-items: baseline;
  font-size: 0.92rem;
  font-weight: 300;
}

.cs-row .cs-particle {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--ink);
}

.cs-row .cs-function {
  color: var(--ink-soft);
}

.cs-row .cs-example {
  font-style: italic;
  color: var(--ink-mute);
  font-size: 0.88rem;
}

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .page-header {
    padding-top: 4rem;
  }

  .site-footer {
    column-gap: 1.25rem;
    row-gap: 0.65rem;
    padding-bottom: 2rem;
  }

  .options {
    grid-template-columns: 1fr;
  }

  .quiz-filter-header {
    display: block;
  }

  .filter-actions {
    margin-top: 0.75rem;
  }

  .cs-row {
    grid-template-columns: 60px 1fr;
    gap: 6px;
  }

  .cs-row .cs-example {
    grid-column: 2;
  }

  .quiz-card {
    padding: 1.75rem 1.25rem;
  }
}
