:root{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#465368;background:#f6f7f9;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;font-weight:400;font-size:16px}
*{box-sizing:border-box}
body{margin:0;min-width:320px}
button{font:inherit;-webkit-tap-highlight-color:transparent;cursor:pointer}
button:focus-visible,a:focus-visible{outline:3px solid #96a8db;outline-offset:5px}
button{touch-action:manipulation}
button:disabled{cursor:default;opacity:.4}
.page{max-width:1136px;margin:0 auto;padding:19px 24px 30px}
h1{font-size:22px;line-height:1.5;font-weight:400;text-align:center;margin:0;letter-spacing:-.4px}
.settings{display:flex;justify-content:center;gap:20px;margin-top:62px}
fieldset{padding:0;margin:0;border:0;min-width:0}
legend{color:#111827;font-size:18px;font-weight:550;text-align:center;margin:0 auto 8px;padding:0}
.segmented{display:flex;background:#e4e6ea;border-radius:8px;padding:5px;gap:0}
.segmented button{background:transparent;border:0;border-radius:5px;color:#27364c;min-width:94px;height:39px;font-size:16px;font-weight:500;padding:0 17px;transition:background .15s,box-shadow .15s}
.segmented button:hover{background:#ffffff70}
.segmented button[aria-pressed=true]{background:#fff;box-shadow:0 2px 4px #202c401a;color:#111827}
.statistics{display:flex;align-items:center;justify-content:center;gap:30px;margin:43px 0 39px;font-size:26px;font-weight:300;line-height:1.5;font-variant-numeric:tabular-nums;letter-spacing:-.7px;white-space:nowrap}
.accuracy{color:#00a976}
.icon-button{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:48px;height:48px;background:transparent;color:#4a5669;border:0;border-radius:12px;transition:background .15s,color .15s,transform .15s}
.icon-button:hover{background:#edf0f5;color:#233f87}
.icon-button:active{transform:scale(.94)}
.icon-button svg{width:32px;height:32px}
.reset-button{width:36px;height:40px;margin-left:0}
.reset-button svg{width:28px;height:28px}
.game-card{display:grid;grid-template-columns:minmax(0,1fr);background:#fff;box-shadow:0 3px 5px #17233a1c,0 10px 20px #17233a03;border-radius:11px;padding:30px 30px 28px}
.board-area{grid-area:1 / 1;display:flex;justify-content:center;align-items:center}
.board-actions{grid-area:1 / 1;display:flex;align-items:center;justify-content:space-between;justify-self:center;width:560px;max-width:100%;pointer-events:none}
.board-actions .board-action{pointer-events:auto}
.action-label,.touch-controls{display:none}
.board-wrap{width:400px;max-width:100%;aspect-ratio:1;border-radius:14px;overflow:hidden;box-shadow:0 9px 13px #25304014,0 2px 3px #25304006;background:white;border:2px solid #e4e6eb;flex-shrink:0}
#board{display:block;width:100%;height:100%;user-select:none;-webkit-user-select:none;touch-action:manipulation;overflow:hidden}
#board[aria-busy=true] .cell{cursor:wait}
.cell{outline:none;cursor:pointer}
.cell rect{fill:#fff;transition:fill .13s}
.cell.given rect{fill:#f8f9fb}
.cell.target rect{fill:#f0f1f5}
.cell.selected rect{fill:#e9ecf1}
.cell:not(.given):hover rect{fill:#edf1f7}
.cell[aria-readonly=true]{cursor:default}
.cell-focus{fill:none;stroke:#8098c7;stroke-width:2;pointer-events:none}
.cell.target.wrong rect{fill:#ffe1e6;transition:none}
.cell.target.correct rect{fill:#d9f7e9;transition:none}
.cell-focus.wrong{stroke:#ef4058;stroke-width:4}
.cell-focus.correct{stroke:#0cbb87;stroke-width:4}
.cell .piece{animation:appear .16s ease-out;pointer-events:none}
.cell.given .piece,.cell.hinted .piece{animation:none}
.cell.note .piece{opacity:.62}
.cell.hinted .piece{opacity:.8}
.grid-line{stroke:#e1e4ea;stroke-width:1.8;pointer-events:none}
.target-dot{fill:#aab2c0;pointer-events:none}
.board-action{width:48px;height:54px}
.board-action.is-solved{color:#08a979;background:#effbf5}
.feedback{grid-area:2 / 1;min-height:40px;display:flex;justify-content:center;align-items:center;text-align:center;font-size:13px;line-height:1.4;padding:8px 0;color:#778296}
.feedback[data-tone=error]{color:#ce4057}
.feedback[data-tone=success]{color:#079a70}
.palette{grid-area:3 / 1;display:flex;gap:8px;align-items:center;justify-content:center;border-top:1px solid #e2e5eb;padding-top:14px;padding-bottom:13px}
.shape-button{border:2px solid transparent;display:flex;align-items:center;justify-content:center;width:78px;height:78px;background:transparent;border-radius:13px;position:relative;transition:background .14s,border-color .14s,transform .14s}
.shape-button:hover{background:#f1f3f7;transform:translateY(-2px)}
.shape-button[aria-pressed=true]{background:#e6e8ed;border-color:#d2d6df;box-shadow:0 2px 4px #15233413}
.shape-button svg{width:43px;height:43px}
.shape-button.eraser{color:#4c586b}
.shape-button.eraser svg{width:33px;height:33px}
.shape-button .key-hint{position:absolute;bottom:3px;font-size:10px;color:#8791a3;opacity:0;transition:opacity .2s}
.palette:hover .key-hint,.palette:focus-within .key-hint{opacity:1}
.game-footer{text-align:center;font-size:12px;color:#929aa8;margin-top:23px;line-height:1.7}
.game-footer p{margin:0 0 6px}
.control-instructions{color:#7b8596}
.footer-actions{display:flex;justify-content:center;gap:13px;align-items:center}
.footer-actions button{background:none;border:0;color:#7b8596;font-size:12px;padding:3px 0}
.footer-actions button:hover{color:#2845ac}
.help-circle{display:inline-flex;align-items:center;justify-content:center;border:1px solid #9da6b4;border-radius:100%;width:13px;height:13px;font-size:9px;margin-left:4px}
.footer-dot{color:#bcc1ca}
dialog{border:1px solid #e5e8ef;border-radius:18px;padding:36px;width:min(470px,calc(100% - 32px));color:#4a5669;box-shadow:0 24px 100px #1d2c4133;font-size:14px;line-height:1.7}
dialog::backdrop{background:#27334755;backdrop-filter:blur(4px)}
dialog h2{color:#27364c;font-size:24px;font-weight:550;letter-spacing:-.6px;line-height:1.3;margin:5px 0 15px}
dialog p{margin:0 0 18px}
dialog ol{padding-left:20px}
dialog li{padding:0 0 8px 4px}
.dialog-close{position:absolute;right:14px;top:9px;border:0;background:transparent;font-size:26px;font-weight:300;color:#929aaa;padding:2px 7px;border-radius:4px}
.dialog-symbol svg{width:44px;height:44px;margin-bottom:14px}
.hint-explanation{color:#7c8799;font-size:13px}
.shortcuts{display:flex;flex-wrap:wrap;gap:12px 18px;padding:15px 0 24px;border-top:1px solid #e8ebf0;color:#7c8799;font-size:11px}
kbd{display:inline-block;background:#f3f4f7;border:1px solid #e0e4ea;border-radius:3px;padding:0 4px;font:11px Inter,sans-serif;color:#536079;margin:0 1px}
.primary-button,.secondary-button{background:#2945ad;color:#fff;border:0;border-radius:8px;padding:11px 18px;font-weight:500;font-size:13px}
.primary-button:hover{background:#21398e}
.secondary-button{background:#f0f2f6;color:#4a5669}
.secondary-button:hover{background:#e4e8ef}
.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:22px}
@keyframes appear{from{opacity:0;transform:scale(.88)}to{opacity:1;transform:scale(1)}}
@media(min-width:1500px){.page{padding-top:38px}.settings{margin-top:70px}.statistics{margin-top:44px;margin-bottom:43px}.game-card{padding-top:38px;padding-bottom:32px}.board-wrap{width:440px}.feedback{min-height:44px}}
@media(max-width:650px){.page{padding:26px 16px 24px}h1{font-size:18px;max-width:340px;margin:auto;letter-spacing:-.3px}.settings{margin-top:32px;gap:14px}legend{font-size:14px;margin-bottom:8px}.segmented{padding:4px;border-radius:7px}.segmented button{min-width:0;height:35px;font-size:13px;padding:0 13px}.size-control button{padding:0 16px}.statistics{gap:16px;margin:27px 0 24px;font-size:18px;letter-spacing:-.5px}.reset-button{width:27px;height:32px}.reset-button svg{width:23px;height:23px}.game-card{padding:22px 14px 12px}.board-area{gap:7px}.board-wrap{width:calc(100% - 74px);max-width:400px;border-radius:10px}.board-action{width:30px;height:44px;border-radius:7px}.board-action svg{width:27px;height:27px}.feedback{font-size:11px;min-height:44px;padding:7px 2px}.palette{gap:3px;padding-top:10px;padding-bottom:5px}.shape-button{width:52px;height:57px;border-radius:10px}.shape-button svg{width:34px;height:34px}.shape-button.eraser svg{width:28px;height:28px}.shape-button .key-hint{display:none}.game-footer{font-size:11px;margin-top:19px}.footer-actions button{font-size:11px}}
@media(max-width:370px){.page{padding-left:10px;padding-right:10px}.settings{gap:10px}.segmented button{padding:0 11px}.statistics{gap:12px;font-size:16px}.game-card{padding-left:10px;padding-right:10px}.shape-button{width:45px;height:51px}}
@media(min-width:1500px){.board-actions{width:600px}}
@media(max-width:650px) and (orientation:portrait){
  .page{padding:16px 10px 20px}
  h1{font-size:17px;line-height:1.45}
  .settings{margin-top:22px}
  .statistics{justify-content:space-between;gap:8px;margin:18px 0 14px;font-size:clamp(14px,4.1vw,18px)}
  .reset-button{width:36px;height:40px}
  .game-card{padding:0;border-radius:0;background:transparent;box-shadow:none}
  .board-wrap{width:100%;max-width:max(240px,calc(100svh - 390px));box-shadow:0 4px 10px #2530400d}
  .feedback{min-height:32px;padding:6px 2px}
  .palette{justify-content:space-evenly;gap:4px;padding:8px 0 6px}
  .shape-button{width:clamp(44px,14vw,64px);height:56px}
  .board-actions{grid-area:4 / 1;width:100%;gap:12px;justify-content:center;margin-top:4px;pointer-events:auto}
  .board-actions .board-action{flex:1;gap:8px;width:auto;height:44px;background:#fff;border:1px solid #e1e5ed;border-radius:10px;font-size:13px;font-weight:500}
  .board-action svg{width:22px;height:22px}
  .action-label,.touch-controls{display:inline}
  .pointer-controls{display:none}
  .game-footer{margin-top:14px}
  .footer-dot,#new-puzzle{display:none}
}
@media(max-width:650px) and (orientation:portrait) and (max-height:760px){
  .page{padding-top:12px}
  .settings{margin-top:14px}
  legend{margin-bottom:5px}
  .statistics{margin:10px 0}
  .board-wrap{max-width:max(240px,calc(100svh - 350px))}
  .feedback{min-height:28px}
  .palette{padding:6px 0 4px}
  .shape-button{height:50px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
