/* FinanceHub site styles
   Design read: bilingual beginner finance education, calm editorial, brand greens kept.
   Dials: DESIGN_VARIANCE 6 / MOTION_INTENSITY 4 / VISUAL_DENSITY 4.

   Shape rule (used everywhere):
   - panels, tiles, images, modal: 16px (--r-lg)
   - inputs, small controls:        10px (--r-md)
   - buttons and toggles:           full pill (--r-pill)
*/

@font-face {
  font-family: "Baleday";
  src: url("/static/fonts/Baleday.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("/static/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root,
:root[data-theme="light"] {
  --bg: #f2f5f3;
  --surface: #fafbfa;
  --surface-2: #e7eeea;
  --ink: #0b2226;
  --muted: #4b605c;
  --line: #d3ddd8;
  --accent: #1c6e50;
  --accent-hover: #155a41;
  --accent-ink: #f4faf6;
  --accent-soft: #dcebe2;
  --danger: #a23b2f;
  --scrim: rgb(6 26 30 / 0.55);
  --shadow: 0 1px 2px rgb(11 34 38 / 0.05), 0 8px 24px -12px rgb(11 34 38 / 0.18);
  --header-bg: rgb(242 245 243 / 0.82);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #061a1e;
  --surface: #0b272c;
  --surface-2: #0f3237;
  --ink: #e3eee7;
  --muted: #9cb6aa;
  --line: #1d4146;
  --accent: #8bbb92;
  --accent-hover: #a3cda9;
  --accent-ink: #062024;
  --accent-soft: #123c38;
  --danger: #f0a196;
  --scrim: rgb(3 14 16 / 0.7);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px -12px rgb(0 0 0 / 0.6);
  --header-bg: rgb(6 26 30 / 0.8);
  color-scheme: dark;
}

:root {
  --font: "Geist", "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --r-lg: 16px;
  --r-md: 10px;
  --r-pill: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --container: 1120px;
  --gutter: 24px;
  --header-h: 68px;
  --rail: 0px;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html:not([data-lang="tr"]) .lang-tr { display: none !important; }
html[data-lang="tr"] .lang-en { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
body > main { flex: 1; }

img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; }

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.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;
}

.skip-link {
  position: absolute;
  left: 16px; top: -60px;
  z-index: 3000;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: var(--r-pill);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

.ph { line-height: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-size: 0.98rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease), color 0.25s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn .ph { font-size: 1.1rem; transition: transform 0.3s var(--ease); }
.btn:hover .ph-arrow-right,
.btn:hover .ph-arrow-up-right { transform: translateX(3px); }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
}
@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
}

.wordmark {
  font-family: "Baleday", var(--font);
  font-size: 1.7rem;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
  padding-top: 4px;
  white-space: nowrap;
}
.wordmark:hover { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav a.active { color: var(--ink); background: var(--surface-2); }
.site-nav a .ph { font-size: 0.9rem; opacity: 0.7; }

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

#nav-auth-slot {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  min-height: 38px;
}
#nav-auth-slot a {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
#nav-auth-slot a:hover { border-color: var(--accent); color: var(--accent); }
.nav-user {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  min-width: 38px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn .ph { font-size: 1.1rem; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn:active { transform: scale(0.96); }
#theme-toggle { padding: 0; width: 38px; }

.menu-btn { display: none; padding: 0; width: 38px; }

.mobile-menu {
  display: none;
}

@media (max-width: 860px) {
  :root { --header-h: 60px; --gutter: 16px; }
  .site-header .container { gap: 12px; }
  .site-header .site-nav { display: none; }
  .menu-btn { display: inline-flex; }
  .wordmark { font-size: 1.45rem; }
  #nav-auth-slot a { padding: 0 12px; }
  .nav-user { display: none; }

  .mobile-menu {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    z-index: 890;
    display: block;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 8px var(--gutter) 16px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0.25s;
  }
  .mobile-menu.open {
    opacity: 1;
    transform: none;
    visibility: visible;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }
  .mobile-menu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
  }
  .mobile-menu a:last-child { border-bottom: 0; }
  .mobile-menu a.active { color: var(--accent); }
}
@media (max-width: 380px) {
  #lang-toggle .lang-code { display: none; }
  #lang-toggle { width: 38px; padding: 0; }
}

/* ---------- Reveal motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
    transition-delay: calc(var(--i, 0) * 70ms);
  }
  .js .reveal.is-in { opacity: 1; transform: none; }

  .enter {
    animation: enter 0.8s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 90ms);
  }
  @keyframes enter {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Home: hero ---------- */
.hero {
  padding: 56px 0 40px;
}
.hero .container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 56px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.5rem, 5.2vw, 4.25rem);
  letter-spacing: -0.035em;
  line-height: 1.02;
  max-width: 12ch;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero-sub {
  margin-top: 22px;
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 40ch;
}
.hero-ctas {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.hero-visual {
  margin: 0;
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #0d1520;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 971 / 560;
}
.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 40%;
}
.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.06);
  pointer-events: none;
}

@media (max-width: 900px) {
  .hero { padding: 32px 0 24px; }
  .hero .container { grid-template-columns: 1fr; gap: 32px; }
  .hero h1 { max-width: 14ch; }
}
@media (max-width: 520px) {
  .hero-ctas .btn { flex: 1 1 auto; }
}

/* ---------- Home: facts ---------- */
.facts {
  padding: 8px 0 8px;
}
.facts dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.facts dl > div {
  padding: 22px 24px 0 0;
}
.facts dt {
  font-size: 0.95rem;
  color: var(--muted);
  order: 2;
}
.facts dd {
  margin: 0 0 4px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.facts dl > div { display: flex; flex-direction: column; }
.facts dd { order: 1; }
@media (max-width: 640px) {
  .facts { padding-bottom: 48px; }
  .facts dl { grid-template-columns: 1fr; }
  .facts dl > div { padding: 16px 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: baseline; gap: 14px; }
  .facts dl > div:last-child { border-bottom: 0; }
  .facts dd { font-size: 1.6rem; min-width: 3ch; }
}

/* ---------- Section heads ---------- */
.section { padding: 72px 0; }
.section + .section { padding-top: 24px; }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
}
.section-head h2 {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  letter-spacing: -0.03em;
}
.count {
  font-size: 0.95rem;
  color: var(--muted);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .section { padding: 48px 0; }
}

/* ---------- Home: investing bento ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: var(--shadow); }
.tile:active { transform: translateY(-1px); }
.tile h3 { font-size: 1.35rem; }
.tile p { color: var(--muted); max-width: 40ch; }
.tile .ph-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.4rem;
  margin-bottom: auto;
}
.tile .go {
  position: absolute;
  right: 22px; top: 22px;
  font-size: 1.2rem;
  color: var(--muted);
  transition: transform 0.35s var(--ease), color 0.35s var(--ease);
}
.tile:hover .go { transform: translate(3px, -3px); color: var(--accent); }

.tile--feature { grid-column: span 7; grid-row: span 2; min-height: 400px; padding: 32px; justify-content: flex-end; background: #0d1520; border-color: transparent; color: #eef5f0; }
.tile--feature .bg {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 30% 60%;
  transition: transform 0.9s var(--ease);
}
.tile--feature::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgb(6 26 30 / 0.05) 20%, rgb(6 26 30 / 0.92) 88%);
}
.tile--feature:hover .bg { transform: scale(1.04); }
.tile--feature h3 { font-size: clamp(1.7rem, 2.6vw, 2.2rem); letter-spacing: -0.03em; }
.tile--feature p { color: rgb(238 245 240 / 0.8); font-size: 1.05rem; }
.tile--feature .ph-icon { background: rgb(139 187 146 / 0.18); color: #a9d3b0; margin-bottom: 0; position: absolute; top: 28px; left: 28px; }
.tile--feature .go { color: rgb(238 245 240 / 0.7); }
.tile--feature:hover .go { color: #a9d3b0; }

.tile--side { grid-column: span 5; min-height: 192px; }
.tile--tall { grid-row: span 2; }
.tile--half { grid-column: span 6; min-height: 192px; }
.tile--solo { grid-column: span 12; grid-row: auto; min-height: 340px; }
.tile--wide {
  grid-column: span 12;
  flex-direction: row;
  align-items: center;
  gap: 24px;
  min-height: 0;
  background: var(--accent-soft);
  border-color: transparent;
}
.tile--wide .ph-icon { margin: 0; background: var(--accent); color: var(--accent-ink); flex: none; width: 52px; height: 52px; font-size: 1.6rem; }
.tile--wide .text { display: grid; gap: 4px; }
.tile--wide .go { position: static; margin-left: auto; font-size: 1.4rem; }
.tile--wide p { color: var(--muted); }

@media (max-width: 900px) {
  .tile--feature { grid-column: span 12; grid-row: auto; min-height: 340px; }
  .tile--side, .tile--half { grid-column: span 6; min-height: 200px; }
  .tile--tall { grid-row: auto; }
}
@media (max-width: 640px) {
  .tile--side, .tile--half { grid-column: span 12; min-height: 0; }
  .tile--side .ph-icon, .tile--half .ph-icon { margin-bottom: 14px; }
  .tile--wide { flex-direction: column; align-items: flex-start; }
  .tile--wide .go { position: absolute; margin: 0; top: 26px; right: 22px; }
}

/* ---------- Home: personal finance list ---------- */
.lesson-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 48px;
  border-top: 1px solid var(--line);
}
.lesson-rows li { border-bottom: 1px solid var(--line); }
.lesson-rows li:nth-last-child(-n + 2):nth-child(odd),
.lesson-rows li:last-child { border-bottom: 0; }
.row-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: start;
  padding: 26px 0;
  text-decoration: none;
  color: var(--ink);
}
.row-link .ph-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 1.35rem;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.row-link h3 { font-size: 1.2rem; margin-top: 2px; transition: color 0.3s var(--ease); }
.row-link p { color: var(--muted); margin-top: 6px; max-width: 42ch; }
.row-link .go { font-size: 1.2rem; color: var(--muted); margin-top: 10px; transition: transform 0.3s var(--ease), color 0.3s var(--ease); }
.row-link:hover h3 { color: var(--accent); }
.row-link:hover .ph-icon { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.row-link:hover .go { transform: translateX(4px); color: var(--accent); }
@media (max-width: 760px) {
  .lesson-rows { grid-template-columns: 1fr; }
  .lesson-rows li:nth-last-child(-n + 2):nth-child(odd) { border-bottom: 1px solid var(--line); }
  .lesson-rows li:last-child { border-bottom: 0; }
  .row-link { padding: 20px 0; gap: 14px; }
}

/* ---------- Home: markets and economy pair ---------- */
.pair-band {
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.pair {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 300px;
  padding: 32px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.pair:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pair .kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pair h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -0.03em; }
.pair .count { font-size: 0.9rem; }
.pair .body { margin-top: auto; display: grid; gap: 8px; }
.pair .ph-big { font-size: 2.6rem; color: var(--accent); }
.pair h3 { font-size: 1.25rem; }
.pair p { color: var(--muted); max-width: 44ch; }
.pair .more {
  margin-top: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent); font-weight: 600; font-size: 0.95rem;
}
.pair .more .ph { transition: transform 0.3s var(--ease); }
.pair:hover .more .ph { transform: translateX(4px); }
@media (max-width: 760px) {
  .pair-band { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .pair { min-height: 240px; padding: 24px; }
}

/* ---------- Community band ---------- */
.community {
  padding: 24px 0 88px;
}
.community-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: center;
  padding: 44px 48px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent-soft) 0%, transparent 55%),
    var(--surface);
}
.community h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.03em; max-width: 20ch; }
.community p { margin-top: 10px; color: var(--muted); max-width: 48ch; }
.community .btns { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .community { padding-bottom: 56px; }
  .community-inner { grid-template-columns: 1fr; padding: 28px 24px; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 48px;
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer .container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px 40px;
  align-items: start;
}
.site-footer .wordmark { font-size: 1.5rem; }
.site-footer .disclaimer { margin-top: 10px; max-width: 52ch; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
@media (max-width: 640px) {
  .site-footer { padding-bottom: 104px; }
  .site-footer .container { grid-template-columns: 1fr; }
}

/* ---------- Lesson page ---------- */
.lesson {
  padding: 40px 0 88px;
}
.lesson .container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 72px;
  align-items: start;
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 36px;
}
.crumbs a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted);
  text-decoration: none;
}
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here { color: var(--ink); }

.lesson-head { max-width: 680px; }
.lesson-head .ph-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.8rem;
  margin-bottom: 26px;
}
.lesson-head h1 {
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.lesson-head .summary {
  margin-top: 18px;
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 44ch;
}
.lesson-body {
  margin-top: 40px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
  max-width: 65ch;
  display: grid;
  gap: 22px;
  font-size: 1.12rem;
  line-height: 1.75;
}
.lesson-body p:first-child::first-line { font-weight: 500; }
.note {
  margin-top: 40px;
  max-width: 65ch;
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.95rem;
}
.note .ph { font-size: 1.2rem; color: var(--accent); margin-top: 2px; flex: none; }

.next-card {
  margin-top: 48px;
  max-width: 65ch;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 24px 26px;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  transition: transform 0.35s var(--ease), background-color 0.35s var(--ease);
}
.next-card:hover { background: var(--accent-hover); transform: translateY(-2px); }
.next-card small { display: block; font-size: 0.9rem; opacity: 0.8; margin-bottom: 4px; }
.next-card strong { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.next-card .ph { font-size: 1.6rem; transition: transform 0.35s var(--ease); }
.next-card:hover .ph { transform: translateX(4px); }

.lesson-aside {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  padding-top: 72px;
}
.lesson-aside h2 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.toc-group + .toc-group { margin-top: 20px; }
.toc-group h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  margin-bottom: 6px;
}
.toc-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc-group a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin-left: -10px;
  border-radius: var(--r-md);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.35;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.toc-group a .ph { color: var(--muted); font-size: 1.05rem; flex: none; }
.toc-group a:hover { background: var(--surface-2); }
.toc-group a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc-group a[aria-current="page"] .ph { color: var(--accent); }

@media (max-width: 980px) {
  .lesson .container { grid-template-columns: 1fr; gap: 56px; }
  .lesson-aside { position: static; padding-top: 32px; border-top: 1px solid var(--line); }
  .lesson-aside .toc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 32px; }
  .toc-group + .toc-group { margin-top: 0; }
}
@media (max-width: 560px) {
  .lesson { padding-top: 24px; }
  .crumbs { margin-bottom: 24px; }
  .lesson-aside .toc { grid-template-columns: 1fr; }
  .lesson-body { font-size: 1.06rem; }
}

/* ---------- About ---------- */
.page-intro { padding: 64px 0 48px; }
.page-intro h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  letter-spacing: -0.035em;
  line-height: 1.03;
  max-width: 16ch;
}
.page-intro p {
  margin-top: 20px;
  font-size: 1.18rem;
  color: var(--muted);
  max-width: 46ch;
}
@media (max-width: 640px) { .page-intro { padding: 36px 0 28px; } }

.statement {
  padding: 24px 0 72px;
}
.statement .container {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 48px;
}
.statement h2 { font-size: 1.1rem; letter-spacing: -0.01em; color: var(--muted); font-weight: 500; padding-top: 8px; }
.statement blockquote {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  line-height: 1.45;
  letter-spacing: -0.02em;
  max-width: 34ch;
  font-weight: 500;
}
.statement blockquote strong { color: var(--accent); font-weight: 600; }
@media (max-width: 760px) {
  .statement .container { grid-template-columns: 1fr; gap: 14px; }
  .statement { padding-bottom: 48px; }
}

.columns {
  padding: 0 0 72px;
}
.columns .container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 48px;
}
.columns article { border-top: 1px solid var(--line); padding-top: 24px; }
.columns h2 { font-size: 1.5rem; letter-spacing: -0.025em; }
.columns p { margin-top: 12px; color: var(--muted); font-size: 1.06rem; line-height: 1.7; max-width: 52ch; }
@media (max-width: 760px) {
  .columns .container { grid-template-columns: 1fr; gap: 32px; }
  .columns { padding-bottom: 48px; }
}

.values {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}
.value {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  padding: 28px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}
.value .ph-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font-size: 1.45rem;
  margin-bottom: auto;
}
.value h3 { font-size: 1.3rem; }
.value p { color: var(--muted); max-width: 40ch; }
.value:nth-child(1) { grid-column: span 7; }
.value:nth-child(2) { grid-column: span 5; background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.value:nth-child(2) p { color: color-mix(in srgb, var(--accent-ink) 82%, transparent); }
.value:nth-child(2) .ph-icon { background: color-mix(in srgb, var(--accent-ink) 16%, transparent); color: var(--accent-ink); }
.value:nth-child(3) { grid-column: span 5; background: var(--surface-2); border-color: transparent; }
.value:nth-child(4) { grid-column: span 7; }
@media (max-width: 760px) {
  .values .value { grid-column: span 12; min-height: 0; }
  .value .ph-icon { margin-bottom: 14px; }
}

/* ---------- Blog ---------- */
.blog-main { padding-bottom: 88px; }
.blog-layout {
  display: grid;
  gap: 40px;
  max-width: 760px;
}
.new-post-box {
  padding: 28px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
}
.new-post-box h2 { font-size: 1.3rem; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.new-post-box h2 .ph { color: var(--accent); }

.blog-list { display: grid; }
.blog-post {
  padding: 32px 0;
  border-top: 1px solid var(--line);
}
.blog-post:first-child { border-top: 0; padding-top: 0; }
.blog-post h3 { font-size: 1.6rem; letter-spacing: -0.025em; }
.blog-meta {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}
.blog-content {
  margin-top: 16px;
  font-size: 1.08rem;
  line-height: 1.75;
  white-space: pre-line;
  max-width: 65ch;
}
.blog-delete {
  margin-top: 18px;
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line));
  background: transparent;
  color: var(--danger);
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.blog-delete:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.blog-loading,
.blog-empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 40px 32px;
  border-radius: var(--r-lg);
  border: 1px dashed var(--line);
  color: var(--muted);
}
.blog-empty .ph { font-size: 2rem; color: var(--accent); }
.blog-empty strong { color: var(--ink); font-size: 1.15rem; font-weight: 600; }

.skeleton { display: grid; gap: 40px; }
.skeleton .sk-post { display: grid; gap: 12px; }
.sk {
  height: 14px;
  border-radius: 6px;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}
.sk.title { height: 26px; width: 55%; }
.sk.meta { width: 24%; height: 12px; }
.sk.l1 { width: 96%; } .sk.l2 { width: 88%; } .sk.l3 { width: 62%; }
@media (prefers-reduced-motion: no-preference) {
  .sk::after {
    content: ""; position: absolute; inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
    animation: shimmer 1.4s infinite;
  }
  @keyframes shimmer { to { transform: translateX(100%); } }
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label,
.new-post-box label,
.login-card label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--muted) 45%, var(--line));
  border-radius: var(--r-md);
  padding: 12px 14px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
textarea { resize: vertical; min-height: 160px; line-height: 1.6; }
input:hover, textarea:hover { border-color: var(--muted); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.help { font-size: 0.86rem; color: var(--muted); }
.login-error {
  min-height: 1.4em;
  margin: 2px 0 14px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--danger);
}
.login-error:empty { margin-bottom: 6px; }

/* ---------- Login ---------- */
.login-main {
  padding: 48px 0 88px;
}
.login-main .container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: 56px;
  align-items: center;
}
.login-visual {
  position: relative;
  margin: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #0d1520;
  min-height: 460px;
  isolation: isolate;
}
.login-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 70% 50%; z-index: -2; }
.login-visual::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, transparent 30%, rgb(6 26 30 / 0.9)); }
.login-visual figcaption {
  position: absolute; left: 32px; right: 32px; bottom: 30px;
  color: #eef5f0;
  font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25;
  max-width: 22ch;
}
.login-card {
  padding: 36px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 2rem; letter-spacing: -0.03em; }
.login-sub { margin: 8px 0 28px; color: var(--muted); }
.login-card .btn { width: 100%; }
@media (max-width: 860px) {
  .login-main { padding: 28px 0 56px; }
  .login-main .container { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-card { padding: 28px 22px; }
}

/* ---------- Music player ---------- */
#music-player {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#music-player button {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.05rem;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
#music-player button:hover { background: var(--surface-2); }
#music-player button:active { transform: scale(0.94); }
#music-play { background: var(--accent) !important; color: var(--accent-ink) !important; }
#music-play:hover { background: var(--accent-hover) !important; }
#music-track {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 10px 0 6px;
  min-width: 30px;
  text-align: center;
}
.eq { display: none; }
@media (prefers-reduced-motion: no-preference) {
  #music-play.playing { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); animation: ring 2.4s var(--ease) infinite; }
  @keyframes ring { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
}
@media (max-width: 640px) {
  #music-player { right: 12px; bottom: 12px; }
}

/* ---------- Consent banner (non-blocking) ---------- */
#consent-banner {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 1100;
  width: min(440px, calc(100vw - 40px));
  padding: 22px 22px 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px -20px rgb(0 0 0 / 0.5);
}
@media (prefers-reduced-motion: no-preference) {
  #consent-banner { animation: enter 0.5s var(--ease) both; }
}
#consent-banner:focus { outline: none; }
#consent-banner:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#consent-banner h2 { font-size: 1.05rem; letter-spacing: -0.01em; margin-bottom: 8px; }
#consent-banner p { font-size: 0.93rem; line-height: 1.6; color: var(--muted); }
#consent-banner p a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.consent-actions { display: flex; gap: 10px; margin-top: 16px; }
.consent-actions .btn { flex: 1; height: 44px; padding: 0 14px; font-size: 0.95rem; }
.consent-actions .btn[aria-current="true"] { border-color: var(--accent); color: var(--accent); }
@media (max-width: 640px) {
  #consent-banner { left: 12px; right: 12px; width: auto; bottom: 68px; padding: 18px 16px 16px; }
}

/* Footer: text-styled button next to the links */
.footer-link-btn {
  padding: 0; border: 0; background: none;
  font: inherit; color: var(--muted); cursor: pointer;
}
.footer-link-btn:hover { color: var(--accent); }

/* ---------- Legal pages (privacy and cookies) ---------- */
.legal { padding: 8px 0 96px; }
.legal .container { max-width: 760px; }
.legal h2 { font-size: 1.35rem; letter-spacing: -0.02em; margin: 44px 0 12px; scroll-margin-top: calc(var(--header-h) + 16px); }
.legal h3 { font-size: 1.05rem; margin: 24px 0 8px; }
.legal p, .legal li { color: var(--muted); line-height: 1.75; }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 14px; padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal strong { color: var(--ink); }
.legal a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.legal .updated { font-size: 0.92rem; }
.legal-table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; font-size: 0.93rem; }
.legal-table caption { text-align: left; font-weight: 600; color: var(--ink); padding-bottom: 8px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); }
.legal-table th { color: var(--ink); font-weight: 600; }
.legal-table code { font-family: var(--mono); font-size: 0.85em; color: var(--ink); }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legal-cta { margin-top: 18px; }
/* ---------- Ad rail ---------- */
#ad-sidebar {
  display: none;
}
@media (min-width: 1380px) {
  html.ads-on { --rail: 212px; }
  /* Keep header and footer backgrounds full width; centre content in the space left of the ad rail. */
  .container {
    margin-left: max(0px, calc((100% - var(--rail) - (var(--container) + var(--gutter) * 2)) / 2));
    margin-right: auto;
  }
  html.ads-on #ad-sidebar {
    display: block;
    position: fixed;
    top: calc(var(--header-h) + 24px);
    right: 24px;
    width: 172px;
    max-height: calc(100dvh - var(--header-h) - 120px);
    overflow: hidden;
    z-index: 500;
  }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }


/* ---------- Header: admin + logout links ---------- */
#nav-auth-slot a .ph { font-size: 1.05rem; }
#nav-auth-slot a { gap: 6px; }
@media (max-width: 480px) {
  #nav-auth-slot a .lbl { display: none; }
  #nav-auth-slot a:has(.lbl) { width: 38px; padding: 0; justify-content: center; }
  #lang-toggle .lang-code { display: none; }
  #lang-toggle { width: 38px; padding: 0; }
}

/* ---------- Lesson not found ---------- */
.lesson .container.missing { display: block; padding-top: 24px; }
.missing-card {
  display: grid;
  justify-items: start;
  gap: 14px;
  max-width: 560px;
}
.missing-card > .ph { font-size: 2.4rem; color: var(--accent); }
.missing-card h1 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); letter-spacing: -0.03em; }
.missing-card p { color: var(--muted); font-size: 1.1rem; }
.missing-card .btn { margin-top: 6px; }
.missing-toc { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px 40px; }
.missing-toc .toc-group + .toc-group { margin-top: 0; }

/* ---------- Buttons: extra variants ---------- */
.btn-sm { height: 40px; padding: 0 16px; font-size: 0.92rem; }
.btn-danger { background: var(--danger); color: var(--bg); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, var(--ink)); }
.icon-btn[disabled] { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto;
  padding: 6px 4px;
  border: 0; background: none;
  color: var(--muted);
  font-size: 0.9rem; font-weight: 500;
  cursor: pointer;
}
.link-btn:hover { color: var(--accent); }

/* ---------- Admin ---------- */
.admin { padding: 48px 0 96px; }
.admin-state .skeleton { max-width: 760px; }
.gate {
  display: grid;
  justify-items: start;
  gap: 14px;
  max-width: 520px;
  padding: 24px 0;
}
.gate > .ph { font-size: 2.2rem; color: var(--accent); }
.gate h1 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); letter-spacing: -0.03em; }
.gate p { color: var(--muted); font-size: 1.05rem; }
.gate .btn { margin-top: 6px; }

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
}
.admin-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -0.035em; }
.admin-head p { margin-top: 10px; color: var(--muted); max-width: 52ch; }

.seed-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 28px 32px;
  margin-bottom: 40px;
  border-radius: var(--r-lg);
  background: var(--accent-soft);
}
.seed-banner h2 { font-size: 1.3rem; }
.seed-banner p { margin-top: 6px; color: var(--muted); max-width: 60ch; }

.topic-list { display: grid; gap: 40px; }
.admin-group-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.admin-group-head h2 { font-size: 1.35rem; letter-spacing: -0.02em; }
.admin-rows { list-style: none; margin: 0; padding: 0; }
.admin-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.admin-row .ph-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font-size: 1.3rem;
}
.admin-row-text { display: grid; gap: 1px; min-width: 0; }
.admin-row-text strong { font-weight: 600; font-size: 1.02rem; }
.admin-row-text .tr { color: var(--muted); font-size: 0.92rem; }
.admin-row-text code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 3px;
}
.admin-row-actions { display: flex; gap: 6px; }
.admin-row-actions .icon-btn { width: 38px; padding: 0; text-decoration: none; }
@media (max-width: 720px) {
  .admin { padding-top: 28px; }
  .admin-head { flex-direction: column; align-items: stretch; }
  .seed-banner { grid-template-columns: 1fr; padding: 24px; }
  .admin-row { grid-template-columns: auto minmax(0, 1fr); }
  .admin-row-actions { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; }
}

/* ---------- Dialogs ---------- */
dialog {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0;
}
dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.sheet {
  width: min(720px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  box-shadow: 0 24px 80px -20px rgb(0 0 0 / 0.5);
}
.sheet[open] { display: flex; }
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: sheet-in 0.45s var(--ease) both; }
  @keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .confirm[open] { animation: enter 0.35s var(--ease) both; }
}
.sheet form { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { font-size: 1.35rem; letter-spacing: -0.02em; }
.sheet-body { flex: 1; overflow-y: auto; padding: 8px 28px 28px; overscroll-behavior: contain; }
.sheet-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.sheet-foot .login-error { margin: 0 auto 0 0; min-height: 0; }
.sheet fieldset { border: 0; margin: 0; padding: 24px 0 8px; }
.sheet fieldset + fieldset { border-top: 1px solid var(--line); }
.sheet legend { padding: 0; margin-bottom: 16px; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; }
.sheet fieldset > .help { margin: -8px 0 14px; }
@media (max-width: 640px) {
  .sheet { border-radius: 0; }
  .sheet-head, .sheet-foot { padding-inline: 18px; }
  .sheet-body { padding-inline: 18px; }
  .sheet-foot { flex-wrap: wrap; }
  .sheet-foot .login-error { flex-basis: 100%; }
  .sheet-foot .btn { flex: 1; }
}

.confirm {
  width: min(460px, calc(100vw - 32px));
  border-radius: var(--r-lg);
  box-shadow: 0 24px 80px -20px rgb(0 0 0 / 0.5);
}
.confirm form { padding: 28px; display: grid; gap: 10px; }
.confirm h2 { font-size: 1.3rem; letter-spacing: -0.02em; }
.confirm .field { margin-bottom: 6px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* ---------- Form bits ---------- */
select {
  width: 100%;
  height: 46px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--muted) 45%, var(--line));
  border-radius: var(--r-md);
  padding: 0 14px;
}
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.label { font-size: 0.92rem; font-weight: 600; }
.field-error { font-size: 0.88rem; font-weight: 500; color: var(--danger); }
.field-error:empty { display: none; }
[aria-invalid="true"] { border-color: var(--danger) !important; }
input[readonly] { color: var(--muted); background: var(--surface-2); cursor: not-allowed; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.field-pair[hidden] { display: none; }
@media (max-width: 640px) { .field-pair { grid-template-columns: 1fr; } }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px;
}
.icon-choice {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  height: 46px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 1.35rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.icon-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.icon-choice:hover { color: var(--ink); border-color: var(--muted); }
.icon-choice:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.icon-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.para-list { display: grid; gap: 14px; margin-bottom: 14px; }
.para {
  padding: 14px 16px 2px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.para-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.para-num { font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.para-actions { display: flex; gap: 4px; }
.para-actions .icon-btn { width: 32px; height: 32px; min-width: 32px; padding: 0; background: var(--surface); }
.para textarea { min-height: 110px; background: var(--surface); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 6000;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  box-shadow: var(--shadow);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .ph { font-size: 1.2rem; }
.toast.error { background: var(--danger); }
.lesson-body p { white-space: pre-line; }

.login-note { margin-top: 14px; font-size: 0.88rem; color: var(--muted); line-height: 1.6; }
.login-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
