/* Rules and Scores: look A, "bright game night". System fonts only, no images but inline SVG.
   Tokens come from docs/v1-build-brief-design.md. The four type colors are fills that carry white text. */
:root {
  --bg: #ffffff; --surface: #ffffff; --soft: #f4f5fb; --text: #1c1e3a; --muted: #555a78;
  --outline: #1c1e3a; --shadow: #1c1e3a; --line: #d9dceb;
  --sun: #ffc53d; --sun-tint: #fff3d1;
  --card: #d23c2f; --dice: #2f5bd8; --tile: #0f7a6c; --yard: #b45309;
  --focus: #1c1e3a; --err: #b3261e; --ink: #1c1e3a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14162a; --surface: #1b1e38; --soft: #1e2140; --text: #f1f2fa; --muted: #b6bad3;
    --outline: #9a9fc4; --shadow: #05060f; --line: #343859;
    --sun-tint: #2e2918; --focus: #ffc53d; --err: #ff9b94;
  }
}
* { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 1rem; line-height: 1.5; font-weight: 500;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--text); font-weight: 800; text-decoration-thickness: 2px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 52rem; margin: 0 auto; padding: 0 1rem; }
main { display: block; padding-bottom: 2rem; }
h1, h2, h3 { font-weight: 900; }
h1 { font-size: 2rem; line-height: 1.1; margin: 1rem 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.375rem; margin: 2rem 0 .5rem; line-height: 1.25; }
h3 { font-size: 1.1rem; margin: 1.25rem 0 .25rem; }
.lede { color: var(--muted); font-size: 1.05rem; font-weight: 600; }
.small { font-size: .85rem; color: var(--muted); }

/* shapes */
.sticker { background: var(--surface); border: 2px solid var(--outline); border-radius: 16px; box-shadow: 4px 4px 0 var(--shadow); }
.t-card { --tc: var(--card); } .t-dice { --tc: var(--dice); } .t-tile { --tc: var(--tile); } .t-yard { --tc: var(--yard); }
.ico { flex: none; width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--outline); background: var(--tc); color: #fff; display: flex; align-items: center; justify-content: center; }
.ico svg { width: 24px; height: 24px; }
svg.i { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }

/* header and footer */
.site-header { background: var(--surface); border-bottom: 2px solid var(--outline); }
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: .6rem; padding-bottom: .6rem; }
.brand { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text); text-decoration: none; font-size: 1.1875rem; font-weight: 900; letter-spacing: -.01em; }
.brand .mark { width: 34px; height: 34px; flex: none; }
.brand .and { font-weight: 700; color: var(--muted); }
.site-header nav { display: flex; gap: 1rem; }
.site-header nav a, .rules-link { display: flex; align-items: center; min-height: 44px; text-decoration: none; font-size: .9375rem; font-weight: 800; }
.site-header.compact .wrap { padding-top: .25rem; padding-bottom: .25rem; }
.site-header.compact .brand { font-size: 1rem; }
.site-header.compact .brand .mark { width: 28px; height: 28px; }
.rules-link { font-size: .875rem; }
.site-footer { background: var(--soft); border-top: 2px solid var(--outline); color: var(--muted); padding: .75rem 0 1rem; }
.site-footer a { font-weight: 800; }
.site-footer p { margin: .5rem 0; }

/* breadcrumbs */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: 0; margin: .5rem 0 0; font-size: .875rem; font-weight: 800; }
.crumbs li + li::before { content: "\203A"; margin-right: .25rem; color: var(--muted); }
.crumbs a { font-weight: 800; }

/* buttons, pills and chips */
.btn {
  font: inherit; font-weight: 800; min-height: 44px; padding: .5rem 1rem; border-radius: 14px; border: 2px solid var(--outline);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn.primary { background: var(--card); color: #fff; box-shadow: 3px 3px 0 var(--shadow); }
.btn.dark { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.big { min-height: 54px; font-size: 1.125rem; font-weight: 900; }
.btn.small { min-height: 44px; padding: .25rem .75rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.wide-btn { display: flex; width: 100%; }
.pill, .tag { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--outline); border-radius: 999px; font-weight: 800; }
.pill { min-height: 44px; padding: 0 14px; text-decoration: none; font-size: .875rem; white-space: nowrap; }
.pill.sun { background: var(--sun); color: var(--ink); }
.tag { font-size: .75rem; padding: 0 .5rem; margin-left: .4rem; background: var(--soft); border-color: var(--line); color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 6px; margin: 0; list-style: none; }
.chips a { flex: none; white-space: nowrap; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 2px solid var(--line); border-radius: 999px; background: var(--soft); color: var(--text); font-size: .875rem; font-weight: 800; text-decoration: none; }
.chips.types a { border-color: var(--outline); border-radius: 999px; color: #fff; font-size: .9375rem; font-weight: 900; }
.chips.types a.t-card, .chips.types a.t-dice, .chips.types a.t-tile, .chips.types a.t-yard { background: var(--tc); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 14px 0 0; }
.facts li { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border: 2px solid var(--outline); border-radius: 999px; font-size: .875rem; font-weight: 800; }

/* fields */
input[type=text], input[type=number], select {
  font: inherit; font-size: 1rem; min-height: 44px; padding: .4rem .7rem; border: 2px solid var(--outline); border-radius: 12px;
  background: var(--surface); color: var(--text); width: 100%;
}
input.big { font-size: 1.375rem; font-weight: 900; min-height: 50px; }

/* home */
.hero { background: var(--sun-tint); border-bottom: 2px solid var(--outline); padding: 18px 0 22px; }
.hero .art { display: flex; gap: 12px; align-items: flex-end; height: 60px; }
.hero h1 { font-size: 2rem; line-height: 1.08; margin: 10px 0 8px; letter-spacing: -.02em; }
.hero p { margin: 0; font-size: 1rem; font-weight: 600; color: var(--muted); max-width: 36rem; }
.home h2 { margin: 1.25rem 0 .6rem; font-size: 1.25rem; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.tile-main { display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 10px; text-decoration: none; flex: 1; }
.tile-name { font-size: 1.125rem; font-weight: 900; }
.tile-goal { font-size: .8125rem; line-height: 1.3; font-weight: 700; color: var(--muted); }
.tile-keeper { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border-top: 2px solid var(--outline); background: var(--sun); color: var(--ink); font-size: .875rem; font-weight: 900; text-decoration: none; }
.game-list { margin-top: .5rem; overflow: hidden; }
.game-list ul { list-style: none; margin: 0; padding: 0; }
.game-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.game-list li + li { border-top: 1px solid var(--line); }
.game-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; }
.game-text { min-width: 0; display: flex; flex-direction: column; }
.game-name { font-size: 1.0625rem; font-weight: 900; }
.game-tag { font-size: .8125rem; line-height: 1.3; font-weight: 600; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.home section[id] { scroll-margin-top: .5rem; }

/* rules pages */
.band { background: var(--tc); color: #fff; border-bottom: 2px solid var(--outline); padding: 14px 0 20px; }
.band .wrap { display: flex; gap: 12px; align-items: flex-start; }
.band-text { flex: 1 1 auto; min-width: 0; }
.band .crumbs ol { margin: 0; }
.band .crumbs a, .band .crumbs li + li::before { color: #fff; }
.band .crumbs a { text-decoration: none; }
.band h1 { font-size: 2.25rem; line-height: 1.05; margin: .15rem 0 .4rem; letter-spacing: -.02em; }
.band p { margin: 0; font-size: 1rem; line-height: 1.4; font-weight: 700; }
.band-pic { flex: none; margin-top: 18px; transform: rotate(8deg); }
.keeping { margin-top: 14px; padding: 14px 14px 16px; background: var(--sun); color: var(--ink); display: flex; flex-direction: column; gap: 6px; }
.keeping h2 { margin: 0; font-size: 1.1875rem; }
.keeping p { margin: 0; font-size: .9375rem; line-height: 1.4; font-weight: 700; }
.keeping .btn { margin-top: 6px; min-height: 50px; font-size: 1rem; font-weight: 900; }
.toc { margin-top: 16px; }
.rules h2 { margin: 1.75rem 0 .5rem; font-size: 1.375rem; }
.rules h2::after { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--tc); margin-top: 8px; }
.rules ul:not(.facts):not(.chips), .rules ol:not(.crumbs ol) { list-style: none; margin: .5rem 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rules ul:not(.facts):not(.chips) > li, .rules ol:not(.crumbs ol) > li { position: relative; padding-left: 26px; font-weight: 600; }
.rules ul:not(.facts):not(.chips) > li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 12px; height: 12px; background: var(--tc); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.rules ol:not(.crumbs ol) { counter-reset: step; }
.rules ol:not(.crumbs ol) > li { counter-increment: step; padding-left: 36px; }
.rules ol:not(.crumbs ol) > li::before { content: counter(step); position: absolute; left: 0; top: .15em; width: 24px; height: 24px; border-radius: 50%; background: var(--tc); color: #fff; font-size: .8125rem; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.rules p { font-weight: 600; }
dt { font-weight: 800; margin-top: .75rem; }
dd { margin: .1rem 0 0 1rem; font-weight: 600; }
.example { background: var(--sun-tint); border: 2px solid var(--line); border-radius: 14px; padding: .25rem 1rem .5rem; margin: 1rem 0; }
.example h3 { margin-top: .5rem; }
.note { background: var(--sun-tint); border: 2px solid var(--line); padding: .5rem .75rem; border-radius: 14px; }
.faq-item { border-top: 1px solid var(--line); padding: .25rem 0 .5rem; }
.faq-item h3 { margin-top: .75rem; }
.faq-item p { margin: .25rem 0; }
.k-scroll { overflow-x: auto; margin: .5rem 0; max-width: 100%; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { border: 1px solid var(--line); padding: .5rem .6rem; text-align: left; vertical-align: top; }
th[scope=row] { font-weight: 800; }
thead th { background: var(--sun-tint); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 800; padding: .25rem 0; }
.ad-slot { min-height: 280px; margin: 1.5rem 0; }

/* score keeper */
.ad-buffer { padding-top: 12px; }
.ad-buffer h1 { font-size: 1.75rem; line-height: 1.1; margin: 0 0 6px; letter-spacing: -.01em; }
.ad-buffer .how { margin: 0 0 6px; font-size: .9375rem; line-height: 1.4; font-weight: 700; }
.ad-buffer .saved { margin: 0; display: flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 800; color: var(--muted); }
#keeper { margin: 12px 0 1rem; }
.k-panel { padding: 10px 14px 14px; margin-bottom: 14px; }
.k-panel h2 { margin: .25rem 0 .5rem; font-size: 1.25rem; line-height: 1.2; }
.k-players { list-style: none; padding: 0; display: grid; gap: .5rem; }
.k-players li { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.k-status { padding: .4rem .7rem; border-radius: 10px; background: var(--soft); font-weight: 700; font-size: .875rem; margin: .25rem 0 .5rem; }
.k-status.won { background: var(--sun); color: var(--ink); }
.k-board-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.k-board-head h2 { margin: 0 0 .25rem; }
.k-target { font-size: .8125rem; font-weight: 800; color: var(--muted); }
.k-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.k-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; }
.k-row.lead, .k-row.win { background: var(--sun-tint); }
.k-seat { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--seat); color: #fff; border: 2px solid var(--outline); display: flex; align-items: center; justify-content: center; font-size: .875rem; font-weight: 900; }
.k-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.k-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 1.0625rem; font-weight: 900; overflow-wrap: anywhere; }
.k-crown { width: 16px; height: 16px; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 8 L7.5 12 L12 5 L16.5 12 L21 8 L19 19 H5 Z' fill='%23FFC53D' stroke='%231C1E3A' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.k-tag { font-size: .75rem; font-weight: 800; padding: 0 8px; border: 2px solid var(--outline); border-radius: 999px; background: var(--sun); color: var(--ink); line-height: 1.3; }
.k-sub { font-size: .8125rem; font-weight: 700; color: var(--muted); }
.k-bar { display: block; height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.k-fill { display: block; height: 100%; border-radius: 4px; background: var(--seat); }
.k-total { flex: none; font-size: 1.625rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.k-table tr.lead th, .k-table tr.lead td { background: var(--sun-tint); }
.k-table tr.editing th, .k-table tr.editing td { outline: 2px solid var(--focus); }
.k-history td, .k-history th { padding: .35rem .5rem; }
.k-hint { color: var(--muted); font-size: .875rem; font-weight: 600; margin: .25rem 0; }
.k-error { color: var(--err); font-weight: 800; min-height: 1.2em; margin: .25rem 0; }
.k-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 10px; align-items: end; }
.k-grid .wide { grid-column: 1 / -1; }
.k-field { display: grid; gap: 4px; font-weight: 800; font-size: .875rem; }
.k-hand { display: grid; gap: .5rem; grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); align-items: end; padding-bottom: .5rem; border-bottom: 1px dashed var(--line); }
.k-hidden[hidden] { display: none; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; font-size: .875rem; font-weight: 800; }
fieldset:not(.k-team) { display: flex; flex-wrap: wrap; gap: 8px; }
fieldset:not(.k-team) > legend { flex: 0 0 100%; }
.k-radio {
  display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 12px; flex: 1 1 7rem;
  border: 2px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 800; cursor: pointer;
}
.k-radio:has(input:checked) { border-color: var(--outline); background: var(--sun-tint); }
.k-radio input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--text); }
.k-radio.wide { flex-basis: 100%; }
.k-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 .25rem; }
.k-form .k-actions .btn.primary { flex: 1 1 14rem; }
.k-preview { padding: 2px 10px; border-radius: 999px; background: var(--sun); color: var(--ink); font-size: .9375rem; border: 2px solid var(--outline); }
fieldset.k-team { background: var(--soft); border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px 12px; display: block; }
.k-team legend { font-weight: 900; padding: 0 .25rem; font-size: 1rem; }
.k-calc { background: var(--soft); border: 2px solid var(--line); border-radius: 14px; padding: .5rem .75rem; }
.k-calc h3 { margin-top: 0; }
.k-combos { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.combo { border-radius: 999px; padding: 0 14px; font-size: .9375rem; }
.btn.combo b { font-weight: 900; }
.k-calc-total { font-size: 1.6rem; font-weight: 900; }
details summary { cursor: pointer; font-weight: 900; font-size: 1.25rem; min-height: 44px; display: flex; align-items: center; }
.k-yahtzee th[scope=row] { min-width: 7rem; position: sticky; left: 0; background: var(--surface); }
.k-yahtzee select { min-width: 5rem; }
.k-yahtzee tr.sub th, .k-yahtzee tr.sub td { background: var(--sun-tint); font-weight: 800; }
.summary { margin-top: 1.5rem; padding: 4px 16px 16px; }
.k-quick { display: flex; flex-wrap: wrap; gap: .4rem; }
.k-tip { padding: .6rem 1rem; background: var(--sun-tint); margin-bottom: 14px; }
.k-tip p { margin: .25rem 0; font-weight: 600; }
.k-tally td, .k-tally th { vertical-align: middle; }
.k-count { display: inline-flex; align-items: center; gap: .3rem; }
.k-count output { min-width: 1.5rem; text-align: center; font-weight: 900; }

/* ad spots. Rules pages keep one tall spot. A keeper page has one 320 x 50 banner at the top. The
   page heading (.ad-buffer) and the keeper's read-only score board below it keep at least 150 px
   between the banner and the first button, field or link (standing rule 8). */
.ad-slot-banner { width: 320px; max-width: 100%; height: 50px; min-height: 0; margin: .75rem auto 0; overflow: hidden; }
.env-preview .ad-slot { border: 2px dashed var(--muted); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 800; }
.env-preview .ad-slot::before { content: "Ad"; font-size: .8125rem; }
.rules .keeping h2::after { display: none; }
[hidden] { display: none !important; }
.summary { background: var(--surface); border: 2px solid var(--outline); border-radius: 16px; box-shadow: 4px 4px 0 var(--shadow); }
