/* Shared layout, typography and theme for the game documents. */
:root{--ui-bg:#f4f6ef;--ui-surface:#fff;--ui-soft:#e8eddd;--ui-text:#293729;--ui-muted:#62705e;--ui-line:#c9d2bf;--ui-accent:#53662c;--font:'DM Sans',system-ui,sans-serif;--serif:Manrope,system-ui,sans-serif;color-scheme:light}
:root[data-theme=dark]{--ui-bg:#161c18;--ui-surface:#20291f;--ui-soft:#303c28;--ui-text:#edf2e6;--ui-muted:#afbba4;--ui-line:#46513d;--ui-accent:#d5ef55;color-scheme:dark;--ink:#edf2e6;--muted:#afbba4;--paper:#161c18;--line:#46513d}
html body{font-family:'DM Sans',system-ui,sans-serif;background:var(--ui-bg);color:var(--ui-text)}html h1,html h2,html .brand,html .collection-logo{font-family:Manrope,system-ui,sans-serif}html button,html input,html textarea{font-family:'DM Sans',system-ui,sans-serif}html .metrics strong,html .metric-value{font-family:Manrope,system-ui,sans-serif}html button:disabled{cursor:default}
.embedded .all-games,.embedded .all-games-link,.embedded .circuit-link,.embedded .game-list,.embedded .site-footer,.embedded footer,.embedded .under-game,.embedded .below-card{display:none!important}
.embedded .shell,.embedded .page-shell{max-width:none;padding:0 20px 18px}.embedded .site-header,.embedded .header{height:56px;min-height:56px;max-width:720px;margin:0 auto;border-bottom:1px solid var(--ui-line)}.embedded .collection-logo,.embedded .brand{font-size:23px}.embedded .collection-logo #game-title{font-family:Manrope,sans-serif;font-size:23px}.embedded .header-right{margin-left:auto}.embedded .site-header>#help{margin-left:auto}.embedded .play-layout{display:block;max-width:500px;margin:16px auto 0}.embedded .game-layout{margin:16px auto 0}
.mode-explanation{font:11px/1.5 'DM Sans',sans-serif;color:var(--ui-muted);background:var(--ui-soft);margin:0;padding:8px 13px;border-bottom:1px solid var(--ui-line)}.mode-explanation strong{font-weight:700;color:var(--ui-text)}
html dialog{font-family:'DM Sans',sans-serif;background:var(--ui-surface);color:var(--ui-text);border-color:var(--ui-line);max-height:calc(100dvh - 24px);overflow:auto}html dialog p,html dialog li,html #modal-content p,html #modal-content ol,html #modal-content ul{color:var(--ui-muted)}html dialog h2,html dialog strong{color:var(--ui-text)}html dialog::backdrop{background:#061019aa;backdrop-filter:blur(3px)}
/* Dark surfaces retain the distinct colours that convey puzzle state. */
html[data-theme=dark] .play-card,html[data-theme=dark] .game-card,html[data-theme=dark] .game{background:var(--ui-surface);border-color:var(--ui-line);box-shadow:0 3px 0 #070d12}
html[data-theme=dark] .play-card-top,html[data-theme=dark] .card-top,html[data-theme=dark] .game-top,html[data-theme=dark] .card-bottom{border-color:var(--ui-line)}
html[data-theme=dark] .collection-logo,html[data-theme=dark] .brand,html[data-theme=dark] .circuit-brand,html[data-theme=dark] #game-title,html[data-theme=dark] .goal-row h1,html[data-theme=dark] .puzzle-heading,html[data-theme=dark] .metric-value,html[data-theme=dark] .metrics strong,html[data-theme=dark] .instruction,html[data-theme=dark] #result h2{color:var(--ui-text)}
html[data-theme=dark] .round-button,html[data-theme=dark] .icon-button,html[data-theme=dark] .tiny-help{color:var(--ui-text);border-color:var(--ui-line)}
html[data-theme=dark] .metric-label,html[data-theme=dark] .metric-value>span,html[data-theme=dark] .metrics>div>span,html[data-theme=dark] .small-label,html[data-theme=dark] #issue,html[data-theme=dark] .daily-foot,html[data-theme=dark] .game-message,html[data-theme=dark] .round-count,html[data-theme=dark] .letter-count,html[data-theme=dark] .live-state,html[data-theme=dark] .card-bottom,html[data-theme=dark] .grid-note,html[data-theme=dark] #result p{color:var(--ui-muted)}
html[data-theme=dark] .mode-tabs button,html[data-theme=dark] #sizes button{color:var(--ui-muted)}html[data-theme=dark] .mode-tabs button.active,html[data-theme=dark] #sizes button.active{background:#335546;color:#d8f0df;box-shadow:inset 0 0 0 1px #698c79}
html[data-theme=dark] .puzzle-tools button,html[data-theme=dark] .tools button,html[data-theme=dark] .secondary-button,html[data-theme=dark] .secondary,html[data-theme=dark] .shuffle-button,html[data-theme=dark] .erase-button{background:var(--ui-soft);color:var(--ui-text);border-color:var(--ui-line)}html[data-theme=dark] .puzzle-tools button:disabled,html[data-theme=dark] .tools button:disabled{opacity:.5}
html[data-theme=dark] .primary-button,html[data-theme=dark] .primary,html[data-theme=dark] .check-button{background:#d5ef55;color:#123629;border-color:#d5ef55}html[data-theme=dark] .primary-button:disabled,html[data-theme=dark] .check-button:disabled{background:#2d414e;color:#8ca1af;border-color:#415a6a}
html[data-theme=dark] .variant-tabs button{background:#213542;color:#d6e5ed;border-color:#536a79}html[data-theme=dark] .variant-tabs button.active{background:#d5ef55;color:#123629;border-color:#d5ef55}html[data-theme=dark] .variant-badge{background:#293f4e;color:#c4d8e4}html[data-theme=dark] .key-chip{color:#c1d2dd}
html[data-theme=dark] .word-goal{background:#302b45;border-color:#76628d}html[data-theme=dark] .word-goal .big-word,html[data-theme=dark] .word-goal .target-word{color:#e5cef7}html[data-theme=dark] .word-goal .tiny-label,html[data-theme=dark] .word-goal .goal-arrow,html[data-theme=dark] .option-label{color:#c9b5dd}html[data-theme=dark] .word-option,html[data-theme=dark] .word-trail span{background:#2e2c43;border-color:#77648d;color:#eee1fb}html[data-theme=dark] .word-option b{color:#d7aff7}
html[data-theme=dark] .quartet-word{background:#3c342c;color:#f2e3cb;border-color:#88725c}html[data-theme=dark] .quartet-word.selected{background:#97714c;color:#fff3df;border-color:#ddb785}html[data-theme=dark] .quartet-found{color:#233123}html[data-theme=dark] .mistakes{color:#dec2a3}
html[data-theme=dark] .weave-grid{background:#283d2e;border-color:#69846a}html[data-theme=dark] .weave-cell{background:#203125;color:#def0ce;border-color:#6b8364}html[data-theme=dark] .weave-cell.found{background:#344c36;color:#d8e8c3}html[data-theme=dark] .weave-cell.selected{background:#95b873;color:#142512;border-color:#bedc99}html[data-theme=dark] .weave-clue,html[data-theme=dark] .traced-word{color:#c3dba7}html[data-theme=dark] .weave-clue>span{color:#cde0b8;border-color:#8ca273}
html[data-theme=dark] .slide-grid{background:#263c50;border-color:#647e93}html[data-theme=dark] .slide-tile{background:#34556e;color:#f0f6fa;border-color:#7b9bb2;box-shadow:0 2px 0 #182a39}html[data-theme=dark] .slide-tile.correct{background:#355e50;color:#d9efdf;border-color:#81ae94}html[data-theme=dark] .slide-tile.gap{background:#172b3b;border-color:#7892a8}
html[data-theme=dark] .number-tile{background:#443044;color:#f4e1f0;border-color:#98748e;box-shadow:0 2px 0 #231c2d}html[data-theme=dark] .number-tile.selected{background:#815b7c;color:#fff;border-color:#c4a1bb}html[data-theme=dark] .operator-preview,html[data-theme=dark] .operator-preview b{color:#d6b5cb}html[data-theme=dark] .operator-buttons button{background:#392c3c;color:#edc9df;border-color:#96728b}html[data-theme=dark] .calculation-list{background:#2b2433;border-color:#775a73}html[data-theme=dark] .calculation-list p{color:#d8bad0}html[data-theme=dark] .calculation-list .empty-calculation{color:#c6aebe!important}
html[data-theme=dark] .clue-card{background:#273952;color:#d0e1ff;border-color:#6e8cb7}html[data-theme=dark] .clue-card.right{background:#50392d;color:#ffe0ca;border-color:#a18169}html[data-theme=dark] .answer-tile{background:#1e303e;color:#e0edf5;border-color:#6a8395}html[data-theme=dark] .answer-tile.filled{background:#3b5236;color:#e4f2d2;border-color:#8b9e6e}html[data-theme=dark] .answer-tile.correct{background:#b7cf76;color:#1d321a}html[data-theme=dark] .letter-key{background:#2a4050;color:#e1edf4;border-color:#647e91;box-shadow:0 2px 0 #102431}html[data-theme=dark] .letter-key:disabled{background:#1c2b36;color:#8299aa;border-color:#3a5163}html[data-theme=dark] .hint-button,html[data-theme=dark] .sound-button,html[data-theme=dark] .bridge-icon{color:#bfd3e0}html[data-theme=dark] .solved-phrases{color:#bed6a7}
html[data-theme=dark][data-game=sudoku] main{color:var(--ui-text)}html[data-theme=dark][data-game=sudoku] .board-wrap{background:#17242e;border-color:#82968d}html[data-theme=dark][data-game=sudoku] .cell{background:#192a34;color:#e8f0ed;border-color:#3f535a}html[data-theme=dark][data-game=sudoku] .cell.peer{background:#253a40}html[data-theme=dark][data-game=sudoku] .cell.answer{background:#203b35;color:#a1d3b9}html[data-theme=dark][data-game=sudoku] .cell.invalid{background:#522e32;color:#ffc8c3}html[data-theme=dark][data-game=sudoku] .cell.uncertain{background:#4a4029;color:#ffe2a1}html[data-theme=dark][data-game=sudoku] .cell:focus{background:#38584b;box-shadow:inset 0 0 0 2px #add4ba}html[data-theme=dark][data-game=sudoku] .camera-button{background:#d5ef55;color:#123629;border-color:#d5ef55}html[data-theme=dark][data-game=sudoku] .text-button,html[data-theme=dark][data-game=sudoku] .status,html[data-theme=dark][data-game=sudoku] #scan-help,html[data-theme=dark][data-game=sudoku] #scan-status{color:#b5c8be}html[data-theme=dark][data-game=sudoku] #viewfinder{background:#20322d}html[data-theme=dark] .share-text{background:var(--ui-bg);color:var(--ui-text);border-color:var(--ui-line)}
@media(max-width:640px){.embedded .shell,.embedded .page-shell{padding:0 10px 12px}.embedded .site-header,.embedded .header{height:46px;min-height:46px}.embedded .play-layout,.embedded .game-layout{margin-top:10px}.embedded .collection-logo #game-title{font-size:21px}.mode-explanation{font-size:10px;padding:7px 11px}.embedded .play-card-body{padding:11px}.embedded .quartet-word{font-size:11px;min-height:48px}.embedded .puzzle-tools button{min-height:40px}.embedded .letter-key{min-height:43px}}
@media(orientation:landscape) and (max-height:550px){.embedded .shell,.embedded .page-shell{padding:0 12px 10px}.embedded .site-header,.embedded .header{height:38px;min-height:38px;margin-bottom:6px}.embedded .play-layout{max-width:760px;margin-top:6px}.embedded .play-card-body{display:grid;grid-template-columns:minmax(200px,1fr) 200px;gap:8px 16px;align-items:start;padding:10px}.embedded #game-content{grid-column:1;grid-row:1/span 5;min-width:0}.embedded .puzzle-heading{grid-column:2;grid-row:1;font-size:12px}.embedded .puzzle-metrics{grid-column:2;grid-row:2;padding:0;gap:8px;flex-wrap:wrap}.embedded .puzzle-tools{grid-column:2;grid-row:3;flex-wrap:wrap;padding:0}.embedded .game-message{grid-column:2;grid-row:4;margin:0}.embedded #result{grid-column:2;grid-row:5}.embedded .flip-grid,.embedded .slide-grid{width:min(100%,calc(100dvh - 145px));margin:auto}.embedded .quartet-word{min-height:36px;font-size:10px}.embedded .weave-grid{max-width:190px;margin:auto}.embedded .weave-cell{font-size:21px}.embedded[data-game=weave] #game-content{display:grid;grid-template-columns:minmax(140px,190px) minmax(120px,1fr);gap:6px 10px}.embedded .weave-grid{grid-column:1;grid-row:1/span 4}.embedded .traced-word{grid-column:2;grid-row:1;margin:5px 0;font-size:15px}.embedded[data-game=weave] .selection-actions{grid-column:2;grid-row:2;margin:0}.embedded .weave-clues{grid-column:2;grid-row:3;grid-template-columns:1fr;margin:4px 0;gap:4px}.embedded .weave-clue{font-size:10px}.embedded .mode-explanation{padding:5px 11px;font-size:10px}.embedded .play-card-top,.embedded .card-top{padding:6px 10px}.embedded .game-layout{max-width:710px;margin-top:6px}.embedded #play-area{display:grid;grid-template-columns:1fr 1fr;gap:8px 16px;padding:10px}.embedded #play-area .round-header{grid-column:1/-1}.embedded #play-area .instruction{grid-column:1;grid-row:2;margin:0 0 4px}.embedded #play-area .bridge{grid-column:1;grid-row:3/span 3}.embedded #play-area .clue-card{padding:12px 5px}.embedded #play-area .clue-text{font-size:15px}.embedded #play-area .answer-tiles{grid-column:2;grid-row:2;margin:0;gap:5px}.embedded #play-area .answer-tile{height:36px;width:32px;font-size:20px}.embedded #play-area .letter-count{grid-column:2;grid-row:3;margin:0}.embedded #play-area .letter-bank{grid-column:2;grid-row:4;margin:0;gap:4px;display:grid;grid-template-columns:repeat(9,minmax(0,1fr))}.embedded #play-area .letter-key{min-height:32px;height:32px;width:100%;font-size:12px}.embedded #play-area .actions{grid-column:2;grid-row:5}.embedded #play-area .hint-button{grid-column:1;grid-row:6;margin:0}.embedded #play-area .card-bottom{grid-column:2;grid-row:6;margin:0;padding:6px 0}.embedded #play-area .feedback{grid-column:1/-1;grid-row:7}.embedded .goal-row{grid-column:2;grid-row:1}.embedded .metrics{grid-column:2;grid-row:2;gap:10px;flex-wrap:wrap;padding:0}.embedded .state-key{grid-column:2;grid-row:3;justify-content:flex-start;margin:0}.embedded .tools{grid-column:2;grid-row:4;margin:0}.embedded .daily-foot{margin-top:6px}.embedded[data-game=sudoku] main{max-width:420px;padding-top:10px}.embedded[data-game=sudoku] #result{display:grid;grid-template-columns:minmax(140px,250px) 135px;gap:8px 14px}.embedded[data-game=sudoku] #result[hidden]{display:none!important}.embedded[data-game=sudoku] .board-wrap{grid-row:1/span 3}.embedded[data-game=sudoku] .board-caption{grid-column:2;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:8px;margin:0}.embedded[data-game=sudoku] .board-caption #undo{margin:0}.embedded[data-game=sudoku] #solve{grid-column:2;align-self:start}.embedded[data-game=sudoku] .cell{font-size:17px}.embedded[data-game=sudoku] .status{font-size:11px}}
/* Short landscape viewports trade header height for usable puzzle space. */
@media(orientation:landscape) and (max-height:550px){.embedded .site-header,.embedded .header{height:30px;min-height:30px;margin-bottom:4px}.embedded .collection-logo #game-title,.embedded .brand,.embedded .circuit-brand{font-size:19px}.embedded .collection-mark,.embedded .brand-icon,.embedded .circuit-brand>span{height:24px;width:24px;font-size:21px}.embedded .round-button,.embedded .icon-button{width:26px;height:26px;font-size:13px}.embedded .play-card-top,.embedded .card-top,.embedded .game-top{padding:4px 8px}.embedded .mode-tabs button{min-height:26px;padding:4px 9px;font-size:10px}.embedded .mode-explanation{font-size:10px;padding:4px 10px;line-height:1.3}.embedded .game-body,.embedded .play-card-body{padding:8px}.embedded #play-area .clue-card{padding:10px 5px}.embedded .daily-foot{font-size:9px;margin-top:4px}}
html[data-theme=dark] .result h2,html[data-theme=dark] .result-stat strong{color:var(--ui-text)}html[data-theme=dark] .result-stat span,html[data-theme=dark] .result-review p,html[data-theme=dark] .result-review summary{color:var(--ui-muted)}html[data-theme=dark] .game-message.success{color:#a6d7ad}html[data-theme=dark] .feedback,html[data-theme=dark][data-game=sudoku] .status.error{color:#ffb1a7}html[data-theme=dark] .round-dot.current{background:#b4d6e6;box-shadow:0 0 0 3px #3b5869}html[data-theme=dark] .round-dot.solved{background:#8bb68a}html[data-theme=dark] .short-key{color:#ff9ca7}html[data-theme=dark] #toast{border:1px solid #627f93}html[data-theme=dark][data-game=sudoku] #read[disabled]{background:#446858;color:#f1f8f0;opacity:1}

/* Circuit controls share the collection theme. */

html[data-theme=dark] .size-control select,html[data-theme=dark] .new-button,html[data-theme=dark] .board-view button{background:var(--ui-soft);color:var(--ui-text);border-color:var(--ui-line)}


/* Keep a small, consistent place for the collection menu beside game titles. */
@media(max-width:1100px){html.embedded body header{padding-left:96px}html.embedded .collection-mark,html.embedded .brand-icon,html.embedded .spider-mark{display:none}}

/* The collection owns the visible brand while an embedded game keeps its title. */
html.embedded .circuit-brand .brand-mark{display:none}
html .collection-brand{transform:none;background:none;border:0;padding:0;overflow:hidden}
html .collection-brand img{display:block;width:100%;height:100%}
