/* Then Price. A shelf-edge price label and a till receipt: navy ink, label
   yellow, brick red for links, on warm paper. System fonts only. */
:root {
  --ink: #1c2541;
  --paper: #faf6ee;
  --card: #ffffff;
  --muted: #4d5470;
  --link: #9b2c1f;
  --label: #f2c14e;
  --label-soft: #fdf0cc;
  --cold: #dde8f5;
  --warm: #fbe3c2;
  --hot: #f6d2c6;
  --error: #a01c12;
  --focus: #c2410c;
  --rule: #d9d3c4;
  --head-text: #f3eee3;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: clamp(1rem, .96rem + .2vw, 1.125rem); line-height: 1.6; overflow-wrap: anywhere; }
img, svg { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.9rem, 1.5rem + 2vw, 2.9rem); margin-top: .4em; }
h2 { font-size: clamp(1.35rem, 1.2rem + .8vw, 1.8rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
p, ul, ol, dl { margin: 0 0 1em; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: var(--mono); font-size: .92em; }
abbr[title] { text-decoration: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip:focus-visible, .site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--label); }

.wrap { width: min(100% - 3rem, 72rem); margin-inline: auto; }
.prose { max-width: 46rem; }
.wrap.prose { width: min(100% - 3rem, 46rem); }
.simple-top { padding-top: 1rem; }
.lede { font-size: 1.12em; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.skip { position: absolute; left: .5rem; top: -4rem; background: var(--label); color: var(--ink); padding: .6rem 1rem; z-index: 10; min-height: 44px; }
.skip:focus { top: .5rem; }

/* header and footer */
.site-header { background: var(--ink); color: var(--head-text); border-bottom: 4px solid var(--label); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1.5rem; padding-block: .4rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--head-text); text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.35rem; min-height: 44px; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0 .25rem; }
.site-header nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .6rem; color: var(--head-text); text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current='page'] { text-decoration: underline; text-underline-offset: .3em; }
.site-footer { margin-top: 4rem; background: var(--ink); color: var(--head-text); padding-block: 1.5rem; font-size: .95rem; }
.site-footer a { color: var(--label); }
.footer-inner > p { max-width: 46rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; }

.crumbs ol { list-style: none; padding: 0; margin: 0 0 .5rem; display: flex; flex-wrap: wrap; gap: 0 .4rem; font-size: .95rem; }
.crumbs li { display: inline-flex; align-items: center; min-height: 44px; }
.crumbs li + li::before { content: '/'; margin-right: .4rem; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; }

/* buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem 1.2rem; border: 2px solid var(--ink); border-radius: .4rem; background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--label-soft); }
.btn.primary { background: var(--ink); color: var(--head-text); }
.btn.primary:hover { background: var(--link); border-color: var(--link); }
input[type='text'], select { min-height: 44px; font: inherit; color: var(--ink); background: var(--card); border: 2px solid #6b7088; border-radius: .35rem; padding: .35rem .6rem; max-width: 100%; }
input[aria-invalid='true'], select[aria-invalid='true'] { border-color: var(--error); }
label, legend { font-weight: 600; }
.hint { color: var(--muted); font-size: .95rem; margin: .3rem 0 0; }
.error { color: var(--error); font-weight: 600; margin: .3rem 0 0; }
.error:empty { display: none; }
.notice { background: var(--label-soft); border-left: 4px solid var(--label); padding: .7rem 1rem; }
.money { display: inline-flex; align-items: stretch; }
.money .pound { display: inline-flex; align-items: center; padding: 0 .6rem; border: 2px solid #6b7088; border-right: 0; border-radius: .35rem 0 0 .35rem; background: var(--label-soft); font-weight: 700; }
.money input { border-radius: 0 .35rem .35rem 0; width: 9rem; font-family: var(--mono); font-size: 1.15rem; }

/* play screen */
.play { display: grid; gap: 0 2.5rem; grid-template-columns: minmax(0, 1fr); padding-top: 1rem; }
.play-intro h1 { margin-bottom: .2em; }
.tag-card { position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: .6rem; padding: 1.25rem clamp(1rem, 3vw, 2rem) 1.5rem; box-shadow: 6px 6px 0 var(--label); }
.tag-card::before { content: ''; position: absolute; top: 1rem; right: 1rem; width: 1rem; height: 1rem; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }
.puzzle-no { font-family: var(--mono); color: var(--muted); margin: 0 2rem .4rem 0; font-size: .95rem; }
.tag-card .item { margin: 0 0 .3rem; font-size: clamp(1.5rem, 1.25rem + 1.3vw, 2.2rem); }
.when { font-size: 1.1em; }
.when strong { background: var(--label); padding: .05em .35em; border-radius: .2em; white-space: nowrap; }
.guess-form { margin: 1rem 0; }
.guess-form label { display: block; margin-bottom: .3rem; }
.money-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.receipt { list-style: none; margin: 1rem 0; padding: 0; border-top: 2px dashed var(--rule); font-family: var(--mono); }
.receipt:empty { display: none; }
.receipt .row { display: grid; grid-template-columns: 1.5rem max-content minmax(0, 1fr); gap: .25rem .6rem; align-items: baseline; padding: .55rem .4rem; border-bottom: 2px dashed var(--rule); }
.receipt .g-no { color: var(--muted); }
.receipt .g-price { font-weight: 700; }
.receipt .g-hint { grid-column: 2 / -1; font-family: var(--sans); font-size: .95rem; }
@media (min-width: 40rem) {
  .receipt .row { grid-template-columns: 1.5rem 5.5rem 3.2rem minmax(0, 1fr); }
  .receipt .g-hint { grid-column: auto; }
}
.receipt .band-cold { background: var(--cold); }
.receipt .band-warm { background: var(--warm); }
.receipt .band-hot { background: var(--hot); }
.receipt .band-spot { background: var(--label); }
.receipt .band-spot .g-no { color: var(--ink); }
.result { border-top: 4px double var(--ink); margin-top: 1rem; padding-top: .5rem; }
.result h3 { margin-top: .5rem; }
.answer { font-family: var(--mono); font-size: 1.25em; background: var(--label); padding: 0 .3em; border-radius: .2em; }
.share-text { display: block; width: 100%; max-width: 24rem; font-family: var(--mono); font-size: 1rem; line-height: 1.4; padding: .6rem; border: 2px solid #6b7088; border-radius: .35rem; background: var(--paper); color: var(--ink); resize: none; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .6rem 0 1rem; }
.copy-status { margin: 0; }
.play-help, .play-more { max-width: 46rem; }
.bands { list-style: none; padding: 0; }
.bands li { padding: .3rem 0; }
.band { display: inline-block; width: 2rem; }

/* tables */
.table-scroll { max-width: 100%; overflow-x: auto; margin: 0 0 1.2rem; }
table { border-collapse: collapse; width: 100%; background: var(--card); font-size: .95rem; }
caption { text-align: left; font-weight: 600; padding: .4rem 0; caption-side: top; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { border-bottom: 2px solid var(--ink); }
td { font-variant-numeric: tabular-nums; }
table.months td, table.months th { white-space: nowrap; padding: .35rem .45rem; }
.index-table th[scope='row'] a { display: inline-block; min-height: 24px; }

/* price pages */
.key-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: .6rem; margin: 1rem 0 1.5rem; }
.key-figures div { background: var(--card); border: 1px solid var(--rule); border-top: 4px solid var(--label); padding: .5rem .8rem; }
.key-figures dt { font-size: .9rem; color: var(--muted); }
.key-figures dd { margin: 0; font-family: var(--mono); font-size: 1.3rem; font-weight: 700; }
.key-figures dd .muted { display: block; font-family: var(--sans); font-size: .85rem; font-weight: 400; }
.chart { margin: 0 0 1.5rem; }
.chart svg { display: block; width: 100%; height: auto; background: var(--card); border: 1px solid var(--rule); }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .tick, .chart .axis-line { stroke: var(--ink); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-family: var(--sans); font-size: 13px; }
.chart .line { fill: none; stroke: var(--link); stroke-width: 3; stroke-linejoin: round; }
.chart .dot { fill: var(--ink); }
.chart figcaption { font-size: .9rem; color: var(--muted); margin-top: .3rem; }
.sources { padding-left: 1.2rem; }
.sources li { margin-bottom: .4rem; }
.guide-list { list-style: none; padding: 0; }
.guide-list li { border-bottom: 1px solid var(--rule); padding-bottom: .4rem; }
.guide-list h2 { font-size: 1.3rem; margin-top: 1rem; }
.related { padding-left: 1.2rem; }
.related a { display: inline-flex; align-items: center; min-height: 44px; }
.formula, .share-sample { background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--label); padding: .8rem 1rem; overflow-x: auto; white-space: pre-wrap; }

/* calculator */
.calc-layout { display: grid; gap: 1.5rem 2.5rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.calc-form { background: var(--card); border: 2px solid var(--ink); border-radius: .6rem; padding: 1rem clamp(1rem, 3vw, 1.5rem); }
.field { margin: 0 0 1rem; border: 0; padding: 0; }
.field > label { display: block; margin-bottom: .3rem; }
.date-pair { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.date-pair legend { margin-bottom: .3rem; }
.date-pair label { display: block; font-weight: 400; }
.results { background: var(--label-soft); border: 2px solid var(--ink); border-radius: .6rem; padding: 1rem clamp(1rem, 3vw, 1.5rem); }
.results h2 { margin-top: 0; }
.big-figure { font-family: var(--mono); font-size: clamp(2rem, 1.6rem + 2vw, 3rem); font-weight: 700; margin: 0; }
.big-figure:empty { display: none; }
.working { font-family: var(--mono); font-size: .95rem; }

/* archive and stats */
.archive-list { list-style: none; padding: 0; }
.archive-list li { display: flex; flex-wrap: wrap; gap: .2rem 1rem; align-items: center; border-bottom: 1px solid var(--rule); padding: .2rem 0; }
.archive-list a { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; font-weight: 600; }
.arch-status { font-size: .95rem; }
.arch-won .arch-status { font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: .6rem; }
.stat-grid div { background: var(--card); border: 1px solid var(--rule); border-top: 4px solid var(--label); padding: .5rem .8rem; }
.stat-grid dt { font-size: .9rem; color: var(--muted); }
.stat-grid dd { margin: 0; font-family: var(--mono); font-size: 1.6rem; font-weight: 700; }
.bar { display: inline-block; height: .9rem; background: var(--ink); vertical-align: middle; width: 0; }
.bar-1 { width: 1.2rem; } .bar-2 { width: 2.4rem; } .bar-3 { width: 3.6rem; } .bar-4 { width: 4.8rem; } .bar-5 { width: 6rem; }
.bar-6 { width: 7.2rem; } .bar-7 { width: 8.4rem; } .bar-8 { width: 9.6rem; } .bar-9 { width: 10.8rem; } .bar-10 { width: 12rem; }

@media (min-width: 64rem) {
  .play { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .play-intro, .tag-card { grid-column: 1; }
  .play-help { grid-column: 2; grid-row: 1 / span 2; }
  .play-more { grid-column: 1 / -1; }
  .calc-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

/* Google auto ads add <ins class="adsbygoogle"> or .google-auto-placed blocks between
   sections. Keep them full width inside grids, inside the page width, and hide
   unfilled slots so they leave no gap. */
.google-auto-placed, ins.adsbygoogle { max-width: 100%; grid-column: 1 / -1; clear: both; }
.google-auto-placed { margin-block: 1.5rem; overflow: hidden; }
ins.adsbygoogle[data-ad-status='unfilled'] { display: none !important; }
iframe { max-width: 100%; }

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

@media print {
  .site-header nav, .skip, .site-footer nav, .guess-form, .share-row, .google-auto-placed, ins.adsbygoogle { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .tag-card { box-shadow: none; }
}
