/* Wordmill web: the app's colours (Theme.swift) and a rounded system font in place of SF Rounded / Nunito. */
:root {
  --accent: #E0703A; --navy: #2E3A6B; --success: #3E9E6B; --danger: #D64545; --gold: #E5A823; --purple: #7A4FB8;
  --bg: #F8F4EC; --card: #FFFFFF; --tile: #FFFFFF; --border: #E2DACB; --key: #E9E3D7; --ink: #1E222B; --muted: #6F695C;
  --shadow: 0 2px 8px rgba(0,0,0,.05);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Arial Rounded MT Bold", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --accent: #F08A55; --navy: #A7B6E6; --success: #5CC48C; --danger: #F06A6A; --gold: #F2BE4A; --purple: #B08EE6;
          --bg: #14161B; --card: #1F232B; --tile: #2A2F39; --border: #3A404C; --key: #343A46; --ink: #F1EEE8; --muted: #A29E96;
          --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; z-index: 50; background: var(--card); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- header and today */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 max(14px, env(safe-area-inset-left));
       max-width: 560px; margin: 0 auto; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand img { border-radius: 7px; }
.hstreak { font-weight: 700; color: var(--accent); white-space: nowrap; }
.iconbtn { border: 0; background: var(--card); border-radius: 50%; width: 38px; height: 38px; cursor: pointer; box-shadow: var(--shadow); font-size: 17px; }
@media (max-width: 380px) { .brand span { display: none; } }
.getapp { background: var(--accent); color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }
main { max-width: 560px; margin: 0 auto; padding: 0 16px 24px; }
h1 { font-size: 26px; line-height: 1.2; margin: 8px 0 2px; font-weight: 800; }
.dayline { margin: 0 0 6px; color: var(--muted); font-weight: 600; min-height: 24px; }
.langpick { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.langpick select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px; }
.sect { font-size: 18px; margin: 18px 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
.points { font-size: 15px; color: var(--muted); font-weight: 700; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 16px; background: var(--card); border-radius: 20px;
        box-shadow: var(--shadow); color: var(--ink); text-decoration: none; border: 2px solid transparent; }
.card:hover { border-color: var(--border); }
.card.solved { border-color: color-mix(in srgb, var(--success) 45%, transparent); }
.cicon { font-size: 26px; width: 34px; text-align: center; }
.ctext { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ctext b { font-size: 17px; }
.ctext small { color: var(--muted); font-size: 14px; }
.cstars { color: var(--gold); font-size: 19px; letter-spacing: 1px; white-space: nowrap; }
.cstars .off { color: var(--border); }
.next { color: var(--muted); text-align: center; margin: 14px 0; min-height: 24px; font-variant-numeric: tabular-nums; }
.pill { display: block; width: 100%; text-align: center; border: 0; cursor: pointer; background: var(--accent); color: #fff; font-weight: 700;
        font-size: 17px; padding: 14px; border-radius: 999px; text-decoration: none; margin: 10px 0; }
.pill.navy { background: var(--navy); }
@media (prefers-color-scheme: dark) { .pill.navy { color: #14161B; } }
.pill:disabled { opacity: .45; cursor: default; }
.about { margin-top: 26px; color: var(--ink); }
.about h2 { font-size: 20px; margin: 0 0 6px; }
.about h3 { font-size: 16px; margin: 16px 0 2px; }
.about p { margin: 4px 0; color: var(--muted); }

/* ---------- app banner */
.appban { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border-radius: 20px; padding: 16px; margin: 16px 0;
          box-shadow: var(--shadow); border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.appicon { border-radius: 13px; flex: none; }
.apptitle { margin: 0; font-weight: 800; }
.apppitch { margin: 2px 0 10px; color: var(--muted); font-size: 14px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badges img { display: block; height: 40px; width: auto; }

/* ---------- footer and text pages */
.foot { max-width: 560px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: 14px; }
.foot .langs { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 10px; }
.foot a { color: var(--muted); }
.credits { font-size: 12px; }
.page .doc { max-width: 680px; }
.doc h1 { margin-top: 20px; }
.doc h2 { margin: 26px 0 6px; font-size: 21px; }
.doc h3 { margin: 14px 0 2px; font-size: 16px; }
.doc section { background: var(--card); border-radius: 20px; padding: 4px 18px 14px; margin: 14px 0; box-shadow: var(--shadow); }
.lead { color: var(--muted); }
.crumbs { margin: 16px 0 0; font-size: 14px; }
.brandline { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 24px; margin: 20px 0 0; }
.brandline img { border-radius: 9px; }
.path { font-weight: 700; letter-spacing: .5px; margin: 2px 0; }
.muted { color: var(--muted); }
.wheelrow { display: flex; gap: 6px; flex-wrap: wrap; }
.lt { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; }
.proverb { font: italic 22px/1.4 Georgia, "Times New Roman", serif; margin: 10px 0; }
.daynav { display: flex; justify-content: space-between; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.days { padding-left: 18px; }
.days li { margin: 6px 0; }
.langs2 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.snippet { width: 100%; font: 13px/1.4 ui-monospace, Menlo, monospace; padding: 10px; border-radius: 12px; border: 1px solid var(--border);
           background: var(--card); color: var(--ink); resize: vertical; }
.preview { margin: 16px 0; }
.page .pill { display: inline-block; width: auto; padding: 12px 22px; }

/* ---------- game shell */
body.ingame .top, body.ingame .foot, body.ingame #today { display: none; }
body.ingame main { padding: 0; }
.game { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto;
        padding-bottom: env(safe-area-inset-bottom); }
.gbar { display: flex; align-items: center; height: 52px; padding: 0 8px; flex: none; }
.back { border: 0; background: none; font-size: 30px; line-height: 1; width: 44px; height: 44px; cursor: pointer; color: var(--accent); }
.gtitle { flex: 1; text-align: center; display: flex; flex-direction: column; line-height: 1.2; }
.gtitle b { font-size: 17px; outline: none; }
.gtitle small { color: var(--muted); font-size: 12px; }
.gside { width: 44px; height: 44px; display: grid; place-items: center; }
.gside button { border: 0; background: none; font-size: 22px; cursor: pointer; }
.gstats { display: flex; justify-content: space-between; padding: 2px 20px; color: var(--muted); font-weight: 600; font-size: 15px; flex: none; }
.gbody { flex: 1; overflow-y: auto; position: relative; padding: 12px 12px; -webkit-overflow-scrolling: touch; }
.gctl { display: flex; gap: 10px; padding: 8px 12px; flex: none; }
.ctl { flex: 1; border: 1px solid var(--border); background: var(--card); color: var(--navy); font-weight: 700; font-size: 15px; border-radius: 999px;
       padding: 10px 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl:disabled { opacity: .45; cursor: default; }
.kb { padding: 4px 4px 8px; flex: none; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.kbrow { display: flex; justify-content: center; gap: 5px; margin-bottom: 7px; }
.key { flex: 0 1 40px; min-width: 0; height: 48px; border: 0; border-radius: 8px; background: var(--key); color: var(--ink); font-weight: 600; font-size: 19px;
       cursor: pointer; padding: 0; }
.kb.many .key { height: 42px; }
.key:active { transform: scale(.92); opacity: .7; }
.kb[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.solvedpanel { flex: none; text-align: center; padding: 12px 20px 16px; }
.solvedpanel p { margin: 4px 0 8px; font-weight: 700; }
.bigstars { font-size: 30px; letter-spacing: 4px; color: var(--gold); }
.bigstars .off { color: var(--border); }
.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } * { transition: none !important; } }

/* ---------- ladder */
.ladder { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lrow { display: flex; gap: 8px; }
.tile { --s: 52px; width: var(--s); height: var(--s); border-radius: calc(var(--s) * .22); display: grid; place-items: center; position: relative;
        font-size: calc(var(--s) * .48); font-weight: 800; background: var(--tile); border: 1.5px solid var(--border); color: var(--ink); padding: 0;
        transition: transform .15s; }
.l4 .tile { --s: 58px; }
.tile.old { opacity: .85; }
.tile.changed { background: color-mix(in srgb, var(--accent) 18%, var(--tile)); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.tile.selected { border: 3px solid var(--accent); transform: scale(1.06); }
.tile.target { background: transparent; color: var(--muted); }
.tile.solved { background: var(--success); border-color: var(--success); color: #fff; }
.tile.match::after { content: ""; position: absolute; bottom: 10%; left: 35%; width: 30%; height: 4px; border-radius: 2px; background: var(--success); }
button.tile { cursor: pointer; }
.rung { width: 4px; height: 10px; border-radius: 2px; background: var(--border); }
.tlabel { font-size: 12px; font-weight: 900; letter-spacing: 2px; color: var(--muted); margin-top: 4px; }

/* ---------- mill */
.mprog { padding: 6px 24px 0; flex: none; }
.bar { position: relative; height: 12px; border-radius: 6px; background: var(--border); }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--gold); transition: width .3s; }
.bar b { position: absolute; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: var(--card); color: var(--muted);
         font-size: 11px; display: grid; place-items: center; }
.bar b.on { background: var(--gold); color: #fff; }
.mcount { text-align: center; color: var(--muted); font-weight: 600; font-size: 15px; margin: 4px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px; align-content: flex-start; min-height: 40px; }
.chip { padding: 5px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-weight: 600; font-size: 15px; }
.chip.bonus { color: var(--purple); border-color: color-mix(in srgb, var(--purple) 50%, transparent); }
.chip.mill { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 900; }
.empty { color: var(--muted); text-align: center; margin-top: 18px; font-size: 15px; }
.mword { text-align: center; font-size: 30px; font-weight: 900; letter-spacing: 3px; height: 42px; line-height: 42px; flex: none; }
.wheel { position: relative; width: 264px; height: 264px; margin: 0 auto; border-radius: 50%; background: var(--card); box-shadow: 0 3px 10px rgba(0,0,0,.06); flex: none; }
.wheel .hub { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px; border-radius: 50%;
              background: color-mix(in srgb, var(--gold) 35%, transparent); }
.wl { position: absolute; width: 56px; height: 56px; margin: -28px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
      font-size: 26px; font-weight: 800; cursor: pointer; padding: 0; }
.wl:disabled { background: var(--key); color: var(--muted); cursor: default; }
.enter { margin: 6px 20px 8px; width: auto; flex: none; }

/* ---------- cipher */
.cwords { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; padding: 12px 4px; }
.cword { display: flex; gap: 3px; }
.cell { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; padding: 0; cursor: pointer; }
.cell .box { width: 26px; height: 32px; border-radius: 6px; display: grid; place-items: center; font-size: 20px; font-weight: 800; background: var(--key);
             border: 2px solid transparent; }
.cell.known .box { background: var(--tile); }
.cell.sel .box { background: color-mix(in srgb, var(--purple) 22%, var(--tile)); border-color: var(--purple); }
.cell .num { font-size: 10px; font-weight: 700; color: var(--muted); height: 14px; }
.cell.sel .num { color: var(--purple); }
.cell.known { cursor: default; }
.punct { font-size: 20px; font-weight: 800; height: 32px; display: grid; place-items: center; padding-bottom: 0; align-self: flex-start; }
.solvedproverb { font: italic 19px/1.4 Georgia, serif; }

/* ---------- embed */
body.embed { background: var(--bg); }
.embedgame { height: 100vh; height: 100dvh; }
.efoot { text-align: center; font-size: 13px; padding: 4px 0 8px; flex: none; }
.efoot a { font-weight: 700; }

/* ---------- modal, toast */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(20,22,27,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 22px 20px 28px; }
@media (min-width: 600px) { .modal { align-items: center; } .sheet { border-radius: 24px; } }
.sheet h2 { margin: 6px 0 2px; text-align: center; font-size: 22px; }
.sheet .sub { text-align: center; color: var(--muted); margin: 0 0 12px; }
.statrow { display: flex; gap: 8px; margin: 12px 0; }
.stat { flex: 1; background: var(--card); border-radius: 16px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 13px; }
.detail { background: var(--card); border-radius: 16px; padding: 12px 16px; margin: 12px 0; }
.detail h3 { margin: 4px 0; font-size: 16px; }
.detail p { margin: 4px 0 8px; font-weight: 600; }
.sharebox { display: flex; gap: 10px; }
.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--bg); padding: 10px 16px;
         border-radius: 14px; font-weight: 600; font-size: 15px; max-width: 90vw; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.on { opacity: 1; }
.embed .gbar { height: 44px; }
.embed .gstats { font-size: 14px; }
.embed .gctl { padding: 4px 12px; }
.embed .ctl { padding: 7px 6px; }
.embed .key { height: 42px; }
.embed .kbrow { margin-bottom: 6px; }
.embed .gbody { padding: 4px 8px; }
.embed .cwords { gap: 10px; padding: 4px; }
@media (min-width: 700px) { body.app .game { height: min(100dvh, 900px); } }
