@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&display=swap');

:root{--navy:#062d69;--blue:#0756aa;--blue2:#168be0;--sky:#71d9ff;--gold:#ffc532;--orange:#e99513;--cream:#fff9e8;--green:#58c83d;--ink:#102c57;--muted:#496684}
html{min-height:100%;background:#72c9f3}
body{font-family:Fredoka,system-ui,sans-serif!important;color:var(--ink)!important;background:linear-gradient(#c7efff2b,#ffffff16),url('assets/plaza-background.webp') center top/cover fixed no-repeat!important}
body:before{background:linear-gradient(180deg,#fff0 0,#fff0 65%,#165a3427)!important;opacity:1!important}
main{max-width:650px!important;padding-top:10px!important}
header{min-height:66px!important;margin-bottom:8px!important;grid-template-columns:92px 1fr 92px!important}
header>a{color:#083e78!important;text-shadow:0 1px #fff;text-decoration:none!important;font-weight:700!important}
.mini-logo{display:block;width:156px;height:84px;object-fit:contain;margin:auto;filter:drop-shadow(0 4px 2px #17445b4f)}
.restart-levels{justify-self:end;border:1px solid #ffffff70;border-radius:999px;background:#0a4485cc;color:#fff;padding:7px 9px;font-size:.68rem;font-weight:800;line-height:1.05}
.panel{border:4px solid #fff!important;background:linear-gradient(180deg,#fffdf3f7,#fff1caf7)!important;border-radius:25px!important;box-shadow:0 0 0 5px #07509e,0 7px 0 5px #04346e,0 14px 28px #17455d5c!important;color:var(--ink)!important}
.panel h1,.panel h2,.panel .clue{color:#074d98!important;text-shadow:0 2px #fff!important}
.panel p,.panel small,.rules,.hand-help,.hand-title small{color:var(--muted)!important}
.eyebrow,.panel>small:first-child{color:#9b6508!important;font-weight:700!important;letter-spacing:.1em}
.primary,.secondary{border:2px solid #d8ffa9!important;border-radius:15px!important;background:linear-gradient(#72df49,#43ad2f)!important;color:#fff!important;box-shadow:0 5px 0 #278b29!important;text-shadow:0 2px #287724!important}
.secondary{border-color:#bcecff!important;background:linear-gradient(#56ccff,#168ada)!important;box-shadow:0 5px 0 #075999!important;text-shadow:0 2px #075999!important}
.primary:disabled,.secondary:disabled{opacity:.45!important;filter:grayscale(.3);box-shadow:none!important}
.playerbar{position:relative;z-index:2}.pill{background:linear-gradient(#fffdf3,#ffe6a8)!important;border:2px solid #fff!important;color:#805610!important;box-shadow:0 0 0 2px #d9941b,0 3px 7px #153d5c43;font-weight:600}.pill b{color:#143b6c!important}
.hud{padding:8px 13px;border:2px solid #fff;border-radius:999px;background:#07509ee8;color:#fff!important;box-shadow:0 3px 0 #04336c}.hud b{color:#ffdd52!important}
.tiles .tile,.warm-tile{border-color:#fff!important;background:linear-gradient(#ffd84c,#f3a615)!important;color:#fff!important;text-shadow:0 2px #85500b;box-shadow:0 4px 0 #a55c10!important}.tiles .tile:nth-child(3n+2),.warm-tile:nth-child(3n+2){background:linear-gradient(#74d84f,#39a93d)!important;box-shadow:0 4px 0 #247b32!important}.tiles .tile:nth-child(3n),.warm-tile:nth-child(3n){background:linear-gradient(#bd72ec,#7141bc)!important;box-shadow:0 4px 0 #452280!important}.tiles .tile.selected,.warm-tile.selected{outline:4px solid #0758ad!important;transform:translateY(-4px)}
.key{background:linear-gradient(#1478c9,#07509e)!important;border:2px solid #a8ddff!important;box-shadow:0 3px 0 #04326b;color:#fff!important}.key:active{transform:translateY(2px);box-shadow:0 1px #04326b}
.feedback,.status{color:#0874b7!important}.quiet{color:#07549a!important}.quiet:hover{text-decoration-thickness:2px}
.stage-dots span,.progress span{background:#cbd8d9!important}.stage-dots .done,.progress .done{background:#55bd3f!important}.stage-dots .current,.progress .current{background:#f5b61f!important}
.preview-hand span,.hand-tile.selected{border-color:#fff!important}.hand-tile{border-color:#d99b21!important;background:#fff9df!important;color:#a46b0b!important}.hand-tile.used{border-color:#168ada!important;background:linear-gradient(#effaff,#a4ddff)!important;color:#164a79!important}
.word-row{border-color:#d79c29!important;background:linear-gradient(90deg,#fffdf7,#ffedbd)!important}.word-row.filled{border-color:#168ada!important}.word-row.valid{border-color:#50b73e!important}.word-letter{color:#183965!important}.checks-panel{background:#e9f6ff!important;border-color:#91cdea!important;color:#174c7b!important}.checks-panel h3{color:#174c7b!important}.check-row{border-color:#92c7e455!important}.attempt{color:#123e6b!important}
.link-1{--link:#e34563;--link-soft:#ffe1e7}.link-2{--link:#7d4ac7;--link-soft:#eee2ff}.link-3{--link:#e89f13;--link-soft:#fff0bf}.link-4{--link:#168bd0;--link-soft:#dff4ff}.link-5{--link:#42a642;--link-soft:#e1f6dc}
.hand-tile.link-1,.hand-tile.link-2,.hand-tile.link-3,.hand-tile.link-4,.hand-tile.link-5{border-color:var(--link)!important;color:var(--link)!important}.hand-tile.selected{background:var(--link)!important;color:#fff!important;box-shadow:0 5px 0 color-mix(in srgb,var(--link),#000 32%)!important}.hand-tile.used{border-color:var(--link)!important;background:linear-gradient(#fff,var(--link-soft))!important;color:var(--link)!important;box-shadow:0 3px 0 color-mix(in srgb,var(--link),#000 24%)!important}.hand-tile:after{display:grid;place-items:center;width:17px;height:17px;right:3px!important;bottom:2px!important;border-radius:50%;background:var(--link);color:#fff!important;opacity:1!important}
.word-row.linked{border-color:var(--link)!important;background:linear-gradient(90deg,#fff,var(--link-soft))!important;box-shadow:0 4px 0 color-mix(in srgb,var(--link),#000 28%)!important}.word-row.linked .word-letter.changed{background:var(--link)!important;color:#fff!important;box-shadow:0 3px 0 color-mix(in srgb,var(--link),#000 30%)!important}.word-row.linked .undo-label{color:var(--link)!important;width:66px}
.win-demo{margin:17px 0 14px;padding:13px;border:2px solid #e0b850;border-radius:17px;background:#fffdf4;text-align:left}.win-demo-title{text-align:center;color:#07509e;font-weight:700}.win-demo-note{margin:3px 0 10px!important;text-align:center;font-size:.82rem}.demo-row{display:grid;grid-template-columns:67px 1fr 74px;align-items:center;gap:7px;padding:6px 0;border-top:1px solid #ead8a4;color:#294d73}.demo-card{padding:5px 7px;border:2px solid var(--link);border-radius:9px;background:var(--link-soft);color:var(--link);font-weight:700;text-align:center}.demo-card b{display:inline-grid;place-items:center;width:18px;height:18px;margin-right:4px;border-radius:50%;background:var(--link);color:#fff;font-size:.7rem}.demo-change{font-weight:600;white-space:nowrap}.demo-change .out{color:#8b6a34;text-decoration:line-through}.demo-change .in{display:inline-block;padding:1px 4px;border-radius:5px;background:var(--link);color:#fff}.demo-return{color:var(--link);font-size:.78rem;font-weight:700;text-align:right}.demo-result{margin-top:10px;padding-top:10px;border-top:2px solid #e3c46f;text-align:center}.demo-result>span{display:block;margin-bottom:7px;color:#805a0a;font-size:.8rem;font-weight:700}.demo-hand{display:flex;justify-content:center;gap:6px}.demo-hand b{display:grid;place-items:center;width:38px;height:40px;border:3px solid var(--link);border-radius:9px;background:var(--link-soft);color:var(--link);font-size:1.15rem}.demo-success{text-align:center!important;color:#278532!important;font-weight:700}
.profile-gate{background:#0d497ac7!important}.profile-fields label{color:#285474!important}.profile-fields input,.namebox input{background:#fff!important;color:#173b67!important;border:2px solid #9fc8df!important}.leaderboard th{color:#6e7f8b!important}.leaderboard td,.resultrow{border-color:#d8be7c!important;color:#3f5c78!important}.resultrow span:last-child{color:#163e6b!important}.reward,.leaderboard .me{color:#a86800!important}.namebox button{background:#168ada!important;color:#fff!important}.test-picker{border-color:#ddb868!important}.test-buttons button{background:linear-gradient(#ffd84c,#efa515)!important;border:2px solid white!important;color:#173c6a!important;box-shadow:0 3px 0 #a65f11}
.site-footer{color:#214d68!important;text-shadow:0 1px white}.site-footer a,.site-footer button{color:#064b84!important;font-weight:700!important}

/* Keep the puzzle itself above the fold while a round is active. */
body.playing main{max-width:700px!important;padding:4px 10px 12px!important}
body.playing header{min-height:42px!important;margin-bottom:3px!important}
body.playing .mini-logo{width:96px;height:44px}
body.playing .playerbar,body.playing .site-footer{display:none!important}
body.playing .hud{margin:0 2px 8px;padding:5px 11px}
body.playing .stage-dots,body.playing .progress{margin:0 0 8px}
body.playing #play .panel{padding:13px 15px!important;border-width:3px!important;border-radius:19px!important;box-shadow:0 0 0 4px #07509e,0 4px 0 4px #04346e,0 9px 18px #17455d45!important}
body.playing .hand-title h2{font-size:1.25rem;margin:0}
body.playing .hand-help{margin:3px 0 7px;font-size:.82rem;line-height:1.3}
body.playing .hand{gap:6px;margin:6px 0 3px}
body.playing .hand-tile{width:46px;height:48px;font-size:1.35rem;border-width:2px}
body.playing .word-board{gap:5px;margin-top:8px}
body.playing .word-row{padding:5px 8px;border-width:2px;border-radius:12px;box-shadow:0 2px 0 #80541d}
body.playing .word-letter{width:clamp(31px,8vw,44px);height:38px;font-size:1.12rem;box-shadow:0 2px #9aa9bb}
body.playing .feedback{min-height:23px;margin:7px 0 0;font-size:.9rem}
body.playing .checks-panel{margin-top:8px;padding:8px}
body.playing .check-row{padding:4px 0}
body.playing .hand-actions{gap:7px;margin-top:8px}
body.playing .hand-actions button{padding:10px 9px}
body.playing #puzzle .clue{min-height:40px;margin:6px 0;font-size:1.18rem}
body.playing #puzzle .tiles,body.playing .warm-tiles{margin:12px 0}
body.playing #puzzle .tile,body.playing .warm-tile{height:54px;font-size:1.5rem}
body.playing .keys{gap:5px;margin-top:10px}
body.playing .keyrow{gap:3px}
body.playing .key{height:39px}
body.playing .quiet{margin-top:8px}
@media(max-width:410px){header{grid-template-columns:72px 1fr 72px!important}.mini-logo{width:132px;height:72px}.panel{border-width:3px!important;box-shadow:0 0 0 4px #07509e,0 6px 0 4px #04346e,0 12px 22px #17455d55!important}}
@media(max-width:410px){body.playing header{grid-template-columns:65px 1fr 65px!important}body.playing .mini-logo{width:84px;height:39px}body.playing #play .panel{padding:11px 9px!important}body.playing .hand-tile{width:42px;height:45px}body.playing .word-letter{width:30px;height:36px;font-size:1.05rem}body.playing .word-row{padding-inline:5px}}
@media(max-width:410px){.win-demo{padding:10px 8px}.demo-row{grid-template-columns:58px 1fr 61px;gap:4px}.demo-card{padding-inline:4px}.demo-return{font-size:.7rem}.demo-change{font-size:.82rem}}

/* Hidden Word pairs use the same filled tile treatment at both ends of a swap. */
.hand-tile:after{display:none!important}
.hand-tile.used,.word-row.linked .word-letter.changed{border:2px solid #fff!important;border-radius:9px!important;background:var(--link)!important;color:#fff!important;box-shadow:0 3px 0 color-mix(in srgb,var(--link),#000 30%)!important}
.word-row.linked{border-color:#d79c29!important;background:linear-gradient(90deg,#fffdf7,#ffedbd)!important;box-shadow:0 4px 0 #80541d!important}
.word-row.linked .undo-label{width:58px;color:#8c6219!important}
.completed-board{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:10px 0}.completed-word{display:flex;justify-content:center;gap:5px;padding:5px;border:2px solid #ead8a4;border-radius:11px;background:#fff;color:#173b67;font-size:1rem;font-weight:700;letter-spacing:.12em}.completed-word:last-child{grid-column:1/-1}.completed-word .changed{display:grid;place-items:center;min-width:25px;margin:-3px 0;padding:2px 5px;border-radius:6px;background:var(--link);color:#fff;letter-spacing:0}.completed-word .rest{padding-top:2px}.win-demo.simple .demo-result{margin-top:8px}.win-demo.simple .demo-result>span{letter-spacing:.12em}.win-demo.simple .demo-success{margin:8px 0 0!important}


/* Keep the Hidden Word heading, prompt and instructions on one visual axis. */
.hand-title{display:block!important;text-align:center!important}
.hand-title small{display:block;margin-top:2px}
.hand-help{max-width:480px;margin-inline:auto!important;text-align:center}
.level-one-rules{max-width:440px;margin:12px auto 14px;padding:12px 15px 12px 34px;border:2px solid #e0b850;border-radius:14px;background:#fff9e8;color:#294d73;text-align:left;line-height:1.35}.level-one-rules li+li{margin-top:6px}

/* A played card is linked by colour; a success tick adds noise and implies validation. */
.hand-tile.used:before{display:none!important;content:none!important}

/* Completed gameplay example used on the explanation screen. */
.win-demo.simple{max-width:420px;margin-inline:auto;padding:12px 14px}
.win-demo.simple .win-demo-title{margin-bottom:9px;color:#805a0a;font-size:.78rem;letter-spacing:.1em}
.completed-hand{margin-bottom:11px}
.completed-hand b{width:42px;height:44px;background:#fff!important;color:var(--link)!important;box-shadow:0 3px 0 color-mix(in srgb,var(--link),#000 24%)}
.completed-board{display:flex;flex-direction:column;gap:5px;margin:0}
.completed-word{display:flex;justify-content:center;gap:5px;padding:4px 8px;border:0;border-top:2px solid #e4b848;border-radius:0;background:#fff5d6;font-size:1rem;letter-spacing:0}
.completed-word:last-child{border-bottom:2px solid #e4b848}
.completed-word span{display:grid;place-items:center;width:34px;height:34px;border-radius:8px;background:#fff;color:#173b67;box-shadow:0 2px #a6b1c0;font-weight:700}
.completed-word .changed{min-width:34px;margin:0;padding:0;background:var(--link)!important;color:#fff;box-shadow:0 2px 0 color-mix(in srgb,var(--link),#000 28%);letter-spacing:0}
@media(max-width:410px){.win-demo.simple{padding:10px}.completed-hand b{width:38px;height:40px}.completed-word span{width:31px;height:31px}}


/* Centre each playable word beneath the hidden hand; the action label floats at the edge. */
.word-row{display:block!important;position:relative}
.word-row .word-letters{justify-content:center}
.word-row .undo-label{position:absolute;right:9px;top:50%;width:auto!important;transform:translateY(-50%);text-align:right}
@media(max-width:410px){.word-row .undo-label{right:5px;font-size:.62rem}}

/* Static example: the R card and the L in COLD show the pending exchange. */
.example-focus-card{transform:translateY(-4px) rotate(-7deg);outline:3px dashed var(--link);outline-offset:3px}
.example-focus-source{outline:3px dashed var(--link);outline-offset:2px}

.win-demo.simple{position:relative}
.example-swap-arrow{position:absolute;z-index:2;top:68px;left:37%;width:72px;height:44px;overflow:visible;pointer-events:none}
.example-swap-arrow path{fill:none;stroke:#6d35b6;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round;opacity:.9}.example-swap-arrow .swap-arrow-up{stroke:#8b58cf}
@media(max-width:410px){.example-swap-arrow{top:63px;left:35%;width:67px}}

/* Level results focus on progression rather than daily ranking controls. */
body.level-mode .namebox,body.level-mode #nameStatus,body.level-mode #leaderboardTitle,body.level-mode .leaderboard,body.level-mode #share,body.level-mode #shareStatus{display:none!important}

/* Reserved display-ad position: below game content, never inside the puzzle board. */
.game-ad-space{display:none;min-height:74px;margin:16px auto 4px;border:1px dashed #ffffffaa;border-radius:12px;background:#fff8;place-items:center;color:#315879;font:600 .68rem/1 system-ui,sans-serif;letter-spacing:.08em;text-transform:uppercase}
.game-ad-space.ad-ready{display:grid}
.game-ad-space>span{display:none}
body.playing .game-ad-space{display:none!important}
