/* ==========================================================
   tickerswimbly.garden — "Lucky Draw" cartoon stylesheet
   Sections: tokens · reset · base · layout · navigation ·
   opener · records · tables · tools · articles · legal ·
   footer · cookie notice · motion · responsive
   ========================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #FFF4D6;
  --panel: #FFFFFF;
  --ink: #241A4D;
  --accent: #5B2FD6;
  --accent-2: #FF6B3D;
  --border: #E9DDBF;

  /* derived shades and tints */
  --accent-dark: #3F1DA8;
  --accent-2-dark: #B8321A;
  --row-cream: #FFFBEF;
  --row-hover: #FFF0C2;
  --tint-green: #EDE6FF;
  --tint-amber: #FFE9DE;
  --control-border: #6D6394;
  --muted: #4F4572;
  --error: #B3261E;

  /* cartoon lottery palette */
  --sun: #FFD84D;
  --sun-light: #FFE88A;
  --pink: #FF8CC6;
  --sky: #8FD0FF;
  --sky-light: #DDF1FF;
  --mint: #7FE3C9;
  --tangerine: #FFB27A;
  --grape: #6C3CE1;

  --display: "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  --serif: var(--display);
  --sans: "Trebuchet MS", "Segoe UI", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --mono: Consolas, "Courier New", Courier, monospace;

  --unit: 8px;
  --pad: 40px;
  --rhythm: 64px;
  --dense: 24px;
  --shell: 1200px;
  --radius: 18px;
  --radius-sm: 12px;
  --pill: 999px;
  --tab-radius: 999px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --confetti: repeating-linear-gradient(90deg,
    var(--sun) 0 40px, var(--pink) 40px 80px, var(--sky) 80px 120px,
    var(--mint) 120px 160px, var(--tangerine) 160px 200px);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, ul, ol, dl, dd, figure, pre { margin: 0; }
ul, ol { padding: 0; }
img, svg { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.no-js .js-only { display: none !important; }

/* ---------- Base ---------- */
body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 2px 2px, rgba(36, 26, 77, 0.09) 0 2px, transparent 2.5px);
  background-size: 30px 30px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: bold;
  line-height: 1.2;
  overflow-wrap: break-word;
  hyphens: auto;
}
h1 { font-size: 56px; letter-spacing: -0.01em; text-shadow: 3px 3px 0 var(--sun); }
h2 { font-size: 34px; margin-bottom: 16px; }
h3 { font-size: 24px; margin-bottom: 8px; }
h4 { font-size: 19px; }
p + p { margin-top: 16px; }
a { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--pink); transition: color 150ms ease, text-decoration-color 150ms ease; }
a:hover { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[id] { scroll-margin-top: 24px; }
code { font-family: var(--mono); font-size: 0.95em; background: var(--tint-green); padding: 1px 6px; border-radius: 6px; border: 1px solid #CFC2F5; }
strong { font-weight: bold; }
time { white-space: nowrap; }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 60;
  background: var(--ink); color: var(--sun); padding: 12px 18px; border-radius: 0 0 14px 14px; font-weight: bold;
}
.skip-link:focus { top: 0; color: var(--sun); }

/* ---------- Layout ---------- */
.wrap { max-width: calc(var(--shell) + 2 * var(--pad)); margin: 0 auto; padding: 0 var(--pad); }
main { display: block; padding-bottom: var(--rhythm); }
.section { padding-top: var(--rhythm); }
.section-dense h2 { margin-bottom: var(--dense); }
.section-intro, .lede { max-width: 68ch; }
.lede { font-size: 20px; margin-top: 16px; }
.page-head { padding: 40px 0 var(--dense); border-bottom: 4px dashed var(--ink); }
.page-head h1 { font-size: 48px; }

.md-grid {
  display: grid;
  grid-template-columns: minmax(0, 36fr) minmax(0, 64fr);
  gap: 32px;
  align-items: start;
  margin-top: var(--dense);
}
.archive-grid { margin-top: 40px; }

/* ---------- Header & navigation ---------- */
.site-header { background: var(--panel); border-bottom: 4px solid var(--ink); position: relative; }
.site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -12px; height: 8px; background: var(--confetti); border-bottom: 2px solid var(--ink); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 32px; padding-top: 16px; padding-bottom: 16px; }
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--display); font-weight: bold; font-size: 24px; color: var(--ink); text-decoration: none; padding: 6px 0;
}
.brand::before {
  content: ""; flex: 0 0 auto; width: 44px; height: 44px;
  background: url("favicon-lottery-ball.svg") center / contain no-repeat;
  transition: transform 200ms ease;
}
.brand:hover { text-decoration: none; color: var(--accent-dark); }
.brand:hover::before { transform: rotate(-20deg) scale(1.08); }
.primary-nav ul { display: flex; flex-wrap: wrap; gap: 6px 10px; list-style: none; }
.primary-nav a {
  display: inline-flex; align-items: center; padding: 8px 16px; min-height: 44px;
  color: var(--ink); text-decoration: none; font-size: 17px; font-weight: bold;
  border: 3px solid transparent; border-radius: var(--pill);
  transition: background-color 150ms ease, border-color 150ms ease;
}
.primary-nav a:hover { background: var(--row-hover); border-color: var(--ink); }
.primary-nav a[aria-current="page"] { background: var(--sun); border-color: var(--ink); box-shadow: var(--shadow-sm); }

.breadcrumb { padding-top: 32px; font-size: 16px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; list-style: none; gap: 4px; }
.breadcrumb li + li::before { content: "★"; margin: 0 8px 0 4px; color: var(--accent-2-dark); }

/* ---------- Opener ---------- */
.opener {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.62fr);
  gap: 40px;
  align-items: stretch;
  padding: var(--rhythm) 0 40px;
  border-bottom: 4px dashed var(--ink);
}
.kicker {
  display: inline-block; font-family: var(--mono); font-size: 14px; font-weight: bold; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--sun); background: var(--ink); padding: 6px 14px; border-radius: var(--pill); margin-bottom: 20px;
}
.coverage-line { margin-top: 24px; font-size: 17px; padding-bottom: 10px; border-bottom: 3px dotted var(--control-border); max-width: 68ch; }
.label-tag {
  display: inline-block; font-family: var(--mono); font-size: 14px; font-weight: bold; text-transform: uppercase;
  background: var(--ink); color: var(--sun); padding: 2px 10px; margin-right: 8px; border-radius: var(--pill);
}
.mini-search {
  margin-top: 24px; max-width: 520px;
  background: var(--panel); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.mini-search label { display: block; font-size: 16px; font-weight: bold; margin-bottom: 8px; }
.mini-search-row { display: flex; gap: 10px; }
.mini-search input { width: 130px; font-weight: bold; font-family: var(--mono); font-size: 20px; text-align: center; }

.month-panel {
  align-self: stretch;
  display: flex; align-items: flex-end; justify-content: flex-end;
  min-height: 300px;
  padding: 24px;
  background-color: var(--sky-light);
  background-image:
    radial-gradient(circle, var(--sun) 0 22px, var(--ink) 23px 25px, transparent 26px),
    radial-gradient(circle, var(--pink) 0 22px, var(--ink) 23px 25px, transparent 26px),
    radial-gradient(circle, var(--mint) 0 22px, var(--ink) 23px 25px, transparent 26px),
    radial-gradient(circle, var(--tangerine) 0 22px, var(--ink) 23px 25px, transparent 26px),
    radial-gradient(circle, var(--grape) 0 22px, var(--ink) 23px 25px, transparent 26px),
    radial-gradient(circle, #FFFFFF 0 22px, var(--ink) 23px 25px, transparent 26px),
    radial-gradient(circle, var(--sun) 0 16px, var(--ink) 17px 19px, transparent 20px);
  background-position: 8% 10%, 38% 6%, 72% 14%, 14% 50%, 50% 36%, 90% 46%, 30% 80%;
  background-size: 56px 56px, 56px 56px, 56px 56px, 56px 56px, 56px 56px, 56px 56px, 42px 42px;
  background-repeat: no-repeat;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.month-label {
  text-align: right;
  background: var(--panel); border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow-sm);
  padding: 16px 20px; transform: rotate(-2deg);
}
.month-word { display: block; font-family: var(--display); font-weight: bold; font-size: clamp(40px, 5.2vw, 72px); line-height: 0.95; color: var(--accent); overflow-wrap: anywhere; }
.month-year { display: inline-block; margin-top: 12px; font-family: var(--mono); font-weight: bold; font-size: 17px; border-top: 3px dashed var(--accent-2); padding-top: 8px; }

/* ---------- Ledger list (records index) ---------- */
.list-heading, .rail-heading { font-size: 21px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 3px dashed var(--ink); }
.ledger { list-style: none; display: grid; gap: 10px; }
.ledger li a {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px;
  padding: 12px 16px; background: var(--panel); color: var(--ink); text-decoration: none;
  border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow-sm);
  transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.ledger li a:hover { background: var(--row-hover); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.ledger li:nth-child(5n+1) a { border-left: 10px solid var(--sun); }
.ledger li:nth-child(5n+2) a { border-left: 10px solid var(--pink); }
.ledger li:nth-child(5n+3) a { border-left: 10px solid var(--sky); }
.ledger li:nth-child(5n+4) a { border-left: 10px solid var(--mint); }
.ledger li:nth-child(5n+5) a { border-left: 10px solid var(--tangerine); }
.row-date { font-family: var(--display); font-weight: bold; font-size: 18px; }
.row-numbers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-family: var(--mono); font-size: 16px; font-weight: bold; }
.row-euro { color: var(--accent-2-dark); background: var(--tint-amber); border: 2px solid var(--accent-2); border-radius: var(--pill); padding: 0 10px; }
.list-foot { margin-top: 18px; font-size: 17px; font-weight: bold; }

/* ---------- Detail sheets & records ---------- */
.tab {
  display: inline-block; font-family: var(--mono); font-size: 14px; font-weight: bold;
  background: var(--accent); color: #FFFFFF;
  padding: 4px 14px; border: 2px solid var(--ink); border-radius: var(--pill);
}
.sheet {
  position: relative;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 20px 32px 32px;
}
.sheet > .tab { margin: 0 0 16px 0; }
.sheet-title { font-size: 32px; margin-bottom: 24px; color: var(--ink); }
.records .sheet + .sheet { margin-top: 40px; }
.pools { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 3fr); gap: 24px; padding-bottom: 24px; border-bottom: 3px dashed var(--border); }
.pool h3, .pool h4 { font-size: 19px; margin-bottom: 14px; }
.pool-rule { display: block; font-family: var(--mono); font-size: 14px; font-weight: normal; color: var(--muted); margin-top: 2px; }
.numbers { display: flex; flex-wrap: wrap; gap: 12px; list-style: none; }
.numbers li {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; min-width: 58px; padding: 0;
  font-family: var(--display); font-size: 22px; font-weight: bold; color: var(--ink);
  background-color: var(--sun);
  background-image: radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.95) 0 4px, rgba(255, 255, 255, 0) 15px);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.pool-main .numbers li:nth-child(5n+2) { background-color: var(--pink); }
.pool-main .numbers li:nth-child(5n+3) { background-color: var(--sky); }
.pool-main .numbers li:nth-child(5n+4) { background-color: var(--mint); }
.pool-main .numbers li:nth-child(5n+5) { background-color: var(--tangerine); }
.pool-euro .numbers li {
  background-color: var(--grape); color: #FFFFFF;
  box-shadow: inset 0 0 0 3px var(--grape), inset 0 0 0 6px var(--sun), var(--shadow-sm);
}
.record-meta { margin-top: 16px; }
.record-meta > div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; padding: 10px 0; border-bottom: 2px dotted var(--border); }
.record-meta dt { font-family: var(--mono); font-size: 14px; font-weight: bold; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.record-meta dd { overflow-wrap: anywhere; }
.snapshot-note { margin-top: 16px; font-size: 16px; color: var(--muted); max-width: 68ch; background: var(--row-cream); border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 12px 16px; }
.text-link { font-weight: bold; }

.empty-state { background: var(--tint-amber); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 32px; margin-bottom: 32px; }
.empty-state p { font-size: 20px; font-weight: bold; margin-bottom: 16px; }

/* ---------- Archive rail & filters ---------- */
.rail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 4px 10px 10px 4px; }
.filters { background: var(--panel); padding: 20px; border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: bold; font-size: 17px; margin-bottom: 6px; }
select, input[type="number"], input[type="url"], input[type="text"], textarea {
  width: 100%; min-height: 46px; padding: 8px 12px; font-size: 17px;
  background: var(--panel); border: 2px solid var(--control-border); border-radius: var(--radius-sm);
}
select:hover, input:hover, textarea:hover { border-color: var(--ink); }
textarea { min-height: 160px; line-height: 1.5; resize: vertical; }
[aria-invalid="true"] { border: 3px solid var(--error); }
.hint { font-size: 16px; color: var(--muted); margin-top: 6px; }
.match-count { font-family: var(--mono); font-size: 16px; font-weight: bold; padding: 10px 14px; background: var(--tint-green); border: 2px solid var(--accent); border-radius: var(--radius-sm); margin: 16px 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 20px; border: 3px solid var(--ink); border-radius: var(--pill);
  background: var(--accent); color: #FFFFFF; font-size: 17px; font-weight: bold; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 150ms ease, color 150ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.btn:hover { background: var(--accent-dark); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-secondary { background: var(--sun); color: var(--ink); }
.btn-secondary:hover { background: var(--sun-light); color: var(--ink); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.rail-index { margin-bottom: 24px; }
.compact-ledger { gap: 8px; }
.compact-ledger li a { padding: 8px 12px; }
.compact-ledger .row-date { font-size: 17px; }

/* ---------- Note / support panels ---------- */
.note-panel { background: var(--panel); padding: 16px 20px; border: 3px solid var(--ink); border-left: 10px solid var(--accent-2); border-radius: 14px; box-shadow: var(--shadow-sm); margin-top: 24px; font-size: 17px; }
.note-panel h3 { font-size: 20px; }
.support-panel { background: #EFFFFA; padding: 24px; border: 3px solid var(--ink); border-left: 10px solid var(--mint); border-radius: var(--radius); box-shadow: var(--shadow); }
.support-panel h3 { font-size: 22px; }
.source-disclosure { margin-top: 24px; font-size: 16px; color: var(--muted); max-width: 72ch; }
.provenance-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 32px; align-items: start; }
.provenance-list { margin-top: 0; background: var(--panel); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 20px 12px; }
.provenance-list > div:last-child { border-bottom: 0; }

/* ---------- Field guide ---------- */
.field-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; counter-reset: field-guide; margin-top: var(--dense); }
.field-guide > div {
  position: relative; counter-increment: field-guide;
  padding: 56px 20px 20px; background: var(--panel);
  border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
}
.field-guide > div::before {
  content: counter(field-guide);
  position: absolute; top: 14px; left: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink);
  font-family: var(--display); font-weight: bold; font-size: 17px;
  background: var(--sun);
}
.field-guide > div:nth-child(2)::before { background: var(--pink); }
.field-guide > div:nth-child(3)::before { background: var(--grape); color: #FFFFFF; }
.field-guide > div:nth-child(4)::before { background: var(--mint); }
.field-guide dt { font-family: var(--display); font-weight: bold; font-size: 22px; margin-bottom: 8px; }
.field-guide dd { font-size: 17px; }

/* ---------- Tables ---------- */
.freq-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; margin-top: var(--dense); }
.table-wrap { overflow-x: auto; background: var(--panel); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); max-width: 100%; }
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.data-table caption { text-align: left; font-family: var(--display); font-weight: bold; font-size: 19px; padding: 16px 16px 12px; caption-side: top; }
.data-table th, .data-table td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: top; min-height: 40px; }
.data-table thead th { font-family: var(--mono); font-size: 14px; text-transform: uppercase; background: var(--sun); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.data-table tbody tr:nth-child(even) { background: var(--row-cream); }
.data-table tbody tr:hover { background: var(--row-hover); }
.data-table tbody th { font-family: var(--mono); font-weight: bold; }
.data-table tfoot th, .data-table tfoot td { font-weight: bold; border-top: 3px solid var(--ink); border-bottom: 0; background: var(--tint-green); }
.freq-table td, .freq-table tbody th { font-family: var(--mono); font-size: 16px; }
.freq-table tbody th { width: 30%; }
.mono { font-family: var(--mono); }
.count { display: inline-block; min-width: 1.5em; font-weight: bold; }
.bar {
  display: inline-block; height: 14px; vertical-align: middle;
  background: repeating-linear-gradient(45deg, var(--accent) 0 6px, #8A66F0 6px 12px);
  border: 2px solid var(--ink); border-radius: var(--pill);
}
.bar-euro { background: repeating-linear-gradient(45deg, var(--accent-2) 0 6px, #FFA07F 6px 12px); }
.bar-0 { width: 0; border: 0; }
.bar-1 { width: 22px; }
.bar-2 { width: 44px; }
.bar-3 { width: 66px; }
.bar-4 { width: 88px; }
.scroll-cue { display: none; font-size: 15px; color: var(--muted); margin-top: 8px; }

/* ---------- FAQ ---------- */
.faq-list { margin-top: var(--dense); max-width: 72ch; display: grid; gap: 12px; }
.faq-list details { background: var(--panel); border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden; }
.faq-list summary {
  cursor: pointer; padding: 14px 20px; min-height: 56px;
  font-family: var(--display); font-weight: bold; font-size: 20px; list-style-position: inside;
}
.faq-list summary::marker { color: var(--accent-2-dark); }
.faq-list summary:hover { background: var(--row-hover); }
.faq-list details[open] summary { background: var(--sun); border-bottom: 3px solid var(--ink); }
.faq-list details p { padding: 16px 20px 20px; max-width: 68ch; }
.faq-list + p { margin-top: 24px; }

/* ---------- Articles / guides ---------- */
.guide-index { margin-top: 32px; }
.guide-index ol { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.guide-index a {
  display: block; height: 100%; padding: 18px 20px; font-family: var(--display); font-weight: bold; font-size: 21px; color: var(--ink); text-decoration: none;
  background: var(--panel); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
.guide-index a:hover { background: var(--row-hover); transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.guide-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; margin-bottom: 10px; border-radius: 50%; border: 3px solid var(--ink);
  font-family: var(--mono); font-size: 15px; font-weight: bold; color: var(--ink); background: var(--sun);
}
.guide-index li:nth-child(2) .guide-num { background: var(--pink); }
.guide-index li:nth-child(3) .guide-num { background: var(--mint); }
.prose { max-width: 68ch; }
.prose ul, .prose ol, .legal ul, .legal ol { padding-left: 24px; margin-top: 16px; }
.prose li + li, .legal li + li { margin-top: 8px; }
.prose li::marker, .legal li::marker { color: var(--accent-2-dark); font-weight: bold; }
.guide { padding-top: var(--rhythm); }
.guide h2 { font-size: 36px; margin-top: 10px; }
.guide h3 { margin-top: 32px; }
.guide h3 + p { margin-top: 0; }
.evidence-note { font-size: 16px; background: var(--panel); border: 2px dashed var(--accent-2); border-radius: var(--radius-sm); padding: 12px 16px; }

/* ---------- Legal / reading layout ---------- */
.legal { max-width: 720px; padding-top: 32px; }
.legal h1 { font-size: 48px; }
.legal section { padding-top: 40px; }
.legal section h2 { font-size: 28px; padding-bottom: 8px; border-bottom: 3px dashed var(--border); }
.legal > h2 { margin-top: 40px; font-size: 28px; }
.toc { margin-top: 24px; background: var(--panel); padding: 16px 20px; border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.toc ol { margin-top: 0; columns: 2; column-gap: 32px; }
.toc li { break-inside: avoid; font-size: 17px; }
.sitemap-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.sitemap-grid section { padding-top: 24px; }
.sitemap-grid ul ul { margin-top: 8px; }

/* ---------- Contact draft tool ---------- */
.local-notice { margin-top: 24px; padding: 16px 20px; background: var(--tint-green); border: 3px solid var(--accent); border-radius: var(--radius-sm); }
.draft-form { margin-top: 32px; }
.field-error { color: var(--error); font-weight: bold; font-size: 16px; margin-top: 6px; }
.error-summary { background: var(--panel); border: 3px solid var(--error); border-left-width: 10px; border-radius: 14px; padding: 16px 20px; margin-bottom: 24px; }
.error-summary h2 { font-size: 22px; }
.error-summary a { color: var(--error); font-weight: bold; }
.draft-preview { margin-top: 28px; padding-top: 24px; }
.draft-output { font-family: var(--mono); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--row-cream); padding: 16px; border: 2px dashed var(--border); border-radius: var(--radius-sm); }

/* ---------- Footer ---------- */
.site-footer { margin-top: var(--rhythm); }
.site-footer::before { content: ""; display: block; height: 10px; background: var(--confetti); border-top: 3px solid var(--ink); }
.index-band { background: var(--panel); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.index-band ul { display: flex; flex-wrap: wrap; list-style: none; gap: 4px 6px; padding: 10px 0; }
.index-band a {
  display: inline-flex; align-items: center; padding: 8px 14px; min-height: 44px; font-size: 16px; font-weight: bold;
  color: var(--ink); text-decoration: none; border: 2px solid transparent; border-radius: var(--pill);
}
.index-band a:hover { background: var(--row-hover); border-color: var(--ink); }
.colophon { background: var(--ink); color: #FFFFFF; }
.colophon-inner { padding-top: 32px; padding-bottom: 40px; font-size: 16px; }
.colophon-inner p { max-width: 90ch; }
.colophon a { color: #FFFFFF; text-decoration-color: var(--sun); }
.colophon a:hover { color: var(--sun); }
.colophon :focus-visible { outline-color: var(--sun); }
.colophon-name { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: bold; font-size: 26px; color: var(--sun); }
.colophon-name::before { content: ""; width: 36px; height: 36px; background: url("favicon-lottery-ball.svg") center / contain no-repeat; }
.copyright { padding-top: 16px; border-top: 2px dashed #5E5290; }

/* ---------- Cookie notice ---------- */
.cookie-pop {
  position: fixed; left: 20px; bottom: 20px; z-index: 50;
  width: calc(100% - 40px); max-width: 440px;
  background: var(--panel); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 22px; box-shadow: 7px 7px 0 var(--ink);
  padding: 22px 22px 20px;
  animation: cookie-pop-in 320ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.cookie-pop::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px; background: var(--confetti); border-radius: 19px 19px 0 0; border-bottom: 2px solid var(--ink); }
.cookie-pop-icon {
  position: absolute; top: -30px; right: 22px;
  width: 66px; height: 66px; border-radius: 50%; border: 3px solid var(--ink);
  background:
    radial-gradient(circle at 30% 34%, #5A3312 0 5px, transparent 6px),
    radial-gradient(circle at 66% 28%, #5A3312 0 4px, transparent 5px),
    radial-gradient(circle at 58% 64%, #5A3312 0 5px, transparent 6px),
    radial-gradient(circle at 28% 70%, #5A3312 0 3px, transparent 4px),
    radial-gradient(circle at 80% 56%, #5A3312 0 3px, transparent 4px),
    #E9A857;
  box-shadow: var(--shadow-sm);
  transform: rotate(-12deg);
}
.cookie-pop-title { font-size: 24px; margin: 8px 0 8px; padding-right: 70px; }
.cookie-pop p { font-size: 16px; }
.cookie-pop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 16px; }
.cookie-pop-link { font-weight: bold; font-size: 16px; }
@keyframes cookie-pop-in {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .btn:hover, .btn:active, .ledger li a:hover, .guide-index a:hover { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
  :root { --pad: 24px; --rhythm: 44px; }
  h1 { font-size: 48px; }
  .field-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 999px) {
  .opener { grid-template-columns: minmax(0, 1fr); }
  .month-panel { min-height: 220px; justify-content: flex-start; }
  .month-label { text-align: left; }
  .md-grid { grid-template-columns: minmax(0, 40fr) minmax(0, 60fr); gap: 24px; }
  .pools { grid-template-columns: minmax(0, 1fr); }
  .freq-grid, .provenance-grid { grid-template-columns: minmax(0, 1fr); }
  .guide-index ol { grid-template-columns: minmax(0, 1fr); }
  .record-meta > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (max-width: 767px) {
  :root { --pad: 16px; --rhythm: 30px; --dense: 16px; }
  body { font-size: 16px; }
  h1, .page-head h1, .legal h1 { font-size: 38px; }
  h2 { font-size: 28px; }
  .guide h2 { font-size: 30px; }
  .lede { font-size: 18px; }
  .md-grid { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; max-height: none; overflow: visible; padding: 0; }
  /* side rail replaced by compact jump navigation */
  .compact-ledger { display: flex; flex-wrap: wrap; gap: 8px; }
  .compact-ledger li a { padding: 8px 12px; border-radius: var(--pill); }
  .compact-ledger .row-numbers { display: none; }
  .sheet { padding: 16px 16px 24px; }
  .sheet-title { font-size: 26px; }
  .field-guide { grid-template-columns: minmax(0, 1fr); }
  .scroll-cue { display: block; }
  .toc ol { columns: 1; }
  .faq-list summary { font-size: 18px; }
  .header-inner { padding-top: 10px; padding-bottom: 10px; }
  .primary-nav a { padding: 8px 12px; font-size: 16px; }
  .month-panel { min-height: 200px; }
  .cookie-pop { left: 12px; bottom: 12px; width: calc(100% - 24px); max-width: none; }
}
@media (max-width: 479px) {
  h1, .page-head h1, .legal h1 { font-size: 32px; }
  .numbers { gap: 10px; }
  .numbers li { width: 46px; height: 46px; min-width: 46px; font-size: 19px; }
  .mini-search-row { flex-direction: column; }
  .mini-search input { width: 100%; }
  .button-row .btn, .cookie-pop-actions .btn { width: 100%; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .brand { font-size: 20px; }
  .brand::before { width: 36px; height: 36px; }
}