/* The site's own pages: the home page's cards, after the screenshot the user sent, and the duel page. Colors match
   the games'. The duel page also loads src/duel/duel.css. */
:root{--bg:#f3efe5;--paper:#fbf8f0;--ink:#1f2422;--muted:#6e746f;--line:#cec8bb;--blue:#315f89;--blue-soft:#dbe8f2;--red:#94463f;--red-soft:#f2d9d4;--gold:#b88a3b;--green:#3b7654;--duel:#f7efc6;--shadow:0 18px 50px rgba(31,36,34,.12)}
*{box-sizing:border-box}
html,body{margin:0;overscroll-behavior:none}
body{color:var(--ink);background:var(--bg);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;-webkit-tap-highlight-color:transparent;line-height:1.4}
.page{max-width:1416px;margin:0 auto;padding:clamp(16px,4vw,40px) clamp(14px,3vw,32px) 48px}
/* viewport-fit=cover draws under a phone's notch and home bar: keep content inside the safe area. */
@supports (padding:max(0px)){.page{padding-left:max(clamp(14px,3vw,32px),env(safe-area-inset-left));padding-right:max(clamp(14px,3vw,32px),env(safe-area-inset-right));padding-bottom:max(48px,env(safe-area-inset-bottom))}}

/* Home: the name, the date, and the daily number on one line, then the title, the tagline, and the sub-tagline, above the cards. */
.masthead{text-align:center;margin:0 0 clamp(18px,4vw,34px)}
.masthead .today{margin:0;font-size:12px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);text-wrap:balance}
.masthead h1{margin:8px 0 0;font-weight:800;font-size:clamp(30px,5.2vw,46px);line-height:1.1;letter-spacing:-.02em}
.masthead .tagline{margin:2px 0 6px;font-weight:800;font-size:clamp(22px,3.8vw,32px);line-height:1.15;letter-spacing:-.015em}
.masthead .subtagline{margin:0;color:var(--muted);font-size:clamp(15px,2vw,18px)}

/*
 * The cards, the duel card first: all one size, as many across as fit (four on a wide screen, one on a phone), and
 * centred. Every row is as tall as the tallest card, so every card is too. A game card's pitch is one line
 * (MAX_PITCH, games.ts), and its Play sits at its foot.
 */
.cards{--card:320px;display:grid;grid-template-columns:repeat(auto-fill,min(100%,var(--card)));grid-auto-rows:1fr;justify-content:center;gap:clamp(14px,2.4vw,24px)}
.card{display:flex;flex-direction:column;background:#fff;border:1px solid #d9d3c6;border-radius:10px;overflow:hidden}
/* A name is one line too (MAX_NAME, games.ts). */
.card h2{font-family:Georgia,"Times New Roman",serif;font-weight:700;font-size:clamp(24px,2.8vw,29px);margin:0;letter-spacing:-.01em;white-space:nowrap}
.card .top{background:var(--top);display:grid;justify-items:center;align-content:center;gap:12px;padding:28px 16px 24px;height:200px;text-align:center}
.card .top svg{width:72px;height:72px}
.card .body{display:flex;flex-direction:column;gap:10px;padding:18px 20px 22px;flex:1;text-align:center}
.card .pitch{margin:0;color:#3f4542;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card .body .pill{margin-top:auto}
.card .about{margin:0;color:var(--muted);font-size:13px;font-weight:700;letter-spacing:.04em;text-transform:uppercase}
.pill{display:block;text-align:center;padding:13px 18px;border:1.5px solid #c9c2b4;border-radius:999px;background:#fff;color:var(--ink);font-weight:800;font-size:16px;text-decoration:none}
.pill:hover{border-color:var(--ink)}
.pill.primary{background:var(--ink);border-color:var(--ink);color:#fff}

/*
 * The duel card is the featured one: pale yellow throughout, its art, a badge, and the black button. It is kept as
 * short as a game card, since every card in a row is as tall as the tallest: compact art, and its buttons side by side.
 */
.card.duel{position:relative;background:var(--duel);border-color:#e6d993;text-align:center;padding:18px 20px 22px;gap:12px}
.card.duel .art{display:grid;place-items:center;min-height:112px}
.card.duel .art svg{width:min(100%,190px);height:auto}
/* In the card's corner, clear of the art. */
.card.duel .badge{position:absolute;top:10px;right:10px;background:#2b2f2c;color:#fff;font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;border-radius:8px;padding:5px 9px}
.card.duel p{margin:0;font-size:16px;color:#3f4542;text-wrap:pretty}
.card.duel .actions{margin-top:auto;display:flex;gap:8px}
.card.duel .actions .pill{flex:1;padding-left:8px;padding-right:8px;white-space:nowrap}
.pill[hidden]{display:none}

.site-foot{margin-top:28px;text-align:center;font-size:13px;color:var(--muted)}
.site-foot a{color:var(--muted)}
.site-foot + .site-foot{margin-top:8px}
/* The last card: more games to come, drawn as a space waiting to be filled. */
.card.more{background:transparent;border:2px dashed var(--line);justify-content:center;align-items:center;gap:10px;padding:28px 20px;text-align:center;min-height:200px}
.card.more svg{width:64px;height:64px;color:var(--line)}
.card.more h2{color:var(--muted)}
.card.more p{margin:0;color:var(--muted);font-size:16px;text-wrap:pretty}

/* The duel page. */
.duel-page{max-width:560px;margin:0 auto}
.site-top{max-width:560px;margin:0 auto 14px}
.back{color:var(--muted);text-decoration:none;font-weight:700;font-size:14px}
.duel-page h1{font-family:Georgia,"Times New Roman",serif;font-size:clamp(28px,6vw,38px);margin:0 0 4px}
.duel-page .lead{margin:0 0 20px;color:var(--muted);font-size:16px}
button{font:inherit;border:1px solid var(--line);border-radius:11px;background:#fff;color:var(--ink);padding:9px 13px;cursor:pointer;font-weight:700;touch-action:manipulation}
button.primary{background:var(--ink);color:#fff;border-color:var(--ink)}
.tiny{font-size:12px;color:var(--muted);line-height:1.5;margin:4px 0 0}

/* Duels (src/duel/page.ts): the cover over a duel board, the strip above it, and the results sheet. Every game's
   export appends this to its stylesheet; it uses the color tokens and the .modal, .sheet, .btns, and .tiny styles
   each game defines. */

/* The cover hides a duel board until Start, so nobody studies it off the clock. Over a board shorter than its card, a
   wide Sokoban's on a phone, it grows down over what's below the board, as far as the board's area goes (100cqh, the
   height of the board-shell the board sits at the top of), and scrolls past that. */
.duel-cover{position:absolute;inset:0 0 auto;min-height:100%;max-height:100cqh;display:grid;place-items:safe center;overflow:auto;background:var(--paper);border:2px solid var(--ink);border-radius:14px;z-index:6;padding:14px}
.duel-cover[hidden]{display:none}
.duel-cover .card{max-width:340px;text-align:center;display:grid;gap:8px}
.duel-cover .kicker{margin:0;font-size:11px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:var(--gold)}
.duel-cover h2{margin:0;font-family:Georgia,serif;font-size:clamp(20px,6cqw,28px);line-height:1.2}
.duel-cover p{margin:0;color:var(--muted);font-size:13px;line-height:1.45}
.duel-cover p.lead{font-size:15px}
.duel-cover p b{color:var(--ink)}
.duel-cover button{justify-self:center;min-width:140px;margin:4px 0;font-size:16px;padding:11px 20px}
/* Your name, asked before Start: 16px, so iOS doesn't zoom in on it. */
.duel-cover .field{display:block;margin:6px 0 -4px;font-weight:700;font-size:13px;text-align:left;color:var(--ink)}
.duel-cover input{display:block;width:100%;font:inherit;font-size:16px;border:1px solid var(--line);border-radius:10px;padding:9px 11px;background:#fff;color:var(--ink)}
.duel-cover .status{color:var(--red);font-size:13px}
/* Live regions stay in the page while empty, so what arrives in them is announced. */
.duel-cover .status:empty{display:block;margin:0}
.duel-cover .more{display:grid;gap:6px}

/* The strip names the stake and what to beat while the try counts. */
.duel-strip{margin:0;max-width:640px;text-align:center;color:var(--muted);font-size:clamp(12.5px,1.5vw,14px);line-height:1.45;background:var(--paper);border:1px solid var(--gold);border-radius:12px;padding:6px 12px}
.duel-strip b{color:var(--ink)}
.duel-strip[hidden]{display:none}

/* Results: the stake's answer first, then the verdict, the standings, where your result stands, and the message with
   Copy. The verdict and the status line stay in the page while empty, so what arrives in them is announced. */
.duel-sheet .results .verdict{margin:0 0 6px;font-weight:700;font-size:15px}
.duel-sheet .results .verdict:empty{margin:0}
.duel-sheet .stake-answer{margin:4px 0 10px;padding:10px 12px;border:1px solid var(--gold);border-radius:12px;background:#fff}
.duel-sheet .stake-answer[hidden]{display:none}
.duel-sheet .stake-answer .line{margin:0;font-size:13px;color:var(--muted)}
.duel-sheet .stake-answer .a{margin:2px 0 0;font-family:Georgia,serif;font-size:20px;line-height:1.3}
.duel-sheet .standings{list-style:none;margin:8px 0 6px;padding:0;display:grid;gap:4px;max-height:28vh;max-height:28dvh;overflow:auto}
.duel-sheet .standings li{display:grid;grid-template-columns:2.6em minmax(0,1fr) auto;gap:8px;align-items:center;padding:6px 10px;border:1px solid var(--line);border-radius:10px;background:#fff;font-size:14px}
.duel-sheet .standings li.me{border-color:var(--ink);box-shadow:inset 0 0 0 1px var(--ink)}
.duel-sheet .standings .rank{font-weight:800;color:var(--muted)}
.duel-sheet .standings .who{min-width:0;overflow-wrap:anywhere;font-weight:600}
.duel-sheet .standings .who small{display:inline-block;white-space:nowrap;margin-left:6px;font-size:10.5px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--gold)}
.duel-sheet .standings .what{white-space:nowrap;color:var(--muted);font-size:13px}
.duel-sheet .field{display:block;margin:12px 0 4px;font-weight:700;font-size:14px}
.duel-sheet textarea{display:block;width:100%;font:inherit;font-size:16px;border:1px solid var(--line);border-radius:10px;padding:8px 10px;background:#fff;color:var(--ink)}
.duel-sheet textarea{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;line-height:1.45;resize:none;margin-bottom:8px}
@media (hover:none){.duel-sheet textarea{font-size:16px}}
.duel-sheet .send{margin:2px 0 6px}
.duel-sheet .send:empty{display:block;margin:0}
.duel-sheet .tiny.warn{color:var(--red)}
.duel-sheet .tiny.warn[hidden]{display:none}
/* Copy stays in reach while the sheet scrolls on a small phone. */
.duel-sheet .sheet-actions{position:sticky;bottom:-20px;margin:0 -22px -20px;padding:10px 22px 14px;background:var(--paper);border-top:1px solid var(--line)}
.duel-sheet .sheet-actions .tiny{margin:6px 0 0}
.duel-sheet .btns{justify-content:flex-end;flex-wrap:wrap}
.duel-sheet .btns button,.duel-sheet .btns a.button{min-width:88px}
a.button{display:inline-grid;place-items:center;font:inherit;font-weight:700;border:1px solid var(--line);border-radius:11px;background:#fff;color:var(--ink);padding:9px 13px;text-decoration:none}

/* The duel page (src/duel/setup.ts): a game with its usual time, the stake, your name, and Create the duel; then the
   duel's one link, ready to send; and Your duels. */
.duel-setup{display:grid;gap:28px}
.duel-setup .form{display:grid;gap:20px}
.duel-setup fieldset{border:0;margin:0;padding:0;display:grid;gap:8px;min-width:0}
.duel-setup legend{font-weight:800;font-size:15px;padding:0;margin-bottom:8px}
.duel-setup .choice{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:#fff;cursor:pointer}
.duel-setup .choice:has(input:checked){border-color:var(--ink);box-shadow:inset 0 0 0 1px var(--ink)}
.duel-setup .choice:has(input:disabled){opacity:.55;cursor:not-allowed}
.duel-setup .choice input{width:18px;height:18px;margin:0;accent-color:var(--ink);flex:none}
.duel-setup .choice .text{display:grid;gap:2px;min-width:0}
.duel-setup .choice .label{font-weight:700}
.duel-setup .choice .about{font-size:13px;color:var(--muted)}
.duel-setup .chips{display:flex;flex-wrap:wrap;gap:8px}
.duel-setup .chip{border-radius:999px;padding:8px 14px;font-weight:600;font-size:14px}
.duel-setup .chip[aria-pressed="true"]{background:var(--ink);color:#fff;border-color:var(--ink)}
.duel-setup .own{display:grid;gap:8px;margin-top:6px}
.duel-setup .own[hidden]{display:none}
.duel-setup .own-line{display:flex;align-items:center;gap:8px;font-weight:700}
.duel-setup input[type=text],.duel-setup select{font:inherit;font-size:16px;border:1px solid var(--line);border-radius:10px;padding:10px 12px;background:#fff;color:var(--ink);width:100%;min-width:0}
.duel-setup .own-line input{flex:1}
.duel-setup .own-line select{width:auto;flex:none}
.duel-setup .go{font-size:17px;padding:14px 20px;border-radius:999px;width:100%}
.duel-setup .status{color:var(--red);font-size:14px;margin:8px 0 0}
/* Kept in the page while empty, so what arrives in it is announced; it takes no room. */
.duel-setup .status:empty{display:block;margin:0}
.duel-setup .ready{display:grid;gap:12px;padding:18px;border:1px solid var(--ink);border-radius:14px;background:#fff}
.duel-setup .ready h2{margin:0;font-family:Georgia,serif;font-size:24px;line-height:1.2}
.duel-setup .ready h2:focus{outline:none}
.duel-setup .ready .lead{margin:0;color:var(--muted);font-size:15px}
.duel-setup .ready textarea{display:block;width:100%;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;line-height:1.45;border:1px solid var(--line);border-radius:10px;padding:8px 10px;background:var(--paper);color:var(--ink);resize:none}
@media (hover:none){.duel-setup .ready textarea{font-size:16px}}
.duel-setup .ready .btns{display:flex;gap:8px;flex-wrap:wrap}
.duel-setup .ready .btns > *{flex:1;min-width:120px;font-size:16px;padding:12px 16px}
.duel-setup .ready .warn{color:var(--red)}
.duel-setup .ready .warn[hidden]{display:none}
.duel-setup .ready > a.tiny{justify-self:start;color:var(--muted)}
/* Your duels: each with its game, its stake, and who has finished. */
.duel-setup .yours{display:grid;gap:10px}
.duel-setup .yours[hidden]{display:none}
.duel-setup .yours h2{margin:0;font-size:15px;font-weight:800}
.duel-list{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.duel-list a{display:grid;gap:2px;padding:10px 14px;border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--ink);text-decoration:none}
.duel-list a:hover{border-color:var(--ink)}
.duel-list .label{font-weight:700}
.duel-list .detail{font-size:13px;color:var(--muted);overflow-wrap:anywhere}
/* A name this device already has, in place of the name field (name.ts); hidden parts stay hidden whatever they show as. */
.duel-cover [hidden],.duel-setup [hidden]{display:none}
.duel-cover p.known-name,.duel-setup .known-name{margin:2px 0;font-size:15px;color:var(--ink)}
.known-name bdi{font-weight:700}
.duel-cover .known-name button,.duel-setup .known-name button{font:inherit;font-weight:600;color:var(--ink);background:none;border:0;border-radius:0;padding:0;margin:0;min-width:0;text-decoration:underline;text-underline-offset:3px;cursor:pointer}

/* The cloud duel page's own rules, made of the duel page's (src/duel/duel.css), which the build puts first: sending a
   duel to friends (src/cloud/web/invites.ts), with the Send to friends box on the ready card and Invited first on the
   page, and Your duels' Remove, Clear all, and Undo (src/cloud/web/setup.ts). */

/* The ready card's place for the box takes no room, and no gap beside it, until there are friends to fill it. */
.duel-setup .send-slot:empty{display:none}
/* A friend's name may be 24 bytes with no space to break at: it breaks anywhere rather than spill out of its row. */
.duel-setup .send .label{overflow-wrap:anywhere}
/* Send fills the box, as Copy and Play fill the card. */
.duel-setup .send-foot button{width:100%;font-size:16px;padding:12px 16px}
.duel-setup .send-foot button:disabled{opacity:.55;cursor:not-allowed}
/* The box's own status line, red only when a send failed. Kept in the page while empty, so what arrives in it is
   announced; it takes no room. */
.duel-setup .send-status{font-size:14px;margin:8px 0 0}
.duel-setup .send-status:empty{margin:0}
.duel-setup .send-status.failed{color:var(--red)}

/* Invited, first on the page: a row's link takes the room, gold-edged with its Play button inside it, and Dismiss beside
   it. A Dismiss that failed says so on a line of its own under them, which takes no room while empty. */
.duel-setup .invited{display:grid;gap:10px}
.duel-setup .invited[hidden]{display:none}
.duel-setup .invited h2{margin:0;font-size:15px;font-weight:800}
.duel-setup .invited li{display:flex;flex-wrap:wrap;align-items:center;gap:0 8px}
.duel-setup .invited li a{flex:1;min-width:0;display:flex;align-items:center;gap:10px;border:2px solid var(--gold)}
.duel-setup .invited li a .text{flex:1;min-width:0;display:grid;gap:2px}
.duel-setup .invited li a .play{flex:none;padding:7px 16px;border-radius:999px;background:var(--ink);color:#fff;font-weight:800;font-size:14px}
.duel-setup .invited .dismiss{flex:none;font-size:14px;color:var(--muted)}
.duel-setup .invited .dismiss:disabled{opacity:.55;cursor:not-allowed}
.duel-setup .invited .dismiss-status{flex-basis:100%;margin:6px 0 0;font-size:14px;color:var(--red)}
.duel-setup .invited .dismiss-status:empty{margin:0}

/* Your duels: Clear all beside the title, Remove beside each row as Dismiss is beside Invited's, and the line that
   offers Undo after either, which takes no room while there's nothing to undo. */
.duel-setup .yours-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.duel-setup .yours li{display:flex;align-items:center;gap:8px}
.duel-setup .yours li a{flex:1;min-width:0}
.duel-setup .yours .remove{flex:none;font-size:14px;color:var(--muted)}
.duel-setup .clear-all,.duel-setup .undo{font:inherit;font-size:14px;font-weight:700;color:var(--ink);background:none;border:0;border-radius:0;padding:4px 0;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.duel-setup .clear-all[hidden]{display:none}
.duel-setup .undo-line{margin:0;font-size:14px;color:var(--ink)}
.duel-setup .undo-line:empty{display:none}
/* Send, on a row this device made: beside Remove, with the row's own Send to friends box under the row when open. */
.duel-setup .yours li{flex-wrap:wrap}
.duel-setup .yours .row-send{flex:none;font-size:14px;color:var(--muted)}
.duel-setup .yours .row-send[aria-expanded="true"]{color:var(--ink);border-color:var(--ink)}
.duel-setup .yours .row-send-box{flex-basis:100%;min-width:0}
.duel-setup .yours .row-send-box[hidden]{display:none}
