/* Square64 web client (§13W). Served from 'self' (CSP style-src/font-src 'self'); the client uses classes
   only, never inline styles.
   Direction: a club tournament hall at night. Pine-green felt and ink, brass chess-clock accents,
   walnut-and-maple boards; a confident grotesque for headings, monospaced digits for clocks and notation. */

@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }

:root {
  --bg: #eef1ec; --surface: #ffffff; --surface-2: #f5f7f3; --ink: #0f2a2e; --muted: #56676a; --line: #dbe1d8;
  --pine: #12383b; --pine-2: #1b4b4e; --on-pine: #eef4f0;
  --brass: #c8902e; --brass-soft: rgba(200, 144, 46, .16); --on-brass: #261a05; --brass-ink: #7a4f0b;
  --danger: #b42318; --on-danger: #ffffff; --success: #1f7a4d; --focus: #2e7dd7; --link: #1b4b4e;
  --shadow: 0 1px 2px rgba(15, 42, 46, .06), 0 10px 30px rgba(15, 42, 46, .08);
  --radius: 14px; --radius-lg: 22px;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c1517; --surface: #13201f; --surface-2: #182826; --ink: #e7eeea; --muted: #9aaba6; --line: #26393a;
          --pine: #0a1213; --pine-2: #12201f; --on-pine: #e7eeea; --brass: #e3ae4f; --brass-soft: rgba(227, 174, 79, .16); --on-brass: #1b1304; --brass-ink: #e3ae4f;
          --danger: #ff8a80; --on-danger: #2a0705; --success: #6dd9a0; --focus: #7db4ff; --link: #e3ae4f; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
          color-scheme: dark; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--text);
       /* Inter's contextual alternates turn the x in "mx20x742" into ×; usernames must read as typed. */
       font-variant-ligatures: no-contextual; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); font-weight: 800; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 1.2rem 0 .6rem; }
a { color: var(--link); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.eyebrow { font: 600 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* Frame */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
             padding: .7rem max(16px, 2vw); background: color-mix(in srgb, var(--surface) 82%, transparent);
             backdrop-filter: saturate(140%) blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 800 1.3rem/1 var(--display); color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: conic-gradient(var(--pine) 0 25%, var(--brass) 0 50%, var(--pine) 0 75%, var(--brass) 0); background-size: 13px 13px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
header.top nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; font-weight: 600; }
header.top nav a { text-decoration: none; color: var(--ink); }
header.top nav a:hover { color: var(--brass); }
.me { display: inline-flex; align-items: center; gap: .45rem; }
main { max-width: 1200px; margin: 0 auto; padding: 1.4rem max(16px, 2vw) 2rem; }
footer.bottom { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1rem; color: var(--muted); font-size: .85rem; padding: 2rem 16px 2.6rem; }
.banner { background: var(--brass); color: var(--on-brass); padding: .55rem 1rem; text-align: center; font-weight: 600; }

/* Surfaces */
.card { background: var(--surface); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 1rem; }
.card.narrow { max-width: 460px; margin: 2.4rem auto; }
.card h2:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 1.1rem; align-items: start; }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; margin: .7rem 0; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: .1rem; }
.list li { padding: .6rem 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.list li:last-child { border-bottom: none; }
.pill { font: 600 .72rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: .35rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.turn { background: var(--brass-soft); color: var(--brass-ink); }

/* Landing */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center;
        background: var(--pine); color: var(--on-pine); border-radius: var(--radius-lg); padding: clamp(1.5rem, 4vw, 3.5rem);
        background-image: repeating-conic-gradient(rgba(255,255,255,.035) 0 25%, transparent 0 50%); background-size: 64px 64px; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { font-size: clamp(2.8rem, 7vw, 5.2rem); line-height: .95; margin: .6rem 0 1rem; letter-spacing: -.03em; }
.hero h1 em { font-style: normal; color: var(--brass); }
.hero .lead { font-size: 1.15rem; color: color-mix(in srgb, var(--on-pine) 78%, transparent); max-width: 34rem; }
.hero .eyebrow { color: var(--brass); }
.hero .btn:not(.primary) { background: transparent; color: var(--on-pine); border-color: rgba(255,255,255,.28); }
.replay { background: rgba(0,0,0,.18); border-radius: var(--radius); padding: .8rem; }
.replay .caption { display: flex; justify-content: space-between; gap: .6rem; font: 500 .8rem/1.3 var(--mono); color: color-mix(in srgb, var(--on-pine) 75%, transparent); margin-top: .6rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 1.1rem; margin-top: 1.4rem; }
.feature { background: var(--surface); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.feature .figure { font: 700 1.6rem/1 var(--mono); color: var(--brass-ink); }
.feature h2 { margin: .7rem 0 .3rem; }
.feature p { margin: 0; color: var(--muted); }

/* Forms */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field label { font-weight: 600; font-size: .9rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
                          padding: .6rem .75rem; min-height: 46px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-soft); }
textarea { min-height: 5.5rem; resize: vertical; }
input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); margin: .1rem 0 0; font-size: .86rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: .7rem; }
.toggle { display: flex; align-items: center; gap: .55rem; margin: .5rem 0; }
.toggle input { min-height: auto; width: 1.15rem; height: 1.15rem; accent-color: var(--brass); }
.notice { padding: .7rem .9rem; border-radius: 10px; margin: 0 0 .9rem; font-weight: 500; }
.notice.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.notice.success { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .5rem 1.1rem; border-radius: 999px;
       border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 .95rem/1 var(--text); cursor: pointer; text-decoration: none;
       transition: transform .12s, border-color .12s, background .12s; }
.btn:hover { border-color: var(--brass); transform: translateY(-1px); }
.btn.primary { background: var(--brass); border-color: var(--brass); color: var(--on-brass); }
.btn.small { min-height: 34px; padding: .3rem .8rem; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
button.link { background: none; border: none; color: inherit; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* Quick pair */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: .8rem .9rem; border-radius: 12px; border: 1px solid var(--line);
          background: var(--surface-2); color: var(--ink); cursor: pointer; font: inherit; text-align: left; transition: transform .12s, border-color .12s, background .12s; }
.preset .tc { font: 700 1.35rem/1 var(--mono); letter-spacing: -.02em; }
.preset .speed { font: 600 .66rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.preset:hover { border-color: var(--brass); background: var(--brass-soft); transform: translateY(-2px); }
.preset.wide { grid-column: span 2; }
.searching { display: flex; align-items: center; gap: .8rem; padding: 1rem; border-radius: 12px; background: var(--brass-soft); }
.searching .tc { font: 700 1.6rem/1 var(--mono); }

/* Game cards with mini boards */
.game-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.game-card { display: flex; flex-direction: column; gap: .5rem; padding: .6rem; border-radius: 12px; background: var(--surface-2); color: var(--ink); text-decoration: none; border: 1px solid transparent; }
.game-card:hover { border-color: var(--brass); }
.game-card .vs { font-weight: 600; }
.mini { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 6px; overflow: hidden; }
.mini span { display: grid; place-items: center; }
.mini img { width: 90%; height: 90%; }

/* Avatars and flags */
.avatar { display: inline-grid; place-items: center; border-radius: 30%; overflow: hidden; flex: none; color: #fff; font-weight: 700; font-family: var(--display); }
.avatar-sm { width: 28px; height: 28px; font-size: .7rem; } .avatar-md { width: 44px; height: 44px; font-size: .95rem; } .avatar-lg { width: 104px; height: 104px; font-size: 2.2rem; }
.avatar img { width: 82%; height: 82%; }
.identicon { display: grid; grid-template-columns: repeat(5, 1fr); width: 66%; height: 66%; }
.identicon .on { background: rgba(255, 255, 255, .92); border-radius: 1px; }
.hue-0 { background: #b3412f; } .hue-1 { background: #b95a1a; } .hue-2 { background: #8f700f; } .hue-3 { background: #588029; }
.hue-4 { background: #22804e; } .hue-5 { background: #157567; } .hue-6 { background: #1d5f86; } .hue-7 { background: #2f445a; }
.hue-8 { background: #6a3d86; } .hue-9 { background: #9c3345; } .hue-10 { background: #7a6510; } .hue-11 { background: #4a2a5c; }
.flag { font-size: 1.05em; }
.avatar-choices { display: flex; gap: .7rem; flex-wrap: wrap; }
.avatar-choice { background: none; border: 2px solid transparent; border-radius: 32%; padding: 3px; cursor: pointer; }
.avatar-choice.chosen { border-color: var(--brass); }
.profile-head { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.profile h1 { margin: 0; font-size: 2.2rem; }
.bio { white-space: pre-wrap; max-width: 60ch; }
.stats { display: flex; flex-wrap: wrap; gap: 1.8rem; margin: 1rem 0; }
.stats b { display: block; font: 700 1.6rem/1.1 var(--mono); }

/* Game layout */
.game { display: grid; grid-template-columns: minmax(0, 660px) minmax(0, 1fr); gap: 1.4rem; align-items: start; }
@media (max-width: 900px) { .game { grid-template-columns: minmax(0, 1fr); } }
.board-frame { padding: clamp(6px, 1.2vw, 12px); border-radius: 18px; background: linear-gradient(145deg, #3b2a1d, #22170f); box-shadow: var(--shadow); }
.player { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem .2rem; }
.player .who { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; min-width: 0; }
.player .rating { font: 500 .8rem/1 var(--mono); color: var(--muted); }
.clock { font: 700 clamp(1.4rem, 3vw, 2rem)/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; padding: .45rem .8rem; border-radius: 10px;
         background: var(--surface); box-shadow: var(--shadow); min-width: 6.2ch; text-align: center; }
.clock.running { background: var(--brass); color: var(--on-brass); }
.clock.low { background: var(--danger); color: var(--on-danger); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .78; } }
.sheet { max-height: 18rem; overflow: auto; border-radius: 10px; background: var(--surface-2); }
.moves { list-style: none; margin: 0; padding: 0; font: 500 .92rem/1 var(--mono); }
.moves li { display: grid; grid-template-columns: 2.6rem 1fr 1fr; align-items: center; }
.moves li:nth-child(even) { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.moves .no { color: var(--muted); padding: .5rem .6rem; }
.moves .m { padding: .5rem .4rem; }
.moves .m.current { background: var(--brass-soft); color: var(--brass-ink); font-weight: 700; border-radius: 6px; }
.chat { list-style: none; padding: 0; margin: 0 0 .6rem; display: flex; flex-direction: column; gap: .35rem; max-height: 12rem; overflow: auto; }
.chat li { background: var(--surface-2); border-radius: 12px; padding: .45rem .7rem; max-width: 85%; }
.chat li.mine { align-self: flex-end; background: var(--brass-soft); }
.chat .who { font-weight: 700; margin-right: .3rem; }
.move-input { display: flex; gap: .5rem; align-items: end; margin-top: .8rem; }
.move-input .field { flex: 1; margin: 0; }
.game-over { padding: 1rem; border-radius: 12px; background: var(--brass-soft); display: flex; flex-direction: column; gap: .6rem; }
.game-over .result { font: 800 1.5rem/1.15 var(--display); }
.opening { font: 600 .8rem/1.3 var(--mono); color: var(--muted); }
.codes { columns: 2; font-family: var(--mono); }

/* Board (§13W.3): a grid of buttons; pieces are the Cburnett SVGs */
.board { position: relative; width: 100%; max-width: 100%; aspect-ratio: 1; display: grid; grid-template-rows: repeat(8, 1fr);
         border-radius: 8px; overflow: hidden; user-select: none; touch-action: manipulation; }
.rank { display: grid; grid-template-columns: repeat(8, 1fr); }
.cell { position: relative; display: grid; min-width: 0; min-height: 0; }
.sq { position: relative; width: 100%; height: 100%; border: none; padding: 0; margin: 0; cursor: pointer; display: grid; place-items: center; }
.sq .piece { width: 92%; height: 92%; pointer-events: none; filter: drop-shadow(0 2px 1px rgba(0,0,0,.22)); transition: transform .12s; }
.sq:hover .piece { transform: translateY(-2px); }
.theme-brown .light, .mini.theme-brown .light { background: #ecd6b1; } .theme-brown .dark, .mini.theme-brown .dark { background: #a97b53; }
.theme-blue .light { background: #dfe6ee; } .theme-blue .dark { background: #7b93ad; }
.theme-green .light { background: #eef0d7; } .theme-green .dark { background: #7d9e5d; }
.theme-gray .light { background: #e3e3df; } .theme-gray .dark { background: #999b95; }
/* High contrast (§13.6): dark squares light enough that the dark coordinate ink keeps 5.2:1. */
.theme-high_contrast .light { background: #ffffff; } .theme-high_contrast .dark { background: #6e8ba8; }
.sq.last { box-shadow: inset 0 0 0 999px rgba(214, 158, 46, .42); }
.sq.selected { box-shadow: inset 0 0 0 3px var(--pine), inset 0 0 0 999px rgba(214, 158, 46, .5); }
.sq.premove { box-shadow: inset 0 0 0 999px rgba(74, 144, 226, .3); }
.sq.check { background: radial-gradient(circle, #ff4d3d 0%, rgba(231, 76, 60, .55) 45%, transparent 72%); }
.sq.target::after { content: ""; width: 28%; height: 28%; border-radius: 50%; background: rgba(18, 56, 59, .55); position: absolute; }
.sq.capture::after { content: ""; position: absolute; inset: 5%; border-radius: 50%; border: 6px solid rgba(18, 56, 59, .55); }
/* Coordinates are dark ink on every square: ≥ 4.5:1 on each theme's squares and highlights (WCAG 1.4.3). */
.coord { position: absolute; font: 700 .66rem/1 var(--mono); color: #1e1208; pointer-events: none; }
.rank-label { top: 4px; left: 5px; } .file-label { bottom: 4px; right: 5px; }
.promotion { position: absolute; inset: 32% 8%; background: var(--surface); border-radius: var(--radius); display: flex; justify-content: center; align-items: center;
             gap: .4rem; box-shadow: 0 14px 40px rgba(0,0,0,.4); }
.promo { width: 18%; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.promo img { width: 90%; height: 90%; }
.promo.cancel { width: auto; aspect-ratio: auto; padding: .4rem .8rem; }
.problems { margin-bottom: .6rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Phase 6: ratings, the rating graph, and leaderboards (§9, §13W.2). */
.pool-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.chip { font: 600 .85rem/1 var(--text); padding: .55rem .85rem; min-height: 2.5rem; border-radius: 999px; border: 1px solid var(--line);
        background: var(--surface-2); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--brass); }
.chip[aria-pressed="true"] { background: var(--brass); color: var(--on-brass); border-color: var(--brass); }
.board-table { width: 100%; border-collapse: collapse; }
.board-table th { text-align: left; font: 600 .72rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
                  padding: .5rem .4rem; border-bottom: 1px solid var(--line); }
.board-table td { padding: .65rem .4rem; border-bottom: 1px solid var(--line); }
.board-table tr:last-child td { border-bottom: none; }
.board-table .num { font-family: var(--mono); text-align: right; }
.board-table th:nth-child(3), .board-table th:nth-child(4) { text-align: right; }
.ratings { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.rating-tile { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; padding: .75rem .9rem; border-radius: 12px;
               border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; text-align: left; }
.rating-tile .pool { font: 600 .66rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.rating-tile .value { font: 700 1.5rem/1 var(--mono); letter-spacing: -.02em; }
.rating-tile[aria-pressed="true"] { border-color: var(--brass); background: var(--brass-soft); }
.rating-graph { width: 100%; height: 160px; margin-bottom: 1rem; }
.rating-graph svg { width: 100%; height: 100%; display: block; overflow: visible; }
.rating-graph .line { stroke: var(--brass); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rating-graph .last { fill: none; stroke: var(--brass); stroke-width: 9; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rating-change { margin: 0; font-family: var(--mono); }
.rating-change .up { color: var(--success); }
.rating-change .down { color: var(--danger); }

/* Phase 7: friends, messages, the notification bell and moderation (§13W.2). */
.bell-wrap { position: relative; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem;
        border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.bell-icon { width: 1.15rem; height: 1.15rem; background: var(--ink);
             -webkit-mask: url("icons/bell.svg") center / contain no-repeat; mask: url("icons/bell.svg") center / contain no-repeat; }
.bell .count { position: absolute; top: -4px; right: -4px; min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem; border-radius: 999px;
               background: var(--danger); color: var(--on-danger); font: 700 .7rem/1.2rem var(--text); text-align: center; }
.bell-panel { position: absolute; right: 0; top: calc(100% + .5rem); width: min(24rem, calc(100vw - 2rem)); max-height: 70vh; overflow: auto;
              z-index: 20; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
              box-shadow: var(--shadow); padding: .5rem 1rem; text-align: left; }
.bell-panel li { flex-wrap: wrap; }
.bell-panel li.unread { font-weight: 600; }
.bell-panel .when { flex-basis: 100%; font-size: .78rem; font-weight: 400; }
.badge { display: inline-block; min-width: 1.2rem; padding: 0 .4rem; margin-left: .35rem; border-radius: 999px; background: var(--brass);
         color: var(--on-brass); font: 700 .72rem/1.25rem var(--text); text-align: center; vertical-align: middle; }
.badge.danger { background: var(--danger); color: var(--on-danger); }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.dot.online { background: var(--success); }
.dot.offline { background: var(--line); }
.spacer { flex: 1; }
.messages { display: grid; grid-template-columns: minmax(14rem, 1fr) 2fr; gap: 1rem; }
@media (max-width: 760px) { .messages { grid-template-columns: 1fr; } }
.threads li { flex-wrap: wrap; }
.threads li.current { background: var(--brass-soft); border-radius: 10px; padding-left: .5rem; }
.threads .snippet { flex-basis: 100%; margin: 0; font-size: .85rem; overflow-wrap: anywhere; }
.dm-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .4rem; max-height: 55vh; overflow: auto; }
.dm-list li { background: var(--surface-2); border-radius: 12px; padding: .45rem .7rem; max-width: 85%; align-self: flex-start;
              white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-list li.mine { align-self: flex-end; background: var(--brass-soft); }
.dm-list .when { display: block; font-size: .72rem; }
.dm-form, .report-form { display: grid; gap: .5rem; }
.report-form { margin-top: 1rem; max-width: 32rem; }
.dm-form textarea, .report-form textarea, .report-form select { width: 100%; box-sizing: border-box; font: inherit; padding: .6rem .7rem;
                                                                border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.report { border-top: 1px solid var(--line); padding: 1rem 0; }
.report .details { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Phase 8: puzzles and analysis (§13W.2). */
.subnav { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.subnav .chip { text-decoration: none; }
.subnav .chip[aria-current="page"] { background: var(--brass); border-color: var(--brass); color: var(--on-brass); }
.theme-filter { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.theme-grid .label { font-weight: 700; }
.tags { list-style: none; padding: 0; margin: .4rem 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.tags li { font: 600 .72rem/1 var(--mono); padding: .35rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.prompt { font: 700 1.15rem/1.3 var(--display); margin: .6rem 0; }
.prompt.phase-solved { color: var(--success); }
.prompt.phase-wrong { color: var(--danger); }
.big-number { font: 800 2.6rem/1 var(--mono); margin: .2rem 0 .4rem; }
.small { font-size: .82rem; }
.notice.info { color: var(--ink); background: var(--brass-soft); }
.sq.hint { box-shadow: inset 0 0 0 4px var(--success), inset 0 0 0 999px color-mix(in srgb, var(--success) 25%, transparent); }
.sq.last .piece { animation: land .28s ease-out; }
@keyframes land { from { transform: scale(.82); opacity: .55; } to { transform: none; opacity: 1; } }
.arrows { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.arrows svg { width: 100%; height: 100%; display: block; }
.arrows polygon { fill: color-mix(in srgb, var(--success) 78%, transparent); stroke: none; }
.nav-row { display: flex; gap: .4rem; justify-content: center; margin-top: .7rem; }
.btn.icon { min-width: 2.75rem; justify-content: center; padding-inline: .6rem; font-size: 1.05rem; }
.eval { font: 700 1rem/1 var(--mono); margin: .7rem 0 0; }
.eval-graph { height: 120px; margin: 0 0 1rem; border-radius: 12px; overflow: hidden; cursor: pointer; background: #2c2a26; box-shadow: var(--shadow); }
.eval-graph svg { width: 100%; height: 100%; display: block; }
.eval-graph .area { fill: #f2efe6; }
.eval-graph .mid { stroke: var(--brass); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.eval-graph .cursor { stroke: var(--brass); stroke-width: 2; vector-effect: non-scaling-stroke; }
.eval-graph .ev-dot { fill: none; stroke-width: 8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.eval-graph .ev-dot.inaccuracy { stroke: #d9a400; }
.eval-graph .ev-dot.mistake { stroke: #e0701b; }
.eval-graph .ev-dot.blunder { stroke: #d1342a; }
.accuracy { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .8rem 0 .3rem; }
.acc-side { display: flex; flex-direction: column; gap: .2rem; padding: .7rem .8rem; border-radius: 12px; background: var(--surface-2); }
.acc-name { font-weight: 700; overflow-wrap: anywhere; }
.acc-value { font: 800 1.6rem/1 var(--mono); }
.moves button.m { font: inherit; color: inherit; background: none; border: none; text-align: left; cursor: pointer; border-radius: 6px; }
.moves button.m:hover { background: var(--brass-soft); }
.moves .m.var { font-style: italic; color: var(--muted); }
.moves .nag { margin-left: .15rem; font-weight: 800; }
.moves .lbl-inaccuracy .nag { color: #a07800; }
.moves .lbl-mistake .nag { color: #c05a10; }
.moves .lbl-blunder .nag { color: var(--danger); }
.better { margin: .7rem 0 0; font-weight: 600; }
.variation { margin-top: .7rem; padding: .7rem .9rem; border-radius: 12px; background: var(--surface-2); }
.variation p { margin: 0 0 .5rem; }
.stack { display: grid; gap: .45rem; margin-bottom: 1rem; }
.stack textarea { width: 100%; box-sizing: border-box; font: .85rem/1.4 var(--mono); }
.daily .game-card { max-width: 260px; }
@media (prefers-color-scheme: dark) {
  .moves .lbl-inaccuracy .nag { color: #f0c43c; }
  .moves .lbl-mistake .nag { color: #ff9d5c; }
}
@media (prefers-reduced-motion: reduce) { .sq.last .piece { animation: none; } }

/* Phase 9: the server-rendered pages (/download, /verify, /reset) share this stylesheet. */
.card.narrow .code { font: .8rem/1.5 var(--mono); overflow-wrap: anywhere; background: var(--surface-2); padding: .5rem .7rem; border-radius: 10px; }
.card.narrow .notes { white-space: pre-wrap; }
.card.narrow label { display: grid; gap: .35rem; margin: .8rem 0; }
.card.narrow form button { margin-top: .4rem; }
.board-table.plain th, .board-table.plain td { text-align: left; }
.board-table.plain td.num { font-family: var(--mono); }

/* Phase 10: Settings → Account (§14.7). */
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn.danger:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.danger-zone { padding: 1rem; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
               background: color-mix(in srgb, var(--danger) 6%, transparent); max-width: 32rem; }
