.puzzle-dialog { width:min(39rem,calc(100vw - 1.5rem)); max-height:calc(100dvh - 2rem); overflow:auto; overscroll-behavior:contain; }
.puzzle-dialog #puzzle-board { margin:1.25rem 0; }
.puzzle-dialog button { min-height:44px; touch-action:manipulation; }
.puzzle-dialog button:focus-visible { outline:2px solid #ddd4fa; outline-offset:3px; }
.puzzle-dialog #puzzle-intro { font-size:1rem; line-height:1.65; text-transform:none; }
.puzzle-dialog h3 { margin:0 0 .75rem; font-size:.875rem; }
.puzzle-button,.puzzle-card,.puzzle-tools button { border:1px solid #757c9f; background:#141c35; color:#e1e3f1; padding:.65rem .75rem; font:inherit; font-size:.875rem; }
.puzzle-button:hover,.puzzle-card:hover { background:#252f50; }
.puzzle-dialog [aria-pressed=true] { border-color:#e0d2ac; background:#353448; box-shadow:inset 0 0 0 1px #ddc69d; }
.puzzle-tools { display:flex; flex-wrap:wrap; gap:.6rem; margin:1rem 0; }
.puzzle-saved { margin:.75rem 0 0; text-transform:none; }
.puzzle-grid { --columns:4; display:grid; grid-template-columns:repeat(var(--columns),minmax(0,1fr)); gap:.35rem; }
.puzzle-basins { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.puzzle-basin { min-width:0; display:flex; flex-direction:column; gap:.5rem; }
.puzzle-gauge { position:relative; height:8rem; border:2px solid #acb4ce; background:#0b132a; display:grid; place-items:center; overflow:hidden; }
.puzzle-water { position:absolute; inset:auto 0 0; background:linear-gradient(#78b6d0,#254767); transition:height .2s ease; }
.puzzle-gauge span { position:relative; z-index:1; font-size:1.4rem; color:white; text-shadow:1px 2px #0b132a; }
.puzzle-cards { display:grid; grid-template-columns:1fr 1fr; gap:.5rem; }
.puzzle-card { text-align:left; min-height:58px!important; }
.puzzle-parcel { margin:0 0 .8rem; padding:.7rem; border:1px solid #697089; }
.puzzle-parcel legend { padding:0 .4rem; font-size:.875rem; }
.puzzle-route-choices { display:grid; grid-template-columns:1fr 1fr; gap:.35rem; }
.puzzle-tile { position:relative; aspect-ratio:1; min-width:0; padding:0; border:1px solid #636d88; background:#101930; color:#8d96b3; display:grid; place-items:center; }
button.puzzle-tile { cursor:pointer; }
.puzzle-tile[data-lit=true] { background:#243247; color:#e9d5a3; }
.puzzle-mirror { font:2rem/1 ui-monospace,monospace; text-shadow:1px 1px #0b1021; }
.puzzle-contact { position:absolute; background:currentColor; pointer-events:none; z-index:0; }
.puzzle-contact[data-direction=e] { left:50%; right:0; top:calc(50% - 2px); height:4px; }
.puzzle-contact[data-direction=w] { left:0; right:50%; top:calc(50% - 2px); height:4px; }
.puzzle-contact[data-direction=n] { top:0; bottom:50%; left:calc(50% - 2px); width:4px; }
.puzzle-contact[data-direction=s] { top:50%; bottom:0; left:calc(50% - 2px); width:4px; }
.puzzle-joint { width:.55rem; height:.55rem; background:currentColor; border-radius:50%; }
.puzzle-terminal { position:absolute; bottom:2px; right:3px; font:10px/1.1 ui-monospace,monospace; letter-spacing:0; color:#efe4c7; }
.puzzle-light-frame,.puzzle-circuit { max-width:26rem; margin:auto; }
.puzzle-light-frame .puzzle-contact { opacity:.6; }
.puzzle-memory-card { border:1px solid #78819d; padding:1.5rem; text-align:center; background:#10172b; margin-bottom:1rem; }
.puzzle-memory-card strong { display:block; min-height:2.5rem; font-size:1.5rem; color:#e9d5a3; }
.puzzle-memory-card + .puzzle-grid { margin-bottom:.8rem; }
.puzzle-weave-layout { display:grid; grid-template-columns:1.3fr 1fr; gap:1rem; align-items:start; }
.puzzle-stitch { aspect-ratio:1; display:grid; place-items:center; padding:0; background:repeating-linear-gradient(0deg,#141c31 0 2px,#19233b 2px 3px); color:#5c6582; border:1px solid #68718e; font-size:1.2rem; }
.puzzle-stitch[data-on=true] { color:#f1e9d3; background:repeating-linear-gradient(0deg,#8e859c 0 2px,#6a677f 2px 3px); }
.puzzle-weave-layout section:last-child .puzzle-stitch { min-height:0; }
@media(max-width:480px){.puzzle-weave-layout{grid-template-columns:1fr}.puzzle-weave-layout section:last-child{max-width:11rem}.puzzle-dialog header h2{font-size:1.05rem}.puzzle-basins{gap:.6rem}}
@media(prefers-reduced-motion:reduce){.puzzle-water{transition:none}}
