/* Nunito (SIL OFL 1.1, play/fonts/OFL.txt): the rounded voice off Apple devices, where ui-rounded doesn't exist. Self-hosted, Latin only. */
@font-face{font-family:"Nunito"; font-style:normal; font-weight:400 800; font-display:swap; src:url(fonts/nunito-latin.woff2) format("woff2"); unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD}
/* The web games' shell. Tokens are the landing page's (docs/index.html), which mirror Theme.swift. */
:root{
  --page:#FFFFFF; --sheet:#FFFFFF; --ink:#151B24; --ink2:#575E69; --pen:#000000; --on-pen:#FFFFFF;
  --paper-rule:#E4E7EC; --margin:#F0837A; --edge:#C3C8D1; --rule:#DADEE5;
  --hl-yellow:#FFE244; --hl-green:#B7F0A2; --hl-blue:#A6DCFF; --hl-pink:#FFB7DC; --hl-purple:#D9C4FF; --hl-blend:multiply;
  --pen-wash:rgb(0 0 0 / .06); --press:rgb(0 0 0 / .05);
  --lift:0 1px 1px rgb(0 0 0 / .05), 0 4px 10px rgb(0 0 0 / .08);
  --r:28px;
  --rounded: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --col:520px;
  --margin-x:14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark){
  :root{
    --page:#0B0D12; --sheet:#151922; --ink:#E9EBEF; --ink2:#A1A5AB; --pen:#FFFFFF; --on-pen:#0B1220;
    --paper-rule:#1B2536; --margin:#6E3A38; --edge:#343B48; --rule:#1C1F24;
    --hl-yellow:rgb(214 181 41 / .5); --hl-green:rgb(111 176 74 / .5); --hl-blue:rgb(74 155 224 / .5); --hl-pink:rgb(208 92 154 / .5); --hl-purple:rgb(148 102 232 / .5); --hl-blend:normal;
    --pen-wash:rgb(255 255 255 / .08); --press:rgb(255 255 255 / .06);
    --lift:0 1px 1px rgb(0 0 0 / .4), 0 6px 14px rgb(0 0 0 / .35);
  }
}

*{box-sizing:border-box}
html{background:var(--page); scrollbar-color:var(--edge) var(--page); -webkit-text-size-adjust:100%; -webkit-tap-highlight-color:transparent}
body{
  margin:0; min-height:100dvh; color:var(--ink); background-color:var(--page);
  font:17px/var(--r) var(--sans); -webkit-font-smoothing:antialiased;
  background-image:repeating-linear-gradient(to bottom, transparent 0 calc(var(--r) - 1px), var(--paper-rule) calc(var(--r) - 1px) var(--r));
}
body::before{content:""; position:fixed; inset:0 auto 0 var(--margin-x); width:1.2px; background:var(--margin); pointer-events:none; z-index:0}
::selection{background:var(--hl-yellow); color:var(--ink)}
a{color:var(--pen); text-decoration-thickness:1px; text-underline-offset:4px}
:focus-visible{outline:2px solid var(--pen); outline-offset:3px; border-radius:8px}
button{font:inherit; color:inherit; margin:0}
[hidden]{display:none !important}

.page{position:relative; z-index:1; max-width:calc(var(--col) + 56px); margin:0 auto; padding:0 20px 24px 36px; min-height:100dvh; display:flex; flex-direction:column}
@media (min-width: 640px){
  :root{--margin-x:min(96px, max(14px, calc(50% - var(--col) / 2 - 24px)))}
  .page{padding-left:20px}
}

/* ---------- The header: icons, then the title written on a rule (PaperScreen) ---------- */
.bar{display:flex; align-items:center; gap:10px; height:calc(var(--r) * 2); padding-top:8px}
.bar .grow{flex:1}
.bar .knight{width:44px; height:44px; color:var(--ink)}
.icon{
  display:grid; place-items:center; width:44px; height:44px; padding:0; border-radius:50%; cursor:pointer;
  background:var(--sheet); border:1px solid var(--rule); box-shadow:var(--lift); color:var(--ink);
  transition:transform .15s var(--ease-out), background-color .15s;
}
.icon:hover{background:color-mix(in srgb, var(--sheet), var(--ink) 5%)}
.icon:active{transform:scale(.94)}
.icon svg{width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round}
.title{margin:0; font:700 34px/calc(var(--r) * 2) var(--rounded); letter-spacing:-.02em; position:relative; top:16px}
.title small{font:600 17px/1 var(--rounded); color:var(--ink2); letter-spacing:0; margin-left:6px}

/* The one line the game talks on. */
.caption{margin:0; min-height:var(--r); font:600 15px/var(--r) var(--rounded); color:var(--ink2); text-align:center; text-wrap:balance; transition:opacity .2s}
.caption.flash{color:var(--ink)}
.title + .caption{position:relative; top:8px; margin:8px 0}

/* ---------- Doodles ---------- */
.d{fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round}
.ghost{opacity:.35}

/* ---------- Buttons: CTAStyle (filled / outlined) and the game's pills ---------- */
.cta{
  display:flex; align-items:center; justify-content:center; width:100%; height:calc(var(--r) * 2 - 4px); padding:0 24px;
  border-radius:999px; border:1px solid var(--pen); background:var(--pen); color:var(--on-pen);
  font:600 17px/1 var(--rounded); cursor:pointer; text-decoration:none; transition:transform .15s var(--ease-out), opacity .15s;
}
.cta.outlined{background:transparent; color:var(--pen)}
.cta:active{transform:scale(.98)}
.cta:hover{opacity:.88}
.pill{
  min-height:44px; padding:0 18px; border:0; border-radius:999px; background:var(--pen-wash); color:var(--ink);
  font:600 17px/1 var(--rounded); cursor:pointer; transition:opacity .2s, transform .15s var(--ease-out);
}
.pill:active{transform:scale(.96)}
.pill:disabled{opacity:.45; cursor:default}

/* ---------- Sheets: results and how-to-play ---------- */
dialog.sheet{
  margin:auto auto 0; width:100%; max-width:var(--col); max-height:92dvh; padding:20px 28px 22px; border:1px solid var(--rule);
  border-radius:28px 28px 0 0; background:var(--sheet); color:var(--ink); box-shadow:0 -8px 40px rgb(0 0 0 / .14); overflow:auto; overscroll-behavior:contain;
}
dialog.sheet::backdrop{background:rgb(11 13 18 / .28)}
dialog.sheet[open]{animation:rise .42s var(--ease-out)}
dialog.sheet[open]::backdrop{animation:fade .3s ease-out}
@media (min-width: 640px){
  dialog.sheet{margin:auto; border-radius:28px; max-height:88dvh}
}
@keyframes rise{from{transform:translateY(24px); opacity:0}}
@keyframes fade{from{opacity:0}}
.sheet .close{position:sticky; top:0; margin:-8px -16px 0 auto; z-index:2}
.results{display:flex; flex-direction:column; align-items:center; gap:12px; text-align:center}
.results .big-knight{width:96px; height:96px; color:var(--ink); margin-top:-28px}
.verdict{margin:0; font:800 34px/1.15 var(--rounded); letter-spacing:-.02em}
.answer-word{margin:0; font:700 21px/1.3 var(--rounded)}
.meaning{margin:2px 0 0; font:400 16px/1.45 var(--serif); color:var(--ink2); max-width:34ch; min-height:1.45em}
.meaning:empty{display:none}
.countdown{margin:0; font:600 15px/1.4 var(--rounded); color:var(--ink2); font-variant-numeric:tabular-nums}

.stats{display:grid; grid-template-columns:repeat(4, 1fr); width:100%; padding:12px 0; border-block:1px solid var(--rule); margin:4px 0}
.stats div{display:flex; flex-direction:column; gap:2px}
.stats b{font:400 28px/1.15 var(--rounded); font-variant-numeric:tabular-nums}
.stats span{font:600 13px/1.3 var(--rounded); color:var(--ink2)}

.rules h2{margin:0 0 4px; font:700 28px/calc(var(--r) * 2) var(--rounded)}
.rules p{margin:0 0 var(--r); font:400 17px/var(--r) var(--sans); text-align:left}
.rules .close{float:right; margin:0 -12px 0 8px}

/* ---------- The highlighter: one pass, left to right, a hair off level ---------- */
.hl-swipe{position:relative; isolation:isolate}
.hl-swipe::before{
  content:""; position:absolute; z-index:-1; left:-5px; right:-5px; top:13%; bottom:13%; border-radius:12px;
  background:var(--ink-color, var(--hl-yellow)); mix-blend-mode:var(--hl-blend); transform:rotate(-1.2deg);
  -webkit-mask:linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 28px), transparent);
          mask:linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 28px), transparent);
}
.hl-swipe.draw::before{animation:sweep .55s var(--ease-out) both}
@keyframes sweep{from{clip-path:inset(0 100% 0 0)} to{clip-path:inset(0 0 0 0)}}

.foot{margin-top:auto; padding-top:var(--r); font:400 15px/var(--r) var(--sans); color:var(--ink2); text-align:center}
.foot a{color:var(--ink2)}

.sr{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}

@keyframes shake{20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(3px)}}
.shake{animation:shake .42s ease-in-out}
@keyframes hop{50%{transform:translateY(-8px)}}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.01ms !important; animation-delay:0s !important; transition-duration:.01ms !important}
  dialog.sheet[open]{animation:fade .2s ease-out !important}
}
