/* ==========================================================================
   Hintgrid: shared stylesheet (the only CSS file on the site)
   1. Tokens  2. Dark mode  3. Reset  4. Base  5. Layout  6. Header/nav
   7. Footer  8. Breadcrumb  9. Hero  10. Buttons  11. Chips/tiles
   12. Hint reveal  13. Cards/grids  14. Content blocks  15. FAQ
   16. Tables  17. Forms/tabs  18. Tools  19. Feedback  20. Utilities
   21. Responsive  22. Motion/print
   Spacing uses only: 4 8 12 16 24 32 48 64 96 px.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --c-primary: #1F6F54;
  --c-primary-dark: #175240;
  --c-primary-soft: #E3F1EA;
  --c-secondary: #1B2A41;
  --c-accent: #F2B705;
  --c-bg: #F7F8F4;
  --c-surface: #FFFFFF;
  --c-surface-2: #EEF1EA;
  --c-border: #DDE1D6;
  --c-text: #1B2A41;
  --c-text-muted: #4A5568;
  --c-on-primary: #FFFFFF;
  --c-success: #1F6F54;
  --c-warning: #8A6100;
  --c-warning-soft: #FDF3D3;
  --c-error: #B3261E;
  --c-error-soft: #FBE9E7;
  --c-info: #1D5FA8;
  --c-info-soft: #E6EFF9;
  --tile-green: #6AAA64;
  --tile-yellow: #C9B458;
  --tile-gray: #787C7E;
  --tile-text: #FFFFFF;

  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: .8125rem;
  --fs-sm: .9375rem;
  --fs-base: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-bold: 700;
  --lh-tight: 1.2;
  --lh-body: 1.65;
  --ls-heading: -.01em;

  --s-4: 4px;
  --s-8: 8px;
  --s-12: 12px;
  --s-16: 16px;
  --s-24: 24px;
  --s-32: 32px;
  --s-48: 48px;
  --s-64: 64px;
  --s-96: 96px;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(27, 42, 65, .08);
  --shadow-md: 0 6px 20px rgba(27, 42, 65, .10);

  --max-w: 1120px;
  --max-w-text: 720px;
  --header-h: 64px;
  --tap: 44px;
  --t-fast: 150ms ease;
  --t-base: 250ms ease;
  --focus: 3px solid var(--c-accent);

  color-scheme: light;
}

/* 2. Dark mode: follows the OS unless a data-theme override is set --------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-primary: #4CC38A;
    --c-primary-dark: #6FD3A3;
    --c-primary-soft: #16302A;
    --c-secondary: #EAEFF5;
    --c-bg: #10151D;
    --c-surface: #18202B;
    --c-surface-2: #1F2935;
    --c-border: #2A3441;
    --c-text: #EAEFF5;
    --c-text-muted: #A9B4C2;
    --c-on-primary: #0B1A13;
    --c-success: #4CC38A;
    --c-warning: #F2C94C;
    --c-warning-soft: #2E2814;
    --c-error: #FF8A80;
    --c-error-soft: #3A1E1C;
    --c-info: #7FB2EE;
    --c-info-soft: #172739;
    --tile-green: #538D4E;
    --tile-yellow: #B59F3B;
    --tile-gray: #3A3A3C;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --c-primary: #4CC38A;
  --c-primary-dark: #6FD3A3;
  --c-primary-soft: #16302A;
  --c-secondary: #EAEFF5;
  --c-bg: #10151D;
  --c-surface: #18202B;
  --c-surface-2: #1F2935;
  --c-border: #2A3441;
  --c-text: #EAEFF5;
  --c-text-muted: #A9B4C2;
  --c-on-primary: #0B1A13;
  --c-success: #4CC38A;
  --c-warning: #F2C94C;
  --c-warning-soft: #2E2814;
  --c-error: #FF8A80;
  --c-error-soft: #3A1E1C;
  --c-info: #7FB2EE;
  --c-info-soft: #172739;
  --tile-green: #538D4E;
  --tile-yellow: #B59F3B;
  --tile-gray: #3A3A3C;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* 3. Reset ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--s-16)); }
body { min-height: 100vh; }
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
table { border-collapse: collapse; border-spacing: 0; }
[hidden] { display: none !important; }

/* 4. Base ------------------------------------------------------------------- */
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
  color: var(--c-secondary);
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-base); }

a { color: var(--c-primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--c-primary-dark); text-decoration-thickness: 2px; }
strong, b { font-weight: var(--fw-bold); }
small { font-size: var(--fs-sm); }
code, kbd { font-family: var(--font-mono); font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--c-border); margin-block: var(--s-32); }

:focus-visible { outline: var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--c-accent); color: #1B2A41; }

.skip-link {
  position: absolute;
  top: var(--s-8);
  left: var(--s-8);
  z-index: 100;
  padding: var(--s-12) var(--s-16);
  background: var(--c-secondary);
  color: var(--c-bg);
  border-radius: var(--r-sm);
  font-weight: var(--fw-bold);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; color: var(--c-bg); }

/* 5. Layout ----------------------------------------------------------------- */
.container { width: 100%; max-width: var(--max-w); margin-inline: auto; padding-inline: var(--s-16); }
.container--text { max-width: calc(var(--max-w-text) + 2 * var(--s-16)); }
.section { padding-block: var(--s-48); }
.section--tight { padding-block: var(--s-32); }
.section--alt { background: var(--c-surface-2); }
.section__head { margin-bottom: var(--s-24); max-width: var(--max-w-text); }
.section__head p { color: var(--c-text-muted); margin-top: var(--s-8); }

.page-layout { display: grid; gap: var(--s-48); }
.page-layout__aside { display: grid; gap: var(--s-24); align-content: start; }

.stack > * + * { margin-top: var(--s-16); }
.stack-lg > * + * { margin-top: var(--s-32); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-12); align-items: center; }
.grid { display: grid; gap: var(--s-24); }

/* 6. Header / navigation ---------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-16); min-height: var(--header-h); }

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  min-height: var(--tap);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  color: var(--c-secondary);
  text-decoration: none;
}
.logo:hover { color: var(--c-secondary); }
.logo img, .logo svg { width: 32px; height: 32px; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r-sm);
  color: var(--c-secondary);
}
.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.nav-toggle__bar { position: relative; }
.nav-toggle__bar::before, .nav-toggle__bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bar::before { top: -7px; }
.nav-toggle__bar::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar::after { transform: translateY(-7px) rotate(-45deg); }

.site-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-md);
  padding: var(--s-8) var(--s-16) var(--s-16);
  display: none;
}
.site-nav.is-open { display: block; }
.site-nav__list { list-style: none; padding: 0; display: grid; gap: var(--s-4); }
.site-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: var(--tap);
  padding: var(--s-8) var(--s-12);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font-weight: var(--fw-medium);
  text-decoration: none;
  text-align: left;
}
.site-nav__link:hover { background: var(--c-surface-2); color: var(--c-text); }
.site-nav__link[aria-current="page"] { color: var(--c-primary); background: var(--c-primary-soft); }

.site-nav__sub { list-style: none; padding: 0 0 0 var(--s-16); display: none; }
.site-nav__item.is-open > .site-nav__sub { display: grid; gap: var(--s-4); }
.site-nav__caret { width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--t-fast); }
.site-nav__item.is-open .site-nav__caret { transform: rotate(-135deg) translateY(-2px); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r-pill);
  color: var(--c-secondary);
}
.theme-toggle:hover { background: var(--c-surface-2); }
.theme-toggle svg { width: 20px; height: 20px; }
.header-actions { display: flex; align-items: center; gap: var(--s-4); }

/* 7. Footer ----------------------------------------------------------------- */
.site-footer {
  margin-top: var(--s-64);
  background: var(--c-secondary);
  color: #C9D2DE;
  padding-block: var(--s-48) var(--s-32);
  font-size: var(--fs-sm);
}
:root[data-theme="dark"] .site-footer { background: #0B0F15; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .site-footer { background: #0B0F15; } }
.site-footer a { color: #E6ECF3; text-decoration: none; display: inline-flex; align-items: center; min-height: var(--tap); }
.site-footer a:hover { color: #FFFFFF; text-decoration: underline; }
.footer-grid { display: grid; gap: var(--s-32); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.footer-brand { grid-column: 1 / -1; }
.footer-brand .logo { color: #FFFFFF; }
.footer-brand p { margin-top: var(--s-8); max-width: 40ch; }
.footer-col h2 { font-size: var(--fs-sm); color: #FFFFFF; text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s-8); }
.footer-col ul { list-style: none; padding: 0; }
.footer-bottom {
  margin-top: var(--s-32);
  padding-top: var(--s-24);
  border-top: 1px solid rgba(255, 255, 255, .12);
  display: grid;
  gap: var(--s-8);
  color: #A9B4C2;
}

/* 8. Breadcrumb ------------------------------------------------------------- */
.breadcrumb { padding-block: var(--s-16) 0; font-size: var(--fs-sm); }
.breadcrumb ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); }
.breadcrumb li { display: inline-flex; align-items: center; gap: var(--s-4); color: var(--c-text-muted); }
.breadcrumb li + li::before { content: "/"; color: var(--c-border); padding-inline: var(--s-4); }
.breadcrumb a { color: var(--c-text-muted); display: inline-flex; align-items: center; min-height: var(--tap); }
.breadcrumb a:hover { color: var(--c-primary); }
.breadcrumb [aria-current="page"] { color: var(--c-text); font-weight: var(--fw-medium); }

/* 9. Hero ------------------------------------------------------------------- */
.hero { padding-block: var(--s-32) var(--s-48); }
.hero__inner { display: grid; gap: var(--s-32); align-items: center; }
.hero__title { font-size: var(--fs-3xl); }
.hero__subtitle { font-size: var(--fs-lg); color: var(--c-text-muted); margin-top: var(--s-12); max-width: 56ch; }
.hero__meta { margin-top: var(--s-16); }
.hero__actions { margin-top: var(--s-24); }
.hero__media img { border-radius: var(--r-lg); box-shadow: var(--shadow-md); width: 100%; }

/* 10. Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  min-height: var(--tap);
  padding: var(--s-8) var(--s-24);
  border: 2px solid transparent;
  border-radius: var(--r-pill);
  font-weight: var(--fw-bold);
  font-size: var(--fs-base);
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.btn--primary { background: var(--c-primary); color: var(--c-on-primary); }
.btn--primary:hover { background: var(--c-primary-dark); color: var(--c-on-primary); text-decoration: none; }
.btn--secondary { border-color: var(--c-primary); color: var(--c-primary); background: transparent; }
.btn--secondary:hover { background: var(--c-primary-soft); color: var(--c-primary); text-decoration: none; }
.btn--ghost { color: var(--c-text); background: var(--c-surface-2); }
.btn--ghost:hover { background: var(--c-border); color: var(--c-text); }
.btn--danger { background: var(--c-error); color: #FFFFFF; }
.btn--sm { min-height: 36px; padding: var(--s-4) var(--s-16); font-size: var(--fs-sm); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.link-arrow { font-weight: var(--fw-bold); text-decoration: none; }
.link-arrow::after { content: " \2192"; }
.link-arrow:hover { text-decoration: underline; }

/* 11. Chips, badges and tiles ----------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-12);
  border-radius: var(--r-pill);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text);
}
.chip--primary { background: var(--c-primary-soft); border-color: transparent; color: var(--c-primary); }
.badge { display: inline-block; padding: var(--s-4) var(--s-8); border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .04em; }
.badge--easy { background: var(--c-primary-soft); color: var(--c-success); }
.badge--medium { background: var(--c-warning-soft); color: var(--c-warning); }
.badge--hard { background: var(--c-error-soft); color: var(--c-error); }

.tiles { display: flex; gap: var(--s-4); }
.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(36px, 12vw, 48px);
  aspect-ratio: 1;
  line-height: 1;
  border: 2px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-xl);
  text-transform: uppercase;
  color: var(--c-text);
}
.tile--sm { width: 32px; font-size: var(--fs-base); }
.tile--green { background: var(--tile-green); border-color: var(--tile-green); color: var(--tile-text); }
.tile--yellow { background: var(--tile-yellow); border-color: var(--tile-yellow); color: var(--tile-text); }
.tile--gray { background: var(--tile-gray); border-color: var(--tile-gray); color: var(--tile-text); }
.tile--blank { color: transparent; }

/* 12. Hint reveal ----------------------------------------------------------- */
.hint-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s-24) var(--s-16);
}
.hint-panel__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-12); align-items: center; margin-bottom: var(--s-16); }
.hint-list { list-style: none; padding: 0; display: grid; gap: var(--s-12); counter-reset: hint; }
.hint {
  counter-increment: hint;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-bg);
  padding: var(--s-12) var(--s-16);
}
.hint__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-12); min-height: var(--tap); }
.hint__label { font-weight: var(--fw-bold); }
.hint__label::before { content: "Hint " counter(hint) ": "; color: var(--c-text-muted); font-weight: var(--fw-medium); }
.hint__body { margin-top: var(--s-8); padding-top: var(--s-8); border-top: 1px dashed var(--c-border); }
.hint.is-revealed, .hint:has(> details[open]) { border-color: var(--c-primary); background: var(--c-primary-soft); }
.hint.is-locked { opacity: .6; }
.hint summary, .answer-box summary { list-style: none; cursor: pointer; }
.hint summary::-webkit-details-marker, .answer-box summary::-webkit-details-marker { display: none; }
.hint.is-locked summary { cursor: not-allowed; }
.hint details[open] .hint__action { display: none; }

.answer-box {
  margin-top: var(--s-24);
  padding: var(--s-24) var(--s-16);
  border: 2px dashed var(--c-accent);
  border-radius: var(--r-md);
  text-align: center;
  display: grid;
  gap: var(--s-16);
  justify-items: center;
}
.answer-box > details { width: 100%; }
.answer-box__reveal { display: grid; gap: var(--s-16); justify-items: center; margin-top: var(--s-16); }
.answer-box__word { justify-content: center; }
.answer-details { max-width: var(--max-w-text); margin-inline: auto; text-align: left; }
.answer-box__note { font-size: var(--fs-sm); color: var(--c-text-muted); }

.puzzle-nav { display: flex; justify-content: space-between; gap: var(--s-12); margin-top: var(--s-24); }

/* 13. Cards and grids ------------------------------------------------------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: var(--s-24);
  transition: box-shadow var(--t-base), border-color var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--c-primary); }
.card__title { font-size: var(--fs-lg); }
.card__title a { color: var(--c-secondary); text-decoration: none; }
.card__title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }
.card__title a:focus-visible { outline: none; }
.card:focus-within { outline: var(--focus); outline-offset: 2px; }
.card__text { color: var(--c-text-muted); font-size: var(--fs-sm); }
.card__icon { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--c-primary-soft); color: var(--c-primary); display: grid; place-items: center; }
.card__icon svg { width: 22px; height: 22px; }
.card-grid { display: grid; gap: var(--s-16); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

.features { display: grid; gap: var(--s-24); }
.feature { display: grid; grid-template-columns: auto 1fr; gap: var(--s-12) var(--s-16); align-items: start; }
.feature h3 { font-size: var(--fs-base); }
.feature p { grid-column: 2; color: var(--c-text-muted); font-size: var(--fs-sm); }

/* 14. Content blocks -------------------------------------------------------- */
.prose { max-width: var(--max-w-text); }
.prose > * + * { margin-top: var(--s-16); }
.prose h2 { margin-top: var(--s-48); }
.prose h3 { margin-top: var(--s-32); }
.prose h2 + *, .prose h3 + * { margin-top: var(--s-12); }
.prose ul, .prose ol { padding-left: var(--s-24); }
.prose li + li { margin-top: var(--s-8); }
.prose li::marker { color: var(--c-primary); }
.prose img { border-radius: var(--r-md); }
.prose figure figcaption { margin-top: var(--s-8); font-size: var(--fs-sm); color: var(--c-text-muted); }
.prose blockquote { border-left: 4px solid var(--c-accent); padding: var(--s-8) var(--s-16); color: var(--c-text-muted); }
.lead { font-size: var(--fs-lg); color: var(--c-text-muted); }

.callout {
  border-radius: var(--r-md);
  padding: var(--s-16) var(--s-24);
  border-left: 4px solid var(--c-info);
  background: var(--c-info-soft);
}
.callout__title { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-base); color: var(--c-secondary); margin-bottom: var(--s-4); }
.callout--tip { border-left-color: var(--c-accent); background: var(--c-warning-soft); }
.callout--tip .callout__title::before { content: "\1F4A1  "; }
.callout--warning { border-left-color: var(--c-warning); background: var(--c-warning-soft); }
.callout--success { border-left-color: var(--c-success); background: var(--c-primary-soft); }
.callout--error { border-left-color: var(--c-error); background: var(--c-error-soft); }

.toc { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: var(--s-16) var(--s-24); }
.toc h2 { font-size: var(--fs-base); margin-bottom: var(--s-8); }
.toc ol { padding-left: var(--s-24); font-size: var(--fs-sm); }
.toc a { display: inline-block; padding-block: var(--s-4); }

.author-box {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: var(--s-16);
  align-items: start;
  padding: var(--s-24);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
}
.author-box img { width: 64px; height: 64px; border-radius: var(--r-pill); object-fit: cover; }
.author-box__name { font-family: var(--font-display); font-weight: var(--fw-bold); }
.author-box__role { font-size: var(--fs-sm); color: var(--c-text-muted); }
.author-box__bio { grid-column: 1 / -1; font-size: var(--fs-sm); }
.meta-line { font-size: var(--fs-sm); color: var(--c-text-muted); }

.cta {
  background: var(--c-primary);
  color: var(--c-on-primary);
  border-radius: var(--r-lg);
  padding: var(--s-32) var(--s-24);
  display: grid;
  gap: var(--s-16);
  text-align: center;
  justify-items: center;
}
.cta h2 { color: inherit; }
.cta p { max-width: 56ch; }
.cta .btn--primary { background: var(--c-surface); color: var(--c-primary); }
.cta .btn--primary:hover { background: var(--c-bg); color: var(--c-primary-dark); }
.cta .btn--secondary { border-color: currentColor; color: inherit; }
.cta .btn--secondary:hover { background: rgba(255, 255, 255, .12); color: inherit; }

/* 15. FAQ (details/summary accordion) --------------------------------------- */
.faq { display: grid; gap: var(--s-12); max-width: var(--max-w-text); }
.faq__item { border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); }
.faq__item > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-16);
  min-height: var(--tap);
  padding: var(--s-12) var(--s-16);
  cursor: pointer;
  font-weight: var(--fw-bold);
}
.faq__item > summary::-webkit-details-marker { display: none; }
.faq__item > summary h4, .faq__item > summary h3 { font-size: var(--fs-base); font-family: var(--font-body); }
.faq__item > summary::after { content: "+"; font-size: var(--fs-xl); line-height: 1; color: var(--c-primary); flex-shrink: 0; transition: transform var(--t-fast); }
.faq__item[open] > summary::after { transform: rotate(45deg); }
.faq__item[open] { border-color: var(--c-primary); }
.faq__answer { padding: 0 var(--s-16) var(--s-16); color: var(--c-text-muted); }

/* 16. Tables ---------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  max-height: 70vh;
}
.table-wrap:focus-visible { outline: var(--focus); }
.table { width: 100%; font-size: var(--fs-sm); }
.table caption { text-align: left; padding: var(--s-12) var(--s-16); font-weight: var(--fw-bold); color: var(--c-secondary); }
.table th, .table td { padding: var(--s-12) var(--s-16); text-align: left; border-bottom: 1px solid var(--c-border); white-space: nowrap; }
.table thead th { position: sticky; top: 0; z-index: 1; background: var(--c-surface-2); font-weight: var(--fw-bold); color: var(--c-secondary); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--c-bg); }
.table .num { font-variant-numeric: tabular-nums; }
.table--wrap td { white-space: normal; }
.table--wrap th[scope="row"] { width: 1%; }
.table .word { font-family: var(--font-mono); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .08em; }

/* 17. Forms and tabs -------------------------------------------------------- */
.field { display: grid; gap: var(--s-8); }
.field + .field { margin-top: var(--s-16); }
.label { font-weight: var(--fw-bold); font-size: var(--fs-sm); }
.help { font-size: var(--fs-xs); color: var(--c-text-muted); }
.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: var(--s-8) var(--s-12);
  border: 2px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--c-text-muted); opacity: .8; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-text-muted); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-accent); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--c-error); }
.field__error { font-size: var(--fs-sm); color: var(--c-error); }
.textarea { min-height: 144px; resize: vertical; }
.input--letters { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .2em; font-weight: var(--fw-bold); }

.check { display: inline-flex; align-items: center; gap: var(--s-12); min-height: var(--tap); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--c-primary); }

.switch { display: inline-flex; align-items: center; gap: var(--s-12); min-height: var(--tap); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; width: 44px; height: 24px; border-radius: var(--r-pill); background: var(--c-border); transition: background-color var(--t-fast); flex-shrink: 0; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #FFFFFF; box-shadow: var(--shadow-sm); transition: transform var(--t-fast); }
.switch input:checked + .switch__track { background: var(--c-primary); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { outline: var(--focus); outline-offset: 2px; }

.tabs__list { display: flex; gap: var(--s-4); overflow-x: auto; border-bottom: 2px solid var(--c-border); }
.tabs__tab {
  min-height: var(--tap);
  padding: var(--s-8) var(--s-16);
  font-weight: var(--fw-bold);
  color: var(--c-text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.tabs__tab:hover { color: var(--c-text); }
.tabs__tab[aria-selected="true"] { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tabs__panel { padding-top: var(--s-24); }

.search { position: relative; }
.search .input { padding-left: var(--s-48); }
.search__icon { position: absolute; left: var(--s-16); top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--c-text-muted); pointer-events: none; }

/* 18. Tools (solver, finder) ------------------------------------------------ */
.tool {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s-24) var(--s-16);
}
.tool__grid { display: grid; gap: var(--s-8); justify-content: center; }
.tool__row { display: flex; gap: var(--s-4); justify-content: center; }
.tool__row .tile { cursor: pointer; }
.tool__actions { margin-top: var(--s-24); justify-content: center; }
.results { margin-top: var(--s-24); }
.results__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-8); margin-bottom: var(--s-12); }
.results__count { font-size: var(--fs-sm); color: var(--c-text-muted); }
.word-list { list-style: none; padding: 0; display: grid; gap: var(--s-8); grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.word-list li {
  padding: var(--s-8);
  text-align: center;
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.word-list .is-answer { background: var(--c-primary-soft); color: var(--c-primary); }
.word-list .is-used { color: var(--c-text-muted); background: transparent; border: 1px dashed var(--c-border); }
.solver-rows { display: grid; gap: var(--s-12); }
.solver-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-8) var(--s-12); }
.solver-row .input { width: 9.5em; flex: 0 0 auto; }
.solver-row .tiles .tile { cursor: pointer; }
.solver-row .tiles .tile:disabled { cursor: default; }
.letter-row { justify-content: flex-start; }
.letter-box { width: var(--tap); height: var(--tap); padding: 0; text-align: center; font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--fs-lg); text-transform: uppercase; }
fieldset { border: 0; padding: 0; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-8) var(--s-16); font-size: var(--fs-sm); color: var(--c-text-muted); }
.legend .tile { margin-right: var(--s-4); vertical-align: middle; }
.word-list a { display: grid; gap: var(--s-4); color: inherit; text-decoration: none; }
.word-list a:hover { color: var(--c-primary); text-decoration: underline; }
.word-list__n { font-family: var(--font-body); font-size: var(--fs-xs); font-weight: var(--fw-regular); letter-spacing: 0; color: var(--c-text-muted); }

/* 19. Feedback: alerts, skeleton, spinner, toast ---------------------------- */
.alert { display: flex; gap: var(--s-12); align-items: flex-start; padding: var(--s-12) var(--s-16); border-radius: var(--r-md); border: 1px solid var(--c-border); background: var(--c-surface); }
.alert--spoiler { border-color: var(--c-accent); background: var(--c-warning-soft); }
.alert--info { border-color: var(--c-info); background: var(--c-info-soft); }
.alert--error { border-color: var(--c-error); background: var(--c-error-soft); }

.skeleton { display: block; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--c-surface-2) 25%, var(--c-border) 50%, var(--c-surface-2) 75%); background-size: 200% 100%; min-height: 16px; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--c-border); border-top-color: var(--c-primary); border-radius: 50%; }

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--s-24);
  z-index: 60;
  transform: translate(-50%, var(--s-96));
  padding: var(--s-12) var(--s-24);
  border-radius: var(--r-pill);
  background: var(--c-secondary);
  color: var(--c-bg);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* Ad slots reserve space so ads never shift layout (CLS) */
.ad-slot { display: grid; place-items: center; min-height: 280px; margin-block: var(--s-32); background: var(--c-surface-2); border-radius: var(--r-sm); }
.ad-slot::before { content: "Advertisement"; font-size: var(--fs-xs); color: var(--c-text-muted); }
.ad-slot--banner { min-height: 100px; }

/* 404 */
.error-page { text-align: center; padding-block: var(--s-64); display: grid; gap: var(--s-16); justify-items: center; }
.error-page .tiles { justify-content: center; }

/* 20. Utilities ------------------------------------------------------------- */
.pending { background: var(--c-warning-soft); color: var(--c-warning); padding: 0 var(--s-4); border-radius: var(--r-sm); font-weight: var(--fw-bold); }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.text-muted { color: var(--c-text-muted); }
.text-sm { font-size: var(--fs-sm); }
.mt-0 { margin-top: 0; }
.mt-16 { margin-top: var(--s-16); }
.mt-24 { margin-top: var(--s-24); }
.mt-32 { margin-top: var(--s-32); }
.mb-16 { margin-bottom: var(--s-16); }
.mb-24 { margin-bottom: var(--s-24); }
.w-full { width: 100%; }
.no-js-only { display: none; }
.no-js .no-js-only { display: block; }

/* 21. Responsive: tablet and up --------------------------------------------- */
@media (min-width: 768px) {
  :root { --header-h: 72px; }
  h1 { font-size: var(--fs-3xl); }
  h2 { font-size: var(--fs-2xl); }
  .hero__title { font-size: calc(var(--fs-3xl) + .5rem); }
  .container { padding-inline: var(--s-24); }
  .container--text { max-width: calc(var(--max-w-text) + 2 * var(--s-24)); }
  .section { padding-block: var(--s-64); }
  .hero { padding-block: var(--s-48) var(--s-64); }
  .hero__inner--media { grid-template-columns: 1.1fr .9fr; }
  .hint-panel, .tool { padding: var(--s-32); }
  .tile { width: 56px; font-size: var(--fs-2xl); }
  .tile--sm { width: 36px; font-size: var(--fs-lg); }
  .features { grid-template-columns: repeat(2, 1fr); }
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1.4fr repeat(4, 1fr); }
  .footer-brand { grid-column: auto; }
  .footer-bottom { grid-template-columns: 1fr auto; align-items: center; }
  .cta { padding: var(--s-48); }
  .ad-slot--banner { min-height: 90px; }
}

@media (min-width: 1024px) {
  .nav-toggle { display: none; }
  .site-nav {
    position: static;
    display: block;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  .site-nav__list { display: flex; align-items: center; gap: var(--s-4); }
  .site-nav__link { width: auto; padding: var(--s-8) var(--s-12); gap: var(--s-8); }
  .site-nav__item { position: relative; }
  .site-nav__sub {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 240px;
    padding: var(--s-8);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
  }
  .page-layout--aside { grid-template-columns: minmax(0, 1fr) 300px; }
  .page-layout__aside { position: sticky; top: calc(var(--header-h) + var(--s-24)); }
  .features { grid-template-columns: repeat(3, 1fr); }
}

/* 22. Motion and print ------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .card:hover { transform: translateY(-2px); }
  .card { transition: box-shadow var(--t-base), border-color var(--t-base), transform var(--t-base); }
  .hint__body, .answer-box__word { animation: fade-in var(--t-base); }
  .answer-box__word .tile { animation: flip 400ms ease both; }
  .answer-box__word .tile:nth-child(2) { animation-delay: 100ms; }
  .answer-box__word .tile:nth-child(3) { animation-delay: 200ms; }
  .answer-box__word .tile:nth-child(4) { animation-delay: 300ms; }
  .answer-box__word .tile:nth-child(5) { animation-delay: 400ms; }
  .skeleton { animation: shimmer 1.2s linear infinite; }
  .spinner { animation: spin .8s linear infinite; }
  .toast { transition: transform var(--t-base), opacity var(--t-base); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media print {
  .site-header, .site-footer, .ad-slot, .nav-toggle, .theme-toggle, .cta, .toast, .skip-link { display: none !important; }
  body { background: #FFFFFF; color: #000000; }
  a { color: #000000; text-decoration: underline; }
}
