/* Cassidy Chess — cassidychess.com
   Single-screen layout: everything fits one desktop viewport; sizes scale with viewport height.
   Palette: evening lawn (dark green), tennis-ball chartreuse, paper ink. */

:root {
  --lawn: #121a17;        /* page background */
  --lawn-2: #18221e;      /* panels */
  --square: #1d2924;      /* chessboard square, bar track */
  --line: #2b3a33;        /* borders, rules */
  --ink: #ece6d6;         /* headings, primary text */
  --ink-2: #b4bdb6;       /* body text */
  --muted: #9da9a1;       /* secondary text */
  --ball: #cfe24a;        /* tennis ball: the single accent */
  --ball-ink: #1b2108;    /* text on ball */
  --eye: #c27a45;         /* Cassidy's eyes: target milestone only */
  --live: #5cc56d;        /* status: playing */
  --idle: #e8c24a;        /* status: online, between games */
  --off: #6b756f;         /* status: offline */

  --serif: "Young Serif", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1280px;
  --gutter: clamp(16px, 4vw, 40px);
  --vgap: clamp(14px, 3.2vh, 36px);   /* vertical rhythm, tied to screen height */
  --px: 5px;                           /* "pixel" size for stepped 8-bit corners */
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  background: var(--lawn);
  color: var(--ink-2);
  font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { color: var(--ink); font-weight: 400; margin: 0; }
h1, h2 { font-family: var(--serif); letter-spacing: -0.01em; }
p, figure { margin: 0; }

:focus-visible { outline: 3px solid var(--ball); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px;
  min-height: clamp(48px, 7vh, 64px);
}
/* Phones: the nav drops below the brand rather than overflowing. */
@media (max-width: 560px) { .site-header .wrap { padding-block: 8px; } }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  font: 400 1.35rem/1 var(--serif);
}
.brand svg { width: 24px; height: 24px; }
.header-nav { display: flex; align-items: center; gap: clamp(16px, 2.5vw, 28px); }
button.header-link { font: inherit; background: none; border: 0; cursor: pointer; }
.header-link {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--ink-2); font-weight: 500;
  padding: 6px 0; border-bottom: 2px solid transparent;
}
.header-link svg { width: 15px; height: 15px; }
.header-link:hover, .header-link[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ball); }

/* ---------- Main ---------- */
main {
  display: flex; flex-direction: column; justify-content: center;
  gap: var(--vgap);
  padding-block: calc(var(--vgap) * 0.65);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid; grid-template-columns: auto 1fr;
  align-items: center; gap: clamp(28px, 4.5vw, 64px);
}
/* Faint chessboard behind the portrait */
.hero::before {
  content: ""; position: absolute; z-index: -1;
  left: -12vw; top: -8vh; bottom: -6vh; width: calc(12vw + clamp(180px, 32vh, 380px) + 24px);
  background: repeating-conic-gradient(var(--square) 0 25%, transparent 0 50%) 0 0 / 72px 72px;
  -webkit-mask-image: radial-gradient(closest-side at 60% 50%, #000 35%, transparent);
          mask-image: radial-gradient(closest-side at 60% 50%, #000 35%, transparent);
  pointer-events: none;
}

/* The portrait: an 8-bit tile with stepped corners and a hard ball-coloured shadow */
.portrait { width: clamp(180px, 32vh, 380px); }
.tile { position: relative; }
.tile::before {
  content: ""; position: absolute; inset: 0;
  translate: calc(var(--px) * 2) calc(var(--px) * 2);
  background: var(--ball);
}
.tile img, .tile::before {
  clip-path: polygon(
    0 calc(var(--px)*3), var(--px) calc(var(--px)*3), var(--px) var(--px), calc(var(--px)*3) var(--px), calc(var(--px)*3) 0,
    calc(100% - var(--px)*3) 0, calc(100% - var(--px)*3) var(--px), calc(100% - var(--px)) var(--px), calc(100% - var(--px)) calc(var(--px)*3), 100% calc(var(--px)*3),
    100% calc(100% - var(--px)*3), calc(100% - var(--px)) calc(100% - var(--px)*3), calc(100% - var(--px)) calc(100% - var(--px)), calc(100% - var(--px)*3) calc(100% - var(--px)), calc(100% - var(--px)*3) 100%,
    calc(var(--px)*3) 100%, calc(var(--px)*3) calc(100% - var(--px)), var(--px) calc(100% - var(--px)), var(--px) calc(100% - var(--px)*3), 0 calc(100% - var(--px)*3)
  );
}
.tile img { position: relative; width: 100%; aspect-ratio: 1; background: #000; }

.hero h1 {
  font-size: clamp(3rem, min(9vw, 11.5vh), 6.75rem);
  line-height: 0.95; letter-spacing: -0.025em;
}
.lede {
  margin-top: clamp(10px, 2vh, 22px); max-width: 48ch;
  padding-left: 16px; border-left: 4px solid var(--ball);
  font-size: clamp(1.05rem, 2.3vh, 1.3rem); line-height: 1.45; color: var(--ink);
}.traits {
  list-style: none; margin: clamp(14px, 2.6vh, 32px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2.5vw, 36px);
}
.traits h3 { font: 600 1rem/1.3 var(--sans); display: flex; align-items: center; gap: 8px; }
.traits h3 svg { width: 20px; height: 20px; color: var(--ball); flex: none; }
.traits p { margin-top: 6px; font-size: 0.94rem; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 20px; min-height: 48px;
  font: 600 1rem/1 var(--sans); text-decoration: none;
  border: 2px solid var(--ink); color: var(--ink); background: transparent; border-radius: 4px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.btn-primary { background: var(--ball); border-color: var(--ball); color: var(--ball-ink); }
.btn-primary:hover { box-shadow: 4px 4px 0 #8fa12a; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:hover { transform: none; } }

/* ---------- Lower panels ---------- */
.lower {
  display: grid; grid-template-columns: minmax(680px, 1.8fr) minmax(0, 1fr);
  gap: clamp(16px, 2vw, 28px); align-items: stretch;
}
.panel {
  background: var(--lawn-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px;
}
.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; }
.panel-head h1, .panel-head h2 { flex: 1 1 0; min-width: 0; }
.panel h1, .panel h2 { font-size: clamp(1.4rem, 3.2vh, 1.85rem); line-height: 1.15; }
.panel-sub { font-size: 0.9rem; color: var(--muted); margin-left: auto; }
.head-icon { flex: none; width: 26px; height: 26px; color: var(--ball); }

/* ---------- Cassidy on Lichess widget ----------
   Spacing: multiples of 8px. The info column is exactly as tall as the board,
   so both columns share top and bottom edges in every game state. */
.lichess {
  --board: clamp(264px, 33vh, 304px);
  display: grid; grid-template-rows: auto auto; row-gap: 16px;
}

/* Header: icon | title | ratings | status */
.lx-headbar {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center; column-gap: 12px;
}
.lx-title { grid-row: 1; grid-column: 2; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.lx-headbar h2 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lx-headbar > .head-icon { grid-row: 1; grid-column: 1; }
.lx-headbar > .lx-ratings { grid-row: 1; grid-column: 3; }
.lx-headbar > .lx-status { grid-row: 1; grid-column: 4; }
.lx-engine-version { flex: none; white-space: nowrap; font: 400 0.7rem/1.2 var(--sans); color: var(--muted); }
.lx-engine-version[hidden] { display: none; }
.lx-player .lx-engine-version {
  display: block; margin: 2px 0 0 18px;
  font-size: 0.82rem; line-height: 1.3; font-weight: 500; color: var(--ink-2);
}
.lx-player .lx-engine-version[hidden] { display: none; }
.lx-ratings {
  display: grid; grid-template-columns: repeat(3, 3.7em); list-style: none; margin: 0; padding: 0 8px;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.lx-ratings a {
  display: grid; justify-items: end; padding: 4px 8px; border-radius: 4px;
  row-gap: 3px; line-height: 1.15; text-decoration: none;
}
.lx-ratings a:hover { background: var(--lawn); }
.lx-ratings a:hover .val { text-decoration: underline; text-decoration-color: var(--ball); text-underline-offset: 3px; }
.lx-ratings .perf { font-size: 0.78rem; font-weight: 500; color: var(--muted); }
.lx-ratings .val { color: var(--ink); font-weight: 600; font-size: 1.08rem; font-variant-numeric: tabular-nums; }

.lx-status {
  display: inline-flex; align-items: center; gap: 6px; min-width: 6em;
  font-size: 0.86rem; color: var(--muted); white-space: nowrap;
}
.lx-status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.lx-status[data-state="live"] { color: var(--ink); }
.lx-status[data-state="live"]::before { background: var(--live); box-shadow: 0 0 0 3px rgba(92, 197, 109, 0.25); animation: blink 1.4s ease-in-out infinite; }
.lx-status[data-state="online"]::before { background: var(--idle); }
.lx-status[data-state="offline"]::before { background: var(--off); }
.lx-status[data-state="error"]::before { background: var(--eye); }
@keyframes blink { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .lx-status::before { animation: none !important; } }

/* Board and fixed-width player table. */
.lx-body { display: grid; grid-template-columns: var(--board) minmax(0, 1fr); column-gap: 24px; }
.lx-board-link { position: relative; display: block; width: var(--board); height: var(--board); line-height: 0; text-decoration: none; }
.lx-board { display: block; width: 100%; height: 100%; outline: 1px solid var(--line); }
.lx-board.is-idle { opacity: 0.45; }
.lx-board-link:hover .lx-board { outline-color: var(--ball); }

/* Game-over result: a small label at the foot of the board; the position stays visible */
.lx-verdict {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 16px; white-space: nowrap;
  background: rgba(18, 26, 23, 0.82); border-radius: 4px; border-left: 3px solid var(--muted);
  font-size: 0.86rem; line-height: 1; color: var(--ink-2);
  transition: opacity .15s ease;
}
.lx-verdict[hidden] { display: none; }
.lx-verdict[data-outcome="win"] { border-left-color: var(--ball); }
.lx-verdict[data-outcome="loss"] { border-left-color: var(--eye); }
.lx-verdict .score { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.lx-board-link:hover .lx-verdict, .lx-board-link:focus-visible .lx-verdict { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .lx-verdict { transition: none; } }

/* Info column: players, details, actions */
.lx-info {
  display: grid; grid-template-rows: auto auto 1fr; row-gap: 16px;
  height: var(--board); min-width: 0; align-self: center;
}

/* Fixed columns keep names, capture icons, ratings and clocks independent. */
.lx-players-wrap { min-width: 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.lx-players { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.88rem; }
.lx-col-name { width: 43%; }
.lx-col-material { width: 23%; }
.lx-col-rating { width: 17%; }
.lx-col-clock { width: 17%; }
.lx-players th { padding: 0 4px 8px; text-align: right; font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.lx-players th:first-child { text-align: left; padding-left: 18px; }
.lx-players th:nth-child(2) { text-align: right; padding-right: 8px; }
.lx-players th:nth-child(3) { text-align: left; padding-left: 8px; }
.lx-players td { padding: 4px; height: 32px; vertical-align: top; overflow: hidden; }
.lx-players td:first-child { padding-left: 0; }
.lx-players td:last-child { padding-right: 0; }
.lx-players td.rating { padding-right: 8px; }
.lx-players td.lx-captures { padding-left: 8px; }
.lx-player .rating, .lx-player .clock { text-align: right; font-variant-numeric: tabular-nums; }

/* Capture strips stay on the same line as the associated player. */
.lx-player .who { min-width: 0; line-height: 24px; }
.lx-player .who-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lx-player .side { flex: none; width: 10px; height: 10px; border: 1px solid var(--muted); }
.lx-player .side.w { background: #f3eedf; }
.lx-player .side.b { background: #2a302c; }
.lx-player .name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); font-weight: 600; text-decoration: none;
}
.lx-player a.name[href]:hover { text-decoration: underline; text-decoration-color: var(--ball); text-underline-offset: 3px; }
.lx-captures .material {
  display: flex; align-items: center; gap: 2px; min-width: 0; height: 24px;
  overflow: hidden; white-space: nowrap; color: var(--muted);
}
.lx-captures .material:empty { visibility: hidden; }
.lx-captures .mini { flex: none; width: 11px; height: 15px; }
.lx-captures .plus { order: -1; flex: none; margin-right: 3px; font-size: 0.72rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lx-player .rating { line-height: 24px; color: var(--muted); }
.lx-player .clock { display: block; line-height: 24px; padding: 0 5px; border-radius: 4px; color: var(--ink-2); }
.lx-player.to-move .clock { color: var(--ball-ink); background: var(--ball); font-weight: 600; }

/* Details: exactly two lines */
.lx-details { display: grid; grid-template-rows: 24px 24px; row-gap: 8px; }
.lx-line { height: 24px; line-height: 24px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lx-tc-line { display: flex; align-items: center; gap: 8px; }
.lx-tc, .lx-move { color: var(--ink); font-weight: 500; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.lx-tc { flex: none; }
.lx-move { min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-left: 8px; border-left: 1px solid var(--line); line-height: 16px; }
.lx-move:empty { display: none; }
.lx-opening { font-size: 0.88rem; color: var(--ink-2); }
.lx-opening .eco {
  display: inline-block; margin-right: 8px; padding: 0 4px; line-height: 18px;
  border: 1px solid var(--line); border-radius: 4px;
  font-size: 0.76rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums;
}
.lx-opening .eco:empty { display: none; }

/* Actions: two equal buttons on the board's bottom edge */
.lx-actions { align-self: end; display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); column-gap: 8px; }
.lx-actions .btn, .development .log-more {
  min-height: 40px; padding: 8px 10px; border-width: 2px; border-radius: 4px;
  justify-content: center; font-size: 0.9rem; line-height: 1.2; text-align: center;
}

/* Development log: recent releases link to a complete history page. */
.lichess { align-self: start; }
.development { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: hidden; }
.recent-releases { flex: 1; min-height: 0; overflow: hidden; }
.recent-releases .log-row + .log-row { margin-top: 9px; padding-top: 9px; }
.recent-releases .log-row { gap: 12px; }
.recent-releases .log-entry-head { gap: 3px 8px; }
.recent-releases .log-entry h3 { font-size: 0.9rem; }
.recent-releases .log-entry p { margin-top: 4px; font-size: 0.88rem; line-height: 1.4; }
.recent-releases .log-rating { font-size: 0.86rem; }
.recent-releases .log-rating small { display: inline; margin-left: 5px; font-size: 0.76rem; }
.log-row[hidden] { display: none; }
.log { list-style: none; margin: 0; padding: 0; }
.log-row { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 16px; }
.log-row + .log-row { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.dot { width: 10px; height: 10px; margin-top: 5px; background: var(--ball); }
.log-entry-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.log-entry h3 { font: 600 1rem/1.35 var(--sans); }
.log-entry p { margin-top: 6px; color: var(--ink-2); font-size: 0.9rem; line-height: 1.5; }
.log-rating { color: var(--muted); font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-rating.is-reference { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.log-rating small { display: block; color: var(--muted); text-align: right; font-size: 0.72rem; font-weight: 400; }
.is-positive { color: var(--ball); }
.is-neutral { color: var(--muted); }
/* Card action: sized like the Lichess card's buttons and pinned to the card's bottom edge. */
.log-more { flex: none; margin-top: auto; }
.development-page { display: block; padding-block: 40px; }
.self-play-results { margin-top: 24px; min-width: 0; }
/* Shared heading block for secondary pages (development log, 404). */
.page-intro { margin-bottom: 32px; }
.page-intro h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.1; }
.page-intro .back-link + h1 { margin-top: 20px; }
.page-intro p { margin-top: 14px; max-width: 65ch; }
.page-intro .btn { margin-top: 28px; }
.back-link { color: var(--ink-2); font-size: 0.9rem; text-underline-offset: 4px; }
.back-link:hover { color: var(--ball); }
.development-page .log-entry { min-width: 0; }
.results-note { margin-top: 14px; max-width: 80ch; font-size: 0.9rem; }
.results-scroll { overflow-x: auto; margin-top: 20px; }
.results-table { width: 100%; min-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.results-table caption { text-align: left; padding-bottom: 12px; font-size: 0.8rem; color: var(--muted); }
.results-table th, .results-table td { text-align: center; padding: 12px; vertical-align: middle; border-bottom: 1px solid var(--line); }
.results-table tbody > tr:not(:last-child) > td:not([rowspan]) { border-bottom: 0; }
.results-table thead th { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.results-table tbody th { color: var(--ink); font-size: 0.9rem; font-weight: 600; }
.results-table .release-milestone { background: var(--square); }
.results-table .release-milestone th { border-left: 3px solid var(--ball); color: var(--ball); font-size: 1.05rem; }
.results-table tbody[hidden] { display: none; }
.milestone-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.milestone-toggle::before { content: '\25B2'; font-size: 0.65rem; }
.milestone-toggle[aria-expanded="true"]::before { content: '\25B3'; }
.milestone-toggle:hover { text-decoration: underline; text-underline-offset: 4px; }
.results-table .release-patch th { padding-left: 30px; font-weight: 500; color: var(--ink-2); }
.results-table .release-patch th::before { content: '\21B1'; margin-right: 7px; color: var(--muted); }
.results-table td { font-size: 0.9rem; }
.results-table thead th:nth-child(2),
.results-table .release-summary { text-align: left; text-wrap: pretty; }
.results-table .release-summary { width: 42%; line-height: 1.5; color: var(--ink-2); }
.results-table small { display: block; margin-top: 3px; font-size: 0.74rem; color: var(--muted); }
.unmeasured { color: var(--muted); }
.rating-controls { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 20px; }
.rating-controls label { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--muted); }
.rating-controls select { font: inherit; color: var(--ink); background: var(--lawn); border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; }
.rating-chart { display: block; width: 100%; height: 300px; margin-top: 12px; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--muted); font: 12px var(--sans); }
.chart-version-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 5; opacity: 0.6; }
.rating-inspector { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 0.78rem; }
.rating-inspector input { flex: 1; min-width: 0; accent-color: var(--ball); }
.rating-detail { min-height: 2.7em; margin-top: 10px; font-size: 0.82rem; color: var(--ink-2); }
.rating-detail a { text-underline-offset: 3px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.site-footer .wrap {
  display: flex; justify-content: center; text-align: center;
  padding-block: clamp(10px, 1.8vh, 16px);
  font-size: 0.86rem; color: var(--muted);
}
.site-footer p { margin: 0; width: 100%; }

/* ---------- Contact dialog ---------- */
.contact {
  width: min(100% - 32px, 520px); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--lawn-2); color: var(--ink-2);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.35);
}
.contact:focus, .contact:focus-visible { outline: none; }
.contact::backdrop { background: rgba(6, 10, 8, 0.72); }
.contact-form, .contact-done { display: grid; gap: 14px; padding: clamp(18px, 3vh, 28px) clamp(18px, 3vw, 28px); }
.contact-done[hidden], .contact-form[hidden] { display: none; }
.contact-head { display: flex; align-items: center; justify-content: space-between; }
.contact h2 { font-size: 1.75rem; line-height: 1.15; }
.contact-close {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-2);
}
.contact-close:hover { color: var(--ink); border-color: var(--ink-2); }
.contact-close svg { width: 18px; height: 18px; }
.field { display: grid; gap: 6px; }
.field label { color: var(--ink); font-weight: 600; font-size: 0.92rem; }
.field .opt { color: var(--muted); font-weight: 400; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--lawn); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
}
.field textarea { resize: vertical; min-height: 120px; max-height: 40vh; }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--ball); outline-offset: 1px; border-color: transparent; }
.field [aria-invalid="true"] { border-color: var(--eye); }
.field-error:empty, .form-status:empty { display: none; }
.field-error { font-size: 0.86rem; color: #e4a27a; }
.form-status { font-size: 0.9rem; }
.form-status[data-kind="error"] { color: #e4a27a; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.turnstile:empty { display: none; }
.contact-actions { display: flex; align-items: center; gap: 16px; }
.btn-quiet {
  font: inherit; font-weight: 500; color: var(--ink-2); background: none; border: 0; cursor: pointer;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.btn-quiet:hover { color: var(--ink); border-bottom-color: var(--ink-2); }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; box-shadow: none; }
.contact-done .btn { justify-self: start; }

/* ---------- Medium-height desktop screens (e.g. 1440×900 laptops): slightly smaller hero ---------- */
@media (min-width: 761px) and (min-height: 801px) and (max-height: 880px) {
  .portrait { width: clamp(180px, 30vh, 380px); }
  .hero h1 { font-size: clamp(3rem, min(9vw, 10.5vh), 6.75rem); }
  .traits { margin-top: 16px; }
}

/* ---------- Short desktop screens (e.g. 1366×768 laptops): drop secondary lines ---------- */
@media (min-width: 761px) and (max-height: 800px) {
  :root { --vgap: clamp(10px, 2.2vh, 20px); }
  .hero h1 { font-size: clamp(3rem, 12vh, 6rem); }
  .portrait { width: clamp(160px, 27vh, 260px); }
  .traits p { font-size: 0.94rem; line-height: 1.4; }
  .panel { padding: 16px; }
  .lichess { --board: 232px; row-gap: 8px; }
  .lx-info { row-gap: 8px; }
  .lx-players-wrap { padding-bottom: 8px; }
  .lx-player .who { line-height: 20px; }
  .lx-player .rating, .lx-player .clock { line-height: 20px; }
  .lx-captures .material { height: 20px; }
  .lx-details { grid-template-rows: 20px 20px; row-gap: 4px; }
  .lx-line { height: 20px; line-height: 20px; }
  .traits { margin-top: 12px; }
  .development { gap: 12px; }
  .site-footer .wrap { padding-block: 8px; }
}

/* Compact, keyboard- and touch-accessible explanation. */
.elo-help { position: relative; }
.elo-help summary { cursor: pointer; list-style: none; padding-block: 4px; }
.elo-help summary::-webkit-details-marker { display: none; }
.elo-help summary span { margin-left: 3px; }
.elo-help summary:hover { color: var(--ink); }
.elo-help p {
  position: absolute; z-index: 2; right: 0; top: 100%; width: min(290px, calc(100vw - 84px));
  margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--lawn); color: var(--ink-2); font-size: 0.88rem; line-height: 1.45;
}
/* Native disclosure keeps the explanation available by keyboard and touch. */

/* ---------- Smaller screens: stack and allow scrolling ---------- */
@media (max-width: 1100px) {
  .lower { grid-template-columns: 1fr; }
  .hero { grid-template-columns: minmax(0, auto) minmax(0, 1fr); }
}
@media (min-width: 1101px) and (max-width: 1200px) {
  .hero h1 { font-size: clamp(3rem, 10vh, 6rem); }
}
@media (min-width: 761px) and (max-width: 900px) {
  .portrait { width: min(26vw, 240px); }
  .hero h1 { font-size: clamp(3rem, 8vw, 5rem); }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero::before { left: -30vw; top: -4vh; bottom: auto; height: 70vw; width: calc(100% + 30vw); }
  .portrait { width: min(72vw, 320px); }
  .traits { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 20px; min-width: 0; }
  .panel-sub { margin-left: 0; flex-basis: 100%; }
  .lichess { --board: min(100%, 360px); }
  .lx-board-link { height: auto; aspect-ratio: 1; }
  .lx-board { aspect-ratio: 1; height: auto; }
  .lx-headbar { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 8px; }
  .lx-headbar > .lx-status { grid-row: 1; grid-column: 3; min-width: 0; }
  .lx-headbar h2 { white-space: normal; font-size: 1.4rem; }
  .lx-headbar > .lx-ratings { grid-row: 2; grid-column: 1 / -1; justify-self: start; }
  .lx-body { grid-template-columns: 1fr; row-gap: 16px; }
  .lx-info { height: auto; row-gap: 16px; }

}

@media (max-width: 380px) {
  .panel { padding: 16px; }
  .brand { font-size: 1.15rem; gap: 6px; }
  .header-nav { gap: 12px; }
  .lx-headbar { column-gap: 8px; }
  .lx-headbar h2 { font-size: 1.25rem; }
  .lx-headbar > .head-icon { width: 22px; height: 22px; }
  .lx-players th { padding-inline: 2px; }
  .lx-players th:first-child { padding-left: 0; }
  .lx-players th:nth-child(2), .lx-players td.rating { padding-right: 4px; }
  .lx-players th:nth-child(3), .lx-players td.lx-captures { padding-left: 4px; }
}
