/* ==========================================================================
   Lotteryplayer — Design System
   Direction: "Official ledger / ticket stub" — trustworthy data-desk feel,
   not a neon casino. Numbers are the hero; everything else stays quiet.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  /* Color tokens */
  --paper:      #F5F6F2;
  --paper-alt:  #ECEEE7;
  --ink:        #1B2A4A;
  --ink-soft:   #45526B;
  --slate:      #5B6472;
  --line:       #D8D9CE;
  --stamp-red:  #B5232F;
  --stamp-gold: #B4922E;
  --stamp-green:#2E6B4F;
  --white:      #FFFFFF;

  /* Type tokens */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --radius: 3px;
  --shadow-card: 0 1px 2px rgba(27,42,74,0.06), 0 1px 8px rgba(27,42,74,0.05);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
}
.skip-link:focus { left: 8px; top: 8px; background: var(--ink); color: var(--white); padding: 8px 12px; z-index: 999; }

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; color: var(--ink-soft); }

/* ---------------- Header ---------------- */
.site-header {
  background: var(--ink);
  border-bottom: 3px solid var(--stamp-gold);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.4rem; font-weight: 700; color: var(--white);
  display: flex; align-items: center; gap: 10px;
}
.logo span { color: var(--stamp-gold); }
.logo-mark { display: block; }
.main-nav { display: flex; gap: 22px; flex-wrap: wrap; }
.main-nav a {
  color: #D8DCE6; font-size: 0.92rem; font-weight: 500;
  letter-spacing: 0.01em;
}
.main-nav a:hover { color: var(--white); text-decoration: none; }

/* ---------------- Buttons / links as actions ---------------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 11px 20px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--white) !important;
  border: 1px solid var(--ink);
}
.btn:hover { background: var(--ink-soft); text-decoration: none; }
.btn-outline {
  background: transparent; color: var(--ink) !important; border: 1px solid var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--white) !important; }

/* ---------------- Ticket stub / hero ---------------- */
.ticket-stub {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.ticket-stub::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 6px;
  background: repeating-linear-gradient(90deg, var(--stamp-gold) 0 14px, transparent 14px 22px);
}
.ticket-head {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  padding: 22px 28px 0;
}
.ticket-game-name { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.ticket-draw-date { font-family: var(--font-mono); color: var(--slate); font-size: 0.9rem; }
.ticket-jackpot {
  padding: 20px 28px 6px;
  font-family: var(--font-mono);
  color: var(--stamp-green);
  font-size: 1.05rem;
}
.ticket-jackpot strong { font-size: 1.9rem; display: block; color: var(--stamp-green); }

.balls-row {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  padding: 14px 28px 24px;
  border-top: 1px dashed var(--line);
  margin-top: 14px;
}
.ball {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 1.05rem;
  background: var(--paper-alt);
  border: 1.5px solid var(--ink);
  color: var(--ink);
}
.ball.bonus {
  background: var(--stamp-red);
  border-color: var(--stamp-red);
  color: var(--white);
}
.ball.sm { width: 34px; height: 34px; font-size: 0.85rem; }

/* ---------------- Cards / grids ---------------- */
.section { padding: 48px 0; }
.section-tight { padding: 28px 0; }
.grid {
  display: grid; gap: 20px;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) {
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------------- Mobile nav toggle ---------------- */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; background: none; border: none; cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block; width: 24px; height: 2px; background: var(--white);
  margin: 0 auto; transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--ink); flex-direction: column; gap: 0;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2); z-index: 50;
  }
  .main-nav.open { display: flex; }
  .main-nav a {
    padding: 14px 24px; border-top: 1px solid rgba(255,255,255,0.1);
  }
  .header-inner { position: relative; }
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.card h3 { margin-bottom: 8px; }
.card .eyebrow {
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--stamp-gold); margin-bottom: 6px; display: block;
}

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; margin: 1em 0; }
th, td {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
}
th { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate); }
td.num, th.num { font-family: var(--font-mono); }
tr:hover td { background: var(--paper-alt); }

/* ---------------- Results list ---------------- */
.results-list .result-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); margin-bottom: 10px; flex-wrap: wrap; gap: 12px;
}
.result-row .date { font-family: var(--font-mono); color: var(--slate); min-width: 130px; }
.result-row .balls-inline { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Breadcrumb ---------------- */
.breadcrumb { font-size: 0.85rem; color: var(--slate); padding: 14px 0 0; }
.breadcrumb a { color: var(--slate); }

/* ---------------- Disclaimer banner ---------------- */
.notice {
  background: #FBF3E3; border: 1px solid #E7CE96; border-radius: var(--radius);
  padding: 14px 18px; font-size: 0.88rem; color: #6B5316; margin: 20px 0;
}

/* ---------------- Footer ---------------- */
.site-footer { background: var(--ink); color: #C7CCD9; padding: 48px 0 24px; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr; gap: 28px; margin-bottom: 32px; }
.footer-grid h4 { color: var(--white); font-family: var(--font-body); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.footer-grid a { display: block; color: #AEB5C6; font-size: 0.9rem; margin-bottom: 8px; }
.footer-grid a:hover { color: var(--white); }
.footer-grid p { color: #9CA4B7; font-size: 0.88rem; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

.disclaimer { border-top: 1px solid #33415F; padding-top: 20px; }
.disclaimer p { font-size: 0.78rem; color: #8892A6; margin-bottom: 8px; }

/* ---------------- Home hero ---------------- */
.hero {
  padding: 56px 0 20px;
}
.hero .lede { font-size: 1.1rem; max-width: 60ch; }
.game-pill-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.game-pill {
  font-family: var(--font-mono); font-size: 0.85rem; padding: 8px 14px;
  border: 1px solid var(--ink); border-radius: 20px; color: var(--ink);
}
.game-pill:hover { background: var(--ink); color: var(--white); }

/* Utility */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.small { font-size: 0.85rem; color: var(--slate); }

/* ---------------- Guides (long-form articles) ---------------- */
.guide-meta {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  font-size: 0.85rem; color: var(--slate); font-family: var(--font-mono);
  margin: 10px 0 0;
}
.guide-meta .tag {
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 12px;
  color: var(--ink-soft); font-family: var(--font-body); font-weight: 600;
}

.guide-layout {
  display: grid; grid-template-columns: 2.2fr 1fr; gap: 48px; align-items: start;
}
@media (max-width: 860px) { .guide-layout { grid-template-columns: 1fr; } }

.guide-toc {
  position: sticky; top: 20px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-card);
}
.guide-toc h4 {
  margin: 0 0 10px; font-family: var(--font-body); font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate);
}
.guide-toc ol { margin: 0; padding-left: 18px; }
.guide-toc li { margin-bottom: 8px; font-size: 0.92rem; }
.guide-toc a { color: var(--ink-soft); }
.guide-toc a:hover { color: var(--stamp-red); }

.guide-related {
  margin-top: 22px; background: var(--paper-alt); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.guide-related h4 {
  margin: 0 0 10px; font-family: var(--font-body); font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate);
}
.guide-related a { display: block; margin-bottom: 8px; font-weight: 600; }

.article-body { font-size: 1.04rem; max-width: 72ch; }
.article-body h2 {
  font-family: var(--font-display); font-size: 1.5rem; margin: 40px 0 14px;
  padding-top: 6px; scroll-margin-top: 20px;
}
.article-body h3 {
  font-family: var(--font-body); font-size: 1.1rem; margin: 26px 0 10px;
  scroll-margin-top: 20px;
}
.article-body p { margin: 0 0 16px; }
.article-body ul, .article-body ol { margin: 0 0 16px; padding-left: 22px; }
.article-body li { margin-bottom: 6px; }
.article-body strong { color: var(--ink); }
.article-body table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.92rem; }
.article-body th, .article-body td {
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line);
}
.article-body th { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; color: var(--slate); }
.article-body blockquote {
  margin: 20px 0; padding: 4px 20px; border-left: 3px solid var(--stamp-gold);
  color: var(--ink-soft); font-style: italic;
}
.article-body a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

.guides-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 700px) { .guides-grid { grid-template-columns: 1fr; } }
.guide-card-tag {
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--stamp-red);
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* ---------------- Pagination (results archive) ---------------- */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  flex-wrap: wrap;
}

/* ---------------- Trend Chart (number matrix analysis tool) ---------------- */
.trend-controls {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end;
  margin-bottom: 18px;
}
.trend-depth-btns { display: flex; gap: 6px; }
.trend-depth-btns button {
  font-family: var(--font-mono); font-size: 0.8rem; padding: 6px 14px;
  border: 1px solid var(--line); background: var(--white); border-radius: 20px;
  cursor: pointer; color: var(--ink-soft);
}
.trend-depth-btns button.active { background: var(--ink); color: var(--white); border-color: var(--ink); }

.trend-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-card); background: var(--white);
  /* Break out of .container's 1120px max-width to use most of the viewport —
     a 69-95 column matrix needs every pixel it can get. Falls back to normal
     horizontal scroll on narrow/mobile screens, which is expected and fine;
     the goal is "no scroll needed on a typical desktop", not "never scrolls
     on any device", which isn't physically achievable for this much data.

     BUG FIXED: this used to also have `max-width: 1600px`, which broke the
     centering — the margin-left/margin-right calc below anchors the LEFT
     edge to the viewport edge, but width capping via max-width only trims
     the right side, leaving a large unbalanced gap there on wide monitors
     instead of splitting evenly. Simplest fix: no cap, just let it use
     96vw consistently, which centers correctly at any viewport width above
     the mobile breakpoint. */
  width: 96vw;
  margin-left: calc(-48vw + 50%);
  margin-right: calc(-48vw + 50%);
  position: relative;
}
@media (max-width: 1000px) {
  .trend-wrap { width: 100%; margin-left: 0; margin-right: 0; }
}
.trend-table { border-collapse: collapse; font-family: var(--font-mono); font-size: 0.64rem; white-space: nowrap; }
.trend-table th, .trend-table td {
  width: 19px; height: 22px; min-width: 19px; text-align: center;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 0; color: var(--slate);
}
.trend-table thead th {
  background: var(--paper-alt); font-weight: 600; color: var(--ink-soft);
  position: sticky; top: 0; z-index: 3;
}
.trend-table td.zone-end, .trend-table th.zone-end { border-right: 2px solid var(--ink); }
.trend-table .sticky-col {
  position: sticky; left: 0; background: var(--white); z-index: 2;
  border-right: 2px solid var(--ink); text-align: left; padding: 0 8px;
  min-width: 76px; font-weight: 600; color: var(--ink);
}
.trend-table thead .sticky-col { z-index: 4; background: var(--paper-alt); }
.trend-table .stat-col { min-width: 40px; font-weight: 600; }
.trend-table .dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper-alt); color: var(--ink); font-weight: 700;
  font-size: 0.6rem; border: 1px solid var(--ink);
}
.trend-table .dot.bonus { background: var(--stamp-red); border-color: var(--stamp-red); color: var(--white); }
.trend-table .dot.ref-bonus { background: var(--stamp-red); border-color: var(--stamp-red); color: var(--white); }
/* Mega Millions' official Mega Ball color is gold, not red — see body's
   game-{slug} class set in base.html. Powerball and Millionaire for Life
   fall back to the site's default red, since neither has a strong
   official color identity distinct enough to be worth a special case. */
.game-mega-millions .trend-table .dot.bonus,
.game-mega-millions .trend-table .dot.ref-bonus,
.game-mega-millions .ball.bonus {
  background: var(--stamp-gold); border-color: var(--stamp-gold); color: var(--white);
}
.trend-line-svg { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }

/* ---------------- Form controls (tool inputs) ---------------- */
.field { margin-bottom: 22px; max-width: 420px; }
.field label {
  display: block; font-weight: 600; font-size: 0.88rem;
  color: var(--ink); margin-bottom: 7px;
}
.field .hint { font-size: 0.8rem; color: var(--slate); margin-top: 5px; }

input[type="number"],
input[type="text"],
input[type="date"],
textarea {
  width: 100%; max-width: 420px;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { max-width: 520px; resize: vertical; }
select {
  width: 100%; max-width: 420px;
  padding: 11px 38px 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--white)
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%2345526B" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>')
    no-repeat right 14px center;
  background-size: 13px;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.98rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="number"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(27,42,74,0.10);
}
input[type="number"]:hover,
input[type="text"]:hover,
input[type="date"]:hover,
textarea:hover,
select:hover { border-color: var(--ink-soft); }

.field-row { display: flex; gap: 20px; max-width: 620px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 180px; }

/* ---------------- Result hero cards (calculator outputs) ---------------- */
.result-heroes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin: 22px 0;
}
.result-hero {
  background: var(--ink); color: var(--white);
  border-radius: var(--radius); padding: 24px 26px;
  position: relative; overflow: hidden;
}
.result-hero.alt { background: var(--stamp-red); }
.result-hero .rh-label {
  font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.08em; opacity: 0.65; margin-bottom: 8px;
}
.result-hero .rh-value {
  font-family: var(--font-display); font-size: 2.1rem; font-weight: 600;
  line-height: 1.15; margin-bottom: 4px;
}
.result-hero .rh-sub { font-size: 0.82rem; opacity: 0.75; }

.result-breakdown { width: 100%; border-collapse: collapse; margin: 10px 0 0; }
.result-breakdown td { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.result-breakdown td.num { text-align: right; font-family: var(--font-mono); }
.result-breakdown tr:last-child td { border-bottom: none; font-weight: 700; }

.compare-table-wrap { overflow-x: auto; margin: 16px 0; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.compare-table th, .compare-table td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line); }
.compare-table th:first-child, .compare-table td:first-child { text-align: left; }
.compare-table thead th { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; color: var(--slate); }
.compare-table tbody tr.highlight { background: var(--paper-alt); font-weight: 700; }

.mini-chart-wrap { margin: 20px 0; }
.mini-chart-legend { display: flex; gap: 20px; font-size: 0.82rem; margin-top: 10px; }
.mini-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mini-chart-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------------- Per-draw stat row (result.html) ---------------- */
.draw-stats-row {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 14px 28px 22px; font-size: 0.88rem; color: var(--ink-soft);
  border-top: 1px dashed var(--line); margin-top: 4px;
}
.draw-stats-row strong { color: var(--ink); font-weight: 600; }

/* ---------------- Gap ("遗漏") values in trend chart ---------------- */
.gap-val {
  font-size: 0.6rem; color: var(--slate); font-weight: 400;
}
.gap-val.unknown { color: var(--line); }

/* ---------------- Picks builder (manual number picker) ---------------- */
.picks-grid {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0;
}
.picks-grid button {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--white);
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-soft);
  cursor: pointer; transition: all 0.1s;
}
.picks-grid button:hover { border-color: var(--ink-soft); }
.picks-grid button.selected {
  background: var(--stamp-red); border-color: var(--stamp-red); color: var(--white); font-weight: 700;
}
.picks-bonus-grid button.selected { background: var(--ink); border-color: var(--ink); }
.picks-status {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 16px 0; padding-top: 14px; border-top: 1px solid var(--line);
}
.picks-status .btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.picks-saved-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 8px; background: var(--paper-alt);
}
.picks-saved-row .remove-btn {
  margin-left: auto; background: none; border: none; color: var(--slate);
  cursor: pointer; font-size: 0.85rem; text-decoration: underline;
}

/* ---------------- Print / Save-as-PDF styles ---------------- */
@media print {
  .site-header, .site-footer, .main-nav, .trend-controls,
  .field, .field-row, button, .notice, .breadcrumb,
  .card:not(.trend-wrap), .picks-grid, #na-root > .field,
  .export-bar, .skip-link { display: none !important; }

  /* The sticky date column and sticky header rely on scroll-container
     behavior that doesn't apply to a printed page — force them back to
     normal static positioning so they don't overlap other content or get
     clipped oddly across page breaks. */
  .trend-wrap {
    width: 100% !important; margin: 0 !important; overflow: visible !important;
    box-shadow: none !important; border: none !important;
  }
  .trend-table .sticky-col, .trend-table thead th {
    position: static !important;
  }
  .trend-line-svg { display: none; } /* the connecting line doesn't reflow correctly across a print page break */

  .trend-table { font-size: 7pt; }
  body { background: white; color: black; }
  a { color: black; text-decoration: none; }
  .container { max-width: none; padding: 0; }

  @page { size: landscape; margin: 10mm; }
}

/* ---------------- Cookie consent banner ---------------- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}
.cookie-banner[hidden] { display: none; }
.cookie-banner-inner {
  max-width: 1120px; margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.cookie-banner-inner p { margin: 0; font-size: 0.86rem; color: #D8DCE6; flex: 1; min-width: 240px; }
.cookie-banner-inner a { color: var(--stamp-gold); }
.cookie-banner-inner .btn { flex-shrink: 0; }

/* Leave room at the bottom of the page so the fixed banner doesn't cover
   the last bit of content (mainly matters on short pages). */
body:has(#cookie-banner:not([hidden])) { padding-bottom: 90px; }

/* ---------------- Number heatmap ---------------- */
.heatmap-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 4px;
}
.heatmap-cell {
  aspect-ratio: 1; border-radius: var(--radius); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-mono); color: var(--ink);
}
.heatmap-n { font-size: 0.95rem; font-weight: 700; }
.heatmap-count { font-size: 0.62rem; color: var(--ink-soft); }

/* ---------------- Tools hub: search + category filter ---------------- */
.tools-filter-bar { margin: 20px 0 16px; }
.tools-filter-bar input[type="text"] { max-width: 420px; margin-bottom: 12px; }
.tools-category-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.tools-category-btns button {
  padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 20px;
  background: var(--white); color: var(--ink-soft); font-size: 0.86rem;
  font-family: var(--font-body); cursor: pointer; transition: all 0.15s;
}
.tools-category-btns button:hover { border-color: var(--ink-soft); }
.tools-category-btns button.active { background: var(--ink); border-color: var(--ink); color: var(--white); }

/* ---------------- Homepage section headings with SVG icons ---------------- */
.section-heading-icon { display: flex; align-items: center; gap: 10px; }
.section-heading-icon svg { flex-shrink: 0; }

/* ---------------- No-JS fallback banner ---------------- */
.noscript-banner {
  background: #FBF3E3; border-bottom: 2px solid var(--stamp-gold);
  color: #6B5316; padding: 12px 24px; font-size: 0.88rem; text-align: center;
}
.noscript-banner a { color: #6B5316; text-decoration: underline; }

/* ---------------- Number generator: spinning-ball reveal animation ---------------- */
@keyframes ball-spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}
.ball.spinning {
  animation: ball-spin 0.35s linear infinite;
  background: var(--paper-alt); color: var(--slate); border: 1.5px dashed var(--line);
}
