:root{--paper:#e6d9ba;--board:#f6efdc;--ink:#1d2742;--red:#cf4026;--teal:#23867c;--ochre:#c28515;--line:#cdbf9d}
*{box-sizing:border-box}
body{margin:0;background:var(--paper);color:var(--ink);font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom)}
.game-header{display:flex;justify-content:space-between;align-items:center;padding:.6rem 1rem;background:var(--ink);color:var(--board);font-size:.85rem}
.game-header a{color:var(--board);text-decoration:none;min-height:44px;display:inline-flex;align-items:center}
.dl{display:flex;flex-direction:column;gap:.5rem;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}
.dl-bar{display:flex;align-items:center;justify-content:space-between;gap:.5rem}
.dl-h1{font:700 1.25rem/1 Georgia,"Times New Roman",serif;margin:0;letter-spacing:.02em}
.dl-chip{min-height:44px;min-width:64px;padding:0 .8rem;border:2px solid var(--ink);background:var(--board);color:var(--ink);font:600 .8rem system-ui,sans-serif;border-radius:4px;cursor:pointer}
.dl-sub2{display:flex;justify-content:space-between;font:600 .85rem ui-monospace,Menlo,Consolas,monospace}
.dl-field{position:relative;width:100%;aspect-ratio:5/7;max-height:min(68svh,calc(100svh - 330px));min-height:300px;margin:0 auto;border:2px solid var(--ink);background:var(--paper);overflow:hidden;box-shadow:4px 4px 0 var(--ink);outline:none}
.dl-field:focus-visible{outline:3px solid var(--teal);outline-offset:2px}
#cv{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none}
.dl-ov{position:absolute;inset:0;display:flex;align-items:flex-start;justify-content:center;overflow-y:auto;background:rgba(230,217,186,.9);padding:.8rem;overscroll-behavior:contain}
.dl-ov[hidden]{display:none}
.dl-ov.result{align-items:center;background:rgba(29,39,66,.45)}
.dl-card{width:100%;max-width:330px;background:var(--board);border:2px solid var(--ink);box-shadow:4px 4px 0 var(--ink);padding:1rem;text-align:center}
.dl-big{font:700 1.7rem/1.1 Georgia,"Times New Roman",serif;margin:0 0 .3rem}
.dl-sub{margin:.2rem 0 .8rem;font-size:.95rem;line-height:1.35}
.dl-stat{margin:.6rem 0;font:600 .8rem ui-monospace,Menlo,Consolas,monospace}
.dl-btn{min-height:48px;min-width:44px;padding:0 1rem;border:2px solid var(--ink);background:var(--board);color:var(--ink);font:700 1rem system-ui,sans-serif;border-radius:4px;cursor:pointer;box-shadow:3px 3px 0 var(--ink);transition:transform .08s,box-shadow .08s}
.dl-btn:active:not(:disabled){transform:translate(2px,2px);box-shadow:1px 1px 0 var(--ink)}
.dl-btn:disabled{opacity:.45;cursor:default}
.dl-btn.primary,.dl-btn.go{background:var(--red);color:#fff}
.dl-btn.small{min-height:44px;font-size:.85rem}
.dl-card>.dl-btn{display:block;width:100%;margin:.5rem 0}
.dl-row{display:flex;gap:.5rem;flex-wrap:wrap;justify-content:center;margin-top:.6rem}
.dl-row .dl-btn{flex:1 1 40%}
.dl-ctl{display:grid;grid-template-columns:1fr 1fr 2fr;gap:.6rem}
.dl-ctl .go{font-size:1.15rem;letter-spacing:.04em;min-height:52px}
.dl-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:6px;margin-top:.8rem}
.dl-lv{position:relative;min-height:46px;border:2px solid var(--ink);background:#fff8;color:var(--ink);font:700 .95rem ui-monospace,Menlo,Consolas,monospace;border-radius:3px;cursor:pointer;padding:0}
.dl-lv.lock{opacity:.4;background:repeating-linear-gradient(45deg,transparent 0 4px,rgba(29,39,66,.18) 4px 5px);cursor:default}
.dl-lv i{position:absolute;left:4px;right:4px;bottom:3px;height:4px;background:var(--teal)}
.dl-lv i.s1{right:66%}.dl-lv i.s2{right:33%}
.dl-msg{min-height:2.4em;font-size:.88rem;line-height:1.25}
.dl-msg.bad{color:var(--red);font-weight:700}.dl-msg.ok{color:var(--teal);font-weight:600}
.dl-pcs{display:flex;flex-wrap:wrap;gap:4px;min-height:20px}
.dl-pcs span{width:11px;height:19px;background:var(--board);border:1.5px solid var(--ink);display:block;position:relative}
.dl-pcs span::after{content:"";position:absolute;left:0;right:0;top:50%;height:1px;background:var(--ink)}
.dl-pcs span.used{background:transparent;border-style:dashed;opacity:.45}
.dl-legend{display:flex;flex-wrap:wrap;gap:.3rem .8rem;align-items:center;font-size:.75rem;margin:.2rem 0}
.lg{display:inline-block;width:14px;height:10px;border:1.5px solid var(--ink);margin-right:.25rem}
.lg.t{background:var(--teal)}.lg.o{background:var(--ochre)}.lg.h{background:repeating-linear-gradient(45deg,#fff 0 2px,var(--ink) 2px 3px)}
.dl-how{font-size:.78rem;line-height:1.4;margin:0;opacity:.85}
.dl-stars{display:flex;justify-content:center;gap:.4rem;margin:.4rem 0}
.st{width:34px;height:34px;background:var(--line);clip-path:polygon(50% 0,62% 36%,98% 38%,69% 60%,80% 96%,50% 74%,20% 96%,31% 60%,2% 38%,38% 36%)}
.st.on{background:var(--ochre);animation:pop .45s cubic-bezier(.2,1.6,.4,1) both}
@keyframes pop{from{transform:scale(0) rotate(-40deg)}to{transform:scale(1) rotate(0)}}
.dl-ov.result .dl-card{animation:rise .3s ease-out both}
@keyframes rise{from{transform:translateY(14px);opacity:0}to{transform:none;opacity:1}}
.dl-ov.lose .dl-big{color:var(--red)}
button:focus-visible{outline:3px solid var(--teal);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.st.on,.dl-ov.result .dl-card{animation:none}.dl-btn{transition:none}}

@media (max-height:820px){.dl-legend,.dl-how{display:none}}
.dl-ov.lose .dl-card{border-color:var(--red)}

/* full screen: fill the stage, hide chrome and help copy */
html.pip-immersive .game-wrap.pip-stage,html.pip-native .game-wrap.pip-stage,.game-wrap.pip-stage:fullscreen{padding:8px 10px;overflow:hidden;max-width:none}
html.pip-immersive .game-wrap .dl,html.pip-native .game-wrap .dl,.pip-stage:fullscreen .dl{height:100%;min-height:0;gap:.4rem}
html.pip-immersive .dl-legend,html.pip-immersive .dl-how,html.pip-native .dl-legend,html.pip-native .dl-how,html.pip-immersive .dl-h1,html.pip-native .dl-h1{display:none}
html.pip-immersive .dl-field,html.pip-native .dl-field{flex:1 1 0;min-height:0;aspect-ratio:auto;max-height:none;width:100%}
html.pip-immersive .dl-msg,html.pip-native .dl-msg{min-height:0}
html.pip-immersive .dl-bar,html.pip-native .dl-bar{justify-content:flex-start}
@media (orientation:landscape) and (max-height:520px){
html.pip-immersive .game-wrap .dl,html.pip-native .game-wrap .dl{display:grid;grid-template-columns:minmax(0,1fr) 190px;grid-template-rows:auto auto 1fr auto auto;column-gap:.6rem}
html.pip-immersive .dl-field,html.pip-native .dl-field{grid-column:1;grid-row:1/6}
html.pip-immersive .dl>:not(.dl-field),html.pip-native .dl>:not(.dl-field){grid-column:2}
html.pip-immersive .dl-ctl,html.pip-native .dl-ctl{grid-template-columns:1fr 1fr}
html.pip-immersive .dl-ctl .go,html.pip-native .dl-ctl .go{grid-column:1/3}
}
