/* Yatzy Scorecard — shared foundations: colour tokens for all three theme
   states, the reset, masthead and toolbar primitives, and the blank-sheet
   print rules. Loaded by the scorecard and the printable sheets page so the
   two never drift apart. Page-specific CSS goes in each page's own <style>,
   which is linked after this file and therefore wins. */

  :root{
    --ground:#E6E2DE;
    --surface:#FBF9F7;
    --surface-2:#F1EDE9;
    --ink:#232022;
    --ink-2:#6E6560;
    --ink-3:#9A918B;
    --rule:#DBD4CE;
    --rule-strong:#BEB4AC;
    --accent:#8E2B34;
    --accent-wash:rgba(142,43,52,.09);
    --accent-line:rgba(142,43,52,.35);
    --good:#1D6B5E;
    --good-wash:rgba(29,107,94,.11);
    --brass:#8E6318;
    --brass-wash:rgba(142,99,24,.12);
    --die-face:#FAF7F2;
    --die-edge:#CFC6BC;
    --die-pip:#2A2422;
    --shadow:0 1px 0 rgba(35,32,34,.05), 0 10px 26px -16px rgba(35,32,34,.45);
    --sans:"IBM Plex Sans",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
    --mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
    --display:"Archivo","IBM Plex Sans",ui-sans-serif,system-ui,sans-serif;
    --label-w:170px;
  }
  @media (prefers-color-scheme: dark){
    :root:not([data-theme="light"]){
      --ground:#151311;
      --surface:#201D1B;
      --surface-2:#2A2522;
      --ink:#F0EAE4;
      --ink-2:#A79C93;
      --ink-3:#7C7269;
      --rule:#38322E;
      --rule-strong:#50473F;
      --accent:#D9737A;
      --accent-wash:rgba(217,115,122,.14);
      --accent-line:rgba(217,115,122,.45);
      --good:#57B7A4;
      --good-wash:rgba(87,183,164,.14);
      --brass:#D3A44A;
      --brass-wash:rgba(211,164,74,.15);
      --die-edge:#8A8079;
      --shadow:0 1px 0 rgba(0,0,0,.4), 0 12px 28px -16px rgba(0,0,0,.9);
    }
  }
  :root[data-theme="dark"]{
    --ground:#151311;
    --surface:#201D1B;
    --surface-2:#2A2522;
    --ink:#F0EAE4;
    --ink-2:#A79C93;
    --ink-3:#7C7269;
    --rule:#38322E;
    --rule-strong:#50473F;
    --accent:#D9737A;
    --accent-wash:rgba(217,115,122,.14);
    --accent-line:rgba(217,115,122,.45);
    --good:#57B7A4;
    --good-wash:rgba(87,183,164,.14);
    --brass:#D3A44A;
    --brass-wash:rgba(211,164,74,.15);
    --die-edge:#8A8079;
    --shadow:0 1px 0 rgba(0,0,0,.4), 0 12px 28px -16px rgba(0,0,0,.9);
  }

  *{box-sizing:border-box}
  html{scroll-behavior:smooth}
  body{
    background:var(--ground);
    color:var(--ink);
    font-family:var(--sans);
    font-size:15px;
    line-height:1.5;
    -webkit-font-smoothing:antialiased;
  }
  .wrap{max-width:1040px;margin:0 auto;padding-inline:16px;padding-block:22px 40px;display:flex;flex-direction:column;gap:18px}
  button{font:inherit;color:inherit}
  :focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px}

  /* ---------- masthead ---------- */
  .masthead{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px 20px}
  .mark{display:flex;flex-direction:column;gap:2px}
  .mark h1{
    margin:0;font-family:var(--display);font-weight:700;
    font-size:clamp(1.55rem,5.2vw,2.15rem);letter-spacing:.13em;text-transform:uppercase;
    line-height:1;text-wrap:balance;
  }
  .mark .sub{font-size:.72rem;letter-spacing:.22em;text-transform:uppercase;color:var(--ink-2);font-weight:600}
  .status{display:flex;align-items:center;gap:8px;font-size:.82rem;color:var(--ink-2)}
  .status .rnd{font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--ink)}
  .status .who{color:var(--accent);font-weight:600}

  /* ---------- toolbar ---------- */
  .toolbar{display:flex;flex-wrap:wrap;gap:8px}
  .btn{
    background:var(--surface);border:1px solid var(--rule-strong);border-radius:999px;
    padding:6px 14px;font-size:.82rem;font-weight:500;cursor:pointer;
    transition:border-color .15s,color .15s,background .15s;
  }
  .btn:hover:not(:disabled){border-color:var(--accent);color:var(--accent)}
  .btn:disabled{opacity:.45;cursor:not-allowed}
  /* Navigation, not a game action — quieter than the buttons beside it. */
  a.btn{display:inline-flex;align-items:center;gap:5px;text-decoration:none;
    background:none;border-color:transparent;color:var(--ink-2)}
  a.btn:hover{border-color:var(--rule-strong);color:var(--accent)}

  /* Ruleset switch. The pressed label takes its text from --surface so it
     reads as light-on-oxblood in light and dark-on-rose in dark. */
  .seg{display:inline-flex;gap:2px;padding:2px;margin-right:4px;
    background:var(--surface-2);border:1px solid var(--rule-strong);border-radius:999px}
  .seg-btn{background:none;border:0;border-radius:999px;padding:5px 13px;cursor:pointer;
    font-size:.8rem;font-weight:500;color:var(--ink-2);transition:background .15s,color .15s}
  .seg-btn:hover{color:var(--ink)}
  .seg-btn[aria-pressed="true"]{background:var(--accent);color:var(--surface);font-weight:600}

  /* ---------- print ----------
     A blank sheet built from the active ruleset, six columns wide so any
     group can use it. Sized for A4; Letter just gets a wider side margin.
     No @page size, so the browser honours the paper the user actually has. */
  .print-sheet{display:none}

  @media print{
    @page{margin:12mm}
    :root{padding:0}
    html{scroll-behavior:auto}
    body{background:#fff;color:#000;font-size:9.5pt;line-height:1.3}
    /* Which elements to hide on paper is page-specific and lives in each
       page's own <style>. This file only sizes and styles the sheet. */

    .ps-head{display:flex;align-items:flex-end;justify-content:space-between;gap:8mm;
      border-bottom:.5mm solid #000;padding-bottom:2mm;margin-bottom:5mm}
    .ps-title{font-family:var(--display);font-weight:700;font-size:15pt;line-height:1;
      letter-spacing:.12em;text-transform:uppercase}
    .ps-sub{font-size:8pt;letter-spacing:.18em;text-transform:uppercase;margin-top:1.5mm}
    .ps-meta{font-size:8.5pt;white-space:nowrap}

    table.ps{width:100%;border-collapse:collapse;table-layout:fixed}
    table.ps col.ps-lab{width:34%}
    table.ps th,table.ps td{border:.2mm solid #000;padding:1.1mm 1.6mm;text-align:left}
    table.ps td{height:7.6mm}
    table.ps thead th{height:9mm;font-size:8.5pt;font-weight:600;text-align:center}
    table.ps tbody th{font-weight:400;font-size:9pt}
    .ps-hint{display:block;font-size:6.6pt;color:#444}
    tr.ps-band th{font-weight:700;font-size:7.5pt;letter-spacing:.16em;text-transform:uppercase}
    tr.ps-sum th{font-weight:600;font-size:8.5pt}
    tr.ps-total th,tr.ps-total td{border-top:.5mm solid #000;height:10mm}
    tr.ps-total th{font-weight:700;font-size:10.5pt;text-transform:uppercase;letter-spacing:.08em}
    table.ps tr{page-break-inside:avoid}

    .ps-foot{margin-top:4mm;font-size:7.5pt;line-height:1.55}
    .ps-foot b{font-family:var(--mono)}
  }
