* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }

button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.game-shell { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 15px 0 40px; position: relative; }

.btn-fullscreen {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 25;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 8, 12, 0.7);
    border: 1px solid rgba(0, 183, 255, 0.4);
    color: #00b7ff;
    border-radius: 8px;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
}
.btn-fullscreen:hover { background: rgba(0, 183, 255, 0.15); }

#hangman-game:fullscreen,
#hangman-game:-webkit-full-screen {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    padding: 16px 14px 20px;
    background: #04080c;
    overflow-y: auto;
    box-sizing: border-box;
}
.game-heading { max-width: 690px; margin: 0 auto 24px auto; text-align: center; }
.eyebrow { margin: 0 0 10px; color: #39ff14; font: 700 .68rem 'Chakra Petch', sans-serif; letter-spacing: 2.5px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #39ff14; box-shadow: 0 0 12px #39ff14; }
.game-heading p:last-child { max-width: 590px; margin: 0 auto; color: #a7bac5; font-size: .94rem; line-height: 1.75; }

.game-layout { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(420px, 1.2fr); gap: 18px; align-items: stretch; }
.panel { border: 1px solid rgba(255, 255, 255, .1); border-radius: 18px; background: linear-gradient(145deg, rgba(11, 28, 39, .9), rgba(5, 12, 18, .85)); box-shadow: 0 20px 70px rgba(0, 0, 0, .38); }
.hangman-panel { display: flex; min-height: 568px; padding: 22px; flex-direction: column; border-top: 1px solid rgba(0,183,255,.6); }
.panel-label, .puzzle-topline, .keyboard-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; color: #7d929f; font: 700 .65rem 'Chakra Petch', sans-serif; letter-spacing: 2px; }
.panel-label span:last-child { color: #00b7ff; }
.gallows { position: relative; width: min(100%, 280px); height: 330px; margin: 20px auto 14px; }
.gallows-beam, .gallows-post, .gallows-base { position: absolute; background: rgba(142, 182, 198, .85); box-shadow: 0 0 8px rgba(0, 183, 255, .18); }
.gallows-base { width: 180px; height: 4px; bottom: 10px; left: 42px; }
.gallows-post { width: 4px; height: 287px; bottom: 10px; left: 72px; }
.gallows-beam { width: 145px; height: 4px; top: 32px; left: 72px; }
.gallows-beam::after { content: ''; position: absolute; top: 0; right: 0; width: 4px; height: 38px; background: inherit; }
.hangman-part { position: absolute; display: none; background: #ff7b00; box-shadow: 0 0 12px rgba(255,123,0,.45); }
.head { width: 58px; height: 58px; border: 4px solid #ff7b00; border-radius: 50%; background: transparent; top: 68px; right: 69px; }
.body { width: 4px; height: 94px; top: 126px; right: 96px; }
.arm-left, .arm-right { width: 4px; height: 68px; top: 136px; right: 96px; transform-origin: top; }
.arm-left { transform: rotate(35deg); }
.arm-right { transform: rotate(-35deg); }
.leg-left, .leg-right { width: 4px; height: 60px; top: 205px; right: 96px; transform-origin: top; }
.leg-left { transform: rotate(31deg); }
.leg-right { transform: rotate(-31deg); }
.hangman-panel[data-mistakes="1"] .head,
.hangman-panel[data-mistakes="2"] .head,
.hangman-panel[data-mistakes="3"] .head,
.hangman-panel[data-mistakes="4"] .head,
.hangman-panel[data-mistakes="5"] .head,
.hangman-panel[data-mistakes="6"] .head,
.hangman-panel[data-mistakes="2"] .body,
.hangman-panel[data-mistakes="3"] .body,
.hangman-panel[data-mistakes="4"] .body,
.hangman-panel[data-mistakes="5"] .body,
.hangman-panel[data-mistakes="6"] .body,
.hangman-panel[data-mistakes="3"] .arm-left,
.hangman-panel[data-mistakes="4"] .arm-left,
.hangman-panel[data-mistakes="5"] .arm-left,
.hangman-panel[data-mistakes="6"] .arm-left,
.hangman-panel[data-mistakes="4"] .arm-right,
.hangman-panel[data-mistakes="5"] .arm-right,
.hangman-panel[data-mistakes="6"] .arm-right,
.hangman-panel[data-mistakes="5"] .leg-left,
.hangman-panel[data-mistakes="6"] .leg-left,
.hangman-panel[data-mistakes="6"] .leg-right { display: block; }
.meter { height: 5px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.09); }
.meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #39ff14, #ff7b00, #ff3b6b); transition: width .35s ease; }
.game-message { min-height: 48px; margin: 18px 0 0; color: #a9bfca; font-size: .8rem; line-height: 1.6; }
.game-message.is-success { color: #39ff14; }
.game-message.is-error { color: #ff7192; }

.puzzle-panel { padding: 24px; border-top: 1px solid rgba(57,255,20,.58); }
.tag { padding: 6px 9px; color: #39ff14; border: 1px solid rgba(57,255,20,.25); border-radius: 7px; font-size: .61rem; }
.round-id { color: #ff7b00; font-size: .64rem; }
.word-display { min-height: 95px; display: flex; justify-content: center; align-items: center; gap: clamp(7px, 2vw, 14px); margin: 28px 0 4px; color: #eaf6fb; font: 700 clamp(1.5rem, 4vw, 2.2rem) 'Chakra Petch', sans-serif; letter-spacing: clamp(2px, 1.5vw, 8px); text-align: center; }
.word-letter { min-width: 22px; padding-bottom: 10px; border-bottom: 2px solid #00b7ff; text-transform: uppercase; }
.word-letter.is-space { min-width: 12px; border: 0; }
.hint-text { min-height: 24px; margin: 0 0 20px; color: #7d929f; font-size: .75rem; text-align: center; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.stat { padding: 15px 8px; text-align: center; }
.stat + .stat { border-left: 1px solid rgba(255,255,255,.1); }
.stat span { display: block; color: #7d929f; font: 700 .57rem 'Chakra Petch', sans-serif; letter-spacing: 1px; }
.stat strong { display: block; margin-top: 4px; color: #00b7ff; font: 700 1.25rem 'Chakra Petch', sans-serif; }
.keyboard-heading { margin: 24px 0 12px; }
.keyboard-heading small { color: #7d929f; font-size: .58rem; font-weight: 400; letter-spacing: .7px; text-transform: none; }
.keyboard { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }

.letter-input {
    display: none;
    width: 100%;
    min-height: 46px;
    margin-bottom: 12px;
    background: rgba(0, 183, 255, .07);
    border: 1px solid rgba(0, 183, 255, .35);
    border-radius: 8px;
    color: #eaf6fb;
    font: 700 1.1rem 'Chakra Petch', sans-serif;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 10px;
    box-sizing: border-box;
}
.letter-input::placeholder { color: #5c6b7a; letter-spacing: 1px; text-transform: none; font-weight: 400; }
.letter-input:focus { outline: none; border-color: #00b7ff; box-shadow: 0 0 12px rgba(0,183,255,.35); }
.letter-input:disabled { opacity: .5; }
.key-button { min-height: 39px; border: 1px solid rgba(0, 183, 255, .23); border-radius: 7px; color: #c9e4ed; background: rgba(0, 183, 255, .06); cursor: pointer; font: 700 .75rem 'Chakra Petch', sans-serif; transition: transform .18s, color .18s, border-color .18s, background .18s; touch-action: manipulation; }
.key-button:hover:not(:disabled), .key-button:focus-visible:not(:disabled) { color: #00131b; background: #00b7ff; border-color: #00b7ff; outline: none; transform: translateY(-2px); box-shadow: 0 0 13px rgba(0,183,255,.32); }
.key-button:active:not(:disabled) { transform: scale(.92); }
.key-button:disabled { cursor: not-allowed; opacity: .46; }
.key-button.is-correct { color: #061209; background: #39ff14; border-color: #39ff14; }
.key-button.is-wrong { color: #ffe9ef; background: rgba(255,59,107,.2); border-color: #ff3b6b; }
.actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; margin-top: 22px; }
.button { min-height: 44px; border-radius: 8px; cursor: pointer; font: 700 .67rem 'Chakra Petch', sans-serif; letter-spacing: 1px; text-transform: uppercase; transition: transform .18s, box-shadow .18s; }
.button:hover, .button:focus-visible { transform: translateY(-2px); outline: none; }
.button-secondary { border: 1px solid rgba(255,123,0,.48); color: #ff7b00; background: rgba(255,123,0,.07); }
.button-secondary:hover, .button-secondary:focus-visible { box-shadow: 0 0 18px rgba(255,123,0,.22); }
.button-secondary span { display: block; margin-top: 2px; color: #7d929f; font-size: .52rem; letter-spacing: .5px; text-transform: none; }
.button-primary { border: 1px solid #39ff14; color: #031006; background: #39ff14; box-shadow: 0 0 20px rgba(57,255,20,.18); }
.button-primary:hover, .button-primary:focus-visible { box-shadow: 0 0 25px rgba(57,255,20,.35); }
.how-to { display: flex; align-items: center; gap: 15px; margin-top: 18px; padding: 18px 22px; border-color: rgba(255,123,0,.2); }
.how-icon { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #ff7b00; border-radius: 50%; color: #ff7b00; font: 700 .8rem 'Chakra Petch', sans-serif; }
.how-to h2 { margin: 0 0 3px; color: #ff7b00; font: 700 .73rem 'Chakra Petch', sans-serif; letter-spacing: 1.5px; text-transform: uppercase; }
.how-to p { margin: 0; color: #7d929f; font-size: .7rem; line-height: 1.6; }
kbd { padding: 2px 5px; border: 1px solid rgba(255,255,255,.18); border-radius: 4px; color: #eaf6fb; font-size: .64rem; }

@media (max-width: 760px) {
    .game-shell { padding-top: 40px; }
    .game-layout { grid-template-columns: 1fr; }
    .hangman-panel { min-height: auto; }
    .gallows { height: 245px; transform: scale(.84); transform-origin: top center; margin-bottom: 4px; }
    .keyboard { display: none; }
    .letter-input { display: block; }
    .word-display { min-height: 70px; margin: 18px 0 4px; }
    .btn-fullscreen { top: 6px; right: 6px; }
}
@media (max-width: 420px) {
    .game-shell { width: min(100% - 22px, 1080px); }
    .puzzle-panel, .hangman-panel { padding: 15px; }
    .keyboard { grid-template-columns: repeat(5, 1fr); gap: 6px; }
    .key-button { min-height: 42px; font-size: .8rem; }
    .actions { grid-template-columns: 1fr; gap: 8px; }
    .button { min-height: 48px; }
    .word-display { font-size: 1.4rem; gap: 5px; }
    .stat strong { font-size: 1.05rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
