/* Shared play navigation. Keep game-specific layout outside this header contract. */
.tm-game-header{--gh-bg:#f8faf5;--gh-ink:#1b4144;--gh-muted:#4d6669;--gh-line:#d8e2da;--gh-button:#e7eee4;--gh-hover:#d8e7d0;display:flex;align-items:center;gap:22px;position:relative;z-index:25;flex:0 0 auto;width:100%;max-width:none;min-height:76px;margin:0;padding:12px clamp(16px,2.3vw,36px);color:var(--gh-ink);background:var(--gh-bg);border:0;border-bottom:1px solid var(--gh-line);font-family:var(--body,Arial,sans-serif);box-sizing:border-box}
.tm-game-header.tm-game-header--dark{--gh-bg:#20212e;--gh-ink:#f0f1f7;--gh-muted:#bdc2d5;--gh-line:#3b3e50;--gh-button:#2c2f41;--gh-hover:#3b4057}
.tm-game-header-start,.tm-game-header-actions{display:flex;align-items:center;gap:10px;flex:0 0 auto}
.tm-game-header .tm-game-header-start>.logo,.tm-game-header .tm-game-header-start>.tr-logo{display:inline-flex;align-items:center;gap:9px;margin:0;color:var(--gh-ink);font-size:24px;line-height:1;font-weight:700;letter-spacing:-1px;flex:none}
.tm-game-header .tm-game-header-start img,.tm-game-header .tm-game-header-start .melon-mark{width:34px;height:36px;object-fit:contain}
.tm-game-header .tm-game-header-heading{min-width:0;display:flex;flex-direction:column;gap:3px;padding-left:22px;border-left:1px solid var(--gh-line);text-align:left}
.tm-game-header-heading>strong{display:block;font-size:18px;font-weight:650;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tm-game-header-heading>small{display:block;font-size:14px;line-height:1.3;color:var(--gh-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tm-game-header-actions{margin-left:auto;gap:8px}
.tm-game-header .tm-game-header-button,.tm-game-header-actions :is(button,a){display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:1px solid transparent;border-radius:12px;background:var(--gh-button);box-shadow:none;color:var(--gh-ink);cursor:pointer;transition:background-color 140ms,transform 120ms}
.tm-game-header .tm-game-header-button:hover,.tm-game-header-actions :is(button,a):hover{background:var(--gh-hover)}
.tm-game-header .tm-game-header-button:active,.tm-game-header-actions :is(button,a):active{transform:scale(.96)}
.tm-game-header :is(button,a,select):focus-visible{outline:3px solid #8fc467;outline-offset:3px}
.tm-game-header-actions svg,.tm-game-header-button svg{width:22px;height:22px}
.tm-game-header-details{margin-left:auto;color:var(--gh-muted);font-size:14px;line-height:1.35}
.tm-game-header-details+.tm-game-header-actions{margin-left:0}
.tm-game-header-details .cloud-map-progress{font-size:14px;min-width:110px}
.tm-game-header-details .cloud-map-progress small{font-size:12px;color:var(--gh-muted);margin:0}
.tm-game-header .tm-game-header-heading select{max-width:480px;width:100%;font:inherit;font-size:18px;font-weight:650;line-height:1.3;background:transparent;border:0;color:var(--gh-ink);padding:0;min-height:24px}
.cloud-map .tm-game-header{position:fixed;top:0;inset-inline:0;transform:none;border-radius:0;backdrop-filter:blur(12px)}
.cloud-map-level-picker{position:relative;z-index:5;display:flex;align-items:center;gap:12px;width:fit-content;max-width:calc(100% - 32px);margin:-12px auto 12px;padding:10px 16px;border:1px solid #d8e2da;border-radius:14px;background:#fffef7;color:#284b3d}
.cloud-map-level-picker label{font-size:14px;white-space:nowrap}
.cloud-map-level-picker select{min-width:0;max-width:360px;border:0;background:transparent;color:inherit;font:inherit;font-size:16px;font-weight:650}
@media(max-width:900px){.tm-game-header{gap:16px}.tm-game-header .tm-game-header-heading{padding-left:16px}.tm-game-header .tm-game-header-start>.logo,.tm-game-header .tm-game-header-start>.tr-logo{font-size:0;letter-spacing:0}.tm-game-header-start{gap:12px}}
@media(max-width:600px){.tm-game-header{gap:12px;min-height:72px;padding:10px 12px}.tm-game-header .tm-game-header-start>.logo,.tm-game-header .tm-game-header-start>.tr-logo{display:none}.tm-game-header .tm-game-header-heading{padding-left:0;border:0;flex:1}.tm-game-header-heading>strong{font-size:18px}.tm-game-header-heading>small{font-size:13px}.tm-game-header-details{display:none}.tm-game-header-actions{gap:6px}.tm-game-header-details+.tm-game-header-actions{margin-left:auto}.tm-game-header-actions :is([data-race=fullscreen],[data-game-header-fullscreen]){display:none}}
@media(max-width:600px){.cloud-map-header .tm-game-header-details{display:block;flex:0 0 68px;font-size:12px;margin-left:0}.cloud-map-header .cloud-map-progress{min-width:0;font-size:12px}.cloud-map-header .cloud-map-progress b{font-size:18px}.cloud-map-header .cloud-map-progress small{font-size:10px}.cloud-map-header .cloud-map-progress progress{width:68px}.cloud-map-header .tm-game-header-heading small{display:none}.cloud-map-level-picker{gap:8px;padding:9px 12px}.cloud-map-level-picker label{font-size:12px}.cloud-map-level-picker select{max-width:200px;font-size:14px}}
@media(prefers-reduced-motion:reduce){.tm-game-header :is(button,a){transition:none}}

/* Optional dark presentation for the light games; the same visualizer and hands stay in use. */
:is(html[data-theme=dark] body,body:has(.tm-game-header[data-game-theme=dark])){background:#20212e;color:#eef0f6;color-scheme:dark}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])){--green:#8fddb0;--ink:#eef0f6;--muted:#bdc2d5;--paper:#20212e;min-height:100dvh;background:#20212e;color:#eef0f6}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) :is(.cloud-play-space,.cloud-practice-break){background:#20212e;color:#eef0f6}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) :is(.cloud-round-instruction,.cloud-helper,.cloud-context-helper,.cloud-target-helper,.cloud-helper-status,.cloud-word-subtitle,.cloud-practice-title,.cloud-round-progress,.game-instruction,.game-actions,.guide-layout,.finger-tip,.cloud-media-status){color:#bdc2d5}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .cloud-typing{color:#eef0f6;caret-color:#ff8ca6;border-color:#8fddb0}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) :is(.target-text .correct,.keyword-green,.cloud-round-celebration strong){color:#8fddb0!important}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) :is(.keyword-pink,.target-text .wrong){color:#ff8ca6!important}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .keyword-gold{color:#e4c989!important}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .keyword-blue{color:#9bcce5!important}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .target-text .caret{border-color:#ff8ca6}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .guide-keyboard{background:#272a39;border-color:#41465b;box-shadow:0 4px 0 #171a26}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .guide-key{background:#333749;color:#eef0f6;border-color:#50566c;box-shadow:0 2px 0 #171a26}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .guide-key.decorative{background:#292d3e;color:#bdc2d5}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) :is(.key-legend,.key-native,.key-english){color:#bdc2d5}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .guide-key.next-key{background:#8fddb0!important;color:#183a2b!important;border-color:#8fddb0!important;outline-color:#8fddb0!important;box-shadow:0 2px 0 #4b936b!important}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .keyboard-hands-overlay{mix-blend-mode:normal;filter:brightness(2);opacity:.85}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) :is(.cloud-hear,.meaning-choice,.btn,.spelling-word-card,.cloud-spelling-review){background:#2d3143;color:#eef0f6;border-color:#50566c;box-shadow:none}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .cloud-story-scene{background:#292d3e}
:is(html[data-theme=dark] #app,#app:has(.tm-game-header[data-game-theme=dark])) .cloud-story-scene>p{color:#bdc2d5}
:is(html[data-theme=dark] body,body:has(.tm-game-header[data-game-theme=dark])) #modal.cloud-dialog{background:#272a39;background-image:none;color:#eef0f6;border-color:#50566c;box-shadow:0 8px 0 #171a26,0 24px 65px #0006}
:is(html[data-theme=dark] body,body:has(.tm-game-header[data-game-theme=dark])) #modal.cloud-dialog :is(.game-settings-tabs button,.modal-close,.cloud-select-trigger,.cloud-select-options,.cloud-select-options button,.cloud-keyboard-preview){background:#333749;color:#eef0f6;border-color:#50566c;box-shadow:none}
:is(html[data-theme=dark] body,body:has(.tm-game-header[data-game-theme=dark])) #modal.cloud-dialog :is(.game-settings-tabs [aria-selected=true],.cloud-select-options [aria-selected=true]){background:#3e5c4c;color:#d6f9e1}
:is(html[data-theme=dark] body,body:has(.tm-game-header[data-game-theme=dark])) #modal.cloud-dialog :is(small,.cloud-keyboard-note){color:#bdc2d5}
:is(html[data-theme=dark] body,body:has(.tm-game-header[data-game-theme=dark])) #modal.cloud-dialog .btn-primary{background:#8fddb0;color:#183a2b}

.cloud-keyboard-tools{display:flex;justify-content:flex-end;width:100%;max-width:1080px;margin:0 auto 12px;flex-shrink:0}
.cloud-keyboard-tools .btn{min-height:36px;padding:6px 12px;display:inline-flex;align-items:center;gap:8px;font-size:13px}
.cloud-round-stage .target-text{max-width:100%}
.cloud-player .game-actions{padding-block:0;min-height:44px}
.cloud-play-space:has(.keyboard-guide:not([hidden])) .cloud-round-stage{min-height:210px;padding-block:20px;gap:14px}
@media(max-width:760px){.cloud-player .keyboard-guide:not([hidden]){display:block!important}.cloud-player .keyboard-guide .guide-key{min-height:28px}.cloud-keyboard-tools{margin-bottom:10px}.cloud-play-space:has(.keyboard-guide:not([hidden])) .cloud-round-stage{min-height:180px}}
@media(min-width:761px) and (max-height:800px){.cloud-play-space:has(.keyboard-guide:not([hidden])){padding-block:12px;min-height:calc(100dvh - 120px)}.cloud-play-space:has(.keyboard-guide:not([hidden])) .cloud-round-stage{min-height:170px;padding-block:12px;gap:10px}.cloud-round-stage .target-text{font-size:38px;line-height:1.4}.cloud-round-celebration{min-height:44px;height:44px}.cloud-round-stage #cloud-feedback:empty{display:none}.cloud-player .keyboard-guide .guide-key{height:32px}.cloud-player .game-actions{margin-top:8px}}
