/* W13 design tokens: primitive → semantic → component */
:root {
  --ink-950: oklch(0.19 0.035 255);
  --ink-900: oklch(0.24 0.04 255);
  --ink-800: oklch(0.31 0.04 255);
  --ink-700: oklch(0.41 0.035 255);
  --ink-600: oklch(0.49 0.03 255);
  --paper-50: oklch(0.975 0.008 210);
  --paper-100: oklch(0.95 0.012 210);
  --paper-200: oklch(0.90 0.015 210);
  --teal-500: oklch(0.73 0.14 180);
  --teal-700: oklch(0.52 0.11 180);
  --gold-500: oklch(0.79 0.13 82);
  --red-600: oklch(0.53 0.18 25);
  --bg: var(--paper-50);
  --surface: oklch(0.995 0.003 210);
  --text: var(--ink-950);
  --muted: var(--ink-700);
  --line: var(--paper-200);
  --accent: var(--teal-500);
  --accent-dark: var(--teal-700);
  --focus: var(--gold-500);
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;
  --shadow: 0 16px 44px oklch(0.19 0.035 255 / 0.08);
  --font-body: "Avenir Next", "Trebuchet MS", sans-serif;
  --font-display: "Trebuchet MS", "Avenir Next", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 280px; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.65; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.025em; }
h1 { max-width: 18ch; margin-bottom: 24px; font-size: clamp(2.25rem, 5vw, 4.6rem); }
h2 { margin-bottom: 16px; font-size: clamp(1.55rem, 2.8vw, 2.35rem); }
h3 { margin-bottom: 10px; font-size: 1.08rem; }
p { margin-bottom: 16px; }
button, .button, .header-action, .task-card, .quick-routes a, summary { transition: transform 180ms ease-out, background-color 180ms ease-out, border-color 180ms ease-out, color 180ms ease-out; }
button:hover, .button:hover, .header-action:hover, .task-card:hover, .quick-routes a:hover { transform: translateY(-2px); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

.shell { width: min(1200px, calc(100% - 48px)); margin-inline: auto; }
.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: fixed; top: 8px; left: 8px; z-index: 20; padding: 10px 16px; background: var(--surface); border-radius: var(--radius-s); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.eyebrow { margin-bottom: 12px; color: var(--accent-dark); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.14em; }
.text-link { display: inline-flex; align-items: center; min-height: 44px; gap: 8px; color: var(--accent-dark); font-weight: 800; }
.text-link:hover { color: var(--ink-950); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 22px; border: 1px solid transparent; border-radius: var(--radius-s); font-weight: 800; }
.button-primary { background: var(--accent); color: var(--ink-950); }
.button-primary:hover { background: oklch(0.79 0.15 180); }
.button-secondary { border-color: var(--ink-950); background: transparent; color: var(--ink-950); }
.button-secondary:hover { background: var(--ink-950); color: var(--surface); }
.button-dark { background: var(--ink-950); color: var(--surface); }
.button-dark:hover { background: var(--ink-800); }

.site-header { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: oklch(0.995 0.003 210 / 0.96); backdrop-filter: blur(16px); }
.header-inner { display: flex; align-items: center; min-height: 76px; gap: 28px; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 10px; font-family: var(--font-display); font-size: 1.05rem; font-weight: 900; letter-spacing: 0.04em; }
.brand svg { width: 32px; height: 32px; fill: none; stroke: var(--accent-dark); stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.brand small { display: block; margin-top: -4px; color: var(--muted); font-size: 0.58rem; letter-spacing: 0.24em; }
.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.main-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 0.92rem; font-weight: 700; }
.main-nav a:hover, .main-nav a.active { background: var(--paper-100); color: var(--text); }
.header-action { display: inline-flex; align-items: center; min-height: 44px; gap: 8px; padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--radius-s); font-weight: 800; }
.header-action svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.menu-toggle { display: none; width: 44px; height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
.menu-toggle span { display: block; height: 2px; margin: 5px 0; background: var(--text); }
.breadcrumbs { display: flex; width: min(1200px, calc(100% - 48px)); margin: 20px auto 0; gap: 10px; color: var(--muted); font-size: 0.85rem; }
.breadcrumbs a { color: var(--accent-dark); }

.hero-shell { position: relative; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr); width: min(1200px, calc(100% - 48px)); margin: 32px auto 0; padding: clamp(28px, 5vw, 64px); overflow: hidden; border-radius: var(--radius-l); background: var(--ink-950); color: var(--paper-50); box-shadow: var(--shadow); }
.hero-shell::after { content: ""; position: absolute; right: -90px; bottom: -110px; width: 320px; height: 320px; border: 1px solid oklch(0.73 0.14 180 / 0.28); border-radius: 50%; box-shadow: 0 0 0 48px oklch(0.73 0.14 180 / 0.04), 0 0 0 96px oklch(0.73 0.14 180 / 0.03); pointer-events: none; }
.hero-copy { position: relative; z-index: 1; padding-right: clamp(0px, 4vw, 48px); }
.hero-shell .eyebrow, .page-hero .eyebrow { color: var(--accent); }
.hero-lead { max-width: 65ch; color: var(--paper-100); font-size: clamp(1rem, 1.4vw, 1.16rem); }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin: 28px 0 20px; }
.hero-shell .text-link, .page-hero .text-link { color: var(--accent); }
.hero-note { max-width: 65ch; margin: 24px 0 0; color: var(--paper-200); font-size: 0.85rem; }
.hero-panel { position: relative; z-index: 1; align-self: center; padding: 28px; border: 1px solid oklch(0.95 0.012 210 / 0.18); border-radius: var(--radius-m); background: var(--ink-900); }
.panel-label { margin-bottom: 8px; color: var(--accent); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em; }
.hero-panel h2 { font-size: 1.45rem; }
.search-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 24px; }
.search-form input { min-width: 0; }
.hero-panel .button-dark { background: var(--accent); color: var(--ink-950); }
.quick-routes { display: grid; gap: 4px; }
.quick-routes a { display: grid; padding: 12px 0; border-top: 1px solid oklch(0.95 0.012 210 / 0.14); }
.quick-routes span { font-weight: 800; }
.quick-routes small { color: var(--paper-200); }
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); width: min(1120px, calc(100% - 72px)); margin: 0 auto; padding: 28px 0; border-bottom: 1px solid var(--line); }
.metric-strip div { display: grid; gap: 2px; padding: 0 24px; border-right: 1px solid var(--line); }
.metric-strip div:last-child { border: 0; }
.metric-strip strong { font-family: var(--font-display); font-size: 1.8rem; }
.metric-strip span { color: var(--muted); font-size: 0.82rem; }
.section-block { width: min(1200px, calc(100% - 48px)); margin: 72px auto; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section-intro { max-width: 70ch; color: var(--muted); }
.split-feature { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 6vw, 80px); align-items: center; padding: 40px 0; border-block: 1px solid var(--line); }
.plain-example { padding: 28px; border-left: 2px solid var(--accent-dark); }
.plain-example span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.82rem; }
.plain-example strong { display: block; margin-bottom: 12px; font-family: var(--font-display); font-size: 1.5rem; }
.plain-example p { margin: 0; color: var(--muted); }
.task-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.task-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.task-card { display: flex; flex-direction: column; min-height: 190px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.task-card p { color: var(--muted); }
.task-card span { margin-top: auto; color: var(--accent-dark); font-weight: 800; }
.task-card:hover { border-color: var(--accent-dark); box-shadow: var(--shadow); }
.notice-block { width: min(1200px, calc(100% - 48px)); margin: 72px auto; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper-100); }
.notice-block p { max-width: 75ch; }
.page-hero { width: min(1200px, calc(100% - 48px)); margin: 40px auto 56px; padding: clamp(28px, 5vw, 56px); border-radius: var(--radius-l); background: var(--ink-950); color: var(--paper-50); }
.page-hero h1 { max-width: 20ch; font-size: clamp(2.1rem, 4.5vw, 3.8rem); }
.page-hero .button { margin-top: 12px; }

.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.game-card { display: flex; min-width: 0; min-height: 250px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.game-mark { display: grid; place-items: center; flex: 0 0 54px; background: var(--ink-900); color: var(--accent); font-family: var(--font-display); font-size: 1.4rem; font-weight: 900; }
.game-info { min-width: 0; padding: 20px; }
.game-info h3 { overflow-wrap: anywhere; }
.game-info p { color: var(--muted); font-size: 0.9rem; }
.game-provider { margin-bottom: 6px; color: var(--accent-dark) !important; font-size: 0.75rem !important; font-weight: 900; letter-spacing: 0.08em; }
.inline-details { margin-top: 12px; }
summary { min-height: 44px; color: var(--accent-dark); font-weight: 800; cursor: pointer; }
.inline-details p { padding-top: 8px; }
.catalog-section, .calculator-section, .diagnostic-section { width: min(1200px, calc(100% - 48px)); margin: 40px auto 72px; }
.catalog-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 0.4fr) auto; gap: 16px; align-items: end; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.catalog-tools label, .diagnostic-picker label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 800; }
input, select { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--text); }
input:focus, select:focus { border-color: var(--accent-dark); }
.catalog-status { margin: 20px 0; color: var(--muted); font-weight: 700; }
.empty-state { padding: 40px; border: 1px dashed var(--accent-dark); border-radius: var(--radius-m); text-align: center; }
.editorial-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 48px; }
.editorial-columns p { color: var(--muted); }
.step-list { display: grid; gap: 0; padding: 0; list-style: none; counter-reset: steps; }
.step-list li { position: relative; padding: 24px 24px 24px 72px; border-top: 1px solid var(--line); counter-increment: steps; }
.step-list li::before { content: counter(steps, decimal-leading-zero); position: absolute; left: 12px; top: 24px; color: var(--accent-dark); font-family: var(--font-display); font-weight: 900; }
.step-list p { margin: 8px 0 0; color: var(--muted); }
.checklist { display: grid; gap: 12px; }
.checklist label { display: flex; align-items: flex-start; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); cursor: pointer; }
.checklist input { flex: 0 0 24px; width: 24px; min-height: 24px; margin-top: 2px; accent-color: var(--accent-dark); }
.checklist span { display: grid; gap: 4px; }
.checklist small { color: var(--muted); }
.checklist-status { margin-top: 20px; font-family: var(--font-display); font-size: 1.25rem; font-weight: 900; }
.calculator-section { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr); gap: 32px; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.calculator-form { align-self: start; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.field-grid label { font-size: 0.85rem; font-weight: 800; }
.field-grid input, .field-grid select { margin-top: 6px; }
.calculation-result { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-top: 28px; border-top: 1px solid var(--line); }
.calculation-result div { display: grid; gap: 4px; }
.calculation-result span { color: var(--muted); font-size: 0.85rem; }
.calculation-result strong { font-family: var(--font-display); font-size: 1.45rem; }
.calculation-result .result-main { color: var(--accent-dark); }
.form-error { padding: 12px; border-radius: var(--radius-s); background: oklch(0.95 0.04 25); color: var(--red-600); font-weight: 700; }
.diagnostic-picker { max-width: 620px; margin-bottom: 24px; }
.diagnostic-answer { padding: 32px; border-radius: var(--radius-l); background: var(--ink-950); color: var(--paper-50); }
.diagnostic-answer h2 { color: var(--accent); }
.diagnostic-answer ol { padding-left: 22px; }
.diagnostic-answer li { margin-bottom: 12px; }
.diagnostic-answer p:last-child { margin-bottom: 0; color: var(--paper-200); }
.source-list { display: grid; gap: 0; }
.source-list > div { padding: 24px 0; border-top: 1px solid var(--line); }
.source-list p { max-width: 75ch; margin: 8px 0 0; color: var(--muted); }

.site-footer { margin-top: 80px; padding-top: 48px; border-top: 1px solid var(--line); background: var(--paper-100); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 0.65fr 0.65fr 1fr; gap: 40px; }
.footer-grid p { max-width: 42ch; color: var(--muted); font-size: 0.88rem; }
.footer-grid nav { display: grid; align-content: start; gap: 8px; }
.footer-grid nav strong { margin-bottom: 4px; }
.footer-grid nav a { display: inline-flex; min-height: 32px; color: var(--muted); }
.footer-grid nav a:hover { color: var(--accent-dark); }
.footer-brand { margin-bottom: 16px; }
.responsible strong { display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 12px; border: 1px solid var(--ink-950); border-radius: 50%; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; margin-top: 40px; padding: 20px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; }
.footer-bottom a { display: inline-flex; min-height: 32px; color: var(--accent-dark); font-weight: 800; }

@media (max-width: 1024px) {
  .header-inner { gap: 16px; }
  .main-nav a { padding-inline: 8px; font-size: 0.86rem; }
  .hero-shell { grid-template-columns: 1fr; gap: 32px; }
  .hero-copy { padding-right: 0; }
  .hero-panel { max-width: 620px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1.4fr 0.6fr 0.6fr; }
  .responsible { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .shell, .hero-shell, .section-block, .notice-block, .page-hero, .catalog-section, .calculator-section, .diagnostic-section, .breadcrumbs { width: min(100% - 32px, 1200px); }
  .header-inner { min-height: 68px; }
  .menu-toggle { display: block; margin-left: auto; }
  .main-nav { position: absolute; top: 68px; left: 16px; right: 16px; display: none; flex-direction: column; align-items: stretch; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); box-shadow: var(--shadow); }
  .site-header[data-open="true"] .main-nav { display: flex; }
  .main-nav a { min-height: 48px; padding: 12px; }
  .header-action { margin-left: 0; }
  .hero-shell { margin-top: 16px; padding: 28px 24px; }
  .hero-panel { padding: 20px; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); width: calc(100% - 48px); }
  .metric-strip div { padding: 16px; border-bottom: 1px solid var(--line); }
  .metric-strip div:nth-child(2) { border-right: 0; }
  .metric-strip div:nth-child(3), .metric-strip div:nth-child(4) { border-bottom: 0; }
  .section-block { margin-block: 56px; }
  .section-heading { align-items: start; flex-direction: column; }
  .split-feature { grid-template-columns: 1fr; gap: 20px; }
  .task-grid, .task-grid.two-col { grid-template-columns: 1fr; }
  .task-card { min-height: 0; }
  .catalog-tools { grid-template-columns: 1fr; }
  .calculator-section { grid-template-columns: 1fr; padding: 24px; }
  .calculation-result { grid-template-columns: 1fr; }
  .editorial-columns { grid-template-columns: 1fr; gap: 20px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .responsible { grid-column: auto; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .brand { font-size: 0.92rem; }
  .brand svg { width: 28px; height: 28px; }
  .header-action { padding-inline: 10px; }
  h1 { font-size: 2.35rem; }
  .page-hero h1 { font-size: 2.15rem; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .search-form { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: 1fr; }
  .game-card { min-height: 0; }
  .field-grid { grid-template-columns: 1fr; }
  .step-list li { padding-left: 52px; }
  .step-list li::before { left: 4px; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-grid > div:first-child, .responsible { grid-column: auto; }
  .footer-bottom { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
