/* The Dice Roller — shared stylesheet (tokens from handoff/DESIGN-SYSTEM.md). */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/inter-5f85b91279.woff2") format("woff2");
}

:root {
  --canvas: #fafafc;
  --surface: #ffffff;
  --ink: #20202a;
  --muted: #64636f;
  --primary: #6551c9;
  --primary-hover: #5542b4;
  --primary-pressed: #443296;
  --border: #e0dfe9;
  --tint: #f0edfc;
  --error-ink: #a52828;
  --error-bg: #fff0f0;
  --success-ink: #166448;
  --success-bg: #e9f6ef;
  --disabled-bg: #e0dfe9;
  --accent: #6551c9;
  --accent-tint: #f0edfc;
  --gutter: 20px;
  --max: 1200px;
  --header-h: 90px;
  --radius-card: 16px;
  --radius-btn: 10px;
  --radius-input: 8px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.menu-open { overflow: hidden; }

img, svg { display: block; max-width: 100%; }

a { color: var(--primary); text-decoration: none; }
a:hover, a:focus, a:active { text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #fff;
}

[hidden] { display: none !important; }

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

.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-btn);
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

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

/* ---------- Header ---------- */
.site-header { position: relative; z-index: 30; }
.header-bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 18px;
  line-height: 27px;
  min-height: 44px;
  border-radius: var(--radius-btn);
}
.brand img { width: 34px; height: 34px; }
.brand:hover { color: var(--primary); }

.main-nav { display: none; }
.nav-list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-item { position: relative; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 22.5px;
  cursor: pointer;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.nav-link:hover { background: var(--tint); color: var(--primary-pressed); }
.nav-link.is-current {
  background: var(--tint);
  color: var(--primary-pressed);
  font-weight: 700;
}
.nav-link .chev {
  width: 16px; height: 16px;
  transition: transform .2s var(--ease);
}
.nav-link[aria-expanded="true"] { background: var(--ink); color: #fff; }
.nav-link[aria-expanded="true"] .chev { transform: rotate(180deg); filter: invert(1); }

.nav-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 24px 48px -24px rgba(32, 32, 42, .28), 0 2px 6px rgba(32, 32, 42, .05);
  animation: panel-in .18s var(--ease);
}
.nav-panel.align-left { left: 0; right: auto; width: 420px; }
.nav-panel.align-left::before { left: 40px; right: auto; }
.nav-panel::before {
  content: "";
  position: absolute;
  top: -7px; right: 40px;
  width: 12px; height: 12px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.nav-panel-title {
  margin: 0 0 12px;
  font-size: 11px;
  line-height: 16.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}
.size-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.size-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 76px;
  padding: 12px;
  border-radius: 12px;
  background: var(--tint);
  color: var(--ink);
  transition: background-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.size-tile strong { font-size: 22px; line-height: 28px; font-weight: 700; color: var(--primary); }
.size-tile span { font-size: 12px; line-height: 18px; color: var(--muted); }
.size-tile:hover, .size-tile[aria-current="page"] { background: var(--primary); color: #fff; }
.size-tile:hover strong, .size-tile:hover span,
.size-tile[aria-current="page"] strong, .size-tile[aria-current="page"] span { color: #fff; }
.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  min-height: 44px;
  border-radius: 12px;
  color: var(--ink);
  font-size: 15px;
  border: 1px dashed var(--border);
}
.panel-foot img { width: 20px; height: 20px; transition: transform .18s var(--ease); }
.panel-foot:hover { border-color: var(--primary); color: var(--primary-pressed); }
.panel-foot:hover img { transform: translateX(3px); }

.tool-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tool-link {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 12px;
  color: var(--ink);
  transition: background-color .18s var(--ease);
}
.tool-link:hover, .tool-link[aria-current="page"] { background: var(--tint); }
.tool-icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}
.tool-icon svg { width: 22px; height: 22px; }
.tool-link strong { display: block; font-size: 15px; line-height: 22px; }
.tool-link span span, .tool-link .tool-desc { display: block; font-size: 13px; line-height: 19.5px; color: var(--muted); }

.menu-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.menu-toggle:hover { background: var(--tint); }
.menu-toggle img { width: 24px; height: 24px; }

/* Mobile menu sheet */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  background: rgba(32, 32, 42, .45);
}
.mobile-sheet {
  width: 100%;
  max-width: 420px;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  padding: 20px var(--gutter) 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: sheet-in .22s var(--ease);
}
.sheet-top { display: flex; align-items: center; justify-content: space-between; min-height: 50px; }
.menu-close {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.menu-close img { width: 24px; height: 24px; }
.sheet-home {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-radius: var(--radius-card);
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  line-height: 30px;
}
.sheet-home small { display: block; font-size: 13px; line-height: 18px; opacity: .85; }
.sheet-home img { width: 24px; height: 24px; filter: invert(1); }
.sheet-home[aria-current="page"] { background: var(--primary-pressed); }
.mobile-sheet nav { display: flex; flex-direction: column; gap: 16px; }
.sheet-label {
  margin: 8px 0 -8px;
  font-size: 11px;
  line-height: 16.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}
.sheet-sizes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet-sizes a {
  display: grid;
  place-items: center;
  min-height: 56px;
  border-radius: 12px;
  background: var(--tint);
  color: var(--primary-pressed);
  font-size: 20px;
  font-weight: 700;
}
.sheet-sizes a[aria-current="page"] { background: var(--primary); color: #fff; }
.sheet-links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.sheet-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  font-size: 22px;
  line-height: 30px;
}
.sheet-links a small { display: block; font-size: 13px; line-height: 18px; color: var(--muted); }
.sheet-links a img { width: 20px; height: 20px; opacity: .55; }
.sheet-links a[aria-current="page"] { color: var(--primary-pressed); font-weight: 700; }
.sheet-foot { display: flex; gap: 20px; margin-top: auto; font-size: 15px; }
.sheet-foot a { color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }

@keyframes panel-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- Page intro ---------- */
main { display: block; }
.page-head { padding-top: 24px; }
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  font-size: 13px;
  line-height: 19.5px;
  color: var(--muted);
}
.breadcrumb li + li::before { content: "/"; margin-right: 4px; color: var(--muted); }
.breadcrumb a { color: var(--muted); display: inline-block; padding: 12px 0; margin: -12px 0; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb [aria-current="page"] { color: var(--ink); }
.eyebrow {
  margin: 0;
  font-size: 11px;
  line-height: 16.5px;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--primary);
}
.page-head .eyebrow { margin-top: 12px; }
.home .page-head { padding-top: 32px; }
.home .page-head .eyebrow { margin-top: 0; }
h1 {
  margin: 12px 0 16px;
  font-size: 38px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.intro {
  margin: 0 0 24px;
  max-width: 900px;
  font-size: 17px;
  line-height: 25.5px;
  color: var(--muted);
}

/* ---------- Cards and buttons ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  font-size: 15px;
  line-height: 22.5px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-primary:active { background: var(--primary-pressed); transform: scale(.99); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); min-height: 44px; }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary-pressed); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--disabled-bg);
  color: var(--muted);
  border-color: var(--disabled-bg);
  cursor: not-allowed;
  transform: none;
}
.btn-block { width: 100%; }
.btn .arrow { width: 20px; height: 20px; filter: invert(1); transition: transform .18s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.cta { margin: 8px 0 0; min-width: 280px; }

/* ---------- Tool card ---------- */
.tool { padding: 22px 24px 24px; margin-bottom: 40px; }
.tool .eyebrow { margin-bottom: 12px; }
.presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.presets.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.presets.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.preset {
  display: flex;
  align-items: center;
  min-height: 44px;
  width: 100%;
  padding: 0 8px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border);
  background: var(--tint);
  color: var(--ink);
  font-size: 13px;
  line-height: 19.5px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.preset:hover { border-color: var(--primary); }
.preset.is-active, .preset[aria-pressed="true"], .preset[aria-current="page"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.preset-check { margin-left: auto; font-size: 12px; }

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
}
.tool-visual { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.preview {
  display: grid;
  place-items: center;
  width: 110px; height: 110px;
  border-radius: 16px;
  color: var(--accent);
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.preview.is-number { background: var(--accent-tint); border: 1px solid var(--border); }
.preview.is-letter { font-size: 80px; font-weight: 400; }
.preview svg { width: 110px; height: 110px; }
.preview-caption { margin: 0; font-size: 12px; line-height: 18px; color: var(--muted); }
.preview.is-rolling { animation: wobble .25s var(--ease); }
@keyframes wobble {
  0% { transform: rotate(0) scale(1); }
  35% { transform: rotate(-9deg) scale(.96); }
  70% { transform: rotate(7deg) scale(1.03); }
  100% { transform: rotate(0) scale(1); }
}

.face-bg { fill: #fff; stroke: #dadce0; stroke-width: 2; }
.pip { fill: var(--accent); }

.tool-title {
  margin: 0;
  font-size: 26px;
  line-height: 39px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.tool-summary { margin: 16px 0 20px; font-size: 13px; line-height: 19.5px; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fields.one { grid-template-columns: minmax(0, 1fr); }
.field { min-width: 0; }
.field.span-2 { grid-column: 1 / -1; }
.field label, .field .label, fieldset legend {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 19.5px;
  color: var(--ink);
}
.input, select.input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--surface);
  font-size: 16px;
  line-height: 22.5px;
  font-variant-numeric: tabular-nums;
}
select.input { appearance: none; background-image: url("/assets/icons/chevron.svg"); background-repeat: no-repeat; background-position: right 10px center; background-size: 20px; padding-right: 36px; }
.input:hover { border-color: #c9c6da; }
.input:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; box-shadow: none; border-color: var(--primary); }
.input[readonly], .input:disabled { background: var(--canvas); color: var(--muted); }
.input:disabled { cursor: not-allowed; }
.input[aria-invalid="true"] { border-color: var(--error-ink); background: var(--error-bg); }
.field-help { margin: 6px 0 0; font-size: 12px; line-height: 18px; color: var(--muted); }
.field-error {
  margin: 6px 0 0;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--error-bg);
  color: var(--error-ink);
  font-size: 13px;
  line-height: 19.5px;
}
.field-error::before { content: "Error: "; font-weight: 700; }
.tool-form .btn-block { margin-top: 20px; }
.tool-status { margin: 16px 0 0; font-size: 13px; line-height: 19.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tool-status.is-error {
  padding: 8px 12px;
  border-radius: var(--radius-input);
  background: var(--error-bg);
  color: var(--error-ink);
}
.tool-status.is-success {
  padding: 8px 12px;
  border-radius: var(--radius-input);
  background: var(--success-bg);
  color: var(--success-ink);
}
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.button-row .btn { flex: 1 1 160px; }

/* Results */
.results { margin-top: 20px; }
.results h3, .history h3, .settings h3 { margin: 0 0 12px; font-size: 15px; line-height: 22.5px; font-weight: 700; }
.dice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.die {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 12px;
  background: var(--accent-tint);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.die.is-face { background: transparent; border: 0; }
.die.is-face svg { width: 56px; height: 56px; }
.die-label { position: absolute; bottom: 5px; font-size: 10px; line-height: 1; color: var(--muted); }
.die.has-label { padding-bottom: 8px; }
.die.is-dropped { opacity: .45; border-style: dashed; }
.die.is-dropped::after {
  content: "";
  position: absolute;
  left: 8px; right: 8px; top: 50%;
  height: 2px;
  background: var(--ink);
  transform: rotate(-20deg);
}
.die.is-kept { outline: 3px solid var(--accent); outline-offset: 2px; }
.die-tag { display: block; margin-top: 6px; font-size: 12px; line-height: 18px; color: var(--muted); text-align: center; }
.die-wrap { display: flex; flex-direction: column; align-items: center; }
.result-letter {
  display: grid;
  place-items: center;
  width: 96px; height: 96px;
  border-radius: 16px;
  background: var(--accent-tint);
  border: 1px solid var(--border);
  color: var(--accent);
  margin: 0;
  font-size: 56px;
}
.stat-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; list-style: none; margin: 0; padding: 0; }
.stat-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--canvas);
}
.stat-group h4 { margin: 0; font-size: 13px; line-height: 19.5px; font-weight: 700; }
.stat-group .dice { grid-column: 1 / -1; grid-row: 2; }
.stat-group .dice .die { width: 44px; height: 44px; font-size: 18px; }
.stat-score { margin: 0; grid-column: 2; grid-row: 1; font-size: 22px; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.stat-score small { display: block; font-size: 11px; color: var(--muted); text-align: right; }

/* History */
.history { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 21px;
  font-variant-numeric: tabular-nums;
  max-height: 320px;
  overflow-y: auto;
}
.history-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); overflow-wrap: anywhere; }
.history-list li:first-child { font-weight: 700; }
.history-empty { margin: 0; font-size: 14px; color: var(--muted); }
.history-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.copy-fallback { margin-top: 12px; }
.copy-fallback textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 14px;
}

/* Disclosure + settings */
.disclosure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 13px;
  line-height: 19.5px;
  cursor: pointer;
}
.disclosure img { width: 18px; height: 18px; transition: transform .2s var(--ease); }
.disclosure[aria-expanded="true"] img { transform: rotate(180deg); }
.disclosure:hover { color: var(--primary-pressed); }
.settings { margin-top: 8px; padding: 20px; border-radius: 12px; background: var(--canvas); border: 1px solid var(--border); }
fieldset { margin: 16px 0 0; padding: 0; border: 0; min-width: 0; }
.swatches { display: grid; gap: 8px; }
.swatch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  cursor: pointer;
}
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch-dot { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.swatch-dot.violet { background: #6551c9; }
.swatch-dot.teal { background: #12695d; }
.swatch-dot.blue { background: #1967d2; }
.swatch-state { margin-left: auto; font-size: 13px; color: var(--muted); }
.swatch:has(input:checked) { border: 2px solid var(--ink); }
.swatch:has(input:checked) .swatch-state { color: var(--ink); font-weight: 700; }
.swatch:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 3px; }
.settings [data-apply] { margin-top: 16px; }
.settings-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

.accent-teal { --accent: #12695d; --accent-tint: #e6f3f1; }
.accent-blue { --accent: #1967d2; --accent-tint: #e8f0fc; }

.progress-wrap { margin-top: 16px; }
.progress-wrap p { margin: 0 0 8px; font-size: 14px; line-height: 21px; font-variant-numeric: tabular-nums; }
progress {
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: var(--tint);
  overflow: hidden;
  appearance: none;
}
progress::-webkit-progress-bar { background: var(--tint); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.noscript-note { margin: 16px 0 0; padding: 12px; border-radius: var(--radius-input); background: var(--error-bg); color: var(--error-ink); font-size: 14px; }

/* ---------- Editorial banner ---------- */
.banner {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 180px;
  margin: 0 0 40px;
  padding: 40px 24px 24px;
  border-radius: var(--radius-card);
  background: var(--tint);
  border: 1px solid var(--border);
  overflow: hidden;
}
.banner p {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  text-transform: uppercase;
  color: var(--primary);
  max-width: 60%;
}
.banner img {
  position: absolute;
  top: 10px; right: 10px;
  width: 150px; height: 150px;
  object-fit: contain;
}

/* ---------- Prose ---------- */
.prose { max-width: 880px; }
.prose h2 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 36px;
  font-weight: 400;
}
.prose section { margin-bottom: 32px; }
.prose p, .prose li { font-size: 16px; line-height: 24px; color: var(--muted); }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; }
.prose a { color: var(--primary-pressed); font-weight: 600; }
.prose a:hover { color: var(--primary); }
.prose strong { color: var(--ink); font-weight: 600; }
.updated { font-size: 13px !important; }

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 4px 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.table-wrap:focus-visible { outline-offset: 2px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 22px; font-variant-numeric: tabular-nums; }
caption { text-align: left; padding: 12px 16px 0; font-size: 13px; color: var(--muted); }
th, td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-weight: 700; color: var(--ink); font-size: 13px; }
td { color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }

.prose .faq { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--tint); }
.faq-item h3 { margin: 0; font-size: 17px; line-height: 25.5px; font-weight: 400; }
.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  border: 0;
  background: none;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--radius-card);
}
.faq-q img { width: 20px; height: 20px; flex: none; transition: transform .2s var(--ease); }
.faq-q[aria-expanded="true"] img { transform: rotate(180deg); }
.faq-q span.static { display: block; }
.faq-a { padding: 0 20px 16px; }
.faq-a p { margin: 0; }
.faq-static { padding: 14px 20px 0; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 56px; }
.footer-inner { border-top: 1px solid var(--border); padding: 28px 0 35px; }
.footer-name { margin: 0; font-size: 24px; line-height: 36px; }
.footer-tag { margin: 8px 0 20px; font-size: 16px; line-height: 24px; color: var(--muted); }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { display: flex; flex-wrap: wrap; align-items: center; font-size: 15px; line-height: 22.5px; color: var(--muted); }
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  transition: color .15s var(--ease);
}
.footer-links a:hover { color: var(--primary); }
.footer-links .sep { padding: 0 6px; }
.footer-links .label { margin-right: 6px; color: var(--ink); }
.footer-fine { margin: 20px 0 0; font-size: 13px; line-height: 19.5px; color: var(--muted); }


/* ---------- Prose extras ---------- */
.prose h3 { margin: 20px 0 8px; font-size: 19px; line-height: 28.5px; font-weight: 600; color: var(--ink); }
.prose li + li { margin-top: 6px; }
.owner-note {
  padding: 12px 16px;
  border-radius: var(--radius-input);
  border: 1px dashed var(--error-ink);
  background: var(--error-bg);
  color: var(--error-ink) !important;
}
.owner-note strong { color: var(--error-ink); }

.tool-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  list-style: none;
  margin: 8px 0 12px !important;
  padding: 0 !important;
}
.tool-cards li + li { margin-top: 0; }
.tool-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  gap: 2px 12px;
  align-items: center;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--ink);
  font-weight: 400 !important;
  transition: border-color .18s var(--ease), background-color .18s var(--ease);
}
.tool-card strong { grid-column: 1; font-size: 16px; line-height: 24px; font-weight: 600; color: var(--ink); }
.tool-card span { grid-column: 1; font-size: 14px; line-height: 21px; color: var(--muted); }
.tool-card img { grid-column: 2; grid-row: 1 / span 2; transition: transform .18s var(--ease); }
.tool-card:hover { border-color: var(--primary); background: var(--tint); }
.tool-card:hover img { transform: translateX(3px); }
@media (min-width: 768px) { .tool-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Footer button, back to top ---------- */
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}
.link-button:hover { color: var(--primary); }

.to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 10px 24px -10px rgba(32, 32, 42, .5);
  cursor: pointer;
  animation: panel-in .2s var(--ease);
  transition: background-color .18s var(--ease), transform .18s var(--ease);
}
.to-top img { transform: rotate(-90deg); filter: invert(1); }
.to-top:hover { background: var(--primary-hover); transform: translateY(-2px); }
.consent-pending .to-top { display: none; }

/* ---------- Cookie consent ---------- */
.consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 45;
  padding: 12px var(--gutter) 16px;
  pointer-events: none;
}
.consent-inner {
  pointer-events: auto;
  display: grid;
  gap: 12px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 20px 48px -20px rgba(32, 32, 42, .45);
  animation: panel-in .2s var(--ease);
}
.consent-text p { margin: 0; font-size: 14px; line-height: 21px; color: var(--muted); }
.consent-text a { color: var(--primary-pressed); font-weight: 600; }
.consent-text .consent-title { margin-bottom: 4px; font-size: 16px; line-height: 24px; color: var(--ink); font-weight: 700; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.consent-actions .btn { flex: 1 1 140px; justify-content: center; min-height: 44px; }
.consent-pending { padding-bottom: 300px; }
.consent-pending { scroll-padding-bottom: 300px; }
@media (min-width: 768px) {
  .consent-inner { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; }
  .consent-actions .btn { flex: 0 0 auto; }
  .consent-pending { padding-bottom: 140px; scroll-padding-bottom: 140px; }
}

.consent-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(32, 32, 42, .5);
}
.consent-dialog::backdrop { background: rgba(32, 32, 42, .5); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 24px; line-height: 36px; font-weight: 400; }
.dialog-intro { margin: 8px 0 16px; font-size: 14px; line-height: 21px; color: var(--muted); }
.consent-options { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.consent-option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.consent-option input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); }
.consent-option strong { display: block; font-size: 15px; line-height: 22.5px; }
.consent-option span span { display: block; font-size: 13px; line-height: 19.5px; color: var(--muted); }
.consent-option.is-unused { background: var(--canvas); cursor: default; }
.consent-option:has(input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.dialog-status { min-height: 21px; margin: 0 0 12px; font-size: 14px; color: var(--success-ink); }

/* ---------- Responsive ---------- */
@media (max-width: 359px) {
  :root { --gutter: 16px; }
  .tool { padding: 20px 16px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .presets.cols-4.dnd { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 560px) {
  .presets { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .presets.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .presets.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .preset { font-size: 15px; padding: 0 6px; }
}

@media (min-width: 768px) {
  :root { --gutter: 32px; }
  .menu-toggle, .mobile-menu { display: none !important; }
  .main-nav { display: block; }
  h1 { font-size: 46px; }
  .intro { font-size: 19px; line-height: 28.5px; }
  .tool-grid { grid-template-columns: 200px minmax(0, 1fr); }
  .tool-visual { align-items: center; padding-top: 4px; }
  .prose h2 { font-size: 27px; line-height: 40.5px; }
  .prose p, .prose li { font-size: 17px; line-height: 25.5px; }
  .banner { padding: 40px 24px; }
  .banner p { font-size: 24px; line-height: 36px; }
  .stat-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .tool-grid { grid-template-columns: 412px minmax(0, 560px); }
  .tool-visual { align-items: flex-start; padding-left: 114px; }
  .nav-list { gap: 32px; }
}

@media (min-width: 1440px) {
  :root { --gutter: 120px; }
}
@media (min-width: 1200px) {
  h1 { font-size: 58px; line-height: 87px; }
  .intro { font-size: 20px; line-height: 30px; }
  .prose h2 { font-size: 29px; line-height: 43.5px; }
  .prose p, .prose li { font-size: 18px; line-height: 27px; }
  .tool-title { font-size: 34px; line-height: 51px; margin-top: 20px; }
  .tool-summary { margin: 32px 0 24px; }
  .banner p { font-size: 28px; line-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header, .site-footer, .tool { display: none; }
}

.tool-form > [data-mode-help] { margin: 0 0 16px; font-size: 13px; line-height: 19.5px; }
