/* Gameplay only: the catalogue and landing page retain their own layouts. */
body.hangman.gameplay-page {
    --hm-hue: 212;
    --hue: 212;
    background: #e2e6df;
    --support-bg: #e2e6df;
    --support-raised: #d3dbcc;
    --support-border: #c0c9b9;
    --support-ink: #292929;
    --support-muted: #595959;
    --support-accent: #c6d2bd;
    --hm-surface: #fafaf7;
    --hm-rules: #eeefe9;
    --hm-soft: #e7ecdf;
    --hm-key: #ffffff;
    --hm-border: #cbd1c5;
    --hm-ink: #292929;
    --hm-muted: #626262;
    --hm-accent: #61764d;
    --hm-success: #e4ecdf;
    --hm-success-ink: #3d5730;
    --hm-primary: #526641;
    --hm-primary-hover: #435534;
    --hm-primary-active: #35452a;
    --hm-wrong: #f2e3df;
    --hm-danger: #984e43;
}
body.hangman.gameplay-page:not(.dark-mode) #top-menu { --hue: 0; }
body.hangman.gameplay-page:not(.dark-mode) #top-menu :focus-visible { outline-color: var(--hm-accent); }
body.hangman.gameplay-page:not(.dark-mode) footer { color: var(--support-muted); border-color: var(--support-border); }
body.hangman.gameplay-page:not(.dark-mode) footer a,
body.hangman.gameplay-page:not(.dark-mode) footer #C { color: var(--support-muted); }
body.hangman.gameplay-page:not(.dark-mode) footer a:hover { color: var(--support-ink); }
body.hangman.gameplay-page.dark-mode {
    background: radial-gradient(ellipse at 80% 0, #203952 0, transparent 55%), #101923;
    --support-bg: #182b3e;
    --support-raised: #263e55;
    --support-border: #405a73;
    --support-ink: #f1f5fb;
    --support-muted: #bfcede;
    --support-accent: #a5c8ed;
    --hm-surface: #182632;
    --hm-rules: #14212c;
    --hm-soft: #213440;
    --hm-key: #253b49;
    --hm-border: #40515d;
    --hm-ink: #f4f7fa;
    --hm-muted: #becdd7;
    --hm-accent: hsl(var(--hm-hue), 55%, 72%);
    --hm-success: hsl(var(--hm-hue), 55%, 72%);
    --hm-success-ink: hsl(var(--hm-hue), 32%, 12%);
    --hm-wrong: #422f38;
    --hm-danger: #ffb9a8;
    --hm-primary: #315e91;
    --hm-primary-hover: #264c78;
    --hm-primary-active: #213f62;
}
body.hangman.gameplay-page .hangman-play {
    width: min(1200px, 94%); margin: 4px auto 0; padding: 0;
    background: var(--hm-surface); color: var(--hm-ink); border-radius: 0;
}
.hangman-play { position: relative; isolation: isolate; }
.hangman-play::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--hm-surface); box-shadow: 0 0 0 100vmax var(--hm-surface); clip-path: inset(0 -100vmax); }
body.hangman .hangman-play .hangman-card { padding: 24px 36px 28px; background: transparent; color: var(--hm-ink); border: 0; border-radius: 0; box-shadow: none; }
.hangman-play .hangman-meta { display: flex; justify-content: flex-end; align-items: center; gap: 20px; }
.hangman-play .hangman-category { display: flex; flex-direction: column; align-items: center; gap: 6px; box-sizing: border-box; max-width: 720px; margin: 18px auto 16px; padding: 16px 20px; border: 1px solid var(--hm-border); border-radius: 12px; background: var(--hm-soft); text-align: center; }
.hangman-play .hangman-category span { color: var(--hm-accent); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.hangman-play .hangman-category strong { color: var(--hm-ink); font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.hangman-play .hangman-attempts { min-width: 160px; }
.hangman-play #hangman-remaining { margin: 0 0 9px; color: var(--hm-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.hangman-play .hangman-lives { display: flex; gap: 5px; }
.hangman-play .hangman-lives i { flex: 1; height: 5px; background: var(--hm-accent); border-radius: 3px; }
.hangman-play .hangman-lives .is-used { background: var(--hm-border); opacity: .45; }
.hangman-play .hangman-board { max-width: 880px; margin: 18px auto 8px; gap: 48px; min-height: 210px; }
.hangman-play .hangman-drawing { width: 210px; height: 210px; flex: 0 0 210px; padding: 0; box-sizing: border-box; overflow: visible; }
.hangman-play .hangman-halo { fill: var(--hm-soft); opacity: .65; }
.hangman-play .hangman-ground { fill: var(--hm-border); opacity: .45; }
/* Warm fabric colours keep the toy distinct from error feedback in both themes. */
.hangman-play .hangman-toy { --toy-fur: #cfa575; --toy-outline: #79583c; --toy-inset: #f2d9b2; --toy-mark: #79583c; }
.hangman-play .hangman-fur { fill: var(--toy-fur); stroke: var(--toy-outline); }
.hangman-play .hangman-plush-inset { fill: var(--toy-inset); stroke: none; }
.hangman-play .hangman-bear-face { fill: #46372e; stroke: none; }
.hangman-play .hangman-bear-smile { fill: none; stroke: #46372e; stroke-width: 1.8; }
.hangman-play .hangman-toy-loop { fill: none; stroke: #55778d; stroke-width: 3; }
.hangman-play .hangman-plush-patch { fill: #94b6ce; stroke: #55778d; stroke-width: 1.5; }
.hangman-play .hangman-plush-seam { fill: none; stroke: var(--toy-outline); stroke-width: 1.3; }
.hangman-play .hangman-prompt { color: var(--hm-muted); margin: 0; font-size: 14px; }
.hangman-play .hangman-word { gap: 5px; margin: 18px 0; flex-wrap: nowrap; }
body.hangman .hangman-play .hangman-letter { box-sizing: border-box; width: 42px; max-width: 42px; flex: 1 1 0; min-width: 0; height: 52px; border: 1px solid var(--hm-border); border-bottom: 3px solid var(--hm-accent); border-radius: 7px; background: var(--hm-key); color: var(--hm-ink); font-size: clamp(18px, 3vw, 26px); }
.hangman-play .hangman-message { margin: 0; min-height: 48px; font-size: 15px; font-weight: 500; color: var(--hm-muted); }
.hangman-play [data-result="won"] .hangman-message { color: var(--hm-accent); }
.hangman-play [data-result="lost"] .hangman-message { color: var(--hm-danger); }
.hangman-play .hangman-input-hint { margin: 12px 0; text-align: center; color: var(--hm-muted); font-size: 13px; }
.hangman-play .hangman-keyboard { max-width: 720px; margin: 0 auto 24px; gap: 8px; }
body.hangman .hangman-play .hangman-key { min-height: 48px; border: 1px solid var(--hm-border); border-radius: 9px; background: var(--hm-key); color: var(--hm-ink); box-shadow: none; font-size: 19px; transition: background .15s, border-color .15s; }
body.hangman .hangman-play .hangman-key:hover:not(:disabled) { background: var(--hm-soft); border-color: var(--hm-accent); }
body.hangman .hangman-play .hangman-key:active:not(:disabled) { background: var(--hm-soft); box-shadow: none; }
body.hangman .hangman-play .hangman-key.is-correct { background: var(--hm-success); border-color: var(--hm-accent); color: var(--hm-success-ink); box-shadow: none; }
body.hangman .hangman-play .hangman-key.is-wrong { background: var(--hm-wrong); color: var(--hm-danger); border-color: transparent; box-shadow: none; text-decoration: none; opacity: .65; }
.hangman-play .hangman-actions { gap: 12px 24px; padding-top: 22px; border-top: 1px solid var(--hm-border); }
body.hangman .hangman-play .hangman-actions a { color: var(--hm-accent); font-size: 14px; }
body.hangman .hangman-play .hangman-actions .hangman-next {
    display: inline-flex; align-items: center; justify-content: center; gap: 12px;
    box-sizing: border-box; min-height: 48px; max-width: 100%; margin: 0; padding: 12px 22px;
    border: 1px solid var(--hm-primary); border-radius: 10px; background: var(--hm-primary); color: #fff;
    font: 600 16px/1.4 Arial, sans-serif; text-decoration: none; text-shadow: none; box-shadow: none;
    touch-action: manipulation; transition: background .15s, border-color .15s;
}
.hangman-play .hangman-next svg { flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.hangman.dark-mode .hangman-play .hangman-actions .hangman-next { background: #a5c8ed; border-color: #a5c8ed; color: #162b40; }
@media (hover: hover) {
    body.hangman .hangman-play .hangman-actions .hangman-next:hover { background: var(--hm-primary-hover); border-color: var(--hm-primary-hover); }
    body.hangman.dark-mode .hangman-play .hangman-actions .hangman-next:hover { background: #c0dbf6; border-color: #c0dbf6; }
}
body.hangman .hangman-play .hangman-actions .hangman-next:active { background: var(--hm-primary-active); }
body.hangman.dark-mode .hangman-play .hangman-actions .hangman-next:active { background: #8fb6df; }
.hangman-play .hangman-rules { position: relative; isolation: isolate; margin: 0; padding: 28px 36px 84px; background: var(--hm-rules); color: var(--hm-muted); font-size: 14px; }
.hangman-play .hangman-rules::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--hm-rules); box-shadow: 0 0 0 100vmax var(--hm-rules); clip-path: inset(0 -100vmax); pointer-events: none; }
.hangman-play .hangman-rules summary { color: var(--hm-ink); font-size: 16px; }
.hangman-play .hangman-rules p { max-width: 850px; margin-bottom: 0; }
body.hangman .hangman-play :focus-visible { outline: 3px solid var(--hm-accent); outline-offset: 4px; }
@media (max-width: 640px) {
    body.hangman.gameplay-page .hangman-play { width: 100%; }
    body.hangman .hangman-play .hangman-card { padding: 20px 16px 24px; }
    .hangman-play .hangman-meta { gap: 12px; align-items: start; }
    .hangman-play .hangman-category { margin: 12px auto 16px; padding: 14px 16px; }
    .hangman-play .hangman-category strong { font-size: 22px; border: 1px solid var(--hm-border); border-radius: 9px; background: var(--hm-key); color: var(--hm-ink); }
    .hangman-play .hangman-attempts { min-width: 132px; }
    .hangman-play #hangman-remaining { font-size: 12px; }
    .hangman-play .hangman-board { flex-direction: column; gap: 18px; margin: 22px auto 0; min-height: 0; }
    .hangman-play .hangman-drawing { width: 150px; height: 150px; flex-basis: auto; padding: 0; }
    .hangman-play .hangman-puzzle { width: 100%; text-align: center; }
    .hangman-play .hangman-word { justify-content: center; gap: 4px; margin: 14px 0; }
    body.hangman .hangman-play .hangman-letter { height: 43px; font-size: 21px; }
    .hangman-play .hangman-message { min-height: 44px; font-size: 14px; }
    .hangman-play .hangman-keyboard { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; margin-bottom: 24px; }
    .hangman-play .hangman-input-hint { font-size: 12px; margin: 8px 0 14px; }
    .hangman-play .hangman-actions { flex-direction: column; gap: 18px; }
    body.hangman .hangman-play .hangman-actions .hangman-next { width: 100%; }
    .hangman-play .hangman-rules { padding: 24px 20px 64px; }
}
@media (prefers-reduced-motion: reduce) { body.hangman .hangman-play .hangman-key { transition: none; } }

/* Ten plush characters repeat by puzzle number, with shared six-part anatomy. */
.hangman-play .hangman-toy--bunny { --toy-fur: #e6d4c9; --toy-outline: #92776d; --toy-inset: #fff1e8; }
.hangman-play .hangman-toy--cat { --toy-fur: #aaaec9; --toy-outline: #5c6180; --toy-inset: #e4e5f2; --toy-mark: #646b93; }
.hangman-play .hangman-toy--dog { --toy-fur: #ead1a1; --toy-outline: #8e6845; --toy-inset: #fff0d3; --toy-mark: #a77852; }
.hangman-play .hangman-toy--fox { --toy-fur: #e8a069; --toy-outline: #925832; --toy-inset: #fff0d6; }
.hangman-play .hangman-toy--panda { --toy-fur: #f1eee3; --toy-outline: #646779; --toy-inset: #fffaed; --toy-mark: #505668; }
.hangman-play .hangman-toy--koala { --toy-fur: #a8bbc1; --toy-outline: #5d737e; --toy-inset: #e1e9e7; }
.hangman-play .hangman-toy--raccoon { --toy-fur: #b8aaa0; --toy-outline: #76675f; --toy-inset: #f2e6d6; --toy-mark: #655d5e; }
.hangman-play .hangman-toy--tiger { --toy-fur: #edb05f; --toy-outline: #926333; --toy-inset: #fff0ce; --toy-mark: #8d5737; }
.hangman-play .hangman-toy--pig { --toy-fur: #eab2b4; --toy-outline: #a76b78; --toy-inset: #ffe1d8; }
.hangman-play .hangman-ear-inset { fill: none; stroke: var(--toy-inset); stroke-width: 5; }
.hangman-play .hangman-toy-mark { fill: var(--toy-mark); stroke: var(--toy-outline); stroke-width: 1.5; }
.hangman-play .hangman-toy-stripes { fill: none; stroke: var(--toy-mark); stroke-width: 3; }
.hangman-play .hangman-toy--panda .hangman-toy-ear,
.hangman-play .hangman-toy--panda [data-hangman-part]:nth-child(n+3) .hangman-fur { fill: var(--toy-mark); }
.hangman-play .hangman-toy--panda .hangman-toy-eye,
.hangman-play .hangman-toy--raccoon .hangman-toy-eye { fill: #fff7e6; }
.hangman-play .hangman-pig-snout { fill: #db8f9e; stroke: #a76b78; stroke-width: 1.5; }
.hangman-play .hangman-toy-teeth { fill: #fffdf7; stroke: var(--toy-outline); stroke-width: 1; }

body.hangman.gameplay-page.arcade-site #top-menu :focus-visible { outline-color: var(--support-accent); }
@media (prefers-reduced-motion: reduce) { body.hangman .hangman-play .hangman-actions .hangman-next { transition: none; } }

/* Keep these controls in the markup for the shared menu initialization. */
body.hangman.gameplay-page #top-menu #rnd,
body.hangman.gameplay-page #top-menu #speech { display: none; }
body.hangman .hangman-play .hangman-actions .hangman-next[hidden],
body.hangman .hangman-play .hangman-actions .hangman-random[hidden] { display: none; }
body.hangman .hangman-play .hangman-actions .hangman-random {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    box-sizing: border-box; min-height: 48px; max-width: 100%; padding: 12px 20px;
    border: 1px solid var(--hm-border); border-radius: 10px;
    background: var(--hm-soft); color: var(--hm-ink); font: 600 16px/1.4 Arial, sans-serif;
    text-decoration: none; touch-action: manipulation;
}
.hangman-play .hangman-random svg { flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
    body.hangman .hangman-play .hangman-actions .hangman-random:hover { border-color: var(--hm-accent); background: var(--hm-key); }
}
@media (max-width: 640px) {
    body.hangman .hangman-play .hangman-actions .hangman-random { width: 100%; }
}

body.hangman .hangman-play .hangman-actions .hangman-change-topic {
    display: inline-flex; align-items: center; justify-content: center;
    box-sizing: border-box; min-height: 44px; margin-right: auto; padding: 10px 14px;
    border: 1px solid var(--hm-border); border-radius: 8px; background: transparent;
    color: var(--hm-muted); font: 400 14px/1.4 Arial, sans-serif; text-decoration: none;
    touch-action: manipulation;
}
@media (hover: hover) {
    body.hangman .hangman-play .hangman-actions .hangman-change-topic:hover { background: var(--hm-soft); color: var(--hm-ink); }
}
@media (max-width: 640px) {
    .hangman-play .hangman-change-topic { align-self: flex-start; }
}

/* Composed native-script guesses are submitted only after composition ends. */
.hangman-composer { margin: 16px auto; max-width: 620px; }
.hangman-composer label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hangman-composer > div { display: flex; flex-wrap: wrap; gap: 8px; }
.hangman-composer input { flex: 1 1 160px; min-width: 0; padding: 8px 12px; font: inherit; font-size: 22px; border: 1px solid var(--hm-border); border-radius: 9px; background: var(--hm-key); color: var(--hm-ink); }
body.hangman .hangman-composer button { min-height: 44px; padding: 10px 18px; border: 1px solid var(--hm-border); border-radius: 9px; background: var(--hm-soft); color: var(--hm-ink); font: inherit; box-shadow: none; }
body.hangman .hangman-composer button[type="submit"] { background: var(--hm-accent); border-color: var(--hm-accent); color: var(--hm-surface); font-weight: 600; }
.hangman-composer input:disabled, .hangman-composer button:disabled { opacity: .7; }
.hangman-word:lang(hi) .hangman-letter, .hangman-word:lang(th) .hangman-letter { min-width: 1.5em; width: auto; padding-inline: .2em; line-height: 1.8; }
.hangman-keyboard:lang(hi), .hangman-keyboard:lang(th), .hangman-keyboard:lang(ja) { max-width: 900px; }
.hangman-lives { flex-wrap: wrap; }
