/* Penpath. Two Tone Arcade palette and button language. All text >= 16px. All targets >= 48px.
 * Black and white only: line style (dashed thin vs solid thick) carries state, never colour. */
:root{--bg:#FAF9F6;--bg-alt:#F0EFEA;--fg:#111111;--muted:#4A4A4A;--line:#D9D6CC;
  --sans:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --mono:ui-monospace,"SF Mono",Menlo,Monaco,Consolas,"Liberation Mono",monospace;
  --bw:min(calc(100vw - 12px),520px);--bhmax:calc(100vh - 236px);color-scheme:light}
html.dark{--bg:#121212;--bg-alt:#1C1C1C;--fg:#F2F2F2;--muted:#BDBDBD;--line:#3A3A3A;color-scheme:dark}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;background:var(--bg);color:var(--fg);font-family:var(--sans);font-size:16px}
body{overflow-x:hidden}
button{font:inherit;color:inherit}
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
[hidden]{display:none!important}
#app{max-width:560px;margin:0 auto;min-height:100%;display:flex;flex-direction:column;padding:0 6px env(safe-area-inset-bottom)}
ul{list-style:none;margin:0;padding:0}

/* top bar */
.bar{display:flex;align-items:center;gap:6px;height:52px;flex:0 0 52px}
.bar-title{flex:1;margin:0;font:900 1.15rem/1 var(--mono);letter-spacing:.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.on-menu .bar-title{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.bar-right{display:flex;gap:6px;margin-left:auto}
.btn{min-height:48px;min-width:48px;padding:0 14px;border:2px solid var(--fg);border-radius:8px;background:var(--bg);color:var(--fg);
  font-weight:700;font-size:1rem;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px;touch-action:manipulation;text-decoration:none}
.btn:hover{background:var(--bg-alt)}
.btn:active{transform:translate(1px,1px)}
.btn:disabled{opacity:.45;cursor:default}
.btn.primary{background:var(--fg);color:var(--bg)}
.btn.ghost{border-color:transparent;padding:0 8px}
.btn.icon{padding:0;width:48px}
.btn svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#themeBtn .half{fill:currentColor;stroke:none}
:focus{outline:none}
:focus-visible{outline:3px solid var(--fg);outline-offset:3px;box-shadow:0 0 0 3px var(--bg)}
.btn.tool{flex-direction:column;gap:2px;min-height:60px;padding:4px 6px;border-color:transparent;background:transparent}
.btn.tool:hover{background:var(--bg-alt)}
.btn.wide{width:100%;min-height:52px;font-size:1.1rem}

/* title */
.screen{flex:1;display:flex;flex-direction:column}
.hero{display:flex;flex-direction:column;align-items:center;padding:8px 0 2px}
.wordmark{margin:6px 0 0;font:900 2.4rem/1 var(--mono);letter-spacing:.04em}
.tagline{margin:8px 0 4px;font:700 1rem var(--mono)}
.hero-art{width:150px;height:90px;margin:6px 0;fill:none;stroke:var(--fg);stroke-width:5;stroke-linecap:round;stroke-linejoin:round}
.hero-art circle{fill:var(--fg);stroke:none}
.hero-art .end{fill:var(--bg);stroke:var(--fg);stroke-width:3}
.menu-list{display:flex;flex-direction:column;gap:10px;margin:8px 0;width:min(100%,300px);align-self:center}
.btn.big{min-height:56px;flex-direction:column;justify-content:center;gap:0;padding:4px 14px;font-size:1.15rem;box-shadow:3px 3px 0 var(--fg)}
.btn.big.primary{box-shadow:3px 3px 0 var(--muted)}
.mlabel{display:inline-flex;align-items:center;gap:8px}
.msub{font:600 1rem var(--mono);color:var(--muted)}
.primary .msub{color:var(--bg)}
.foot{margin-top:auto;padding:10px 0;font-size:1rem;color:var(--muted);text-align:center}
.lead{margin:6px 0;font-size:1rem;line-height:1.4}
@media (max-height:620px){.hero-art{display:none}}

/* free draw picker */
#freepick .menu-list{margin-top:4px}

/* level select */
.star-total{margin:4px 0;font:700 1rem var(--mono);display:flex;align-items:center;gap:6px}
.level-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;padding:4px 0 16px}
.lv{min-height:60px;flex-direction:column;gap:2px;padding:4px 0;font-family:var(--mono)}
.lv .lv-n{font-size:1.05rem}
.lv-stars{display:flex;gap:1px}
.lv.cur{box-shadow:3px 3px 0 var(--fg)}
.lv:disabled{opacity:.5;border-style:dashed}
.lv-band{grid-column:1/-1;font:700 1rem var(--mono);margin:8px 0 0}
.lock{width:18px;height:18px}

/* stars: SVG, filled vs outline (shape, not colour) */
.star{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:2.5;stroke-linejoin:round}
.star.on{fill:currentColor}
.star-total .star{width:20px;height:20px}
.win-stars{display:flex;justify-content:center;gap:6px}
.win-stars .star{width:40px;height:40px;stroke-width:1.6}

/* game */
.game{align-items:center;flex:0 0 auto}
.status{width:var(--bw);display:flex;justify-content:space-between;align-items:center;min-height:40px;font:600 1rem var(--mono);gap:8px}
.mode-label{display:inline-flex;align-items:center;gap:6px}
.counts b{font-weight:900}
.board-wrap{position:relative;width:var(--bw);display:flex;justify-content:center;align-items:center;min-height:200px}
.board{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;border-radius:10px;cursor:crosshair}
.board svg{display:block;width:100%;height:100%;overflow:visible}
.board:focus-visible{outline:3px solid var(--fg);outline-offset:4px}
/* drawing */
@keyframes march{to{stroke-dashoffset:-36}}
.ring{fill:none;stroke:var(--fg);stroke-width:3}
.ring.sel{stroke-dasharray:4 4}
.ring.hint{stroke-width:3;stroke-dasharray:6 5;animation:march 900ms linear infinite}
html.rm .ring.hint{animation:none}
.hint-msg{margin:4px 0 0;min-height:1.4em;font:700 1rem var(--mono);text-align:center}
.controls{width:var(--bw);display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;padding:6px 0}

/* win (soft scrim over the screen, card sized to its content so it never scrolls; no full-screen flash) */
.win{position:fixed;inset:0;padding:12px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--bg) 72%,transparent);animation:fadein 200ms ease-out both;z-index:3}
html.rm .win{animation:none}
.win-card{background:var(--bg);color:var(--fg);border:2px solid var(--fg);border-radius:10px;box-shadow:4px 4px 0 var(--fg);padding:12px 14px;text-align:center;width:min(94%,320px);max-height:calc(100dvh - 24px);overflow:auto}
.win-card h2{margin:0 0 4px;font:900 1.4rem var(--mono)}
.win-sub{margin:4px 0 6px;font:700 1rem var(--mono)}
.win-text{margin:6px 0 8px;font:600 1rem var(--mono)}
.win-btns{display:flex;gap:6px;justify-content:center;margin-top:8px}
.win-btns .btn{flex:1;padding:0 6px}
@keyframes fadein{from{opacity:0}to{opacity:1}}

/* settings */
.set-list{display:flex;flex-direction:column;gap:10px;padding:4px 0 16px}
.btn.row{width:100%;justify-content:space-between;min-height:52px}
.row-label{font-weight:700;margin:0 0 6px}
.seg{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.seg [aria-checked="true"]{background:var(--fg);color:var(--bg)}
.sw{width:44px;height:26px;border:2px solid var(--fg);border-radius:13px;position:relative;flex:0 0 44px}
.sw::after{content:"";position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:var(--fg);transition:left 120ms}
[aria-checked="true"] .sw{background:var(--fg)}
[aria-checked="true"] .sw::after{left:21px;background:var(--bg)}
html.rm .sw::after{transition:none}
.howto{padding:8px 4px;line-height:1.45}
.howto p{margin:0 0 8px}
.danger{border-style:dashed}
.confirm{padding:8px 0}
.confirm-q{margin:0;font-weight:700}
.set-msg{min-height:1.2em;margin:0;font-size:1rem}
/* stars/locks inside buttons: beat the generic .btn svg size */
.btn .star{width:14px;height:14px;stroke-width:2.5}
.btn .lock{width:18px;height:18px}
.lv .lv-stars{gap:0}

/* art pack v1: wordmark + board sprites are white alpha masks tinted with the theme colours */
.wordmark{width:213px;height:43px;margin:10px 0 2px;background:var(--fg);
  -webkit-mask:url(art/title/title_penpath.png) center/213px 43px no-repeat;mask:url(art/title/title_penpath.png) center/213px 43px no-repeat;
  -webkit-mask-image:-webkit-image-set(url(art/title/title_penpath.png) 1x,url(art/title/title_penpath@2x.png) 2x);
  mask-image:image-set(url(art/title/title_penpath.png) 1x,url(art/title/title_penpath@2x.png) 2x)}
.fl-fg{flood-color:var(--fg)}
.fl-bg{flood-color:var(--bg)}
.ln.glow{animation:pulse 1100ms ease-in-out infinite alternate}
@keyframes pulse{from{opacity:1}to{opacity:.55}}
html.rm .ln.glow{animation:none}
.board svg{overflow:visible}
.ln,.dot,.arrow,.bridge,.pen{stroke:none}
/* level select: number, picture name and stars */
.level-grid{grid-template-columns:repeat(2,1fr)}
.lv{min-height:64px;display:grid;grid-template-columns:auto 1fr;column-gap:8px;row-gap:2px;align-items:center;justify-items:start;padding:6px 10px;text-align:left}
.lv .lv-n{min-width:1.6em;font-weight:700;grid-row:1/3}
.lv .lv-name{font:600 1rem/1.15 var(--sans);overflow-wrap:normal;word-break:normal;hyphens:manual}
.lv .lv-stars{grid-column:2}
.legal{display:flex;flex-direction:column;gap:10px}
a.btn.row{text-decoration:none;justify-content:flex-start}
.status .counts{white-space:nowrap;flex:0 0 auto;margin-left:8px}
.status .mode-label{min-width:0}
.bar{position:relative;z-index:4}
