/* Quadsort tokens — from design/mockups/Main.dc.html */
@font-face { font-family: "Bricolage Grotesque"; src: url(/fonts/bricolage.woff2) format("woff2"); font-weight: 200 800; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: "Figtree"; src: url(/fonts/figtree.woff2) format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  /* difficulty palette: colour + lightness + shape all differ */
  --d1: #FFD84D; /* Gentle  · circle   */
  --d2: #5EC4E6; /* Tricky  · triangle */
  --d3: #FF8B4A; /* Sneaky  · square   */
  --d4: #5A3DE0; /* Devious · diamond  */
  --fd: "Bricolage Grotesque", system-ui, sans-serif;
  --fb: "Figtree", system-ui, sans-serif;
  --bg: #EFEEF6; --surf: #fff; --surf2: #E3E1EE; --ink: #17142A; --mute: #5B5770;
  --line: #17142A; --tile: #fff; --tileInk: #17142A; --shadow: #17142A; --inv: #17142A; --invInk: #fff;
  --focus: #5A3DE0; /* keyboard focus ring: 3:1 or better against every background */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13111C; --surf: #1E1B2A; --surf2: #2A2639; --ink: #F3F1FA; --mute: #A9A4BE;
    --line: #7D7896; --tile: #2A2639; --tileInk: #F3F1FA; --shadow: #000; --inv: #F3F1FA; --invInk: #13111C;
    --focus: #A593FF; /* borders and focus lightened to reach 3:1 on the dark surfaces */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #13111C; --surf: #1E1B2A; --surf2: #2A2639; --ink: #F3F1FA; --mute: #A9A4BE;
  --line: #7D7896; --tile: #2A2639; --tileInk: #F3F1FA; --shadow: #000; --inv: #F3F1FA; --invInk: #13111C;
  --focus: #A593FF;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.45 var(--fb); -webkit-text-size-adjust: 100%; }
:root { --th: 74px; --gap: 8px; --r: 14px; } /* tile height, grid gap, tile radius */
@media (min-width: 640px) { :root { --th: 94px; --gap: 12px; --r: 18px; } }

main, .top-in { width: min(100% - 32px, 1120px); margin-inline: auto; }
.top { background: var(--surf); border-bottom: 2.5px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a:not(.btn) { padding: 12px 16px; border-radius: 999px; color: inherit; text-decoration: none; font-weight: 600; white-space: nowrap; }
@media (max-width: 479px) { .nav a:not(.btn):not(.avatar-sm):not(.nav-login) { display: none; } }
@media (max-width: 479px) {
  .top-in { gap: 8px; }
  .brand { font-size: 20px; gap: 8px; }
  .mark { width: 28px; height: 28px; }
  .nav { gap: 2px; }
  .nav .btn-sm { padding: 0 14px; font-size: 14px; }
  .nav a.nav-login { padding: 12px 8px; }
}
@media (max-width: 359px) { .nav .nav-login { display: none; } }
/* hide the word on tiny screens but keep it for screen readers (display:none would leave the link nameless) */
@media (max-width: 339px) { .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
.nav a.nav-login { padding: 12px 10px; }
.nav a.avatar-sm { color: #17142A; } /* beats .nav a:not(.btn) { color: inherit }, which made the initials pale in dark mode */
.avatar-sm { flex: none; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: 2.5px solid var(--line); border-radius: 50%; background: var(--d2); color: #17142A; font: 800 14px var(--fd); text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 800 24px/1 var(--fd); letter-spacing: -0.03em; }
.mark { width: 34px; height: 34px; }

.hero { padding: 48px 0 80px; }
.hero h1 { margin: 0; font: 800 clamp(64px, 17vw, 148px)/0.86 var(--fd); letter-spacing: -0.045em; }
.dot { display: inline-block; width: .2em; height: .2em; margin-left: .06em; border-radius: 50%; background: var(--d1); border: .03em solid var(--line); }
.lede { margin: 28px 0 0; max-width: 34ch; font-size: clamp(18px, 2.4vw, 22px); color: var(--mute); }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

.btn {
  display: inline-flex; align-items: center; min-height: 52px; padding: 0 26px;
  border: 2.5px solid var(--line); border-radius: 999px; background: var(--surf); color: var(--ink);
  font: 700 17px/1 var(--fd); text-decoration: none; white-space: nowrap; cursor: pointer; box-shadow: 0 3px 0 var(--shadow);
  transition: transform 140ms cubic-bezier(.3, 1.6, .5, 1), box-shadow 140ms;
}
.btn:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.btn-primary { background: var(--d1); color: #17142A; }
.btn-ink { background: var(--inv); color: var(--invInk); }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:active { transform: none; box-shadow: 0 3px 0 var(--shadow); }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- play ---------- */
.play { display: flex; gap: 48px; justify-content: center; align-items: flex-start; padding: 20px 0 40px; }
.play-col { flex: 0 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.play aside { display: none; }
@media (min-width: 900px) {
  .play { padding-top: 44px; }
  .play-col { gap: 28px; }
  .play aside { display: flex; flex: 0 1 320px; flex-direction: column; gap: 20px; padding-top: 8px; }
}
.puzzle-head { display: flex; flex-direction: column; gap: 10px; }
.puzzle-head h1 { margin: 0; font: 800 clamp(32px, 6vw, 46px)/1 var(--fd); letter-spacing: -0.035em; }
.by { margin: 0; font-size: 15px; }
.by a:not(.chip) { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.chip { margin-left: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surf2); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; }
.desc { margin: 0; font-size: 15px; color: var(--mute); }
.card { padding: 22px; border-radius: 24px; background: var(--surf2); }
.card h2 { margin: 0 0 12px; font: 800 18px/1.2 var(--fd); }
.howto ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.4; }

.board { position: relative; display: flex; flex-direction: column; gap: var(--gap); }
.rows { display: flex; flex-direction: column; gap: var(--gap); }
.rows:empty { display: none; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); perspective: 700px; }

.tile {
  --fs: 17px; height: var(--th); min-width: 0; padding: 0 6px; overflow: hidden;
  border: 2.5px solid var(--line); border-radius: var(--r);
  background: var(--tile); color: var(--tileInk); box-shadow: 0 4px 0 var(--shadow);
  font: 700 var(--fs)/1.05 var(--fd); text-transform: uppercase; letter-spacing: .01em; hyphens: none;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform 140ms cubic-bezier(.3, 1.6, .5, 1), box-shadow 140ms, background-color 140ms;
}
.tile.len2 { --fs: 15px; }
.tile.len3 { --fs: 14px; font-stretch: 85%; }
.tile.len4 { --fs: 12.5px; font-stretch: 75%; }
@media (min-width: 640px) {
  .tile.len1 { --fs: 22px; } .tile.len2 { --fs: 20px; }
  .tile.len3 { --fs: 19px; font-stretch: 88%; } .tile.len4 { --fs: 18px; font-stretch: 78%; }
}
.tile.brk { overflow-wrap: anywhere; }
.tile[aria-pressed="true"] { background: var(--inv); color: var(--invInk); transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
.tile:focus-visible, .btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.board.over .tile { cursor: default; }

.row {
  min-height: var(--th); padding: 6px 10px; border: 2.5px solid var(--line); border-radius: var(--r); box-shadow: 0 4px 0 var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-align: center; transform-origin: top left;
}
.row .name { display: flex; align-items: center; gap: 8px; font: 800 15px/1.1 var(--fd); text-transform: uppercase; letter-spacing: .02em; }
.row .words { font-weight: 600; font-size: 13px; opacity: .9; }
.row.merging > * { opacity: 0; }
.row.revealed { border-style: dashed; box-shadow: none; }
.lv[data-level="1"] { background: var(--d1); color: #17142A; }
.lv[data-level="2"] { background: var(--d2); color: #17142A; }
.lv[data-level="3"] { background: var(--d3); color: #17142A; }
.lv[data-level="4"] { background: var(--d4); color: #fff; }
@media (min-width: 640px) { .row .name { font-size: 19px; } .row .words { font-size: 16px; } }
/* colour-blind cue: every level has its own shape */
.shape { flex: none; width: 13px; height: 13px; background: currentColor; }
.shape[data-level="1"] { border-radius: 50%; }
.shape[data-level="2"] { clip-path: polygon(50% 6%, 100% 94%, 0 94%); }
.shape[data-level="3"] { border-radius: 2px; }
.shape[data-level="4"] { transform: rotate(45deg) scale(.78); border-radius: 2px; }
@media (min-width: 640px) { .shape { width: 16px; height: 16px; } }

.toast {
  position: absolute; left: 50%; top: -14px; transform: translate(-50%, -50%); z-index: 3; white-space: nowrap;
  padding: 11px 20px; border-radius: 999px; background: var(--inv); color: var(--invInk); font: 700 16px/1 var(--fd); box-shadow: 0 3px 0 var(--shadow);
}
.toast[hidden], .end[hidden], .controls[hidden], .grid[hidden], .lives[hidden] { display: none; }

.lives { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 15px; font-weight: 600; color: var(--mute); }
.dots { display: flex; gap: 8px; }
.dots i { display: block; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--ink); }
.dots i.gone { background: transparent; border: 2.5px dashed var(--mute); }

.controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.controls .btn { gap: 8px; min-height: 50px; padding: 0 12px; font-size: 15px; }
@media (min-width: 640px) { .controls .btn { padding: 0 22px; font-size: 17px; } }

.end { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 20px; border-radius: 22px; text-align: center; }
.end h2 { margin: 0; font: 800 28px/1.1 var(--fd); letter-spacing: -0.02em; }
.end p { margin: 0; font-size: 15px; font-weight: 600; }
.end.won { background: var(--d1); color: #17142A; border: 2.5px solid var(--line); box-shadow: 0 4px 0 var(--shadow); }
.end.lost { background: var(--inv); color: var(--invInk); }
.fine { margin: 0; text-align: center; font-size: 13px; color: var(--mute); }

/* very small phones (320px) */
@media (max-width: 359px) {
  .top-in .btn-sm { padding: 0 12px; font-size: 14px; }
  .controls { gap: 6px; }
  .controls .btn { padding: 0 9px; font-size: 14px; gap: 5px; }
  .tile { padding: 0 3px; }
}

/* ---------- play: side stats ---------- */
.tiles2 { display: flex; gap: 12px; }
.card.stat { flex: 1; padding: 16px; border-radius: 20px; background: var(--surf); border: 2.5px solid var(--line); }
.stat b { display: block; font: 800 26px/1.1 var(--fd); }
.stat span { font-size: 13px; font-weight: 600; color: var(--mute); }
.end .btn { margin-top: 10px; }
.end.won .btn { background: #17142A; color: #fff; }
.end.lost .btn { background: var(--d1); color: #17142A; }

/* ---------- results ---------- */
.results { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; padding: 24px 0 48px; }
.res-a { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.res-b { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 900px) { .results { gap: 40px; padding-top: 48px; } .res-a { gap: 28px; } }
.res-head { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.back { padding: 0; border: 0; background: none; color: var(--ink); font: 600 15px var(--fb); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.kicker { font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.res-head h1 { margin: 0; font: 800 clamp(48px, 11vw, 88px)/.9 var(--fd); letter-spacing: -0.045em; }
.res-head p { margin: 0; font-size: clamp(17px, 2vw, 19px); color: var(--mute); }

.share-card, .card.white, .card.creator {
  padding: 22px; border: 2.5px solid var(--line); border-radius: 26px; box-shadow: 0 4px 0 var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
}
.share-card, .card.white { background: var(--surf); }
.share-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.share-top h2, .answers h2, .card.white h2 { margin: 0; font: 800 22px/1.1 var(--fd); }
.share-top span { font-size: 14px; font-weight: 700; }
.squares { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.squares div { display: flex; gap: 6px; }
.sq { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 2px solid var(--line); border-radius: 9px; }
.sq .shape { width: 12px; height: 12px; }
@media (min-width: 640px) { .sq { width: 40px; height: 40px; } .sq .shape { width: 12px; height: 12px; } }
.linkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-radius: 16px; background: var(--surf2); }
.url { flex: 1 1 190px; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbar .btn { min-height: 48px; padding: 0 18px; font-size: 16px; gap: 8px; flex: 1 1 auto; justify-content: center; }
.linkbar .btn.done { background: var(--d1); color: #17142A; }
.hint { font-size: 13px; color: var(--mute); }
.answers { display: flex; flex-direction: column; gap: 10px; }
.answers > div { display: flex; flex-direction: column; gap: 10px; }
.answers .row { padding: 10px; gap: 4px; }
.tag { padding: 2px 8px; border: 1.5px solid currentColor; border-radius: 999px; font-size: 12px; font-weight: 700; }

.big3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.big3 b { display: block; font: 800 30px/1.1 var(--fd); }
.big3 span { font-size: 13px; font-weight: 600; color: var(--mute); }
.dist { display: flex; flex-direction: column; gap: 8px; }
.drow { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.drow > span:first-child { width: 76px; flex: none; }
.drow .track { flex: 1; height: 22px; border-radius: 7px; background: var(--surf2); overflow: hidden; }
.drow .bar { display: block; height: 100%; border-radius: 7px; background: var(--ink); opacity: .75; }
.drow.mine .bar { background: var(--d3); opacity: 1; box-shadow: inset 0 0 0 2px var(--line); }
.drow .pct { width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.verdict { margin: 0; font-size: 15px; font-weight: 600; }
.muted { margin: 0; font-size: 14px; color: var(--mute); }

.card.creator { background: var(--d2); color: #17142A; }
.creator .who { display: flex; align-items: center; gap: 14px; }
.avatar { flex: none; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; border: 2.5px solid #17142A; border-radius: 50%; background: #fff; color: #17142A; font: 800 22px var(--fd); }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cname { font: 800 24px/1.1 var(--fd); }
.csub { font-size: 14px; font-weight: 600; }
.cbtns { display: flex; flex-wrap: wrap; gap: 10px; }
.pill { flex: 1 1 140px; display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 18px; border-radius: 999px; font: 700 16px var(--fd); text-decoration: none; text-align: center; }
.pill.dark { background: #17142A; color: #fff; }
.pill.light { background: #fff; color: #17142A; border: 2.5px solid #17142A; }
.more { display: flex; flex-direction: column; gap: 8px; }
.more a { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .7); color: #17142A; text-decoration: none; font-weight: 700; font-size: 15px; }
.more .sr { font-weight: 600; flex: none; }
.make-own { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 24px; border: 2.5px solid var(--line); border-radius: 26px; background: var(--d1); color: #17142A; box-shadow: 0 4px 0 var(--shadow); text-decoration: none; }
.make-own span { display: flex; flex-direction: column; gap: 4px; }
.make-own b { font: 800 22px/1.1 var(--fd); }
.make-own small { font-size: 15px; font-weight: 600; }
.make-own svg { flex: none; }

/* ---------- create ---------- */
:root { --err: #B3261E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --err: #FF8A80; } }
:root[data-theme="dark"] { --err: #FF8A80; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.create { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; padding: 24px 0 56px; }
.create-main { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.create-side { flex: 1 1 340px; max-width: 460px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 900px) { .create { gap: 40px; padding-top: 44px; } .create-side { position: sticky; top: 16px; } }
.create-head h1 { margin: 0 0 8px; font: 800 clamp(36px, 7vw, 56px)/1 var(--fd); letter-spacing: -0.035em; }
.create-head p { margin: 0; font-size: 17px; color: var(--mute); }

.panel { display: flex; flex-direction: column; gap: 16px; padding: 18px; border: 2.5px solid var(--line); border-radius: 26px; background: var(--surf); box-shadow: 0 4px 0 var(--shadow); }
@media (min-width: 640px) { .panel { padding: 24px; } }
.panel h2 { margin: 0; font: 800 22px/1.1 var(--fd); }
.panel h3 { margin: 0; font: 800 19px/1.2 var(--fd); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label, legend { font-weight: 700; font-size: 14px; }
.opt { font-weight: 500; color: var(--mute); }
input[type="text"], input:not([type]), input[type="url"], input[type="email"], input[type="password"], select {
  width: 100%; min-width: 0; height: 48px; padding: 0 14px; border: 2.5px solid var(--line); border-radius: 12px;
  background: var(--surf); color: var(--ink); font: 600 16px var(--fb);
}
input::placeholder { color: var(--mute); opacity: .8; font-weight: 500; }
input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--err); }
.ferr { min-height: 0; font-size: 13px; font-weight: 700; color: var(--ink); }
.ferr.err { color: var(--err); }
.ferr:empty { display: none; }
.basics { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .basics { grid-template-columns: 1fr 1fr; } }

.topics { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.topics legend { padding: 0; margin-bottom: 8px; }
.topic-list { display: flex; flex-wrap: wrap; gap: 8px; }
.topic { position: relative; }
.topic input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.topic span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 2.5px solid var(--line); border-radius: 999px; background: var(--surf); font-weight: 700; font-size: 14px; }
.topic input:checked + span { background: var(--inv); color: var(--invInk); }
.topic input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.topic input:disabled + span { opacity: .45; }

.groups-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.groups-head h2 { margin: 0; font: 800 26px/1.1 var(--fd); }
.groups-head span { font-size: 14px; color: var(--mute); }
.ggrid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .ggrid { grid-template-columns: 1fr 1fr; } }
.gcard { display: flex; flex-direction: column; overflow: hidden; border: 2.5px solid var(--line); border-radius: 24px; background: var(--surf); box-shadow: 0 4px 0 var(--shadow); }
.gband { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 2.5px solid var(--line); }
.gtitle { display: flex; align-items: center; gap: 8px; font: 800 17px var(--fd); }
.diff { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.diff select { width: auto; height: 36px; padding: 0 8px; border: 2px solid #17142A; border-radius: 10px; background: #fff; color: #17142A; font: 700 14px var(--fb); }
.gbody { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.gwords { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wlabel { position: relative; display: block; }
.wn { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 800; color: var(--mute); }
input.wi { padding: 0 8px 0 26px; font: 700 16px var(--fd); text-transform: uppercase; }
input.wi.cond { font-stretch: 78%; }
input.wi.cnt { padding-right: 40px; }
.wi.empty { border-style: dashed; border-color: var(--mute); }
.wi.long { border-color: var(--d3); }
.wi.bad { border-color: var(--err); }
.wc { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 800; color: var(--mute); }
.gname.bad { border-color: var(--err); }
.gerrs { display: flex; flex-direction: column; gap: 4px; }
.gerrs:empty { display: none; }
.gerr { font-size: 13px; font-weight: 700; }
.gerr.err { color: var(--err); }
.gerr.warn { color: var(--ink); }
.gerr.missing { color: var(--mute); }

.pv-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pv-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#pv-title { font: 800 20px/1.1 var(--fd); overflow-wrap: anywhere; }
#pv-by { font-size: 14px; color: var(--mute); }
.pgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pt { height: 52px; min-width: 0; padding: 0 3px; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; overflow-wrap: anywhere; box-sizing: border-box;
  border: 2px solid var(--line); border-radius: 10px; background: var(--tile); color: var(--tileInk); box-shadow: 0 3px 0 var(--shadow);
  font: 700 13px/1 var(--fd); text-transform: uppercase; }
.pt.len2 { font-size: 11px; } .pt.len3 { font-size: 10px; font-stretch: 85%; } .pt.len4 { font-size: 10px; font-stretch: 75%; }
.pt.empty { border-style: dashed; border-color: var(--mute); color: var(--mute); background: transparent; box-shadow: none; }
.pt.long { background: var(--d3); color: #17142A; }
@media (min-width: 640px) { .pt { height: 56px; font-size: 14px; } .pt.len2 { font-size: 12px; } .pt.len3, .pt.len4 { font-size: 11px; } }

#issues ul { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.ready { margin: 0; font: 800 19px/1.2 var(--fd); }
.warn-note { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--surf2); font-size: 14px; font-weight: 600; }
.btn-wide { width: 100%; justify-content: center; }
.pub-msg { margin: 0; font-size: 14px; font-weight: 700; color: var(--err); }

.published { display: flex; flex-direction: column; align-items: stretch; gap: 20px; width: min(100%, 640px); margin: 0 auto; padding: 32px 0 56px; }
.pub-top { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.pub-top .mark { width: 72px; height: 72px; }
.pub-top h1 { margin: 0; font: 800 clamp(44px, 10vw, 72px)/.95 var(--fd); letter-spacing: -0.045em; }
.pub-top p { margin: 0; font-size: 18px; color: var(--mute); max-width: 460px; }
.linkrow { display: flex; flex-wrap: wrap; gap: 10px; }
.linkrow input { flex: 1 1 200px; font-weight: 700; }
.linkrow .btn { flex: 1 1 auto; justify-content: center; gap: 8px; }
.linkrow .btn.done { background: var(--d1); color: #17142A; }
.sharelabel { margin-top: 4px; font-size: 14px; font-weight: 700; }
.sharegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.sharegrid .btn { justify-content: center; }
.pub-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.pub-actions .btn { flex: 1 1 160px; justify-content: center; }
.published .back { align-self: center; }

/* ---------- auth + settings ---------- */
.auth { width: min(100%, 460px); margin: 0 auto; padding: 36px 0 56px; display: flex; flex-direction: column; gap: 18px; }
.auth h1 { margin: 0; font: 800 clamp(40px, 9vw, 60px)/.95 var(--fd); letter-spacing: -0.04em; }
.auth .lede { margin: 0; max-width: none; font-size: 17px; }
.auth .btn-wide { margin-top: 4px; }
.alt { margin: 0; text-align: center; font-size: 15px; color: var(--mute); }
.alt a { color: var(--ink); font-weight: 700; }
.saved { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--d1); color: #17142A; font-weight: 700; font-size: 14px; }
.auth form[action="/logout"] { text-align: center; }

.basics.one { grid-template-columns: 1fr; }
.as { margin: 0; font-size: 14px; color: var(--mute); }
.as b { color: var(--ink); }
.as a { color: var(--ink); font-weight: 700; }

/* ---------- profile + puzzle cards ---------- */
.profile { display: flex; flex-direction: column; gap: 36px; padding: 28px 0 56px; }
.phead { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.avatar.big { width: 96px; height: 96px; font-size: 32px; background: var(--d2); }
.pinfo { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.pinfo h1 { margin: 0; font: 800 clamp(34px, 7vw, 56px)/.95 var(--fd); letter-spacing: -0.04em; overflow-wrap: anywhere; }
.psub { font-size: 16px; font-weight: 600; color: var(--mute); }
.bio { margin: 0; max-width: 56ch; font-size: 17px; line-height: 1.5; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links .chip { margin: 0; }
.pstats.card.white { flex: 1 1 300px; max-width: 420px; padding: 20px; gap: 16px; }
.pstats .pill { flex: none; min-height: 48px; }
.plist { display: flex; flex-direction: column; gap: 18px; }
.plist-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.plist-head h2 { margin: 0; font: 800 28px/1.1 var(--fd); }
.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: var(--surf2); }
.tabs a { padding: 8px 14px; border-radius: 999px; color: var(--ink); font-weight: 700; font-size: 14px; text-decoration: none; }
.tabs a[aria-current] { background: var(--inv); color: var(--invInk); }
.pgrid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.pcard { display: flex; flex-direction: column; overflow: hidden; border: 2.5px solid var(--line); border-radius: 22px; background: var(--surf); box-shadow: 0 4px 0 var(--shadow); color: inherit; text-decoration: none; transition: transform 140ms cubic-bezier(.3, 1.6, .5, 1); }
.pcard:hover { transform: translateY(-2px); }
.pcard:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.cover { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 10px; border-bottom: 2.5px solid var(--line); background: var(--surf2); }
.cover span { height: 24px; border-radius: 6px; border: 2px solid var(--line); }
.cbody { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
.ctitle { font: 800 19px/1.12 var(--fd); overflow-wrap: anywhere; }
.cmeta { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; }
.cdiff { display: inline-flex; align-items: center; gap: 6px; }
.bars { display: flex; gap: 2px; }
.bars i { width: 6px; height: 14px; border-radius: 2px; border: 1.5px solid var(--line); background: transparent; }
.bars i.on { background: var(--ink); }
.empty { margin: 0; padding: 28px; border: 2.5px dashed var(--mute); border-radius: 22px; text-align: center; color: var(--mute); font-weight: 600; }

/* ---------- dashboard ---------- */
.dash { display: flex; flex-direction: column; gap: 24px; padding: 28px 0 56px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.dash-head h1 { margin: 0; font: 800 clamp(36px, 7vw, 56px)/1 var(--fd); letter-spacing: -0.035em; }
.dash-head p { margin: 8px 0 0; color: var(--mute); }
.statgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .statgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.statgrid .card.stat { padding: 18px 20px; border-radius: 22px; box-shadow: 0 4px 0 var(--shadow); }
.statgrid .stat b { font-size: 30px; letter-spacing: -0.02em; }
.dtable { display: flex; flex-direction: column; gap: 14px; }
.dhead { display: none; }
.drow2 { display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 2.5px solid var(--line); border-radius: 22px; background: var(--surf); box-shadow: 0 4px 0 var(--shadow); }
.drow2 > [data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.dtitle { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dtitle a { color: var(--ink); font: 800 19px/1.15 var(--fd); text-decoration: none; overflow-wrap: anywhere; }
.dtitle a:hover { text-decoration: underline; }
.status { align-self: flex-start; padding: 2px 8px; border: 1.5px solid var(--mute); border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--mute); }
.status.live { border-color: #17142A; color: #17142A; background: var(--d1); } /* fixed dark text: the yellow is pale in both themes */
.status.flag { border-color: var(--err); color: var(--err); }
.solve { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.solve::before { flex-basis: 100%; }
.meter { flex: 1; min-width: 60px; height: 12px; border-radius: 6px; background: var(--surf2); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--ink); }
.wrong { font-size: 15px; line-height: 1.35; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.acts .btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn.danger { color: var(--err); }
.emptybox { align-items: center; text-align: center; }
.emptybox p { margin: 0; color: var(--mute); }
.foot-links { margin: 0; font-size: 14px; color: var(--mute); }
.foot-links a { color: var(--ink); font-weight: 700; }
@media (min-width: 980px) {
  .dhead, .drow2 { display: grid; grid-template-columns: minmax(200px, 2.2fr) 70px minmax(150px, 1.3fr) minmax(180px, 2fr) auto; gap: 16px; align-items: center; }
  .dhead { padding: 0 22px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
  .drow2 { padding: 16px 22px; }
  .drow2 > [data-label]::before { display: none; }
  .solve::before { display: none; }
  .acts { justify-content: flex-end; flex-wrap: nowrap; }
}

/* ---------- landing ---------- */
.lhero { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; padding: 32px 0 48px; }
.hero-copy { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.hero-copy h1 { margin: 0; font: 800 clamp(40px, 9vw, 76px)/.95 var(--fd); letter-spacing: -0.04em; }
.hero-copy .lede { margin: 0; max-width: 46ch; }
.hero-copy .actions { margin: 0; }
.pill-note { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 2.5px solid var(--line); border-radius: 999px; background: var(--surf); font-size: 14px; font-weight: 700; }
.pill-note i { width: 10px; height: 10px; border-radius: 50%; background: var(--d3); }
.fine-l { font-size: 14px; color: var(--mute); }
.demo { --th: 60px; --gap: 8px; --r: 14px; flex: 1 1 380px; max-width: 520px; min-width: 0; padding: 18px; gap: 14px; }
@media (min-width: 640px) { .demo { --th: 72px; padding: 24px; } }
.demo-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.demo-top b { font: 800 20px var(--fd); }
.demo-top span { font-size: 13px; font-weight: 600; color: var(--mute); }
.demo-done { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.demo-done b { font: 700 17px var(--fd); }
@keyframes pop { from { transform: translateY(16px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drop { from { transform: translate(-50%, -50%) translateY(-14px); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(5px); } }
.row.pop { animation: pop 420ms cubic-bezier(.2, .9, .3, 1.25); }
.toast.drop { animation: drop 220ms cubic-bezier(.3, 1.4, .5, 1); }
.grid.shake { animation: shake 380ms; }

.band { display: flex; flex-direction: column; gap: 20px; padding: 28px 0; }
.band h2 { margin: 0; font: 800 clamp(28px, 5vw, 40px)/1.05 var(--fd); letter-spacing: -0.03em; }
.band-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.band-head p { margin: 6px 0 0; color: var(--mute); }
.seeall { flex: none; padding: 10px 0; color: var(--ink); font-weight: 700; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.pgrid2.four { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.step { display: flex; flex-direction: column; gap: 10px; padding: 24px; border: 2.5px solid var(--line); border-radius: 26px; background: var(--surf); box-shadow: 0 4px 0 var(--shadow); }
.step h3 { margin: 0; font: 800 26px/1.1 var(--fd); }
.step p { margin: 0; line-height: 1.5; color: var(--mute); }
.num { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 2.5px solid var(--line); border-radius: 50%; font: 800 20px var(--fd); }
.creator-band { display: flex; flex-wrap: wrap; gap: 32px; padding: clamp(24px, 5vw, 48px); border: 2.5px solid var(--line); border-radius: 32px; background: #17142A; color: #fff; }
.cb-copy { flex: 1 1 360px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.creator-band .eyebrow { opacity: .7; letter-spacing: .12em; }
.cb-copy p { margin: 0; font-size: 17px; line-height: 1.5; opacity: .85; }
.cb-stats { flex: 1 1 280px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; }
.cb-stats div { padding: 18px; border: 2px solid rgba(255, 255, 255, .18); border-radius: 20px; background: rgba(255, 255, 255, .08); }
.cb-stats b { display: block; font: 800 30px/1.1 var(--fd); }
.cb-stats span { font-size: 14px; opacity: .8; overflow-wrap: anywhere; }

.site-foot { margin-top: 24px; border-top: 2.5px solid var(--line); background: var(--surf); }
.foot-in { width: min(100% - 32px, 1120px); margin-inline: auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; padding: 24px 0; }
.foot-brand { font: 800 20px var(--fd); letter-spacing: -0.03em; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 15px; }
.site-foot a { color: var(--ink); }

/* ---------- browse ---------- */
.browse { display: flex; flex-direction: column; gap: 18px; padding: 28px 0 48px; }
.browse h1 { margin: 0; font: 800 clamp(34px, 7vw, 56px)/1 var(--fd); letter-spacing: -0.04em; }
.search label { position: relative; display: block; max-width: 720px; }
.search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search input { width: 100%; height: 56px; padding: 0 18px 0 52px; border: 2.5px solid var(--line); border-radius: 999px; background: var(--surf); color: var(--ink); font: 600 17px var(--fb); box-shadow: 0 3px 0 var(--shadow); }
.search input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.browse .tabs { align-self: flex-start; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 2.5px solid var(--line); border-radius: 999px; background: var(--surf); color: var(--ink); font-weight: 700; font-size: 14px; text-decoration: none; }
.chips a[aria-current] { background: var(--inv); color: var(--invInk); }
.chips a:focus-visible, .tabs a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bcount { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.bcount b { font-size: 15px; }
.bcount span { font-size: 14px; color: var(--mute); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; color: var(--mute); }
.ceyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.cby { font-size: 14px; color: var(--mute); }
@media (max-width: 639px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px 8px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips a { flex: none; }
}

/* ---------- moderation ---------- */
textarea { width: 100%; padding: 10px 14px; border: 2.5px solid var(--line); border-radius: 12px; background: var(--surf); color: var(--ink); font: 600 16px/1.4 var(--fb); resize: vertical; }
textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hidden-note { width: min(100% - 32px, 1120px); margin: 16px auto 0; padding: 12px 16px; border: 2.5px dashed var(--err); border-radius: 14px; color: var(--err); font-weight: 700; }
.report-row { margin: 0; padding: 0 0 28px; text-align: center; }
.linkbtn { padding: 8px; border: 0; background: none; color: var(--mute); font: 600 13px var(--fb); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkbtn:hover { color: var(--ink); }
.linkbtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
dialog { width: min(92vw, 440px); padding: 22px; border: 2.5px solid var(--line); border-radius: 26px; background: var(--surf); color: var(--ink); box-shadow: 0 4px 0 var(--shadow); }
dialog::backdrop { background: rgba(23, 20, 42, .55); }
dialog form { display: flex; flex-direction: column; gap: 14px; }
dialog h2 { margin: 0; font: 800 22px/1.1 var(--fd); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.report-thanks { margin: 0; font: 800 19px/1.3 var(--fd); }

.admin .tabs { align-self: flex-start; }
.qitem { gap: 12px; }
.qhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.qtitle { color: var(--ink); font: 800 20px/1.15 var(--fd); overflow-wrap: anywhere; }
.qby { margin-top: 4px; font-size: 14px; color: var(--mute); }
.rchips { display: flex; flex-wrap: wrap; gap: 6px; }
.rchips .chip { margin: 0; }
.rnotes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
form.inline { display: inline; margin: 0; }
.astatus { font-size: 13px; color: var(--mute); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badges:empty { display: none; }
@media (min-width: 980px) { .arow { grid-template-columns: minmax(0, 1fr) auto; } }

/* ---------- accessibility ---------- */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; } /* main is only focused by the skip link */
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; padding: 12px 18px; border: 2.5px solid var(--line); border-radius: 12px; background: var(--surf); color: var(--ink); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.theme { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surf2); }
.theme button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: 700 13px var(--fb); cursor: pointer; }
.theme button[aria-pressed="true"] { background: var(--inv); color: var(--invInk); }
