:root{color-scheme:dark;font:16px system-ui,sans-serif;color:#eef5ff;background:#101825;--line:#3a4b65;--panel:#1a273a;--accent:#baf2cd}
*{box-sizing:border-box}body{margin:0}header,main{width:min(100% - 1.25rem,60rem);margin:auto}
header{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.7rem 0;border-bottom:1px solid var(--line)}
header a{color:var(--accent);font-weight:750}main{padding:1rem 0 2rem}
h1{font-size:clamp(1.6rem,6vw,3rem);margin:.25rem 0 .35rem;line-height:1.1}p{line-height:1.5;margin:.55rem 0}
button,select{font:inherit;color:inherit;background:#263954;border:1px solid var(--line);border-radius:.45rem;min-height:42px;padding:.3rem .55rem;cursor:pointer;touch-action:manipulation}
button:disabled{opacity:.65;cursor:default}button:not(:disabled):hover{filter:brightness(1.25)}
:focus-visible{outline:3px solid #ffdc80;outline-offset:-3px}
[aria-pressed=true],.chosen{outline:2px solid #ffd577;outline-offset:-2px}
#game{max-width:41rem;margin-inline:auto}.toolbar{display:flex;flex-wrap:wrap;gap:.45rem;align-items:center;margin:.65rem 0}
#status{min-height:1.55rem;color:var(--accent);font-weight:650}
details{margin-top:1rem;background:var(--panel);padding:.8rem;border-radius:.6rem}summary{cursor:pointer}
.grid{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:3px;width:min(100%,33rem);margin:.55rem auto}
.cell{padding:0;min-width:0;min-height:0;aspect-ratio:1;font-weight:700;display:grid;place-items:center;line-height:1}
.cell.open{background:#172233}.cell.bad{background:#743744}.cell.good{background:#225946}
.card{font-weight:750;font-size:clamp(.66rem,2.7vw,1.02rem);padding:.13rem;min-width:0;color:#1b2940;background:#e4edfb}
.card.red{color:#9c2544}.card.back{background:#2b4776;color:#e1edff}.card.empty{background:#172233;color:#c2d3ed;border-style:dashed}
.cards{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:clamp(2px,1vw,8px);margin:.75rem 0}
.stack{display:flex;flex-direction:column;min-width:0}.stack .card{min-height:38px}.piles{display:flex;gap:.35rem;align-items:center;flex-wrap:wrap}
.piles .card{min-width:2.25rem}.pill{color:#c4d4ec}
.catalog{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,15rem),1fr));gap:.65rem;margin-top:1rem}
.catalog a{color:inherit;background:var(--panel);border:1px solid var(--line);padding:.85rem;text-decoration:none;border-radius:.65rem;min-height:78px;display:grid;gap:.25rem}
.catalog a:hover{border-color:var(--accent)}.catalog span{color:#bfd0e9}
canvas{display:block;width:min(100%,32rem);height:auto;margin:auto;border:1px solid var(--line);border-radius:.45rem;touch-action:none}
.site-footer{width:min(100% - 1.25rem,60rem);margin:0 auto;padding:.75rem 0;border-top:1px solid var(--line)}
.site-footer a,main a{color:var(--accent)}
.directions{justify-content:center}.directions button{min-width:46px}
.piece{display:grid;grid-template-columns:repeat(4,9px);grid-template-rows:repeat(4,9px);gap:1px}
.piece i.filled{background:var(--accent);border-radius:2px}
.grid.maze{gap:0}.maze .maze-cell{border:1px solid;border-radius:0;background:#18273a}
.maze .maze-cell.good{background:#225946;color:#d2f9d9}
