/* letsquares.css — LetSquares 聰明方格：只有「板面」（N×N 彩色框框＋數字盤＋方向鍵）。
   木框／教練／🌼／回家的路／折線圖／統計／方向鍵全部在 garden-kit.css（class gk-），這裡不要重寫。 */

.sq-ref-goal { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.sq-ref-mini { display: flex; gap: 2px; }
.sq-ref-mini i { width: 14px; height: 14px; border-radius: 4px; color: #fff; font: 900 10px/14px inherit; text-align: center; font-style: normal; }
.sq-ref-text { font-size: 10px; font-weight: 800; color: #7c5a21; line-height: 1; white-space: nowrap; }
.sq .gk-road-home { align-items: center; justify-content: center; }
.sq-home { font-size: 18px; line-height: 1; }
.sq-lvl button { padding: 0 12px; }
.sq-lvl button[disabled] { opacity: .35; cursor: default; }
.sq-lvl-label { appearance: none; background: none; border: 0; border-left: 1px solid var(--gd-bd); border-right: 1px solid var(--gd-bd); cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; padding: 0 12px; font-weight: 800; font-size: 14.5px; color: #334155; min-width: 86px; justify-content: center; }
.sq-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; width: 100%; max-height: 196px; overflow-y: auto; padding: 8px; box-sizing: border-box; background: #fff8ea; border: 2px solid #e5c58c; border-radius: 14px; }
.sq-pick { appearance: none; position: relative; height: 40px; border-radius: 10px; border: 2px solid #e5c58c; background: #fff; font: 800 15px/1 inherit; color: #475569; cursor: pointer; }
.sq-pick.is-done { background: #fef9c3; border-color: #eab308; }
.sq-pick.is-done::after { content: '⭐'; position: absolute; right: -5px; top: -7px; font-size: 12px; }
.sq-pick.is-cur { border-color: var(--gk-good); box-shadow: 0 0 0 2px var(--gk-good); }

.sq-board { position: relative; }
/* 方格盤：--c 一格、--g 格子之間的縫（同一個框框的格子會把縫補起來） */
.sq-yard { --c: min(118px, calc(576px / var(--n)), calc((100vw - 84px) / var(--n))); --g: 6px; position: relative; width: calc(var(--c) * var(--n) + var(--g) * (var(--n) + 1) + 16px); margin: 0 auto; padding: 8px; box-sizing: border-box; border-radius: 22px; background: #fff; border: 4px solid #cfe0f5; box-shadow: 0 4px 0 #b6c9e3, 0 6px 10px rgba(30,58,95,.2); }
.sq-grid { position: relative; width: calc(var(--c) * var(--n) + var(--g) * (var(--n) + 1)); height: calc(var(--c) * var(--n) + var(--g) * (var(--n) + 1)); border-radius: 16px; background: #2f4a6d; touch-action: manipulation; outline: none; user-select: none; -webkit-user-select: none; }
.sq-grid:focus-visible { box-shadow: 0 0 0 3px #86efac; }
.sq-cell { position: absolute; width: var(--c); height: var(--c); left: calc(var(--g) + var(--x) * (var(--c) + var(--g))); top: calc(var(--g) + var(--y) * (var(--c) + var(--g))); box-sizing: border-box; background: var(--cg); cursor: pointer; -webkit-tap-highlight-color: transparent; display: grid; place-items: center; }
/* 只有框框「外側」的角才圓；同框框相鄰的縫用 ::before（右）／::after（下）補滿 */
.sq-cell.r-tl { border-top-left-radius: 14px; } .sq-cell.r-tr { border-top-right-radius: 14px; }
.sq-cell.r-bl { border-bottom-left-radius: 14px; } .sq-cell.r-br { border-bottom-right-radius: 14px; }
.sq-cell.b-r::before { content: ''; position: absolute; left: 100%; top: 0; width: var(--g); height: 100%; background: var(--cg); }
.sq-cell.b-d::after { content: ''; position: absolute; top: 100%; left: 0; height: var(--g); width: 100%; background: var(--cg); }
.sq-cell.b-r.b-d::after { width: calc(100% + var(--g)); }
.sq-cage-lbl { position: absolute; left: 5px; top: 4px; font-size: max(12px, calc(var(--c) * .2)); font-weight: 900; line-height: 1.2; color: #fff; background: rgba(0,0,0,.22); border-radius: 8px; padding: 1px 6px; letter-spacing: .5px; text-shadow: 0 1px 0 rgba(0,0,0,.25); z-index: 2; pointer-events: none; }
.sq-cage-lbl.is-ok { background: var(--gk-good); }
.sq-cage-lbl.is-ok::after { content: ' ✓'; }
.sq-cage-lbl.is-bad { background: var(--gk-bad); }
.sq-val { font-size: calc(var(--c) * .52); font-weight: 900; line-height: 1; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.22); transform: translateY(6%); z-index: 1; }
.sq-cell.is-given .sq-val { color: #1e293b; text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.sq-cell.is-given { cursor: default; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px); }
.sq-cell.is-sel { z-index: 4; outline: 4px solid #fff; outline-offset: -4px; box-shadow: 0 0 0 4px #fde047, 0 0 14px 4px rgba(253,224,71,.7); }
.sq-cell.is-sel .sq-val { transform: translateY(6%) scale(1.08); }
.sq-cell.is-dup { box-shadow: inset 0 0 0 4px #ef4444; }
.sq-cell.is-dup .sq-val { color: #fecaca; text-decoration: underline wavy #ef4444 3px; text-underline-offset: 4px; }
.sq-cell.is-wrong { box-shadow: inset 0 0 0 4px var(--gk-bad); }
.sq-cell.is-wrong .sq-val { opacity: .8; }
.sq-cell.is-cage-ok { filter: saturate(1.15) brightness(1.06); }
.sq-badge { --b: min(24px, calc(var(--c) * .26)); position: absolute; right: 3px; top: 3px; width: var(--b); height: var(--b); border-radius: 50%; display: none; place-items: center; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); z-index: 3; pointer-events: none; }
.sq-badge svg { width: 60%; height: 60%; display: block; }
.sq-badge.is-good { display: grid; background: var(--gk-good); animation: sq-pop .35s ease-out; }
.sq-badge.is-bad { display: grid; background: var(--gk-bad); pointer-events: auto; cursor: pointer; --b: min(30px, calc(var(--c) * .32)); box-shadow: 0 2px 0 rgba(0,0,0,.25), 0 0 0 3px rgba(255,255,255,.7); }
.sq-badge.is-bad:active { transform: scale(.9); }
.sq .gk-lg-no { background: var(--gk-bad); }
.sq-cell.gk-glow { animation: gk-glow 1s ease-in-out infinite; }
.sq-cell .gk-hand { top: auto; bottom: -10px; }
@keyframes sq-pop { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.sq-yard--done .sq-grid { background: #14532d; }
.sq-yard--done .sq-cell { animation: sq-cheer .7s ease-in-out; animation-delay: calc((var(--x) + var(--y)) * 60ms); }
@keyframes sq-cheer { 30% { transform: translateY(-10%) scale(1.04); } }
/* 數字盤：跟方向鍵同一種按鈕，先數字再方向鍵 */
.sq-nums { margin-top: 14px; }
.sq-num .gk-pad-arrow { font-weight: 900; font-size: 30px; color: #334155; }
.sq-num.is-cur { background: #fde68a; border-color: #f59e0b; }
.sq-num--erase .gk-pad-arrow { font-size: 24px; color: #b45309; }
.sq-num.gk-glow { animation: gk-glow 1s ease-in-out infinite; opacity: 1; }
.sq .gk-pad + .gk-pad { margin-top: 8px; }
.sq .gk-win { position: absolute; top: auto; }
@media (max-width: 380px) { .sq-num .gk-pad-arrow { font-size: 26px; } .sq-yard { --g: 5px; } }
@media (prefers-reduced-motion: reduce) { .sq-badge.is-good, .sq-yard--done .sq-cell { animation: none; } }
