:root {
    /* Background Overlay - Thoda dark taaki game chamke */
    --bg-overlay: rgba(0, 0, 0, 0.3);
    
    /* GLASS VARS: Bilkul Transparent (sirf 10% white tint) */
    --glass-bg: rgba(255, 255, 255, 0.15); 
    --glass-border: rgba(255, 255, 255, 0.4);
    
    --panel-border: #4e342e;
    --orange-btn: #ff9800; --orange-shadow: #e65100;
    --blue-btn: #039be5; --blue-shadow: #01579b;
    --green-btn: #43a047; --green-shadow: #1b5e20;
    --text-main: #3e2723;
}

* { box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0; padding: 0;
    font-family: 'Nunito', sans-serif;
    height: 100vh; width: 100vw;
    overflow: hidden;
    display: flex; justify-content: center; align-items: center;
    color: var(--text-main);
}

.background-layer {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: url('image/bg.png') no-repeat center center;
    background-size: cover; z-index: -2;
}
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-overlay); z-index: -1; backdrop-filter: blur(2px); /* Blur kam kiya taaki bg dikhe */
}

/* Controls */
.top-controls { position: absolute; top: 15px; right: 15px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; z-index: 100; }
.store-btn {
    background: linear-gradient(180deg, #ffca28, #ff6f00);
    padding: 8px 16px; border-radius: 50px; border: 2px solid #fff;
    text-decoration: none; color: #fff; font-weight: 900; font-size: 0.9rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); font-family: 'Fredoka One', cursive;
    display: flex; align-items: center; gap: 5px; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.store-btn:hover { transform: scale(1.05) translateY(-2px); filter: brightness(1.1); box-shadow: 0 6px 10px rgba(0,0,0,0.4); }
.store-btn:active { transform: scale(0.95); }

.control-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff;
    background: rgba(93, 64, 55, 0.9); color: white; font-size: 1.2rem; cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); display: flex; justify-content: center; align-items: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.control-btn:hover { transform: scale(1.1) rotate(10deg); }
.control-btn:active { transform: scale(0.9); }

/* --- BIG TRANSPARENT GAME PANEL --- */
.game-panel {
    /* Crystal Clear Glass Effect */
    background: var(--glass-bg);
    backdrop-filter: blur(8px); /* Thoda blur taaki text padha jaye */
    -webkit-backdrop-filter: blur(8px);
    border: 3px solid var(--glass-border);
    
    width: 90vw; max-width: 900px;
    height: 85vh; max-height: 800px;
    border-radius: 35px; 
    
    /* Clean Shadow */
    box-shadow: 0 20px 50px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.2);
    
    display: flex; flex-direction: column; padding: 2rem; position: relative;
    
    /* Elastic Popup Animation */
    animation: popUpElastic 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.center-layout { justify-content: center; align-items: center; }
.scroll-layout { justify-content: flex-start; overflow-y: auto; }
.game-layout { padding: 1rem; }

@keyframes popUpElastic {
    0% { transform: scale(0.7) translateY(50px); opacity: 0; }
    60% { transform: scale(1.05) translateY(-10px); opacity: 1; }
    80% { transform: scale(0.98) translateY(5px); }
    100% { transform: scale(1) translateY(0); }
}

/* Typography - Updated for Visibility on Transparent BG */
.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 4rem; color: #fff; text-align: center; line-height: 1;
    /* Strong Shadow + Outline Effect */
    text-shadow: 4px 4px 0 #3e2723, -2px -2px 0 #3e2723, 0 0 20px rgba(0,0,0,0.5);
    margin: 0;
    animation: float 3s ease-in-out infinite;
}
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-12px); } 100% { transform: translateY(0px); } }

.game-title .highlight { color: #ffca28; }

/* Subtitle ko white glow diya taaki bg pe dikhe */
.subtitle { 
    text-align: center; font-weight: 900; color: #4e342e; 
    font-size: 1.4rem; margin-top: 10px; margin-bottom: 40px; 
    text-shadow: 2px 2px 0 #fff, -1px -1px 0 #fff, 0 0 10px #fff;
}

/* 3D Buttons */
.button-stack { display: flex; flex-direction: column; gap: 20px; width: 100%; align-items: center; }
.btn-3d {
    width: 100%; max-width: 400px; padding: 18px; border: none; border-radius: 20px;
    font-family: 'Fredoka One', cursive; font-size: 1.5rem;
    color: white; cursor: pointer; position: relative; top: 0;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    display: flex; justify-content: center; align-items: center; gap: 15px;
}
.btn-3d:hover { transform: translateY(-5px) scale(1.02); filter: brightness(1.1); box-shadow: 0 15px 25px rgba(0,0,0,0.2) !important; }
.btn-3d:active { top: 4px; box-shadow: 0 0 0 !important; transform: translateY(0) scale(0.98); }

.btn-orange { background: var(--orange-btn); box-shadow: 0 8px 0 var(--orange-shadow); }
.btn-blue { background: var(--blue-btn); box-shadow: 0 8px 0 var(--blue-shadow); }
.btn-green { background: var(--green-btn); box-shadow: 0 8px 0 var(--green-shadow); }

.btn-text { 
    background: rgba(255,255,255,0.5); padding: 5px 15px; border-radius: 20px;
    border: none; color: #4e342e; font-weight: 800; 
    cursor: pointer; font-size: 1.1rem; transition: all 0.2s; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.btn-text:hover { background: #fff; color: var(--orange-btn); transform: scale(1.05); }

/* Inputs - Semi Transparent */
.styled-form { display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 500px; margin: 0 auto; }
.input-group label { 
    font-size: 1.1rem; font-weight: 900; color: #4e342e; margin-bottom: 8px; display: block; 
    text-shadow: 1px 1px 0 rgba(255,255,255,0.8);
}
input, select {
    width: 100%; padding: 15px; border: 3px solid rgba(255,255,255,0.6); border-radius: 15px;
    font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 1.1rem; 
    background: rgba(255, 255, 255, 0.7); /* See-through inputs */
    outline: none; transition: all 0.2s;
    color: #3e2723;
}
input:focus, select:focus { border-color: var(--orange-btn); background: #fff; box-shadow: 0 0 15px rgba(255, 152, 0, 0.4); }

/* Game Screen */
.game-header { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 15px; height: 10%; }
.badge { 
    background: rgba(255,255,255,0.8); padding: 8px 20px; border-radius: 25px; 
    font-weight: 800; border: 2px solid #fff; font-size: 1.1rem; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
}
.player-tag { 
    font-weight: 900; font-size: 1.3rem; color: #3e2723; 
    text-shadow: 2px 2px 0 rgba(255,255,255,0.8); 
}
.game-split-area { display: flex; width: 100%; height: 85%; gap: 20px; }

/* Visual Area Transparent */
.visual-area { 
    flex: 1; display: flex; justify-content: center; align-items: center; 
    background: rgba(255,255,255,0.25); /* More transparent */
    backdrop-filter: blur(5px); 
    border-radius: 25px; 
    border: 3px dashed rgba(255,255,255,0.6); 
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

.interaction-area { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.word-display { 
    font-family: 'Fredoka One', cursive; font-size: 2.5rem; letter-spacing: 8px; 
    text-align: center; margin-bottom: 20px; color: #fff; /* White Text */
    text-shadow: 3px 3px 0 #3e2723, 0 0 10px rgba(0,0,0,0.5); /* Strong shadow */
}

/* Keyboard */
.keyboard-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; width: 100%; }
.key-btn {
    background: rgba(255,255,255,0.8); border: 2px solid #fff; border-radius: 12px; padding: 15px 0;
    font-weight: 800; font-size: 1.1rem; cursor: pointer; color: #3e2723;
    box-shadow: 0 4px 0 rgba(0,0,0,0.1); transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.key-btn:hover:not(:disabled) { transform: translateY(-3px); background: #fff; border-color: var(--orange-btn); box-shadow: 0 6px 0 var(--orange-shadow); }
.key-btn:active { transform: translateY(4px); box-shadow: none; }
.key-btn.correct { background: var(--green-btn); color: white; border-color: var(--green-shadow); box-shadow: 0 5px 0 var(--green-shadow); }
.key-btn.wrong { background: rgba(0,0,0,0.3); color: #fff; border-color: rgba(0,0,0,0.4); opacity: 0.8; box-shadow: none; transform: translateY(4px); }

/* Actions */
.bottom-actions { display: flex; gap: 15px; margin-top: 20px; }
.btn-action { flex: 1; padding: 15px; border-radius: 15px; border: none; font-weight: 800; font-size: 1rem; color: white; cursor: pointer; transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); box-shadow: 0 5px 10px rgba(0,0,0,0.2); }
.btn-action:hover { transform: translateY(-3px) scale(1.02); filter: brightness(1.05); }
.btn-action:active { transform: translateY(0) scale(0.98); }
.btn-yellow { background: #fbc02d; color: #3e2723; border-bottom: 5px solid #f57f17; }
.btn-red { background: #ef5350; border-bottom: 5px solid #c62828; }

/* --- POPUP / MODALS (Stylized) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 200;
    display: flex; justify-content: center; align-items: center; 
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.modal-box {
    background: rgba(255, 255, 255, 0.95); /* Opaque popups for readability */
    border: 4px solid #4e342e;
    border-radius: 30px; padding: 2.5rem; width: 85%; max-width: 400px; text-align: center;
    box-shadow: 0 25px 50px rgba(0,0,0,0.6);
    animation: modalPopElastic 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPopElastic {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Alert Box */
.alert-box { 
    max-width: 320px; padding: 2rem; border-color: var(--orange-shadow); 
    background: #fff;
    animation: modalPopElastic 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), subtleShake 0.4s ease-in-out 0.3s;
}
@keyframes subtleShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

.alert-icon { font-size: 3.5rem; margin-bottom: 15px; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.2)); }
.small-btn { padding: 12px 25px; font-size: 1rem; margin-top: 20px; width: auto; }

.tutorial-list { text-align: left; list-style: none; padding: 0; margin: 25px 0; }
.tutorial-list li { margin-bottom: 15px; font-size: 1.15rem; font-weight: 700; color: #4e342e; }
.hidden { display: none !important; }

.btn-small-round { width: 45px; height: 45px; border-radius: 50%; border: 3px solid #fff; background: rgba(255,255,255,0.5); font-weight: bold; cursor: pointer; font-size: 1.3rem; transition: all 0.2s; display: flex; justify-content: center; align-items: center; }
.btn-small-round:hover { transform: rotate(-90deg) scale(1.15); color: var(--orange-btn); background: #fff; }

/* Mobile */
@media (max-width: 768px) {
    .game-panel { width: 95vw; height: 92vh; padding: 1.5rem; border-width: 2px; }
    .game-title { font-size: 2.8rem; }
    .game-split-area { flex-direction: column; gap: 10px; }
    .visual-area { flex: 0 0 auto; height: 220px; }
    .interaction-area { flex: 1; justify-content: flex-start; }
    #hangman-canvas { height: 200px; }
    .word-display { font-size: 2rem; letter-spacing: 5px; margin: 15px 0; }
    .keyboard-grid { gap: 5px; }
    .key-btn { padding: 12px 0; font-size: 1rem; border-radius: 8px; }
    .big-btn { font-size: 1.2rem; padding: 15px; }
    .subtitle { margin-bottom: 25px; color: #fff; text-shadow: 2px 2px 0 #3e2723; }
}

/* Horror theme redesign */
:root {
    --bg-overlay: rgba(2, 0, 6, 0.68);
    --glass-bg: rgba(13, 11, 18, 0.78);
    --glass-border: rgba(179, 21, 43, 0.42);
    --panel-border: #2b1017;
    --orange-btn: #9f1d2f;
    --orange-shadow: #450812;
    --blue-btn: #26334f;
    --blue-shadow: #101725;
    --green-btn: #2d5a45;
    --green-shadow: #10261c;
    --text-main: #f5ead5;
    --blood: #b3152b;
    --blood-dark: #540811;
    --bone: #efe0bd;
    --ash: #a89f93;
    --night: #08070d;
}

body {
    font-family: Georgia, "Times New Roman", serif;
    color: var(--text-main);
    background: #050409;
}

.background-layer {
    background:
        radial-gradient(circle at 50% 34%, rgba(126, 16, 32, 0.22), transparent 18rem),
        radial-gradient(circle at 20% 88%, rgba(255, 255, 255, 0.06), transparent 14rem),
        linear-gradient(rgba(8, 3, 6, 0.34), rgba(8, 3, 6, 0.62)),
        url('image/bg.png') no-repeat center center,
        linear-gradient(180deg, #12101b 0%, #07060b 48%, #030205 100%);
    background-size: auto, auto, auto, cover, auto;
}

.background-layer::before,
.background-layer::after {
    content: "";
    position: fixed;
    pointer-events: none;
}

.background-layer::before {
    inset: 0;
    opacity: 0.5;
    background:
        linear-gradient(180deg, rgba(137, 8, 24, .95) 0 14px, transparent 14px 100%),
        linear-gradient(180deg, rgba(137, 8, 24, .88) 0 58px, transparent 58px 100%),
        linear-gradient(180deg, rgba(94, 4, 16, .88) 0 34px, transparent 34px 100%),
        linear-gradient(180deg, rgba(137, 8, 24, .82) 0 82px, transparent 82px 100%),
        linear-gradient(90deg, transparent 0 14%, rgba(255,255,255,.04) 14.4% 14.8%, transparent 15.2% 100%),
        radial-gradient(circle at 15% 20%, rgba(255,255,255,.08), transparent 2rem),
        radial-gradient(circle at 78% 18%, rgba(255,255,255,.07), transparent 1.4rem);
    background-size:
        18px 100%,
        26px 100%,
        16px 100%,
        34px 100%,
        190px 100%,
        auto,
        auto;
    background-position:
        7% 0,
        19% 0,
        34% 0,
        88% 0,
        0 0,
        0 0,
        0 0;
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat, no-repeat;
}

.background-layer::after {
    left: -10%;
    right: -10%;
    bottom: -8%;
    height: 38%;
    background:
        radial-gradient(ellipse at center, rgba(210, 210, 210, .18), transparent 62%),
        linear-gradient(180deg, transparent, rgba(170, 170, 170, .16));
    filter: blur(18px);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .52;
    background:
        radial-gradient(circle at 12% 18%, rgba(155, 8, 26, .86) 0 8px, transparent 9px),
        radial-gradient(circle at 14% 21%, rgba(94, 4, 16, .7) 0 4px, transparent 5px),
        radial-gradient(circle at 82% 28%, rgba(155, 8, 26, .72) 0 10px, transparent 11px),
        radial-gradient(circle at 86% 33%, rgba(94, 4, 16, .62) 0 5px, transparent 6px),
        radial-gradient(circle at 52% 86%, rgba(155, 8, 26, .34) 0 18px, transparent 20px),
        radial-gradient(circle at 58% 89%, rgba(94, 4, 16, .26) 0 10px, transparent 11px);
    filter: blur(.2px);
}

.overlay {
    background:
        radial-gradient(circle at 50% 40%, transparent 0 28%, rgba(0,0,0,.44) 70%),
        var(--bg-overlay);
    backdrop-filter: blur(1px);
}

.game-panel {
    background:
        linear-gradient(180deg, rgba(24, 20, 28, .9), rgba(10, 8, 13, .9));
    border: 2px solid var(--glass-border);
    border-radius: 18px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .04),
        0 24px 70px rgba(0,0,0,.72),
        inset 0 0 34px rgba(179, 21, 43, .08);
    overflow: hidden;
}

.game-panel::before {
    content: "";
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(239, 224, 189, .12);
    border-radius: 14px;
    pointer-events: none;
}

.game-panel::after {
    content: "";
    position: absolute;
    left: 7%;
    right: 7%;
    top: 0;
    height: 120px;
    pointer-events: none;
    opacity: .58;
    background:
        linear-gradient(180deg, rgba(153, 7, 25, .9) 0 36px, transparent 36px),
        linear-gradient(180deg, rgba(112, 4, 16, .78) 0 72px, transparent 72px),
        linear-gradient(180deg, rgba(153, 7, 25, .84) 0 50px, transparent 50px),
        radial-gradient(circle at 18px 38px, rgba(153, 7, 25, .9) 0 10px, transparent 11px),
        radial-gradient(circle at 154px 74px, rgba(112, 4, 16, .78) 0 8px, transparent 9px),
        radial-gradient(circle at 78% 52px, rgba(153, 7, 25, .86) 0 9px, transparent 10px);
    background-size: 24px 120px, 18px 120px, 28px 120px, auto, auto, auto;
    background-position: 4% 0, 31% 0, 72% 0, 0 0, 0 0, 0 0;
    background-repeat: no-repeat;
}

.game-title {
    color: var(--bone);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow:
        0 3px 0 #17070b,
        0 0 20px rgba(179,21,43,.5),
        0 0 42px rgba(0,0,0,.9);
    animation: horrorFloat 4s ease-in-out infinite;
}

.game-title .highlight {
    color: #d9233f;
}

@keyframes horrorFloat {
    0%, 100% { transform: translateY(0) rotate(-0.5deg); }
    50% { transform: translateY(-7px) rotate(0.5deg); }
}

.subtitle,
.player-tag,
.input-group label,
.tutorial-list li {
    color: var(--bone);
    text-shadow: 0 2px 0 #12070a, 0 0 18px rgba(179,21,43,.24);
}

.subtitle {
    font-size: 1.25rem;
    letter-spacing: 1px;
}

.btn-3d,
.btn-action,
.hm-ol-btn {
    border: 1px solid rgba(239, 224, 189, .22);
    border-radius: 10px;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow:
        inset 0 -5px 0 rgba(0,0,0,.28),
        0 9px 22px rgba(0,0,0,.46) !important;
}

.btn-orange,
.btn-red,
.hm-ol-create {
    background: linear-gradient(180deg, #c1273d, var(--blood-dark));
    box-shadow: 0 8px 0 #27050a !important;
}

.btn-blue,
.hm-ol-join {
    background: linear-gradient(180deg, #35476e, #121a2a);
    box-shadow: 0 8px 0 #090d15 !important;
}

.btn-green {
    background: linear-gradient(180deg, #396b52, #132a20);
    box-shadow: 0 8px 0 #07120c !important;
}

.btn-yellow {
    background: linear-gradient(180deg, #d7b35e, #77511d);
    color: #170b08;
    border-bottom-color: #3b240d;
}

.btn-text {
    color: var(--bone);
    background: rgba(179, 21, 43, .16);
    border: 1px solid rgba(179, 21, 43, .38);
    border-radius: 8px;
    box-shadow: none;
}

.btn-text:hover {
    color: #fff;
    background: rgba(179, 21, 43, .34);
}

.top-controls {
    top: 18px;
    right: 18px;
}

.control-btn,
.btn-small-round {
    background: rgba(14, 10, 16, .88);
    border-color: rgba(239, 224, 189, .24);
    color: var(--bone);
    box-shadow: 0 0 20px rgba(179,21,43,.18);
}

input,
select,
.hm-ol-input,
.big-input {
    color: var(--bone);
    background: rgba(5, 4, 8, .74);
    border: 1px solid rgba(239, 224, 189, .2);
    border-radius: 8px;
    box-shadow: inset 0 0 16px rgba(0,0,0,.45);
}

input:focus,
select:focus,
.hm-ol-input:focus {
    border-color: var(--blood);
    background: rgba(8, 5, 9, .92);
    box-shadow: 0 0 22px rgba(179,21,43,.28), inset 0 0 16px rgba(0,0,0,.45);
}

.select-wrapper {
    position: relative;
}

.game-header .badge,
.badge,
.stats-card,
.hm-ol-card,
.modal-box {
    color: var(--bone);
    background:
        linear-gradient(180deg, rgba(32, 25, 31, .96), rgba(12, 9, 13, .96));
    border: 1px solid rgba(239, 224, 189, .18);
    border-radius: 12px;
    box-shadow:
        0 18px 42px rgba(0,0,0,.65),
        inset 0 0 24px rgba(179,21,43,.08);
}

.visual-area {
    background:
        radial-gradient(circle at 50% 70%, rgba(179,21,43,.12), transparent 12rem),
        rgba(5, 4, 7, .6);
    border: 1px dashed rgba(239, 224, 189, .18);
    border-radius: 14px;
    box-shadow: inset 0 0 40px rgba(0,0,0,.44);
}

#hangman-canvas {
    filter: drop-shadow(0 12px 18px rgba(0,0,0,.45));
}

.word-display {
    color: var(--bone);
    text-shadow:
        0 3px 0 #16070b,
        0 0 22px rgba(179,21,43,.52);
}

.keyboard-grid {
    gap: 7px;
}

.key-btn {
    color: var(--bone);
    background:
        linear-gradient(180deg, rgba(38, 32, 40, .95), rgba(12, 10, 14, .95));
    border: 1px solid rgba(239, 224, 189, .16);
    border-radius: 8px;
    box-shadow: 0 4px 0 #070508, 0 8px 14px rgba(0,0,0,.32);
}

.key-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #3b1220, #18080d);
    border-color: rgba(179,21,43,.58);
    box-shadow: 0 6px 0 #070508, 0 0 16px rgba(179,21,43,.25);
}

.key-btn.correct {
    background: linear-gradient(180deg, #396b52, #132a20);
    border-color: #5c9a79;
}

.key-btn.wrong {
    background: linear-gradient(180deg, #3d0b13, #140407);
    color: #c7b6a1;
    border-color: rgba(179,21,43,.48);
}

.modal-overlay {
    background: rgba(0,0,0,.72);
}

.modal-box h2,
.hm-ol-title,
.modal-content h2 {
    color: #d9233f;
    text-shadow: 0 0 18px rgba(179,21,43,.36);
}

.alert-box {
    background: linear-gradient(180deg, #20171d, #0b080c);
    border-color: var(--blood);
}

.result-icon {
    filter: drop-shadow(0 0 18px rgba(179,21,43,.5));
}

.highlight {
    color: #d9233f;
}

#hm-watch-banner {
    background: rgba(20, 8, 11, .94);
    border-top-color: rgba(179,21,43,.72);
    color: var(--bone);
}

#hm-lobby-overlay {
    background: rgba(0,0,0,.78);
}

.hm-ol-code-box {
    background: rgba(179,21,43,.11);
    border-color: rgba(179,21,43,.42);
}

.hm-ol-code {
    color: #d9233f;
}

@media (max-width: 768px) {
    .game-panel {
        background: rgba(10, 8, 13, .86);
    }
    .game-title {
        font-size: 2.65rem;
    }
    .subtitle {
        color: var(--bone);
        text-shadow: 0 2px 0 #12070a;
    }
}

/* Keep the original doll visible and make forms feel designed */
.background-layer {
    background:
        radial-gradient(circle at 68% 42%, rgba(255, 255, 255, 0.14), transparent 13rem),
        radial-gradient(circle at 50% 34%, rgba(126, 16, 32, 0.16), transparent 18rem),
        linear-gradient(rgba(8, 3, 6, 0.16), rgba(8, 3, 6, 0.42)),
        url('image/bg.png') no-repeat center center,
        linear-gradient(180deg, #12101b 0%, #07060b 48%, #030205 100%);
    background-size: auto, auto, auto, cover, auto;
}

.overlay {
    background:
        radial-gradient(circle at 69% 48%, transparent 0 19%, rgba(0,0,0,.08) 35%, rgba(0,0,0,.38) 78%),
        rgba(2, 0, 6, .48);
    backdrop-filter: none;
}

.background-layer::before {
    opacity: .38;
}

body::after {
    opacity: .34;
}

.game-panel {
    background:
        linear-gradient(180deg, rgba(24, 20, 28, .72), rgba(10, 8, 13, .68));
}

#screen-home,
#screen-setup,
#screen-word-input,
#screen-report {
    width: min(88vw, 620px);
    margin-left: clamp(18px, 6vw, 110px);
    margin-right: auto;
}

.scroll-layout {
    gap: 18px;
}

.panel-header {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 10px;
}

.panel-header h2 {
    margin: 0;
    color: var(--bone);
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 0 18px rgba(179,21,43,.4);
}

.styled-form {
    gap: 14px;
}

.input-group {
    position: relative;
    padding: 14px;
    border: 1px solid rgba(239, 224, 189, .16);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(46, 35, 42, .72), rgba(12, 9, 13, .62));
    box-shadow:
        inset 0 0 24px rgba(0,0,0,.28),
        0 10px 24px rgba(0,0,0,.24);
}

.input-group::before {
    content: "";
    position: absolute;
    left: 13px;
    top: 13px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--blood);
    box-shadow: 0 0 14px rgba(179,21,43,.75);
}

.input-group label {
    margin-left: 16px;
    margin-bottom: 10px;
    font-size: .9rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #d8c8a7;
}

.input-group input,
.input-group select,
.big-input {
    border-radius: 10px;
    background:
        linear-gradient(180deg, rgba(5,4,8,.82), rgba(18,12,16,.82));
    border-color: rgba(216, 200, 167, .2);
}

.stats-card {
    display: grid;
    gap: 12px;
    width: min(100%, 430px);
    padding: 18px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(216, 200, 167, .18);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(46, 35, 42, .76), rgba(12, 9, 13, .68));
    box-shadow:
        inset 0 0 18px rgba(0,0,0,.24),
        0 10px 22px rgba(0,0,0,.24);
}

.stat-row span {
    color: #d8c8a7;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.stat-row b {
    color: #fff2d2;
    text-shadow: 0 0 14px rgba(179,21,43,.36);
}

.tutorial-list {
    display: grid;
    gap: 12px;
}

.tutorial-list li {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(216, 200, 167, .16);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(46, 35, 42, .75), rgba(12, 9, 13, .65));
}

@media (max-width: 768px) {
    #screen-home,
    #screen-setup,
    #screen-word-input,
    #screen-report {
        width: 95vw;
        margin-left: auto;
        margin-right: auto;
    }

    .game-panel {
        background: rgba(10, 8, 13, .78);
    }

    .overlay {
        background: rgba(2, 0, 6, .48);
    }
}

/* Full haunted pass: make every screen feel like a bloody game board, not a form/table */
:root {
    --fresh-blood: #e01f37;
    --old-blood: #5b0610;
    --dried-blood: #220307;
    --rust-red: #8d101e;
    --grave-blue: #162136;
    --metal-edge: rgba(236, 221, 190, .34);
    --panel-black: rgba(10, 8, 11, .88);
}

.background-layer {
    background:
        radial-gradient(circle at 16% 14%, rgba(235,235,235,.42) 0 42px, transparent 78px),
        linear-gradient(115deg, rgba(0,0,0,.82) 0 34%, rgba(30,5,9,.56) 64%, rgba(0,0,0,.2) 100%),
        linear-gradient(rgba(5,4,7,.54), rgba(5,4,7,.7)),
        url('image/bg.png') no-repeat center center,
        #050307;
    background-size: auto, auto, auto, cover, auto;
    filter: saturate(.62) contrast(1.12) brightness(.72);
}

.background-layer::before {
    opacity: .78;
    background:
        linear-gradient(180deg, rgba(122,4,17,.98) 0 88px, transparent 88px),
        linear-gradient(180deg, rgba(169,9,27,.9) 0 48px, transparent 48px),
        linear-gradient(180deg, rgba(91,6,16,.95) 0 122px, transparent 122px),
        linear-gradient(180deg, rgba(169,9,27,.75) 0 66px, transparent 66px),
        linear-gradient(180deg, rgba(91,6,16,.9) 0 150px, transparent 150px),
        radial-gradient(circle at 9% 18%, rgba(169,9,27,.95) 0 10px, transparent 11px),
        radial-gradient(circle at 22% 7%, rgba(122,4,17,.95) 0 9px, transparent 10px),
        radial-gradient(circle at 73% 9%, rgba(169,9,27,.9) 0 10px, transparent 11px),
        radial-gradient(circle at 89% 16%, rgba(122,4,17,.9) 0 8px, transparent 9px);
    background-size: 26px 100%, 18px 100%, 24px 100%, 16px 100%, 30px 100%, auto, auto, auto, auto;
    background-position: 7% 0, 18% 0, 38% 0, 69% 0, 84% 0, 0 0, 0 0, 0 0, 0 0;
    background-repeat: no-repeat;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        repeating-linear-gradient(100deg, rgba(255,255,255,.03) 0 1px, transparent 1px 9px),
        radial-gradient(circle at 78% 60%, transparent 0 15rem, rgba(0,0,0,.42) 32rem),
        radial-gradient(circle at 50% 50%, transparent 0 38%, rgba(0,0,0,.55) 100%);
    mix-blend-mode: screen;
    opacity: .45;
}

body::after {
    opacity: .62;
    background:
        radial-gradient(circle at 10% 18%, rgba(170,8,27,.95) 0 9px, transparent 10px),
        radial-gradient(circle at 14% 22%, rgba(91,6,16,.8) 0 4px, transparent 5px),
        radial-gradient(circle at 76% 13%, rgba(170,8,27,.9) 0 10px, transparent 11px),
        radial-gradient(circle at 91% 26%, rgba(170,8,27,.78) 0 11px, transparent 12px),
        radial-gradient(circle at 49% 91%, rgba(91,6,16,.48) 0 24px, transparent 26px),
        radial-gradient(circle at 61% 88%, rgba(170,8,27,.34) 0 18px, transparent 20px);
}

.overlay {
    background:
        radial-gradient(circle at 75% 58%, transparent 0 15%, rgba(0,0,0,.12) 31%, rgba(0,0,0,.6) 84%),
        linear-gradient(90deg, rgba(0,0,0,.52), rgba(0,0,0,.22) 44%, rgba(0,0,0,.04) 70%, rgba(0,0,0,.3));
}

.app-container {
    width: min(100vw, 1320px);
    min-height: 100vh;
    display: grid;
    align-items: center;
}

.game-panel {
    border-radius: 16px;
    border: 1px solid rgba(132, 12, 24, .72);
    background:
        radial-gradient(circle at 50% 20%, rgba(255,255,255,.035), transparent 14rem),
        linear-gradient(180deg, rgba(22,18,25,.9), rgba(8,6,10,.9));
    box-shadow:
        0 0 0 1px rgba(236,221,190,.08),
        0 32px 80px rgba(0,0,0,.82),
        inset 0 0 0 1px rgba(255,255,255,.035),
        inset 0 0 46px rgba(141,16,30,.14);
}

.game-panel::before {
    inset: 13px;
    border-color: rgba(236,221,190,.16);
    box-shadow: inset 0 0 32px rgba(0,0,0,.38);
}

.game-panel::after {
    left: 5%;
    right: 5%;
    height: 145px;
    opacity: .88;
    background:
        linear-gradient(180deg, rgba(142,7,21,.98) 0 38px, transparent 38px),
        linear-gradient(180deg, rgba(91,6,16,.96) 0 74px, transparent 74px),
        linear-gradient(180deg, rgba(142,7,21,.94) 0 104px, transparent 104px),
        linear-gradient(180deg, rgba(91,6,16,.9) 0 58px, transparent 58px),
        radial-gradient(circle at 9% 44px, rgba(142,7,21,.95) 0 10px, transparent 11px),
        radial-gradient(circle at 27% 88px, rgba(91,6,16,.9) 0 8px, transparent 9px),
        radial-gradient(circle at 86% 57px, rgba(142,7,21,.95) 0 10px, transparent 11px);
    background-size: 27px 145px, 18px 145px, 24px 145px, 21px 145px, auto, auto, auto;
    background-position: 8% 0, 24% 0, 47% 0, 83% 0, 0 0, 0 0, 0 0;
    background-repeat: no-repeat;
}

#screen-home,
#screen-setup,
#screen-word-input,
#screen-report {
    width: min(88vw, 720px);
    height: auto;
    min-height: min(82vh, 650px);
    margin-left: clamp(16px, 7vw, 170px);
    padding: clamp(1.6rem, 3vw, 2.6rem);
}

#screen-home {
    justify-content: center;
}

.game-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3.4rem, 8vw, 6rem);
    line-height: .88;
    color: #d8d2c7;
    letter-spacing: 5px;
    text-transform: uppercase;
    text-shadow:
        0 4px 0 #0a0507,
        0 0 12px rgba(224,31,55,.55),
        0 0 38px rgba(0,0,0,.95);
}

.game-title .highlight {
    display: inline-block;
    margin-top: 5px;
    color: var(--rust-red);
    text-shadow:
        0 5px 0 #130305,
        0 0 22px rgba(224,31,55,.7),
        0 0 44px rgba(0,0,0,.92);
}

.title-area {
    margin-bottom: 12px;
}

.subtitle {
    max-width: 620px;
    margin: 14px auto 34px;
    color: #b9afa0;
    font-size: clamp(1.2rem, 2.8vw, 1.8rem);
    letter-spacing: 2px;
    text-shadow: 0 2px 0 #080406, 0 0 22px rgba(255,255,255,.08);
}

.button-stack {
    gap: 24px;
}

.btn-3d,
.btn-action,
.btn-text,
.hm-ol-btn {
    position: relative;
    min-height: 64px;
    border-radius: 10px;
    border: 1px solid var(--metal-edge);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.25rem, 2.5vw, 1.8rem);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    overflow: hidden;
    background-blend-mode: multiply;
}

.btn-3d::before,
.btn-action::before,
.hm-ol-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255,255,255,.22), transparent 26%),
        radial-gradient(circle at 14% 24%, rgba(255,255,255,.16), transparent 1.8rem),
        linear-gradient(90deg, transparent 0 18%, rgba(80,0,10,.34) 18% 22%, transparent 22% 100%);
}

.btn-3d::after,
.btn-action::after,
.hm-ol-btn::after {
    content: "";
    position: absolute;
    inset: -2px 0 auto;
    height: 38px;
    pointer-events: none;
    opacity: .7;
    background:
        linear-gradient(180deg, rgba(90,3,12,.9) 0 22px, transparent 22px),
        radial-gradient(circle at 21% 24px, rgba(90,3,12,.9) 0 7px, transparent 8px),
        radial-gradient(circle at 68% 18px, rgba(90,3,12,.78) 0 5px, transparent 6px);
    background-size: 16px 38px, auto, auto;
    background-position: 7% 0, 0 0, 0 0;
    background-repeat: no-repeat;
}

.btn-orange,
.btn-red,
.hm-ol-create {
    background: linear-gradient(180deg, #8f1424, #3b060d 78%);
    box-shadow:
        inset 0 -7px 0 rgba(0,0,0,.36),
        0 8px 0 #120204,
        0 18px 34px rgba(0,0,0,.55) !important;
}

.btn-blue,
.hm-ol-join {
    background: linear-gradient(180deg, #263b62, #101827 78%);
    box-shadow:
        inset 0 -7px 0 rgba(0,0,0,.36),
        0 8px 0 #070b12,
        0 18px 34px rgba(0,0,0,.55) !important;
}

.btn-green {
    background: linear-gradient(180deg, #375f4b, #102218 78%);
    box-shadow:
        inset 0 -7px 0 rgba(0,0,0,.36),
        0 8px 0 #050d09,
        0 18px 34px rgba(0,0,0,.55) !important;
}

.btn-3d:hover,
.btn-action:hover,
.hm-ol-btn:hover {
    transform: translateY(-4px) scale(1.015);
    filter: brightness(1.12) contrast(1.08);
}

.big-btn,
.full-width,
#btn-submit-word {
    width: min(100%, 520px);
    max-width: 520px;
}

.btn-icon {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(0,0,0,.32);
    border: 1px solid rgba(236,221,190,.18);
    filter: grayscale(1) contrast(1.15);
}

.btn-text {
    min-height: 44px;
    width: fit-content;
    padding: 7px 32px;
    background: rgba(18,10,13,.72);
    color: #d7c9b8;
}

.panel-header {
    grid-template-columns: 54px 1fr 54px;
    margin-bottom: 16px;
}

.panel-header h2,
#report-title,
#screen-word-input h2 {
    font-family: Georgia, "Times New Roman", serif;
    color: #f0e5cb;
    font-size: clamp(1.65rem, 4vw, 2.7rem);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.styled-form {
    width: min(100%, 540px);
    max-width: 540px;
    gap: 18px;
}

.level-select {
    width: min(100%, 660px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.level-card {
    width: 100%;
    min-height: 178px;
    padding: 18px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    align-items: start;
    gap: 12px;
    border-radius: 16px;
    border: 1px solid rgba(236,221,190,.18);
    background:
        linear-gradient(145deg, rgba(54,21,29,.94), rgba(7,5,8,.94) 64%),
        radial-gradient(circle at 78% 18%, rgba(224,31,55,.38), transparent 5rem),
        radial-gradient(circle at 12% 84%, rgba(236,221,190,.1), transparent 4rem);
    color: #f0e5cb;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,.035),
        inset 0 -8px 0 rgba(0,0,0,.32),
        0 16px 34px rgba(0,0,0,.42);
    cursor: pointer;
    text-align: left;
    font-family: Georgia, "Times New Roman", serif;
    overflow: hidden;
    position: relative;
    isolation: isolate;
    transition: transform .18s ease, filter .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.level-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .78;
    background:
        linear-gradient(180deg, rgba(160,7,24,.85) 0 34px, transparent 34px),
        linear-gradient(180deg, rgba(91,6,16,.8) 0 64px, transparent 64px),
        radial-gradient(circle at 83% 28px, rgba(194,12,31,.9) 0 7px, transparent 8px);
    background-size: 16px 100%, 20px 100%, auto;
    background-position: 10% 0, 84% 0, 0 0;
    background-repeat: no-repeat;
}

.level-card::after {
    content: "";
    position: absolute;
    inset: auto -18% -55% 34%;
    height: 120px;
    border-radius: 50%;
    background: rgba(224,31,55,.22);
    filter: blur(24px);
    opacity: 0;
    transition: opacity .18s ease;
}

.level-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: rgba(224,31,55,.82);
    filter: brightness(1.12);
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,.05),
        inset 0 -8px 0 rgba(0,0,0,.32),
        0 0 0 1px rgba(224,31,55,.28),
        0 22px 44px rgba(0,0,0,.52),
        0 0 28px rgba(224,31,55,.22);
}

.level-card:hover::after {
    opacity: 1;
}

.level-card:active {
    transform: translateY(1px);
}

.level-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 24%, rgba(255,255,255,.26), transparent 1.1rem),
        linear-gradient(180deg, #a91528, #3b060d 78%);
    border: 1px solid rgba(236,221,190,.34);
    color: #fff4d8;
    font-size: 1.4rem;
    font-weight: 900;
    letter-spacing: 1px;
    box-shadow:
        inset 0 -5px 0 rgba(0,0,0,.34),
        0 0 18px rgba(224,31,55,.24);
    line-height: 1;
}

.level-icon small {
    margin-top: -8px;
    color: rgba(255,244,216,.72);
    font-size: .55rem;
    letter-spacing: 0;
}

.level-copy {
    display: grid;
    gap: 8px;
    align-self: end;
}

.level-copy strong {
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 3px 0 #090406, 0 0 14px rgba(224,31,55,.32);
}

.level-copy small {
    color: #b9afa0;
    font-size: .95rem;
    font-weight: 900;
    letter-spacing: .5px;
}

.level-meta {
    width: fit-content;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(236,221,190,.2);
    background: rgba(5,3,6,.58);
    color: #efe0bd;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.level-card[data-level="nightmare"] {
    border-color: rgba(224,31,55,.52);
    background:
        linear-gradient(145deg, rgba(84,8,18,.96), rgba(4,3,6,.96) 66%),
        radial-gradient(circle at 78% 18%, rgba(224,31,55,.55), transparent 5rem);
}

.input-group {
    padding: 15px 16px 17px;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(33,25,30,.78), rgba(8,6,9,.78)),
        radial-gradient(circle at 12% 0, rgba(224,31,55,.22), transparent 5rem);
    border: 1px solid rgba(236,221,190,.17);
}

.input-group::before {
    width: 32px;
    height: 4px;
    left: 16px;
    top: 0;
    border-radius: 0 0 10px 10px;
    background: linear-gradient(90deg, var(--fresh-blood), var(--old-blood));
}

.input-group label {
    margin-left: 0;
    color: #f0e5cb;
    font-size: 1rem;
}

input,
select,
.big-input,
.hm-ol-input {
    min-height: 56px;
    padding: 14px 16px;
    border-radius: 9px;
    background:
        linear-gradient(180deg, rgba(2,2,5,.9), rgba(9,6,9,.94));
    color: #f0e5cb;
    border: 1px solid rgba(236,221,190,.24);
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 900;
}

select {
    cursor: pointer;
}

input::placeholder,
.hm-ol-input::placeholder {
    color: rgba(240,229,203,.42);
}

.game-header {
    height: auto;
    gap: 12px;
    margin-bottom: 18px;
}

.badge,
.player-tag {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border-radius: 9px;
    color: #f0e5cb;
    background:
        linear-gradient(180deg, rgba(31,25,30,.94), rgba(8,6,9,.94));
    border: 1px solid rgba(236,221,190,.18);
    text-shadow: 0 2px 0 #050205;
}

.game-split-area {
    gap: 18px;
}

.visual-area,
.interaction-area {
    position: relative;
}

.visual-area {
    border-style: solid;
    border-color: rgba(236,221,190,.16);
    background:
        radial-gradient(circle at 50% 42%, rgba(224,31,55,.18), transparent 11rem),
        linear-gradient(180deg, rgba(7,5,8,.68), rgba(0,0,0,.58));
}

.keyboard-grid {
    gap: 9px;
}

.key-btn {
    min-height: 48px;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 900;
    background:
        linear-gradient(180deg, rgba(44,37,43,.96), rgba(10,8,11,.96));
    color: #eadbc1;
}

.key-btn.correct {
    background: linear-gradient(180deg, #39664f, #0f2318);
}

.key-btn.wrong {
    background: linear-gradient(180deg, #70101b, #180307);
}

.stats-card {
    width: min(100%, 520px);
    padding: 0;
    margin: 6px 0 26px;
}

.stat-row {
    border-radius: 10px;
}

.result-icon {
    font-size: clamp(2rem, 6vw, 3.6rem);
    margin-bottom: 8px;
}

.modal-box,
.hm-ol-card {
    border-radius: 14px;
    background:
        radial-gradient(circle at 50% 0, rgba(224,31,55,.14), transparent 9rem),
        linear-gradient(180deg, rgba(25,19,24,.97), rgba(7,5,8,.97));
    border: 1px solid rgba(236,221,190,.18);
}

@media (max-width: 768px) {
    .app-container {
        justify-items: center;
    }

    #screen-home,
    #screen-setup,
    #screen-word-input,
    #screen-report {
        width: 94vw;
        min-height: 88vh;
        margin-left: auto;
        margin-right: auto;
        padding: 1.25rem;
    }

    .game-title {
        font-size: 3.1rem;
        letter-spacing: 2px;
    }

    .subtitle {
        font-size: 1.08rem;
        letter-spacing: 1px;
    }

    .button-stack {
        gap: 16px;
    }

    .btn-3d,
    .btn-action {
        min-height: 56px;
        font-size: 1.15rem;
    }

    .panel-header {
        grid-template-columns: 46px 1fr 46px;
    }

    .game-header {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .player-tag {
        grid-column: 1 / -1;
        justify-content: center;
    }
}

/* Reference-match home layout: centered haunted board with wide red/blue slabs */
.app-container {
    justify-items: center;
    align-items: center;
}

#screen-home,
#screen-setup,
#screen-word-input,
#screen-report {
    margin-left: auto;
    margin-right: auto;
}

#screen-home {
    width: min(86vw, 760px);
    min-height: min(84vh, 680px);
    padding: clamp(2rem, 4vw, 3.6rem);
    justify-content: center;
    background:
        linear-gradient(180deg, rgba(24, 21, 24, .78), rgba(7, 6, 8, .82)),
        radial-gradient(circle at 50% 0, rgba(180, 20, 30, .16), transparent 12rem);
    border: 1px solid rgba(178, 31, 36, .62);
    border-radius: 22px;
    box-shadow:
        0 0 0 1px rgba(236,221,190,.1),
        0 26px 80px rgba(0,0,0,.78),
        inset 0 0 0 1px rgba(255,255,255,.035),
        inset 0 0 52px rgba(0,0,0,.42);
}

#screen-home::before {
    inset: 18px;
    border-radius: 18px;
    border-color: rgba(236,221,190,.18);
}

#screen-home .title-area {
    width: 100%;
    margin: 0 0 24px;
    text-align: center;
}

#screen-home .game-title {
    font-size: clamp(3.75rem, 8.6vw, 6.8rem);
    line-height: .82;
    letter-spacing: 4px;
}

#screen-home .subtitle {
    margin: 18px auto 0;
    font-size: clamp(1.15rem, 2.3vw, 1.65rem);
    color: rgba(222, 211, 196, .82);
}

#screen-home .button-stack {
    width: min(100%, 540px);
    gap: 24px;
}

#screen-home .big-btn {
    width: 100%;
    max-width: none;
    min-height: 76px;
    border-radius: 10px;
    font-size: clamp(1.45rem, 3vw, 2.05rem);
    letter-spacing: 2.5px;
}

#screen-home .btn-orange {
    background:
        linear-gradient(180deg, rgba(255,255,255,.2), transparent 27%),
        linear-gradient(180deg, #8d111e, #33060b 82%);
    box-shadow:
        inset 0 -7px 0 rgba(0,0,0,.36),
        0 8px 0 #120204,
        0 20px 34px rgba(0,0,0,.58) !important;
}

#screen-home .btn-blue {
    background:
        linear-gradient(180deg, rgba(255,255,255,.2), transparent 27%),
        linear-gradient(180deg, #263d67, #0d1422 82%);
    box-shadow:
        inset 0 -7px 0 rgba(0,0,0,.36),
        0 8px 0 #050a12,
        0 20px 34px rgba(0,0,0,.58) !important;
}

#screen-home .btn-icon {
    width: 48px;
    height: 48px;
    margin-right: 8px;
}

#screen-home .btn-text {
    margin-top: 10px;
    min-height: 50px;
    padding: 8px 32px;
    border-radius: 8px;
    color: #d6c8b6;
    background: rgba(15, 8, 10, .72);
    border: 1px solid rgba(178, 31, 36, .48);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    letter-spacing: .5px;
}

@media (max-width: 768px) {
    #screen-home {
        width: 94vw;
        min-height: 86vh;
        padding: 1.35rem;
    }

    #screen-home .game-title {
        font-size: clamp(3rem, 14vw, 4.4rem);
        letter-spacing: 2px;
    }

    #screen-home .subtitle {
        margin-top: 14px;
        font-size: 1.05rem;
    }

    #screen-home .button-stack {
        gap: 16px;
    }

    #screen-home .big-btn {
        min-height: 62px;
        font-size: 1.2rem;
    }

    #screen-home .btn-icon {
        width: 36px;
        height: 36px;
    }
}

/* Final responsive pass */
@media (max-width: 900px) {
    body {
        min-height: 100svh;
        height: auto;
        overflow: auto;
        align-items: flex-start;
    }

    .app-container {
        width: 100%;
        min-height: 100svh;
        padding: 12px;
    }

    .top-controls {
        top: 10px;
        right: 10px;
    }

    #screen-home,
    #screen-setup,
    #screen-word-input,
    #screen-report,
    #screen-game {
        width: min(100%, 720px);
        min-height: calc(100svh - 24px);
        max-height: none;
        height: auto;
        margin: 0 auto;
        padding: clamp(16px, 4vw, 26px);
        border-radius: 16px;
    }

    #screen-game {
        display: flex;
        gap: 12px;
    }

    .game-header {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 8px;
    }

    .badge,
    .player-tag {
        min-width: 0;
        justify-content: center;
        padding: 8px 10px;
        font-size: .95rem;
        white-space: nowrap;
    }

    .player-tag {
        grid-column: 1 / -1;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .game-split-area {
        flex-direction: column;
        height: auto;
        min-height: 0;
        gap: 12px;
    }

    .visual-area {
        flex: none;
        min-height: 180px;
        max-height: 28svh;
        border-radius: 14px;
    }

    #hangman-canvas {
        width: min(100%, 300px);
        height: auto;
        max-height: 26svh;
    }

    .interaction-area {
        flex: none;
        width: 100%;
        justify-content: flex-start;
    }

    .word-display {
        width: 100%;
        margin: 4px 0 12px;
        font-size: clamp(1.45rem, 7vw, 2.2rem);
        letter-spacing: clamp(3px, 1.4vw, 7px);
        overflow-wrap: anywhere;
    }

    .keyboard-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 6px;
    }

    .key-btn {
        min-height: 42px;
        padding: 8px 0;
        border-radius: 8px;
        font-size: clamp(.85rem, 3.5vw, 1rem);
    }

    .bottom-actions {
        gap: 8px;
        margin-top: 12px;
    }

    .btn-action {
        min-height: 48px;
        padding: 10px 8px;
        border-radius: 9px;
        font-size: clamp(.82rem, 3.4vw, 1rem);
        letter-spacing: .5px;
    }

    .level-select {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .level-card {
        min-height: 132px;
        gap: 14px;
        padding: 13px 14px;
    }

    .level-icon {
        width: 48px;
        height: 48px;
        font-size: 1rem;
    }

    .level-copy strong {
        font-size: clamp(1.05rem, 5vw, 1.35rem);
        letter-spacing: 1px;
    }

    .level-copy small {
        font-size: .82rem;
        line-height: 1.25;
    }
}

@media (max-width: 430px) {
    .app-container {
        padding: 8px;
    }

    #screen-home,
    #screen-setup,
    #screen-word-input,
    #screen-report,
    #screen-game {
        width: 100%;
        min-height: calc(100svh - 16px);
        padding: 14px;
        border-radius: 14px;
    }

    .panel-header {
        grid-template-columns: 40px 1fr 40px;
        gap: 8px;
        margin-bottom: 10px;
    }

    .panel-header h2,
    #report-title,
    #screen-word-input h2 {
        font-size: clamp(1.35rem, 8vw, 1.9rem);
        letter-spacing: 1.5px;
    }

    .btn-small-round,
    .control-btn {
        width: 38px;
        height: 38px;
    }

    #screen-home .game-title {
        font-size: clamp(2.55rem, 15vw, 3.8rem);
    }

    #screen-home .big-btn,
    .btn-3d {
        min-height: 56px;
        font-size: 1.05rem;
        letter-spacing: 1px;
        gap: 10px;
    }

    .visual-area {
        min-height: 150px;
        max-height: 24svh;
    }

    #hangman-canvas {
        max-height: 22svh;
    }

    .keyboard-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 5px;
    }

    .key-btn {
        min-height: 38px;
        border-radius: 7px;
    }

    .bottom-actions {
        flex-direction: column;
    }

    .level-card {
        min-height: 118px;
        gap: 11px;
        padding: 12px;
    }

    .level-icon {
        width: 42px;
        height: 42px;
        font-size: .9rem;
    }
}

@media (max-height: 680px) and (min-width: 901px) {
    .game-panel {
        max-height: none;
        height: auto;
        min-height: calc(100vh - 24px);
    }

    #screen-home,
    #screen-setup,
    #screen-word-input,
    #screen-report {
        min-height: calc(100vh - 24px);
    }

    .level-card {
        min-height: 142px;
    }
}

/* Home screen responsive polish */
#screen-home {
    width: min(94vw, 760px);
    max-height: calc(100svh - 24px);
    overflow: hidden;
}

#screen-home .game-title {
    font-size: clamp(2.7rem, min(8.4vw, 13svh), 6.4rem);
}

#screen-home .subtitle {
    font-size: clamp(1rem, min(2.2vw, 4svh), 1.55rem);
    margin-bottom: clamp(18px, 4svh, 34px);
}

#screen-home .button-stack {
    gap: clamp(12px, 2.8svh, 24px);
}

#screen-home .big-btn {
    min-height: clamp(54px, 10svh, 76px);
    font-size: clamp(1.05rem, min(2.8vw, 4.8svh), 1.95rem);
}

@media (max-height: 700px) {
    .app-container {
        padding: 8px;
    }

    #screen-home {
        min-height: calc(100svh - 16px);
        padding: clamp(14px, 3svh, 22px);
    }

    #screen-home .title-area {
        margin-bottom: clamp(10px, 2.5svh, 18px);
    }

    #screen-home .subtitle {
        margin-top: clamp(8px, 1.8svh, 14px);
    }

    #screen-home .btn-text {
        min-height: 42px;
        margin-top: 2px;
        font-size: clamp(.9rem, 3svh, 1.1rem);
    }
}

@media (max-width: 520px) {
    #screen-home {
        width: 100%;
        min-height: calc(100svh - 16px);
        padding: 16px 14px;
    }

    #screen-home .game-title {
        font-size: clamp(2.25rem, 14vw, 3.6rem);
        letter-spacing: 1px;
    }

    #screen-home .subtitle {
        max-width: 22rem;
        line-height: 1.25;
    }

    #screen-home .button-stack {
        width: 100%;
    }

    #screen-home .big-btn {
        width: 100%;
        min-height: 54px;
        padding: 12px 10px;
        font-size: clamp(1rem, 6vw, 1.25rem);
    }

    #screen-home .btn-icon {
        width: 34px;
        height: 34px;
        margin-right: 0;
    }
}

@media (max-width: 360px) {
    #screen-home .game-title {
        font-size: 2rem;
    }

    #screen-home .subtitle {
        font-size: .92rem;
    }

    #screen-home .big-btn {
        min-height: 50px;
        font-size: .95rem;
    }
}

/* ================================================================
   HORROR ART DIRECTION — visual-only override
   ================================================================ */
:root {
    --blood: #8b0009;
    --blood-bright: #d31520;
    --blood-dark: #240003;
    --bone: #d8cbb2;
    --ash: #0b0b0c;
    --iron: #242326;
    --glass-bg: rgba(7, 6, 7, .84);
    --glass-border: rgba(122, 11, 17, .72);
    --text-main: #e2d8c5;
}

body {
    font-family: "Cinzel", serif;
    color: var(--bone);
    background: #030304;
}

.background-layer {
    background-image:
        radial-gradient(circle at 50% 55%, transparent 0 25%, rgba(0,0,0,.62) 72%),
        linear-gradient(rgba(9,0,2,.38), rgba(0,0,0,.82)),
        url("image/bg.png");
    filter: saturate(.46) contrast(1.3) brightness(.54);
    transform: scale(1.03);
}

.overlay {
    background:
        repeating-linear-gradient(90deg, rgba(255,255,255,.012) 0 1px, transparent 1px 5px),
        radial-gradient(circle at 50% 30%, rgba(120,0,8,.1), transparent 36%),
        rgba(0,0,0,.26);
    backdrop-filter: none;
}

.blood-vignette {
    position: fixed; inset: 0; z-index: 80; pointer-events: none;
    box-shadow: inset 0 0 130px 36px rgba(0,0,0,.95), inset 0 0 35px 4px rgba(106,0,7,.75);
    background:
        radial-gradient(circle at 4% 82%, rgba(143,0,10,.7) 0 3px, transparent 4px),
        radial-gradient(circle at 7% 77%, rgba(143,0,10,.5) 0 6px, transparent 7px),
        radial-gradient(circle at 95% 18%, rgba(143,0,10,.58) 0 4px, transparent 5px);
    mix-blend-mode: multiply;
}

.blood-drips { position: fixed; inset: 0 0 auto; height: 90px; z-index: 81; pointer-events: none; filter: drop-shadow(0 3px 2px #000); }
.blood-drips::before { content:""; position:absolute; inset:0 0 auto; height:23px; background: linear-gradient(#380003, #88000b 58%, #4b0005); border-radius: 0 0 48% 28%; }
.blood-drips i { position:absolute; top:12px; width:12px; background:linear-gradient(90deg,#3b0004,#b0000e 45%,#470005); border-radius:0 0 60% 60%; animation: bloodPulse 4.5s ease-in-out infinite; transform-origin:top; }
.blood-drips i::after { content:""; position:absolute; width:15px; height:18px; left:-2px; bottom:-8px; background:#760009; border-radius:50% 50% 58% 42%; }
.blood-drips i:nth-child(1){left:8%;height:45px}.blood-drips i:nth-child(2){left:26%;height:25px;animation-delay:-2s}.blood-drips i:nth-child(3){left:53%;height:58px;animation-delay:-1s}.blood-drips i:nth-child(4){left:76%;height:34px;animation-delay:-3s}.blood-drips i:nth-child(5){left:92%;height:65px;animation-delay:-.5s}
@keyframes bloodPulse { 0%,100%{transform:scaleY(1)} 50%{transform:scaleY(1.12)} }

.glb-stage { position:fixed; bottom:-7vh; width:min(31vw,420px); height:62vh; z-index:0; pointer-events:none; opacity:.58; filter:sepia(.28) saturate(.72) contrast(1.35) drop-shadow(0 18px 24px #000); }
.glb-stage-left{left:-8vw;transform:rotate(-10deg)}
.glb-stage-right{right:-8vw;transform:rotate(12deg) scaleX(-1)}
.glb-stage model-viewer{width:100%;height:100%;--poster-color:transparent;background:transparent}

.app-container { position:relative; z-index:2; }
.game-panel {
    background:
        linear-gradient(145deg, rgba(30,27,26,.88), rgba(4,4,5,.94)),
        repeating-linear-gradient(35deg, transparent 0 14px, rgba(255,255,255,.018) 15px 16px);
    border: 1px solid rgba(157,18,25,.8);
    border-radius: 8px;
    box-shadow: 0 0 0 4px #080708, 0 0 0 5px rgba(196,28,36,.24), 0 28px 90px #000, inset 0 0 80px rgba(0,0,0,.78);
}
.game-panel::before { content:""; position:absolute; inset:10px; pointer-events:none; border:1px solid rgba(209,190,160,.12); clip-path:polygon(0 0,44% 0,46% 2px,100% 0,100% 100%,63% 100%,60% calc(100% - 2px),0 100%); }

.game-title { font-family:"Creepster", cursive; color:#d9d0be; letter-spacing:.08em; text-shadow:0 3px 0 #130002,0 5px 0 #790008,0 0 22px rgba(220,0,12,.55),5px 7px 12px #000; animation:titleHaunt 4s ease-in-out infinite; }
.game-title .highlight { color:#a8000d; text-shadow:0 2px 0 #e06c69,0 6px 0 #2c0004,0 0 24px #b4000d; position:relative; }
@keyframes titleHaunt { 0%,100%{transform:translateY(0) rotate(-.3deg)} 50%{transform:translateY(-5px) rotate(.3deg)} }
.subtitle { color:#9e9182; text-shadow:0 2px 3px #000; font-family:"Cinzel",serif; letter-spacing:.08em; }

.btn-3d, .btn-action, .hm-ol-btn, .level-card, .btn-text, .control-btn, .btn-small-round {
    font-family:"Cinzel",serif; text-transform:uppercase; letter-spacing:.08em;
    border-radius:3px; border:1px solid #5c4f45;
    color:#eee3cf; text-shadow:0 2px 2px #000;
    background:linear-gradient(180deg,#302d2a,#111112 64%,#080808);
    box-shadow:inset 0 1px rgba(255,255,255,.13),inset 0 -5px rgba(0,0,0,.6),0 5px 0 #050505,0 10px 22px rgba(0,0,0,.65);
}
.btn-3d::before, .btn-action::before, .hm-ol-btn::before { content:""; position:absolute; inset:4px; border:1px solid rgba(210,187,153,.13); pointer-events:none; }
.btn-3d:hover, .btn-action:hover, .hm-ol-btn:hover { transform:translateY(-3px); filter:brightness(1.2); border-color:#a91019; box-shadow:inset 0 0 22px rgba(164,0,10,.2),0 7px 0 #130002,0 14px 28px #000 !important; }
.btn-orange, .btn-red, #screen-home .btn-orange { background:linear-gradient(180deg,#9d151e,#500006 58%,#1b0003); border-color:#c64045; }
.btn-blue, #screen-home .btn-blue { background:linear-gradient(180deg,#3b4048,#16191d 58%,#090a0c); border-color:#68717c; }
.btn-green { background:linear-gradient(180deg,#4c5244,#1c2119 62%,#090b08); border-color:#707b64; }
.btn-yellow { background:linear-gradient(180deg,#735d28,#2c220d 62%,#0d0a04); color:#eee3cf; border-color:#9b8042; }
.btn-text { background:rgba(9,8,9,.82); color:#a9a094; padding:10px 22px; }
.control-btn { background:#110d0e; border-color:#720008; }

input, select, .hm-ol-input { background:#0b0a0b; color:#e5dac5; border:1px solid #514742; border-radius:2px; box-shadow:inset 0 2px 12px #000; }
input:focus, select:focus, .hm-ol-input:focus { background:#0e0b0c; border-color:#a30c16; box-shadow:0 0 0 2px rgba(150,0,10,.2),inset 0 2px 12px #000; }
.input-group label, .panel-header h2, #report-title { color:#b9ab96; text-shadow:0 2px 3px #000; }

.level-card { background:linear-gradient(150deg,#211e1d,#0a090a); border-color:#4f4540; }
.level-card:hover, .level-card.selected { border-color:#9f0c15; background:linear-gradient(150deg,#351417,#0d090a); box-shadow:0 0 24px rgba(155,0,11,.28),inset 0 0 30px #080405; }
.level-icon { background:#17080a; border-color:#780811; color:#c8b9a3; }
.level-copy strong,.level-meta { color:#cfc1aa; }

.badge,.player-tag,.stats-card { background:rgba(10,9,10,.88); color:#d8ccb8; border:1px solid #564843; border-radius:3px; text-shadow:0 1px #000; box-shadow:inset 0 0 18px #000,0 5px 15px rgba(0,0,0,.45); }
.visual-area { background:radial-gradient(circle at 55% 42%,rgba(109,0,8,.16),transparent 40%),rgba(5,5,6,.78); border:1px solid #4b3b38; border-radius:4px; box-shadow:inset 0 0 42px #000; }
.word-display { color:#d8cab2; font-family:"Creepster",cursive; text-shadow:0 3px 0 #5e0007,0 0 12px #000; }
.key-btn { background:linear-gradient(#2d2b2a,#0c0c0d); color:#d8cbb6; border:1px solid #554a44; border-radius:2px; box-shadow:inset 0 1px rgba(255,255,255,.1),0 4px 0 #050505; }
.key-btn:hover:not(:disabled) { background:linear-gradient(#641017,#1e0205); border-color:#ad1720; box-shadow:0 5px 0 #190003; }
.key-btn.correct { background:linear-gradient(#46533d,#15200f); border-color:#64795a; }
.key-btn.wrong { background:linear-gradient(#580911,#170104); color:#8c7775; border-color:#730810; }
.modal-overlay { background:rgba(0,0,0,.86); }
.modal-box,.hm-ol-card { background:linear-gradient(145deg,#211d1d,#080708); border:1px solid #810a12; border-radius:5px; color:#d8cbb5; box-shadow:0 25px 80px #000,inset 0 0 45px #000; }

@media(max-width:900px){.glb-stage{opacity:.22;width:44vw}.blood-drips{height:55px}.blood-drips i{transform:scaleY(.7)}}
@media(max-width:520px){.glb-stage{display:none}.game-panel{box-shadow:0 0 0 2px #080708,0 18px 50px #000}.blood-vignette{box-shadow:inset 0 0 70px 15px rgba(0,0,0,.92)}}

/* Popup backdrops, ornamental buttons and close controls */
.modal-overlay,
#hm-lobby-overlay {
    background:
        radial-gradient(circle at 18% 24%, rgba(139,0,10,.2) 0 2px, transparent 3px),
        radial-gradient(circle at 82% 72%, rgba(139,0,10,.18) 0 4px, transparent 5px),
        repeating-radial-gradient(ellipse at 50% 50%, transparent 0 58px, rgba(91,0,7,.04) 60px 62px),
        linear-gradient(135deg, rgba(9,2,3,.94), rgba(0,0,0,.97));
    backdrop-filter: blur(9px) grayscale(.25);
}

.modal-overlay::before,
#hm-lobby-overlay::before {
    content:""; position:absolute; inset:0; pointer-events:none;
    background:
        linear-gradient(115deg, transparent 0 48%, rgba(170,0,12,.06) 49%, transparent 50%),
        radial-gradient(ellipse at top, rgba(135,0,10,.22), transparent 42%);
    box-shadow:inset 0 0 120px 28px #000;
}

.modal-box,
.hm-ol-card {
    position:relative; overflow:visible;
    background:
        linear-gradient(160deg, rgba(45,34,33,.94), rgba(8,6,7,.98) 58%),
        repeating-linear-gradient(90deg, transparent 0 18px, rgba(255,255,255,.02) 19px 20px);
    border:1px solid #860b14;
    box-shadow:0 0 0 5px #080708,0 0 0 6px rgba(151,16,23,.36),0 28px 90px #000,inset 0 0 55px #000;
}

.modal-box::before,
.hm-ol-card::before {
    content:""; position:absolute; inset:9px; pointer-events:none;
    border:1px solid rgba(206,183,148,.13);
    clip-path:polygon(0 0,38% 0,42% 3px,100% 0,100% 82%,97% 86%,100% 100%,0 100%,0 18%,3% 14%);
}

.modal-box::after,
.hm-ol-card::after {
    content:""; position:absolute; left:7%; right:7%; top:-2px; height:9px; pointer-events:none;
    background:linear-gradient(90deg,transparent,#4c0005 9%,#b1000e 48%,#4d0006 89%,transparent);
    border-radius:0 0 60% 45%; filter:drop-shadow(0 4px 2px #000);
}

.popup-cross {
    position:absolute; z-index:10; top:-17px; right:-17px;
    width:42px; height:42px; display:grid; place-items:center;
    padding:0; border-radius:50%; cursor:pointer;
    color:#f0dfc5; font:700 2rem/1 "Cinzel",serif;
    background:radial-gradient(circle at 38% 30%,#b91d27,#620007 54%,#160003 72%);
    border:2px solid #d07970;
    box-shadow:inset 0 0 0 3px #3b0005,inset 0 2px 4px rgba(255,255,255,.25),0 5px 0 #160002,0 9px 20px #000;
    text-shadow:0 2px 2px #000; transition:.18s ease;
}
.popup-cross:hover { transform:rotate(8deg) scale(1.1); filter:brightness(1.25); box-shadow:inset 0 0 0 3px #3b0005,0 0 20px rgba(202,0,16,.55),0 7px 18px #000; }
.popup-cross:active { transform:translateY(3px) scale(.96); box-shadow:inset 0 0 0 3px #3b0005,0 2px 7px #000; }

.btn-3d,
.btn-action,
.hm-ol-btn {
    isolation:isolate; overflow:hidden;
    clip-path:polygon(13px 0,calc(100% - 13px) 0,100% 13px,100% calc(100% - 13px),calc(100% - 13px) 100%,13px 100%,0 calc(100% - 13px),0 13px);
}
.btn-3d::after,
.btn-action::after,
.hm-ol-btn::after {
    content:""; position:absolute; z-index:-1; left:-25%; top:-80%; width:28%; height:260%;
    background:linear-gradient(90deg,transparent,rgba(255,235,210,.16),transparent);
    transform:rotate(20deg); transition:left .45s ease; pointer-events:none;
}
.btn-3d:hover::after,
.btn-action:hover::after,
.hm-ol-btn:hover::after { left:115%; }

.hm-ol-title,
.modal-box h2,
.alert-box h3 {
    font-family:"Creepster",cursive; color:#b91620; letter-spacing:.08em;
    text-shadow:0 2px #270003,0 0 14px rgba(210,0,15,.45);
}
.tutorial-list { position:relative; text-align:left; color:#bfb29f; }
.tutorial-list li { margin:12px 0; padding:10px 12px; background:rgba(0,0,0,.28); border-left:2px solid #730810; }
.hm-ol-code-box { background:rgba(20,0,3,.62); border:1px solid #740810; box-shadow:inset 0 0 25px #000; }

@media(max-width:520px){.popup-cross{top:-12px;right:-8px;width:36px;height:36px;font-size:1.6rem}.modal-box,.hm-ol-card{width:min(90vw,400px);padding:2rem 1.25rem}}
\n
/* ── TASK 3: BLEEDING SOUL HEALTH BAR ── */
#soul-bar-container {
  width: 200px;
  height: 24px;
  background: #111;
  border: 2px solid #5a1818;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(90, 24, 24, 0.5);
  display: flex;
  align-items: center;
}

#soul-bar-frame {
  width: 100%;
  height: 100%;
  position: relative;
  background: url('data:image/svg+xml;utf8,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="none" stroke="%233a0000" stroke-width="4" stroke-dasharray="5,5"/></svg>');
}

#soul-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b0000, #ff0000);
  width: 100%;
  transition: width 0.1s linear, background 0.3s;
  box-shadow: 0 0 15px #ff0000;
}

#soul-bar-label {
  position: absolute;
  width: 100%;
  text-align: center;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  color: #fff;
  font-family: 'Creepster', cursive;
  font-size: 14px;
  letter-spacing: 2px;
  text-shadow: 1px 1px 2px #000;
  z-index: 2;
  pointer-events: none;
}

/* Shake animation for penalty */
@keyframes soulShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-1deg); }
  50% { transform: translateX(4px) rotate(1deg); }
  75% { transform: translateX(-4px) rotate(-1deg); }
  100% { transform: translateX(0); }
}

#soul-bar-container.shake {
  animation: soulShake 0.3s ease-in-out;
}

/* Critical state styles */
#soul-bar-container.critical #soul-bar-fill {
  background: linear-gradient(90deg, #ff0000, #ff4500);
  box-shadow: 0 0 20px #ff4500, inset 0 0 10px #fff;
  animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

/* Optional body blood flash when critical */
body.soul-critical .blood-vignette {
  background: radial-gradient(circle, transparent 30%, rgba(255, 0, 0, 0.4) 90%);
  animation: heartbeat 0.8s infinite;
}

@keyframes heartbeat {
  0% { opacity: 0.5; transform: scale(1); }
  25% { opacity: 0.8; transform: scale(1.02); }
  50% { opacity: 0.5; transform: scale(1); }
  75% { opacity: 0.7; transform: scale(1.01); }
  100% { opacity: 0.5; transform: scale(1); }
}

/* Compact first screens for short mobile landscape viewports. */
@media (orientation: landscape) and (max-height: 700px) {
    body {
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
        align-items: center;
    }

    .app-container {
        width: 100%;
        min-height: 100dvh;
        height: 100dvh;
        padding: 8px;
        align-items: center;
    }

    #screen-home,
    #screen-setup {
        width: min(96vw, 900px);
        height: calc(100dvh - 16px);
        min-height: 0;
        max-height: none;
        margin: 0 auto;
        padding: 16px 22px;
        overflow: hidden;
    }

    #screen-home {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: clamp(22px, 7vw, 80px);
    }

    #screen-home .title-area {
        width: min(45%, 430px);
        margin: 0;
    }

    #screen-home .game-title {
        font-size: clamp(2.4rem, 9vh, 4.8rem);
        line-height: .82;
    }

    #screen-home .subtitle {
        margin: 10px auto 0;
        font-size: clamp(.85rem, 3vh, 1.2rem);
        line-height: 1.2;
    }

    #screen-home .button-stack {
        width: min(42%, 390px);
        gap: 10px;
    }

    #screen-home .big-btn {
        min-height: clamp(44px, 13vh, 58px);
        padding: 9px 12px;
        font-size: clamp(.9rem, 3.2vh, 1.35rem);
    }

    #screen-home .btn-icon {
        width: 30px;
        height: 30px;
        margin-right: 0;
    }

    #screen-home .btn-text {
        min-height: 34px;
        margin-top: 0;
        padding: 5px 16px;
        font-size: clamp(.75rem, 2.7vh, 1rem);
    }

    #screen-setup {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 8px;
    }

    #screen-setup .panel-header {
        flex: 0 0 auto;
        grid-template-columns: 38px 1fr 38px;
        gap: 8px;
        margin-bottom: 2px;
    }

    #screen-setup .panel-header h2 {
        font-size: clamp(1.15rem, 4vh, 1.8rem);
    }

    #screen-setup .level-select {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        overflow: hidden;
    }

    #screen-setup .level-card {
        min-height: 0;
        height: 100%;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-rows: 1fr;
        align-items: center;
        padding: 9px 10px;
        gap: 6px;
        border-radius: 10px;
    }

    #screen-setup .level-icon {
        width: 34px;
        height: 34px;
        font-size: .8rem;
    }

    #screen-setup .level-copy {
        gap: 3px;
        min-width: 0;
        align-self: center;
    }

    #screen-setup .level-copy strong {
        font-size: clamp(.95rem, 3.5vh, 1.35rem);
    }

    #screen-setup .level-copy small,
    #screen-setup .level-meta {
        font-size: clamp(.62rem, 2.2vh, .8rem);
    }

    #screen-setup .level-meta {
        min-height: 22px;
        padding: 3px 7px;
        white-space: nowrap;
    }
}
