/* ------------------------------------------------------------------
   Fonts (self-hosted: no Google Fonts, no tracking)
------------------------------------------------------------------ */
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/source-serif-4-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400; font-style: italic; font-display: swap; src: url(../fonts/source-serif-4-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-style: normal; font-display: swap; src: url(../fonts/source-serif-4-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 700; font-style: normal; font-display: swap; src: url(../fonts/source-serif-4-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Caveat"; font-weight: 700; font-display: swap; src: url(../fonts/caveat-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(../fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }

/* ------------------------------------------------------------------
   Club colours — change --accent to your school colour
------------------------------------------------------------------ */
:root {
  --accent: #7a2430;
  --accent-ink: #5e1a24;
  --accent-wash: #f3e7e4;
  --paper: #f8f5ef;
  --card: #fffdf9;
  --ink: #1d1b18;
  --muted: #6d675d;
  --rule: #ddd5c6;
  --rule-strong: #1d1b18;
  --up: #2f5a57;
  --down: #9a3a2a;
  --blue: #1e3fae;        /* biro: anything a player wrote */
  --red: #c8202f;         /* arbiter's pen: anything the admin did */
  --cond: "IBM Plex Sans Condensed", "Arial Narrow", var(--sans);
  --pen: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 12px; top: 12px; background: var(--card); padding: 6px 10px; z-index: 10; }
main.wrap { min-height: 60vh; padding-top: 36px; padding-bottom: 56px; }
#view:focus, #view:focus-visible { outline: none; }

/* Masthead: printed-notice style, double rule */
.masthead { border-bottom: 3px double var(--rule-strong); padding-top: 34px; background: var(--paper); }
.title-link { text-decoration: none; color: inherit; }
.masthead h1 { font: 700 clamp(30px, 5vw, 44px)/1.05 var(--serif); letter-spacing: -0.01em; margin: 0; }
.tagline { font: italic 400 17px/1.4 var(--serif); color: var(--muted); margin: 6px 0 20px; }
.site-nav { display: flex; gap: 26px; flex-wrap: wrap; font-size: 15px; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 8px 0 10px; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current] { border-bottom-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.site-nav .admin-link { margin-left: auto; color: var(--muted); }

h2 { font: 600 26px/1.2 var(--serif); margin: 0 0 14px; }
h3 { font: 600 19px/1.3 var(--serif); margin: 30px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.aside { color: var(--muted); font-size: 14px; margin: 10px 0; }
.loading { color: var(--muted); font-style: italic; font-family: var(--serif); }
.narrow { max-width: 640px; }
.crumb { margin: 0 0 4px; font-size: 14px; }
.more { margin-top: 10px; font-size: 14px; }
.grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 48px; }
.grid > aside { border-left: 1px solid var(--rule); padding-left: 32px; }

/* Tables: crosstable feel — rules, not boxes */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { font: 500 12px/1.2 var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
     text-align: left; padding: 8px 10px; border-bottom: 1.5px solid var(--rule-strong); }
td { padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
tbody tr:hover { background: rgba(122, 36, 48, 0.035); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.standings .rank { color: var(--muted); width: 2.5em; }
.standings tbody tr:first-child .rank { color: var(--accent); font-weight: 600; }
.standings .rating { font: 600 17px var(--serif); font-variant-numeric: tabular-nums; }
.player { color: var(--ink); text-decoration: none; font-weight: 500; }
.player:hover { color: var(--accent); text-decoration: underline; }
.wdl span { color: var(--rule); margin: 0 1px; }
.prov { font: italic 400 13px var(--serif); color: var(--muted); text-decoration: none; margin-left: 2px; cursor: help; vertical-align: super; }
.delta { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.up { color: var(--up); } .delta.down { color: var(--down); } .delta.flat { color: var(--muted); }
.tag { font: 500 11px var(--sans); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
       border: 1px solid var(--rule); padding: 1px 6px; border-radius: 3px; vertical-align: middle; }
tr.inactive td { color: var(--muted); }

/* Results list */
.results { list-style: none; margin: 0; padding: 0; }
.results li { display: grid; grid-template-columns: 6.5em 1fr auto; align-items: baseline; gap: 12px;
              padding: 9px 0; border-bottom: 1px solid var(--rule); }
.results.compact li { grid-template-columns: 4em 1fr; font-size: 15px; }
.results .when { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.results .tc { color: var(--muted); font-size: 13px; }
.pairing { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: baseline; }
.pairing .w { text-align: right; }
.score, .q-game .score { font: 600 16px var(--serif); font-variant-numeric: tabular-nums; min-width: 2.4em; text-align: center; }
.month { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--sans); font-weight: 500;
         color: var(--accent-ink); margin: 28px 0 4px; }

/* Profile */
.profile-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
                border-bottom: 1px solid var(--rule); padding-bottom: 18px; }
.player-name { font-size: 36px; margin: 0; }
.facts { display: flex; gap: 32px; margin: 0; }
.facts dt { font: 500 12px var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font: 600 20px var(--serif); font-variant-numeric: tabular-nums; }
.facts dd.big { font-size: 30px; color: var(--accent-ink); line-height: 1; }
.facts dd .muted { font: 400 14px var(--sans); }
.chart { margin: 22px 0 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--accent); }
.chart .tick { font: 11px var(--sans); fill: var(--muted); }
.colour { display: inline-block; width: 10px; height: 10px; border: 1px solid var(--ink); margin-right: 8px; vertical-align: 0; }
.colour.white { background: #fff; } .colour.black { background: var(--ink); }
.res.win { color: var(--up); font-weight: 500; } .res.loss { color: var(--down); } .res.draw { color: var(--muted); }

/* Forms */
form { display: grid; gap: 16px; }
label { display: grid; align-content: start; gap: 5px; font-size: 14px; font-weight: 500; }
label small { font-weight: 400; color: var(--muted); }
input, select { font: 16px var(--sans); color: var(--ink); background: var(--card); border: 1px solid #c9c0ae;
                border-radius: 4px; padding: 9px 10px; width: 100%; }
input:focus, select:focus { border-color: var(--accent); outline: 2px solid var(--accent-wash); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.tc-other { margin-top: 6px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.outcome { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.outcome legend { grid-column: 1 / -1; }
.outcome label { display: block; cursor: pointer; }
.outcome input { position: absolute; opacity: 0; width: 1px; }
.outcome span { display: grid; place-items: center; gap: 2px; padding: 10px 6px; border: 1px solid #c9c0ae; background: var(--card);
                font-weight: 400; font-size: 13px; color: var(--muted); text-align: center; }
.outcome label + label span { border-left: 0; }
.outcome label:first-of-type span { border-radius: 4px 0 0 4px; } .outcome label:last-of-type span { border-radius: 0 4px 4px 0; }
.outcome b { font: 600 20px var(--serif); color: var(--ink); }
.outcome input:checked + span { background: var(--accent); border-color: var(--accent); color: #f6e9e6; }
.outcome input:checked + span b { color: #fff; }
.outcome input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { font: 500 15px var(--sans); background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 4px;
       padding: 10px 18px; cursor: pointer; justify-self: start; }
.btn:hover { background: var(--accent-ink); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.secondary { background: transparent; color: var(--accent-ink); }
.btn.secondary:hover { background: var(--accent-wash); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link.danger { color: var(--down); }
.form-error { color: var(--down); margin: 0; font-size: 14px; }
.notice { background: var(--accent-wash); border-left: 3px solid var(--accent); padding: 10px 14px; font-size: 14px; }
.notice.error { background: #f7e4df; border-color: var(--down); }
form.inline { grid-template-columns: 1fr auto; align-items: end; max-width: 520px; }
.settings { max-width: 520px; margin-bottom: 28px; }
.settings h3 { margin-top: 10px; }

/* Admin */
.admin-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--rule); margin-bottom: 22px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 0; font: 15px var(--sans);
               color: var(--muted); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.count { display: inline-block; background: var(--accent); color: #fff; font-size: 12px; border-radius: 9px; padding: 0 7px; margin-left: 4px; }
.queue { list-style: none; padding: 0; margin: 0 0 18px; }
.queue li { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.q-game { display: flex; gap: 12px; align-items: baseline; font-weight: 500; }
.q-game .score { min-width: 0; }
.q-meta { grid-column: 1; font-size: 14px; color: var(--ink); }
.q-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 8px; align-self: center; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .link + .link { margin-left: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper);
         padding: 10px 16px; border-radius: 4px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.18); z-index: 20; max-width: 90vw; }
.toast.error { background: var(--down); }

footer.wrap.foot { border-top: 1px solid var(--rule); padding-top: 18px; padding-bottom: 40px; color: var(--muted); font-size: 13px; }
.foot p { margin: 4px 0; }
.demo-only { display: none; }
.is-demo .demo-only { display: block; }

@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .grid { grid-template-columns: 1fr; gap: 32px; }
  .grid > aside { border-left: 0; padding-left: 0; }
  .hide-sm { display: none; }
  .pair { grid-template-columns: 1fr; }
  .site-nav { gap: 18px; }
  .site-nav .admin-link { margin-left: 0; }
  .results li { grid-template-columns: 1fr; gap: 2px; }
  .results.compact li { grid-template-columns: 3.6em 1fr; }
  .facts { gap: 20px; }
  .queue li { grid-template-columns: 1fr; }
  .q-actions { grid-row: auto; grid-column: 1; margin-top: 6px; }
  form.inline { grid-template-columns: 1fr; }
}
form.rename { display: flex; gap: 10px; align-items: center; }
form.rename input { padding: 5px 8px; max-width: 14em; }

/* ------------------------------------------------------------------
   Profiles
------------------------------------------------------------------ */
.highlights { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-top: 1.5px solid var(--rule-strong); }
.highlights > div { padding: 12px 14px 14px 0; border-bottom: 1px solid var(--rule); }
.highlights dt { font: 500 12px var(--sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.highlights dd { margin: 0; font-size: 16px; }
.highlights .sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.tour-hist { list-style: none; padding: 0; margin: 0; }
.tour-hist li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.tour-hist .place { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------
   Tournaments
------------------------------------------------------------------ */
.tlist { list-style: none; padding: 0; margin: 0 0 8px; }
.tlist li { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.tlist a { font: 600 18px var(--serif); color: var(--ink); text-decoration: none; }
.tlist a:hover { color: var(--accent); text-decoration: underline; }
.tlist .muted { font-size: 14px; }
.new-t { margin-top: 28px; }
.tmeta { color: var(--muted); margin: -6px 0 22px; font-size: 15px; }
.status.running { color: var(--accent-ink); font-weight: 500; }
.tgrid { display: flex; flex-direction: column; gap: 8px; }
.tournament.finished .t-standings { order: -1; }
.tournament h3 { margin-top: 18px; }
.crosstable td, .crosstable th { padding: 8px 8px; }
.crosstable .pts { font: 600 17px var(--serif); }
.crosstable .rc { font-size: 14px; white-space: nowrap; }
.crosstable tbody tr:first-child .rank { color: var(--accent); font-weight: 600; }
.entrants { columns: 3 12em; padding-left: 1.4em; margin: 0; }
.entrants li { padding: 3px 0; }
.round-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.round-tabs { display: flex; gap: 4px; }
.round-tabs button { font: 14px var(--sans); min-width: 30px; height: 30px; border: 1px solid var(--rule); background: var(--card); border-radius: 4px; cursor: pointer; color: var(--muted); }
.round-tabs button[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.boards td, .boards th { padding: 8px 10px; }
.boards .w { text-align: right; }
.boards .c { text-align: center; white-space: nowrap; }
.draft .boards select { width: auto; min-width: 12em; padding: 6px 8px; }
.respick { display: inline-flex; gap: 0; align-items: center; }
.respick button { font: 600 14px var(--serif); padding: 5px 9px; border: 1px solid #c9c0ae; background: var(--card); color: var(--ink); cursor: pointer; margin-left: -1px; }
.respick button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.respick button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; position: relative; }
.respick select { width: 2.6em; font-size: 13px; padding: 5px 4px; margin-left: 6px; border-radius: 4px; color: var(--muted); }
.respick select.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.arbiter { border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--card); padding: 14px 18px; margin-bottom: 18px; }
.arb-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.arb-bar p { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.draft { margin-top: 16px; border-top: 1px solid var(--rule); padding-top: 4px; }
.tplayers { margin-top: 12px; }
.tplayers summary { cursor: pointer; color: var(--accent-ink); font-size: 14px; }
.tplayers ul { list-style: none; padding: 0; columns: 3 14em; margin: 10px 0; }
.tplayers li { padding: 3px 0; font-size: 14px; }
.tplayers li .link { font-size: 13px; margin-left: 6px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: auto; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(11em, 1fr)); gap: 4px 12px; margin: 6px 0; }
.link.small { font-size: 13px; font-weight: 400; margin-left: 8px; }

@media (max-width: 760px) {
  .highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .respick button { padding: 6px 8px; }
  .boards .w { text-align: left; }
}

/* Printing: pairings sheet for the noticeboard */
@media print {
  body { background: #fff; font-size: 12pt; }
  .site-nav, .foot, .no-print, .skip, .toast { display: none !important; }
  .masthead { padding-top: 0; border-bottom: 1px solid #000; }
  .tagline { display: none; }
  .print-pairings .t-standings { display: none; }
  .boards td, .boards th { padding: 6px 8px; }
  a { color: #000; text-decoration: none; }
}

/* ------------------------------------------------------------------
   Titles, markers, achievements
------------------------------------------------------------------ */
/* Arbiter's red pen: titles boxed, ♔ circled, e.p. in handwriting */
.ttl { font: 600 11px var(--cond); letter-spacing: 0.05em; color: var(--red); border: 1.5px solid currentColor;
       border-radius: 2px; padding: 0 4px; margin-left: 6px; vertical-align: 2px; white-space: nowrap; }
.ttl.big { font-size: 15px; padding: 1px 7px; vertical-align: 0; margin-left: 0; }
.player-name .ttl { font-size: 16px; vertical-align: 6px; margin-left: 10px; }
.king { position: relative; display: inline-block; color: var(--red); font-size: 1.1em; line-height: 1; padding: 0 .3em; cursor: help; }
.king::after { content: ""; position: absolute; inset: -.2em -.05em -.15em; border: 1.5px solid var(--red);
               border-radius: 50%; transform: rotate(-8deg); pointer-events: none; }
.ep { font: 700 17px/1 var(--pen); color: var(--red); text-decoration: none; white-space: nowrap; cursor: help; }
.achievements { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15em, 1fr)); gap: 0 18px; }
.achievements li { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.achievements b { font: 600 15px var(--serif); }
.achievements span { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.achievements time { grid-row: 1; grid-column: 2; font-size: 12px; color: var(--muted); }
.achievements li.got b::before { content: "✓ "; color: var(--accent); font-family: var(--sans); }
.achievements li.locked { opacity: .5; }
.achievements li.locked b { font-weight: 400; }

/* Attendance */
.att-head { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; }
.att-head label { max-width: 14em; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr)); gap: 8px; margin-top: 8px; }
.att { font: 500 15px var(--sans); padding: 12px 10px; border: 1px solid #c9c0ae; background: var(--card); color: var(--ink);
       border-radius: 4px; cursor: pointer; text-align: left; min-height: 48px; }
.att.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.att.on::before { content: "✓ "; }

/* PINs */
.pin-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 14px 0; font-size: 14px; }
.slips-wrap { border: 1px dashed var(--rule-strong); padding: 14px 16px; margin-bottom: 18px; background: var(--card); }
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(12em, 1fr)); gap: 8px; }
.slip { border: 1px dashed var(--muted); padding: 10px 12px; display: grid; gap: 2px; }
.slip span { font-weight: 500; }
.slip b { font: 700 24px var(--serif); letter-spacing: 0.15em; }
.slip small { color: var(--muted); font-size: 11px; }
form.add-player { grid-template-columns: 1fr 10em auto; max-width: 640px; }
.remembered { font-size: 14px; }
.whoami { display: flex; gap: 20px; flex-wrap: wrap; }
.whoami legend { width: 100%; }
label.remember { align-self: end; padding-bottom: 10px; }

/* Settings */
.tiers { display: grid; grid-template-columns: 7em auto 7em; gap: 8px 12px; align-items: end; max-width: 400px; }
.tiers > span { font-size: 14px; color: var(--muted); padding-bottom: 10px; }
.title-row { display: grid; grid-template-columns: 9em 7em auto; gap: 8px; align-items: center; margin-bottom: 6px; }

@media (max-width: 760px) { form.add-player { grid-template-columns: 1fr; } }
@media print {
  .print-slips main > section > *:not(#panel), .print-slips .tabs, .print-slips #panel > *:not(#slips), .print-slips .masthead { display: none !important; }
  .print-slips .slips-wrap { border: 0; padding: 0; }
  .print-slips .slips-wrap > p { display: none; }
}

.results.compact .ttl { display: none; }

/* ------------------------------------------------------------------
   Pen colours: blue biro for what players wrote
------------------------------------------------------------------ */
.results .score { color: var(--blue); font-family: var(--sans); font-weight: 600; }
.results a.player { color: var(--blue); }
.stamp { display: inline-block; font: 600 16px var(--cond); letter-spacing: .14em; text-transform: uppercase; color: var(--red);
         border: 2px solid var(--red); padding: 2px 10px; transform: rotate(-5deg); }

/* Boxed header strip on the home page */
.sheet-head { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 2px solid var(--ink); margin: 0 0 30px; background: var(--card); }
.sheet-head > div { padding: 6px 12px 8px; border-right: 1px solid var(--ink); min-width: 0; }
.sheet-head > div:last-child { border-right: 0; }
.lbl { display: block; font: 600 11px/1.3 var(--cond); letter-spacing: .09em; text-transform: uppercase; color: var(--ink); }
.sheet-head b { display: block; font: 600 22px/1.25 var(--cond); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) {
  .sheet-head { grid-template-columns: 1fr 1fr; }
  .sheet-head > div:nth-child(2) { border-right: 0; }
  .sheet-head > div:nth-child(-n+2) { border-bottom: 1px solid var(--ink); }
}

/* ------------------------------------------------------------------
   Submit page: the form is a scoresheet
------------------------------------------------------------------ */
.sheet-intro { margin: -6px 0 16px; color: var(--muted); font-size: 15px; }
form.sheet { gap: 16px; }
.sheet-box { border: 2px solid var(--ink); background: var(--card); }
.sheet-box > * + * { border-top: 1px solid var(--ink); }
.sheet-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.sheet-row > * + * { border-left: 1px solid var(--ink); }
.cell { display: block; padding: 6px 10px 6px; font-weight: 400; }
.cell:focus-within, .sheet-player:focus-within { background: #f1f3f9; }
.lbl i { font-style: normal; text-transform: none; letter-spacing: 0; font: 400 12px var(--sans); color: var(--muted); }
.pen, .pen:focus { font: 700 25px/1.2 var(--pen); color: var(--blue); background: transparent; border: 0; border-radius: 0;
                   padding: 0; outline: none; width: 100%; min-height: 34px; }
select.pen { -webkit-appearance: none; appearance: none; padding-right: 22px; cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%231d1b18' stroke-width='2' fill='none'/%3E%3C/svg%3E") right 2px center no-repeat; }
.pen option { font: 16px var(--sans); color: var(--ink); }
.pen::placeholder { color: #a9b2c8; }
.pen.tc-other { margin-top: 0; border-top: 1px dashed #c9c0ae; }
.sheet-player { display: grid; grid-template-columns: 82px minmax(0, 1fr); font-weight: 400; }
.sheet-player .lbl { display: flex; align-items: center; gap: 7px; padding: 0 10px; background: #eef0ec; border-right: 1px solid var(--ink); font-size: 12px; }
.sheet-player .colour { margin: 0; }
.sheet-player .pen { padding: 8px 32px 8px 10px; background-position: right 12px center; }
.sheet-box > .sheet-player + .circle { border-top-width: 2px; }

/* "Circle one": the choice gets a blue biro ring */
.circle { padding: 6px 10px 12px; }
.circle legend { float: left; width: 100%; padding: 0 0 6px; margin: 0; }
.circle .opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; clear: both; }
.circle .opts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.circle label { display: block; cursor: pointer; font-weight: 400; }
.circle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.circle span { position: relative; display: grid; place-items: center; gap: 0; min-height: 60px; padding: 6px 4px;
               border: 1.5px solid var(--ink); background: #fff; text-align: center; }
.circle span b { font: 600 22px/1.1 var(--cond); color: var(--ink); }
.circle span small { font: 600 11px var(--cond); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.circle .opts.two span { min-height: 46px; }
.circle .opts.two span b { font-size: 17px; letter-spacing: .04em; text-transform: uppercase; }
.circle input:checked + span::after { content: ""; position: absolute; top: 5px; bottom: 5px; left: 50%; width: min(calc(100% - 6px), 8.5em);
                                      border: 2.5px solid var(--blue); border-radius: 50%; transform: translateX(-50%) rotate(-5deg); pointer-events: none; }
.circle input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.sig { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; font-weight: 400; }
.sig .lbl { flex: 1; }
.pen.pin { width: 5.5em; min-height: 46px; font-size: 32px; letter-spacing: .4em; padding: 0 0 0 .2em;
           border-bottom: 2px solid var(--ink); }
.sheet-box label.remember { display: flex; padding: 10px; border-top: 1px solid var(--rule); font-size: 14px; }
.sheet-box label.remember input { width: 20px; height: 20px; accent-color: var(--ink); }
.btn.hand-in { justify-self: stretch; background: var(--ink); border-color: var(--ink); border-radius: 0; min-height: 52px;
               font: 600 16px var(--cond); letter-spacing: .09em; text-transform: uppercase; }
.btn.hand-in:hover { background: #3a362f; }
.arbiter-copy { margin-top: 24px; border: 2px dashed var(--red); padding: 12px 14px 16px; font-size: 14px; }
.arbiter-copy .lbl { color: var(--red); }
.arbiter-copy p { margin: 4px 0 12px; }
@media (max-width: 480px) {
  .sheet-row { grid-template-columns: 1fr; }
  .sheet-row > * + * { border-left: 0; border-top: 1px solid var(--ink); }
}

/* ------------------------------------------------------------------
   Board
------------------------------------------------------------------ */
.board { position: relative; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); aspect-ratio: 1; width: 100%;
         border: 2px solid var(--ink); user-select: none; -webkit-user-select: none; touch-action: none; }
.board .sq { position: relative; border: 0; padding: 0; margin: 0; display: block; aspect-ratio: 1; cursor: default; }
.board .light { background: #efe6d2; } .board .dark { background: #b49a76; }
.board .sq svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.board .sq svg.lifted { opacity: .25; }
.board.live [data-mine], .board.live .target { cursor: pointer; }
.board .last::before, .board .sel::before { content: ""; position: absolute; inset: 0; background: rgba(30, 63, 174, .2); }
.board .sel::before { background: rgba(30, 63, 174, .34); }
.board .target::after { content: ""; position: absolute; left: 50%; top: 50%; width: 26%; height: 26%; transform: translate(-50%, -50%);
                        border-radius: 50%; background: rgba(30, 63, 174, .42); pointer-events: none; }
.board .target.capture::after { width: 84%; height: 84%; background: none; border: 3px solid rgba(30, 63, 174, .45); }
.board .wrong::before { content: ""; position: absolute; inset: 0; background: rgba(200, 32, 47, .45); }
.board .sq:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; z-index: 1; }
.board i { position: absolute; font: 600 10px/1 var(--cond); font-style: normal; pointer-events: none; opacity: .75; }
.board .cf { right: 3px; bottom: 2px; } .board .cr { left: 3px; top: 3px; }
.board .light i { color: #8a7458; } .board .dark i { color: #f3ecdc; }
.ghost { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 30; }
.ghost svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 6px rgba(0,0,0,.25)); }
.promo { position: absolute; inset: 25% 10%; background: var(--card); border: 2px solid var(--ink); display: grid; place-items: center;
         gap: 6px; padding: 10px; z-index: 5; text-align: center; }
.promo p { margin: 0; font: 600 12px var(--cond); letter-spacing: .08em; text-transform: uppercase; }
.promo div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: 100%; }
.promo div button { aspect-ratio: 1; border: 1.5px solid var(--ink); background: #fff; padding: 4px; cursor: pointer; }
.promo div button svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------------
   Puzzles
------------------------------------------------------------------ */
.pz-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.pz-board { max-width: 560px; }
.pz-side form.sheet { margin-bottom: 12px; }
.pz-who { font-size: 14px; margin: 0 0 10px; }
.pz-status p { margin: 0 0 8px; }
.pz-right { font-weight: 600; color: var(--up); }
.pz-wrong { font-weight: 600; color: var(--red); }
.pz-done { margin: 4px 0 14px !important; }
.pz-done .stamp { font-size: 20px; }
.solution { margin: 14px 0 10px; }
.lbl-row { padding: 6px 10px; }
.moves { font-size: 15px; }
.moves th.lbl { display: table-cell; text-align: left; }
.moves th { padding: 4px 10px; border-bottom: 1px solid var(--ink); background: #eef0ec; }
.moves td { padding: 2px 10px; border-bottom: 1px solid var(--rule); }
.moves td:first-child { width: 3.5em; color: var(--muted); font-variant-numeric: tabular-nums; }
.moves tbody tr:last-child td { border-bottom: 0; }
.pen-txt { font: 700 23px/1.25 var(--pen); color: var(--blue); }
.pz-game { font: 600 16px/1.4 var(--serif); margin: 12px 0 6px; }
.pz-note { font-style: italic; color: var(--muted); margin: 0 0 8px; }
.pz-notes { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.pz-notes li { padding: 6px 0; border-top: 1px solid var(--rule); }
.pz-notes b { font-family: var(--cond); margin-right: 4px; }
.replay { margin-top: 10px; }
.replay .btn { min-width: 44px; }
.pz-list { list-style: none; padding: 0; margin: 0; }
.pz-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.pz-list .n { font: 600 13px var(--cond); letter-spacing: .06em; text-transform: uppercase; min-width: 4.5em; }
.pz-list a { font: 600 17px var(--serif); color: var(--ink); text-decoration: none; }
.pz-list a:hover { color: var(--accent); text-decoration: underline; }
.pz-list .muted { font-size: 14px; flex-basis: 100%; padding-left: calc(4.5em + 12px); }
.imp { max-width: 720px; }
.imp textarea { font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; width: 100%; padding: 10px; border: 1px solid #c9c0ae; border-radius: 4px; background: var(--card); }
.pz-preview { padding-left: 1.4em; margin: 4px 0 12px; }
.pz-preview li { padding: 3px 0; }
.pz-preview .bad { color: var(--down); }
.pzq button[disabled] { opacity: .3; cursor: default; }
.pzq .link { text-decoration: none; font-size: 16px; }
.pzq .link.danger { font-size: 14px; text-decoration: underline; }
@media (max-width: 760px) {
  .pz-grid { grid-template-columns: 1fr; gap: 20px; }
  .pz-list .muted { padding-left: 0; }
}

/* ------------------------------------------------------------------
   Noticeboard (admin's notices: red pen dates)
------------------------------------------------------------------ */
.nb-head { margin-top: 34px; }
.notices { list-style: none; padding: 0; margin: 0; }
.notices li { display: grid; grid-template-columns: 3.4em minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.notices li:first-child { border-top: 1.5px solid var(--rule-strong); }
.nd { display: grid; place-items: center; align-self: start; border: 1.5px solid var(--red); color: var(--red); padding: 2px 0 3px;
      font: 600 11px/1.1 var(--cond); letter-spacing: .08em; text-transform: uppercase; background: var(--card); }
.nd b { font: 600 22px/1.05 var(--cond); letter-spacing: 0; }
.nd.none { font-size: 20px; padding: 6px 0; border-style: dashed; }
.nt { font: 600 17px/1.3 var(--serif); }
.nw { display: block; font: 600 12px var(--cond); letter-spacing: .06em; text-transform: uppercase; color: var(--red); margin-top: 1px; }
.notices p { margin: 4px 0 0; font-size: 14.5px; overflow-wrap: anywhere; }
.notice-form textarea { font: 16px var(--sans); color: var(--ink); background: var(--card); border: 1px solid #c9c0ae; border-radius: 4px; padding: 9px 10px; width: 100%; }
.nlist td.actions .link + .link { margin-left: 14px; }
