/* ================================================================
   THEME: change the look of the whole site here.

   Colors: each line below is one named color, used everywhere on
   the site. Change the hex code (like #f8f1e7) to change it
   everywhere at once. Pick colors at https://htmlcolorcodes.com
     --bg        page background
     --surface   cards, the writing box, crossword squares
     --ink       main text
     --muted     softer text (dates, hints)
     --line      thin borders and dividers
     --accent    buttons, links, highlights
     --accent-soft  light tint behind selected things
     --honey     the active crossword square
   The first block is the light theme. The block under
   "prefers-color-scheme: dark" is used when a visitor's device is
   in dark mode.

   Fonts: set in --font-display (headings), --font-ui (buttons,
   menus) and --font-read (journal text). To use a different Google
   Font, also change the fonts link near the top of index.html and
   play.html.
   ================================================================ */
:root{
  --bg:#f8f1e7; --surface:#fffaf3; --ink:#3b2f26; --muted:#7a6857; --line:#e8dbc8;
  --accent:#5f6f3a; --accent-soft:#ece6cf; --honey:#f2cf7e; --danger:#b4473f;
  --warn-bg:#fbefd2; --warn-ink:#6b5418;
  --font-display:"Fraunces", Georgia, "Times New Roman", serif;
  --font-ui:"Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-read:"Lora", Georgia, "Times New Roman", serif;
  --radius:14px;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#1e1915; --surface:#28211c; --ink:#f1e6d8; --muted:#b5a493; --line:#3d342c;
    --accent:#b9c77f; --accent-soft:#35361f; --honey:#7a5a1e; --danger:#e58a7f;
    --warn-bg:#2f2717; --warn-ink:#ead39a;
    color-scheme:dark;
  }
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--font-ui);font-size:16px;line-height:1.6;-webkit-font-smoothing:antialiased}
a{color:var(--accent)}
button{font:inherit;color:inherit;cursor:pointer}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}
[hidden]{display:none!important}
.wrap{max-width:720px;margin:0 auto;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
.wrap.wide{max-width:1000px}

/* header */
header.top{position:sticky;top:0;z-index:5;background:color-mix(in srgb,var(--bg) 90%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border-bottom:1px solid var(--line)}
header.top .wrap{display:flex;align-items:center;justify-content:space-between;gap:16px;padding-block:14px;flex-wrap:wrap}
.brand{font-family:var(--font-display);font-weight:600;font-size:19px;text-decoration:none;color:var(--ink);display:flex;align-items:center;gap:10px;min-width:0}
.brand svg{width:24px;height:24px;flex:none}
.brand span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
nav.tabs{display:flex;gap:4px}
nav.tabs a{text-decoration:none;color:var(--muted);font-weight:700;font-size:15px;padding:6px 14px;border-radius:999px}
nav.tabs a:hover{color:var(--ink)}
nav.tabs a[aria-current="page"]{color:var(--ink);background:var(--accent-soft)}

main{padding-block:40px 72px;display:flex;flex-direction:column;gap:32px}
.eyebrow{font-size:12px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin:0}
h1,h2,h3{margin:0;text-wrap:balance;font-family:var(--font-display);letter-spacing:-.01em}
h1{font-size:clamp(34px,6vw,48px);line-height:1.08;font-weight:600}
h2{font-size:22px;font-weight:600}
h3{font-weight:600}
p{margin:0}
.hero{display:flex;flex-direction:column;gap:12px}
.lede{font-family:var(--font-read);font-size:19px;line-height:1.6;max-width:60ch}
.muted{color:var(--muted)}
.num{font-variant-numeric:tabular-nums}

.btn{border:1px solid var(--line);background:var(--surface);padding:8px 16px;border-radius:999px;font-weight:700;font-size:14px}
.btn:hover{border-color:var(--accent)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--bg)}
.btn.primary:hover{filter:brightness(1.08)}
.btn.ghost{border-color:transparent;background:none;color:var(--muted);padding:6px 10px}
.btn.ghost:hover{color:var(--ink)}
.btn.danger{color:var(--danger)}
.btn:disabled{opacity:.5;cursor:default}
.linkish{background:none;border:none;padding:0;color:var(--muted);text-decoration:underline;text-underline-offset:3px;font-size:13px}
.linkish:hover{color:var(--ink)}

.notice{background:var(--warn-bg);color:var(--warn-ink);border-radius:var(--radius);padding:12px 16px;font-size:14px}
.status{font-size:14px;color:var(--muted)}
.status.err{color:var(--danger)}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.row.end{justify-content:flex-end}

.field{width:100%;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:10px;padding:10px 12px;font:inherit}
.field:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
textarea.field{font-family:var(--font-read);font-size:18px;line-height:1.65;resize:vertical;min-height:140px}
label.lbl{font-size:13px;font-weight:700;color:var(--muted)}
form.stack{display:flex;flex-direction:column;gap:12px}

/* journal */
.composer{border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);padding:18px 20px;display:flex;flex-direction:column;gap:8px;box-shadow:0 1px 0 var(--line)}
.composer .bare{border:none;padding:4px 0;background:transparent;box-shadow:none}
.composer input.bare{font-family:var(--font-display);font-size:21px;font-weight:600}
.composer textarea.bare{min-height:110px}
.composer .row{border-top:1px dashed var(--line);padding-top:12px}
.entries{display:flex;flex-direction:column}
.entry{display:grid;grid-template-columns:96px 1fr;gap:20px;padding-block:28px;border-top:1px dashed var(--line)}
.entry:first-child{border-top:none;padding-top:4px}
.entry time{font-size:13px;font-weight:700;color:var(--muted);line-height:1.5;padding-top:6px;font-variant-numeric:tabular-nums}
.entry time b{display:block;font-family:var(--font-display);font-size:30px;font-weight:600;line-height:1.1;color:var(--accent)}
.entry-body{display:flex;flex-direction:column;gap:10px;min-width:0}
.entry-body h3{font-size:22px}
.entry-text{font-family:var(--font-read);font-size:18px;line-height:1.7;white-space:pre-wrap;overflow-wrap:anywhere;max-width:62ch}
.entry-tools{display:flex;gap:4px;flex-wrap:wrap;margin-left:-10px}
.confirm{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:14px}
.empty{border:1px dashed var(--line);border-radius:var(--radius);padding:32px 24px;text-align:center;display:flex;flex-direction:column;gap:6px;align-items:center}
.empty p{max-width:44ch}
@media (max-width:520px){
  .entry{grid-template-columns:1fr;gap:6px}
  .entry time b{display:inline;font-size:18px;margin-right:6px}
}
.signin{border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);padding:18px;max-width:360px}

/* daily crossword */
.xw-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap}
.xw-timer{display:flex;flex-direction:column;align-items:flex-end}
.xw-timer .num{font-size:26px;font-weight:700}
.xw{display:grid;grid-template-columns:minmax(0,1fr);gap:24px;align-items:start}
@media (min-width:860px){ .xw{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr)} }
.xw-board{display:flex;flex-direction:column;gap:14px;min-width:0}
.xw-bar{display:flex;align-items:center;gap:6px;background:var(--accent-soft);border-radius:var(--radius);padding:8px;min-height:58px}
.xw-bar .clue{flex:1;min-width:0;font-size:16px;line-height:1.35}
.xw-bar .clue b{font-weight:800;margin-right:6px;white-space:nowrap}
.xw-bar button{border:none;background:none;width:36px;height:36px;border-radius:50%;font-size:18px;color:var(--muted);flex:none}
.xw-bar button:hover{background:var(--surface);color:var(--ink)}
.xw-grid{display:grid;gap:3px;width:100%;margin:0 auto;touch-action:manipulation}
.xw-cell{position:relative;aspect-ratio:1/1;background:var(--surface);border:1.5px solid color-mix(in srgb,var(--ink) 55%,transparent);border-radius:6px;transition:background .12s}
.xw-cell input{position:absolute;inset:0;width:100%;height:100%;border:none;background:transparent;text-align:center;font-family:var(--font-ui);font-weight:800;font-size:var(--xw-font,20px);text-transform:uppercase;color:var(--ink);caret-color:transparent;padding:12% 0 0;border-radius:5px;cursor:pointer}
.xw-cell input:focus{outline:none}
.xw-cell .n{position:absolute;top:2px;left:4px;font-size:var(--xw-num,11px);font-weight:700;line-height:1;color:var(--muted);pointer-events:none}
.xw-cell.in-word{background:var(--accent-soft)}
.xw-cell.active{background:var(--honey)}
.xw-cell.wrong input{color:var(--danger);text-decoration:line-through;text-decoration-thickness:2px}
.xw-cell.revealed::after{content:"";position:absolute;right:4px;top:4px;width:5px;height:5px;border-radius:50%;background:var(--accent)}
.xw-grid.solved .xw-cell{background:var(--accent-soft);border-color:var(--accent)}
.xw-tools{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}
.xw-msg{text-align:center;min-height:1.6em}
.xw-msg.win{font-family:var(--font-display);font-size:22px;color:var(--accent)}
.xw-clues{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:24px;min-width:0}
.xw-clues h2{font-size:18px;margin-bottom:8px}
.xw-clues ol{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
.xw-clues li button{display:flex;gap:10px;width:100%;text-align:left;border:none;background:none;padding:7px 10px;border-radius:10px;line-height:1.4}
.xw-clues li button:hover{background:var(--accent-soft)}
.xw-clues li button b{min-width:1.6em;font-weight:800;color:var(--muted)}
.xw-clues li.current button{background:var(--honey)}
.xw-clues li.done button span{color:var(--muted);text-decoration:line-through;text-decoration-color:color-mix(in srgb,var(--muted) 60%,transparent)}

footer{border-top:1px solid var(--line);padding-block:20px;font-size:13px;color:var(--muted)}
footer .wrap{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}
@media (prefers-reduced-motion:reduce){ *{transition:none!important} }
