/* ============================
   CSS VARIABLES & RESET
   ============================ */
:root {
    /* Colors - Dark Medieval Theme */
    --bg-primary: #08070e;
    --bg-secondary: #0e0d18;
    --bg-tertiary: #151422;
    --bg-card: rgba(20, 18, 30, 0.75);
    --bg-glass: rgba(20, 18, 30, 0.5);

    --accent-gold: #d4a844;
    --accent-gold-light: #f0d078;
    --accent-gold-dark: #a07828;
    --accent-crimson: #c0392b;
    --accent-crimson-light: #e74c3c;
    --accent-blood: #8b1a1a;
    --accent-green: #27ae60;
    --accent-green-light: #2ecc71;
    --accent-blue: #3498db;
    --accent-orange: #e67e22;

    --text-primary: #eae6d8;
    --text-secondary: #a09880;
    --text-muted: #5a5248;

    /* Materials */
    --wood-darkest: #1a1008;
    --wood-dark: #2a1a0c;
    --wood-medium: #3d2814;
    --wood-light: #4e351c;
    --wood-highlight: #6b4c2a;
    --wood-grain: #5a3e20;

    --iron-darkest: #1a1a1e;
    --iron-dark: #2a2a30;
    --iron-medium: #3e3e46;
    --iron-light: #585862;
    --iron-highlight: #70707a;
    --iron-rust: #6b3a22;
    --iron-rust-light: #8b5a3a;

    --metal-dark: #3a3a42;
    --metal-medium: #6a6a76;
    --metal-light: #9a9aaa;
    --metal-shine: #d0d0e0;
    --metal-edge: #e8e8f0;

    --skin-tone: #f5cba7;
    --skin-shadow: #e0a87c;
    --hair-color: #4a3520;

    --parchment-bg: #2a2218;
    --parchment-edge: #3d3225;
    --parchment-text: #f0d878;

    /* Spacing */
    --gap-xs: 4px;
    --gap-sm: 8px;
    --gap-md: 16px;
    --gap-lg: 24px;
    --gap-xl: 32px;
    --gap-2xl: 48px;

    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
    --shadow-glow-gold: 0 0 20px rgba(212, 168, 68, 0.3);
    --shadow-glow-green: 0 0 20px rgba(39, 174, 96, 0.4);
    --shadow-glow-red: 0 0 20px rgba(192, 57, 43, 0.4);
    --shadow-glow-fire: 0 0 40px rgba(230, 126, 34, 0.3);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Fonts */
    --font-title: 'Cinzel', serif;
    --font-body: 'Poppins', sans-serif;
    --font-mono: 'Fira Code', monospace;
    --font-medieval: 'MedievalSharp', cursive;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    background: #000;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ============================
   GAME CONTAINER
   ============================ */
#game-container {
    width: 100%;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* Panic Zone Visuals (Danger close to Game Over) */
#game-container.panic-mode {
    box-shadow: inset 0 0 calc(var(--panic-glow) * 100px) rgba(255, 0, 0, var(--panic-alpha, 0.5));
}

/* ============================
   BACKGROUND SCENERY
   ============================ */
#bg-scenery {
    position: absolute;
    inset: 0;
    z-index: 0;
}

#bg-image {
    position: absolute;
    inset: 0;
    background-image: url('dungeon_bg.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    filter: brightness(0.45) saturate(0.7);
}

/* Animated fog / mist overlay */
#bg-fog {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(100, 80, 50, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(100, 80, 50, 0.06) 0%, transparent 50%);
    animation: fogDrift 12s ease-in-out infinite alternate;
}

@keyframes fogDrift {
    0% { opacity: 0.6; transform: translateX(-5px); }
    100% { opacity: 1; transform: translateX(5px); }
}

/* Dark overlay for depth and readability */
#bg-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg,
            rgba(0,0,0,0.5) 0%,
            rgba(0,0,0,0.25) 30%,
            rgba(0,0,0,0.2) 50%,
            rgba(0,0,0,0.35) 70%,
            rgba(0,0,0,0.7) 100%
        ),
        radial-gradient(ellipse at center 40%, transparent 30%, rgba(0,0,0,0.5) 100%);
}

/* Vignette on game container */
#game-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.7) 100%);
    pointer-events: none;
    z-index: 100;
}

/* ============================
   TORCHES
   ============================ */
.torch {
    position: absolute;
    z-index: 5;
    top: 18%;
    width: 30px;
    height: 100px;
}

.torch-left { left: 8px; }
.torch-right { right: 8px; }

.torch-bracket {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 8px;
    background: linear-gradient(180deg, var(--iron-highlight), var(--iron-dark));
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.torch-bracket::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 12px;
    background: linear-gradient(90deg, var(--iron-dark), var(--iron-medium), var(--iron-dark));
    border-radius: 1px;
}

.torch-stick {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 50px;
    background: linear-gradient(90deg, var(--wood-dark) 0%, var(--wood-medium) 40%, var(--wood-light) 60%, var(--wood-medium) 100%);
    border-radius: 2px;
}

.torch-wrap {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 14px;
    background: repeating-linear-gradient(
        -30deg,
        #5a4020,
        #5a4020 2px,
        #4a3018 2px,
        #4a3018 4px
    );
    border-radius: 3px;
}

/* Flames */
.flame-container {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 30px;
}

.flame {
    position: absolute;
    bottom: 0;
    left: 50%;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.flame-core {
    width: 6px;
    height: 14px;
    transform: translateX(-50%);
    background: #fff8e0;
    box-shadow: 0 0 6px #fff, 0 0 12px #ffe066;
    animation: flameCore 0.15s ease-in-out infinite alternate;
}

.flame-mid {
    width: 12px;
    height: 20px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse, #ffcc00 0%, #ff8800 60%, transparent 100%);
    opacity: 0.9;
    animation: flameMid 0.2s ease-in-out infinite alternate;
}

.flame-outer {
    width: 18px;
    height: 26px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse, #ff660080 0%, #ff330040 50%, transparent 100%);
    opacity: 0.7;
    animation: flameOuter 0.3s ease-in-out infinite alternate;
}

@keyframes flameCore {
    0% { height: 12px; opacity: 1; }
    100% { height: 16px; opacity: 0.9; transform: translateX(-50%) skewX(2deg); }
}

@keyframes flameMid {
    0% { height: 18px; transform: translateX(-50%) skewX(-1deg); }
    100% { height: 22px; transform: translateX(-50%) skewX(2deg); }
}

@keyframes flameOuter {
    0% { height: 24px; transform: translateX(-50%) skewX(1deg); opacity: 0.6; }
    100% { height: 28px; transform: translateX(-50%) skewX(-2deg); opacity: 0.8; }
}

/* Embers */
.ember {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #ffaa00;
    border-radius: var(--radius-full);
    box-shadow: 0 0 4px #ff6600;
}

.ember-1 { animation: emberFloat1 2s ease-out infinite; bottom: 20px; left: 8px; }
.ember-2 { animation: emberFloat2 2.5s ease-out infinite 0.5s; bottom: 18px; left: 14px; }
.ember-3 { animation: emberFloat3 1.8s ease-out infinite 1s; bottom: 22px; left: 6px; }

@keyframes emberFloat1 {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(-8px, -40px) scale(0); opacity: 0; }
}
@keyframes emberFloat2 {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(6px, -50px) scale(0); opacity: 0; }
}
@keyframes emberFloat3 {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(-4px, -35px) scale(0); opacity: 0; }
}

/* Torch glow - light cast on wall */
.torch-glow {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 160px;
    background: radial-gradient(ellipse at center 30%, rgba(255, 150, 40, 0.12) 0%, transparent 70%);
    pointer-events: none;
    animation: torchGlow 3s ease-in-out infinite alternate;
}

@keyframes torchGlow {
    0% { opacity: 0.7; transform: translateX(-50%) scale(1); }
    100% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

/* ============================
   PARTICLES
   ============================ */
#particles-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: var(--radius-full);
    pointer-events: none;
    will-change: transform, opacity;
}

/* ============================
   SCREENS
   ============================ */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    z-index: 10;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Game screen needs top-to-bottom layout, not centered */
#game-screen {
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ============================
   START SCREEN
   ============================ */
.start-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gap-xl);
    padding: var(--gap-lg);
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.title-wrapper {
    text-align: center;
    position: relative;
}

.title-icon {
    font-size: 3rem;
    margin-bottom: var(--gap-sm);
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.game-title {
    font-family: var(--font-title);
    font-size: clamp(2.2rem, 8vw, 3.5rem);
    font-weight: 900;
    line-height: 1.1;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(0,0,0,0.7), 0 0 40px rgba(212, 168, 68, 0.15);
    letter-spacing: 2px;
}

.title-highlight {
    background: linear-gradient(135deg, var(--accent-gold-light) 0%, var(--accent-gold) 50%, var(--accent-gold-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 4px rgba(212, 168, 68, 0.3));
}

.game-subtitle {
    font-family: var(--font-title);
    font-size: clamp(0.9rem, 3vw, 1.15rem);
    color: var(--text-secondary);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-top: var(--gap-sm);
}

.start-info {
    display: flex;
    gap: var(--gap-md);
    flex-wrap: wrap;
    justify-content: center;
}

.info-card {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    padding: var(--gap-sm) var(--gap-md);
    background: linear-gradient(135deg, rgba(42, 26, 12, 0.7), rgba(30, 20, 10, 0.8));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 168, 68, 0.2);
    border-bottom: 2px solid rgba(212, 168, 68, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition-normal);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.info-card:hover {
    border-color: rgba(212, 168, 68, 0.4);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-gold), inset 0 1px 0 rgba(255,255,255,0.04);
}

.info-icon {
    font-size: 1.3rem;
}

/* Play Button */
.btn-play {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--gap-md);
    padding: 18px 56px;
    font-family: var(--font-title);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--bg-primary);
    background: linear-gradient(135deg, var(--accent-gold-light) 0%, var(--accent-gold) 50%, var(--accent-gold-dark) 100%);
    border: 2px solid rgba(255, 220, 120, 0.3);
    border-radius: var(--radius-xl);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(212, 168, 68, 0.4), inset 0 1px 0 rgba(255,255,255,0.3);
    animation: pulseGlow 2.5s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(212, 168, 68, 0.4), inset 0 1px 0 rgba(255,255,255,0.3); }
    50% { box-shadow: 0 4px 40px rgba(212, 168, 68, 0.7), inset 0 1px 0 rgba(255,255,255,0.3); }
}

.btn-play::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 60%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
}

.btn-play:hover::before {
    left: 120%;
}

.btn-play:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 30px rgba(212, 168, 68, 0.6), inset 0 1px 0 rgba(255,255,255,0.3);
}

.btn-play:active {
    transform: translateY(0) scale(0.98);
}

.btn-play-icon {
    font-size: 1.1rem;
}

.high-score-display {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Audio Button */
.btn-audio {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: var(--bg-glass);
    border: 1px solid rgba(212, 168, 68, 0.3);
    border-radius: var(--radius-full);
    color: var(--accent-gold-light);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 90;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-audio:hover {
    background: rgba(42, 26, 12, 0.7);
    border-color: var(--accent-gold);
    transform: scale(1.05);
}

.btn-audio.muted {
    color: var(--text-muted);
    border-color: rgba(255, 255, 255, 0.1);
}

/* ============================
   HUD
   ============================ */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: var(--gap-md) var(--gap-md) var(--gap-sm);
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
    z-index: 20;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.hud-value {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--accent-gold-light);
    text-shadow: 0 0 10px rgba(212, 168, 68, 0.3);
    transition: var(--transition-fast);
}

.hud-value.bump {
    animation: hudBump 0.3s ease-out;
}

@keyframes hudBump {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); color: #fff; }
    100% { transform: scale(1); }
}

/* ============================
   GUILLOTINE AREA
   ============================ */
#guillotine-area {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding-top: 60px;
}

#guillotine-frame {
    position: relative;
    width: 180px;
    height: 280px;
}

/* ============================
   CEILING CHAIN
   ============================ */
.ceiling-chain {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 60px;
    background:
        repeating-linear-gradient(
            180deg,
            var(--iron-dark) 0px,
            var(--iron-highlight) 2px,
            var(--iron-dark) 4px,
            transparent 4px,
            transparent 6px
        );
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.ceiling-chain::before,
.ceiling-chain::after {
    content: '';
    position: absolute;
    left: -2px;
    width: 8px;
    height: 10px;
    border: 2px solid var(--iron-medium);
    border-radius: 3px;
    background: transparent;
}

.ceiling-chain::before { top: 5px; }
.ceiling-chain::after { top: 18px; }

/* ============================
   POSTS WITH WOOD GRAIN
   ============================ */
.post {
    position: absolute;
    bottom: 0;
    width: 22px;
    height: 240px;
    border-radius: 2px 2px 0 0;
    box-shadow: 3px 3px 10px rgba(0,0,0,0.6), -1px 0 3px rgba(0,0,0,0.3);
    overflow: hidden;
    /* Complex wood grain base */
    background:
        linear-gradient(90deg,
            var(--wood-darkest) 0%,
            var(--wood-dark) 15%,
            var(--wood-medium) 30%,
            var(--wood-light) 45%,
            var(--wood-highlight) 50%,
            var(--wood-light) 55%,
            var(--wood-medium) 70%,
            var(--wood-dark) 85%,
            var(--wood-darkest) 100%
        );
}

/* Wood grain texture overlay */
.wood-grain {
    position: absolute;
    inset: 0;
    background:
        /* Vertical grain lines */
        repeating-linear-gradient(
            180deg,
            transparent 0px,
            transparent 12px,
            rgba(0,0,0,0.12) 12px,
            rgba(0,0,0,0.12) 13px,
            transparent 13px,
            transparent 20px,
            rgba(0,0,0,0.08) 20px,
            rgba(0,0,0,0.08) 21px
        ),
        /* Knot-like darker bands */
        repeating-linear-gradient(
            180deg,
            transparent 0px,
            transparent 55px,
            rgba(0,0,0,0.15) 58px,
            rgba(0,0,0,0.1) 62px,
            transparent 65px
        ),
        /* Subtle horizontal variation */
        linear-gradient(90deg,
            rgba(0,0,0,0.05) 0%,
            transparent 20%,
            rgba(255,255,255,0.02) 50%,
            transparent 80%,
            rgba(0,0,0,0.05) 100%
        );
    border-radius: 2px 2px 0 0;
}

/* Inner rail grooves */
.post-left {
    left: 18px;
}

.post-left::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(90deg, rgba(0,0,0,0.4), rgba(0,0,0,0.6));
    box-shadow: inset 1px 0 2px rgba(0,0,0,0.4);
}

.post-right {
    right: 18px;
}

.post-right::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(90deg, rgba(0,0,0,0.6), rgba(0,0,0,0.4));
    box-shadow: inset -1px 0 2px rgba(0,0,0,0.4);
}

/* ============================
   IRON BRACKETS ON POSTS
   ============================ */
.iron-bracket {
    position: absolute;
    left: -3px;
    right: -3px;
    height: 10px;
    background: linear-gradient(180deg, var(--iron-highlight) 0%, var(--iron-medium) 30%, var(--iron-dark) 70%, var(--iron-darkest) 100%);
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
    z-index: 2;
}

/* Bracket rivets */
.iron-bracket::before,
.iron-bracket::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: var(--radius-full);
    background: radial-gradient(circle, var(--iron-highlight) 30%, var(--iron-dark) 100%);
    box-shadow: inset 0 -1px 1px rgba(0,0,0,0.5), 0 1px 1px rgba(255,255,255,0.05);
}

.iron-bracket::before { left: 2px; }
.iron-bracket::after { right: 2px; }

.bracket-top { top: 15%; }
.bracket-mid { top: 50%; }
.bracket-bottom { top: 82%; }

/* ============================
   TOP BEAM (ENHANCED)
   ============================ */
.top-beam {
    position: absolute;
    top: 28px;
    left: 6px;
    right: 6px;
    height: 26px;
    background:
        linear-gradient(180deg,
            var(--wood-highlight) 0%,
            var(--wood-light) 20%,
            var(--wood-medium) 50%,
            var(--wood-dark) 80%,
            var(--wood-darkest) 100%
        );
    border-radius: 3px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
    z-index: 5;
    overflow: visible;
}

/* Wood grain on beam */
.top-beam::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 8px,
            rgba(0,0,0,0.1) 8px,
            rgba(0,0,0,0.1) 9px,
            transparent 9px,
            transparent 15px,
            rgba(0,0,0,0.06) 15px,
            rgba(0,0,0,0.06) 16px
        );
    border-radius: 3px;
}

/* Iron bands on beam ends */
.beam-iron-band {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 12px;
    background: linear-gradient(180deg, var(--iron-highlight), var(--iron-medium), var(--iron-dark));
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
    z-index: 1;
}

.beam-iron-left { left: -2px; }
.beam-iron-right { right: -2px; }

/* Iron nails on beam */
.beam-nail {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: var(--radius-full);
    background: radial-gradient(circle at 35% 35%, var(--iron-highlight), var(--iron-dark));
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.6), 0 1px 1px rgba(255,255,255,0.05);
    z-index: 2;
}

.beam-nail-1 { left: 2px; }
.beam-nail-2 { left: 9px; }
.beam-nail-3 { right: 9px; }
.beam-nail-4 { right: 2px; }

/* ============================
   PULLEY SYSTEM
   ============================ */
.pulley-system {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
}

.pulley {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pulley-mount {
    width: 14px;
    height: 8px;
    background: linear-gradient(180deg, var(--iron-medium), var(--iron-darkest));
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.pulley-wheel {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    border: 3px solid var(--iron-medium);
    background: radial-gradient(circle, var(--iron-dark) 40%, var(--iron-darkest) 100%);
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,255,255,0.05);
    margin-bottom: -3px;
}

.pulley-axle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: radial-gradient(circle at 35% 35%, var(--iron-highlight), var(--iron-dark));
    box-shadow: inset 0 -1px 1px rgba(0,0,0,0.5);
}

.pulley-spoke {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 1px;
    background: var(--iron-medium);
    transform-origin: center;
}

.spoke-1 { transform: translate(-50%, -50%) rotate(0deg); }
.spoke-2 { transform: translate(-50%, -50%) rotate(90deg); }

/* ============================
   BLADE ASSEMBLY (ENHANCED)
   ============================ */
#blade-assembly {
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    will-change: top;
    transition: none;
}

/* ============================
   ROPE SYSTEM (anchored at top, height grows with blade)
   ============================ */
#rope-system {
    position: absolute;
    top: 42px;  /* Just below the top beam / pulley */
    left: 40px;
    right: 40px;
    height: 0;  /* Set dynamically by JS */
    z-index: 3;
    pointer-events: none;
}

.blade-rope {
    position: absolute;
    top: 0;
    background:
        repeating-linear-gradient(
            180deg,
            #8b7355 0px,
            #6b5340 1px,
            #8b7355 2px,
            #7a6348 3px
        );
    border-radius: 2px;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    height: 100%;
}

.rope-main {
    width: 4px;
    left: 50%;
    transform: translateX(-50%);
}

.rope-left {
    width: 3px;
    left: 15%;
}

.rope-right {
    width: 3px;
    right: 15%;
}

/* Blade housing (the heavy weight block) */
.blade-housing {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.blade-weight {
    width: 96px;
    height: 18px;
    background:
        linear-gradient(180deg,
            var(--iron-highlight) 0%,
            var(--iron-medium) 20%,
            var(--iron-dark) 60%,
            var(--iron-darkest) 100%
        );
    border-radius: 3px 3px 1px 1px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08);
    position: relative;
}

/* Hatching texture on weight */
.blade-weight::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent 0px,
            transparent 3px,
            rgba(0,0,0,0.1) 3px,
            rgba(0,0,0,0.1) 4px
        );
    border-radius: 3px 3px 1px 1px;
}

/* Bolts on housing */
.blade-bolt {
    position: absolute;
    top: 5px;
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: radial-gradient(circle at 35% 35%, var(--iron-highlight), var(--iron-darkest));
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.6), 0 1px 1px rgba(255,255,255,0.05);
    z-index: 2;
}

.blade-bolt-left { left: calc(50% - 44px); }
.blade-bolt-right { right: calc(50% - 44px); }

/* The blade itself */
.blade {
    position: relative;
    width: 100px;
    height: 22px;
    background:
        linear-gradient(180deg,
            var(--metal-shine) 0%,
            var(--metal-light) 15%,
            var(--metal-medium) 40%,
            var(--metal-dark) 70%,
            var(--metal-medium) 90%,
            var(--metal-light) 100%
        );
    margin-top: -1px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
}

/* Rust spots */
.blade-rust {
    position: absolute;
    border-radius: 40%;
    background: radial-gradient(ellipse, var(--iron-rust-light) 0%, var(--iron-rust) 60%, transparent 100%);
    opacity: 0.5;
}

.blade-rust-1 {
    width: 14px;
    height: 8px;
    top: 3px;
    left: 12px;
}

.blade-rust-2 {
    width: 10px;
    height: 6px;
    top: 8px;
    right: 18px;
    opacity: 0.35;
}

/* Metallic shine sweep */
.blade-shine {
    position: absolute;
    top: 0;
    left: -30%;
    width: 20%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    transform: skewX(-20deg);
    animation: bladeGleam 5s ease-in-out infinite;
}

@keyframes bladeGleam {
    0%, 100% { left: -30%; }
    50% { left: 110%; }
}

/* Sharp angled edge */
.blade-edge {
    position: absolute;
    bottom: -12px;
    left: 3%;
    right: 3%;
    height: 16px;
    background:
        linear-gradient(180deg,
            var(--metal-medium) 0%,
            var(--metal-light) 40%,
            var(--metal-shine) 70%,
            #fff 95%,
            rgba(255,255,255,0.8) 100%
        );
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6));
}

/* Cartoony Splash Stain on Blade */
.blade-stained::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 20%;
    right: 20%;
    height: 30px;
    background: radial-gradient(circle at bottom center, #ff2a4b 0%, rgba(255, 42, 75, 0.8) 40%, transparent 70%);
    filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.5));
    border-radius: 50% 50% 0 0;
    z-index: 5;
    animation: stainAppear 0.3s ease-out forwards;
}

@keyframes stainAppear {
    0% { opacity: 0; transform: scaleY(0); }
    100% { opacity: 1; transform: scaleY(1); }
}

/* ============================
   CHARACTER
   ============================ */
#character {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.char-head {
    position: relative;
    width: 50px;
    height: 54px;
    z-index: 2;
}

.char-hair {
    position: absolute;
    top: -2px;
    left: -3px;
    right: -3px;
    height: 28px;
    background: var(--hair-color);
    border-radius: 26px 26px 0 0;
    z-index: 1;
}

.char-face {
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, var(--skin-tone) 0%, var(--skin-shadow) 100%);
    border-radius: 25px 25px 22px 22px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    padding-top: 14px;
    gap: 10px;
    overflow: visible;
}

.char-eye {
    width: 10px;
    height: 12px;
    background: #fff;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-normal);
}

.char-pupil {
    width: 5px;
    height: 6px;
    background: #2c1810;
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
}

.char-mouth {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 5px;
    border-bottom: 2.5px solid #c0392b;
    border-radius: 0 0 8px 8px;
    transition: all var(--transition-normal);
}

/* Sweat drop */
.char-sweat {
    position: absolute;
    top: 12px;
    right: -2px;
    width: 6px;
    height: 8px;
    background: rgba(100, 180, 255, 0.8);
    border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

/* Scared state */
#character.scared .char-eye {
    width: 13px;
    height: 15px;
}

#character.scared .char-pupil {
    width: 3px;
    height: 3px;
}

#character.scared .char-mouth {
    width: 12px;
    height: 10px;
    border-bottom: none;
    background: #1a0a05;
    border-radius: var(--radius-full);
}

#character.scared .char-sweat {
    opacity: 1;
    animation: sweatDrop 1s ease-in-out infinite;
}

@keyframes sweatDrop {
    0% { transform: translateY(0); opacity: 0.8; }
    70% { opacity: 1; }
    100% { transform: translateY(12px); opacity: 0; }
}

/* Terrified state */
#character.terrified .char-eye {
    width: 15px;
    height: 17px;
}

#character.terrified .char-pupil {
    width: 2px;
    height: 2px;
    animation: shake 0.1s linear infinite;
}

#character.terrified .char-mouth {
    width: 16px;
    height: 13px;
    border-bottom: none;
    background: #1a0a05;
    border-radius: var(--radius-full);
}

#character.terrified .char-sweat {
    opacity: 1;
    animation: sweatDrop 0.5s ease-in-out infinite;
}

#character.terrified .char-head {
    animation: shake 0.15s linear infinite;
}

/* Relieved state */
#character.relieved .char-eye {
    height: 4px;
}

#character.relieved .char-pupil {
    height: 2px;
    width: 6px;
}

#character.relieved .char-mouth {
    width: 12px;
    height: 3px;
    border-bottom: 2.5px solid #27ae60;
    border-radius: 0 0 10px 10px;
}

#character.relieved .char-sweat {
    opacity: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-1px); }
    75% { transform: translateX(1px); }
}

/* Body */
.char-body {
    width: 60px;
    height: 30px;
    background: linear-gradient(180deg, #4a3728, #3a2a1a);
    border-radius: 8px 8px 14px 14px;
    position: relative;
    margin-top: -4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.char-neck-hole {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 12px;
    background: linear-gradient(180deg, var(--skin-shadow), var(--skin-tone));
    border-radius: var(--radius-full);
}

/* ============================
   GUILLOTINE BASE (ENHANCED)
   ============================ */
.guillotine-base {
    position: absolute;
    bottom: 0;
    left: 2px;
    right: 2px;
    height: 26px;
    background:
        linear-gradient(180deg,
            var(--wood-highlight) 0%,
            var(--wood-light) 20%,
            var(--wood-medium) 50%,
            var(--wood-dark) 80%,
            var(--wood-darkest) 100%
        );
    border-radius: 3px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.6);
    z-index: 6;
    overflow: visible;
}

/* Wood grain on base */
.guillotine-base::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 6px,
            rgba(0,0,0,0.08) 6px,
            rgba(0,0,0,0.08) 7px,
            transparent 7px,
            transparent 12px,
            rgba(0,0,0,0.05) 12px,
            rgba(0,0,0,0.05) 13px
        );
    border-radius: 3px;
}

/* Iron band across base */
.base-iron-band {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(180deg, var(--iron-highlight), var(--iron-medium), var(--iron-dark));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.base-nail {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: var(--radius-full);
    background: radial-gradient(circle at 35% 35%, var(--iron-highlight), var(--iron-darkest));
    box-shadow: inset 0 -1px 1px rgba(0,0,0,0.5);
    z-index: 1;
}

.base-nail-1 { left: 6px; }
.base-nail-2 { left: 22px; }
.base-nail-3 { right: 22px; }
.base-nail-4 { right: 6px; }

.lunette {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 22px;
    border-radius: 16px 16px 0 0;
    border: 4px solid var(--wood-dark);
    border-bottom: none;
    background: transparent;
}

.lunette-iron {
    position: absolute;
    top: -1px;
    left: -2px;
    right: -2px;
    bottom: 0;
    border-radius: 18px 18px 0 0;
    border: 2px solid var(--iron-dark);
    border-bottom: none;
    opacity: 0.6;
}

/* Scaffold platform */
.scaffold-platform {
    position: absolute;
    bottom: -10px;
    left: -20px;
    right: -20px;
    height: 12px;
    background:
        linear-gradient(180deg,
            var(--wood-medium) 0%,
            var(--wood-dark) 60%,
            var(--wood-darkest) 100%
        );
    border-radius: 2px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 7;
}

.scaffold-platform::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 20px,
            rgba(0,0,0,0.15) 20px,
            rgba(0,0,0,0.15) 21px
        );
    border-radius: 2px;
}

/* Danger glow */
#danger-glow {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    box-shadow: inset 0 0 60px rgba(192, 57, 43, 0.35);
}

#danger-glow.active {
    opacity: 1;
    animation: dangerPulse 0.8s ease-in-out infinite;
}

@keyframes dangerPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ============================
   QUESTION AREA (PARCHMENT STYLE)
   ============================ */
#question-area {
    width: 100%;
    padding: var(--gap-md) var(--gap-lg) var(--gap-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gap-lg);
    z-index: 15;
}

#question-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: var(--gap-lg) var(--gap-xl);
    /* Parchment / aged paper feel */
    background:
        linear-gradient(135deg,
            rgba(45, 36, 22, 0.85) 0%,
            rgba(35, 28, 16, 0.9) 50%,
            rgba(40, 32, 20, 0.85) 100%
        );
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(160, 120, 40, 0.25);
    border-radius: 4px;
    text-align: center;
    box-shadow:
        var(--shadow-md),
        0 0 30px rgba(212, 168, 68, 0.08),
        inset 0 0 40px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Parchment texture overlay */
#question-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 3px,
            rgba(255, 220, 150, 0.015) 3px,
            rgba(255, 220, 150, 0.015) 4px
        );
    border-radius: 4px;
    pointer-events: none;
}

/* Corner decorations */
.parchment-corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: var(--accent-gold-dark);
    border-style: solid;
    opacity: 0.5;
}

.corner-tl {
    top: 4px; left: 4px;
    border-width: 2px 0 0 2px;
    border-radius: 3px 0 0 0;
}

.corner-tr {
    top: 4px; right: 4px;
    border-width: 2px 2px 0 0;
    border-radius: 0 3px 0 0;
}

.corner-bl {
    bottom: 4px; left: 4px;
    border-width: 0 0 2px 2px;
    border-radius: 0 0 0 3px;
}

.corner-br {
    bottom: 4px; right: 4px;
    border-width: 0 2px 2px 0;
    border-radius: 0 0 3px 0;
}

#question-text {
    font-family: var(--font-mono);
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    font-weight: 600;
    color: var(--parchment-text);
    text-shadow: 0 0 20px rgba(240, 216, 120, 0.25), 0 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 2px;
}

#question-box.new-question {
    animation: questionPop 0.35s ease-out;
}

@keyframes questionPop {
    0% { transform: scale(0.85); opacity: 0.5; }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* Answers Grid - Medieval tablet style */
#answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-md);
    width: 100%;
    max-width: 400px;
}

.btn-answer {
    position: relative;
    padding: 16px 12px;
    font-family: var(--font-mono);
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 600;
    color: var(--text-primary);
    /* Dark wood plaque feel */
    background:
        linear-gradient(180deg,
            rgba(50, 38, 22, 0.8) 0%,
            rgba(35, 25, 14, 0.85) 50%,
            rgba(28, 20, 10, 0.9) 100%
        );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid rgba(107, 76, 42, 0.35);
    border-bottom: 3px solid rgba(80, 56, 28, 0.5);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.04);
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Wood texture on buttons */
.btn-answer::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 10px,
            rgba(0,0,0,0.04) 10px,
            rgba(0,0,0,0.04) 11px
        );
    pointer-events: none;
    border-radius: 6px;
}

.btn-answer:hover {
    border-color: var(--accent-gold);
    background:
        linear-gradient(180deg,
            rgba(70, 50, 25, 0.85) 0%,
            rgba(50, 35, 18, 0.9) 50%,
            rgba(40, 28, 14, 0.9) 100%
        );
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(212, 168, 68, 0.15);
    color: var(--accent-gold-light);
}

.btn-answer:active {
    transform: translateY(0) scale(0.97);
    border-bottom-width: 2px;
}

.btn-answer.correct {
    border-color: var(--accent-green-light);
    background: rgba(39, 174, 96, 0.2);
    color: var(--accent-green-light);
    animation: correctFlash 0.5s ease-out;
    box-shadow: var(--shadow-glow-green);
}

@keyframes correctFlash {
    0% { transform: scale(1); }
    30% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.btn-answer.wrong {
    border-color: var(--accent-crimson-light);
    background: rgba(192, 57, 43, 0.2);
    color: var(--accent-crimson-light);
    animation: wrongShake 0.4s ease-out;
    box-shadow: var(--shadow-glow-red);
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.btn-answer:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* ============================
   FEEDBACK OVERLAYS
   ============================ */
.feedback-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 3px;
    padding: var(--gap-md) var(--gap-xl);
    border-radius: var(--radius-lg);
    z-index: 60;
    pointer-events: none;
    opacity: 0;
}

#feedback-correct {
    color: var(--accent-green-light);
    background: rgba(39, 174, 96, 0.12);
    border: 2px solid rgba(39, 174, 96, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-shadow: 0 0 20px rgba(39, 174, 96, 0.5);
}

#feedback-wrong {
    color: var(--accent-crimson-light);
    background: rgba(192, 57, 43, 0.12);
    border: 2px solid rgba(192, 57, 43, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-shadow: 0 0 20px rgba(192, 57, 43, 0.5);
}

.feedback-overlay.show {
    animation: feedbackShow 0.8s ease-out forwards;
}

@keyframes feedbackShow {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    60% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -60%) scale(0.9); opacity: 0; }
}

/* Screen flash */
#screen-flash {
    position: absolute;
    inset: 0;
    background: var(--accent-crimson);
    opacity: 0;
    pointer-events: none;
    z-index: 55;
    transition: opacity 0.1s ease;
}

#screen-flash.flash-red {
    animation: flashRed 0.3s ease-out;
}

#screen-flash.flash-green {
    background: var(--accent-green);
    animation: flashGreen 0.3s ease-out;
}

@keyframes flashRed {
    0% { opacity: 0.3; }
    100% { opacity: 0; }
}

@keyframes flashGreen {
    0% { opacity: 0.18; }
    100% { opacity: 0; }
}

/* ============================
   GAME OVER SCREEN
   ============================ */
.gameover-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gap-lg);
    padding: var(--gap-xl);
    animation: fadeInUp 0.6s ease-out;
}

.gameover-icon {
    font-size: 4rem;
    animation: floatIcon 2s ease-in-out infinite;
}

.gameover-title {
    font-family: var(--font-title);
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 900;
    color: var(--accent-crimson-light);
    text-shadow: 0 0 30px rgba(192, 57, 43, 0.4), 0 2px 8px rgba(0,0,0,0.6);
    letter-spacing: 4px;
}

.gameover-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: -10px;
}

.gameover-stats {
    display: flex;
    gap: var(--gap-md);
    flex-wrap: wrap;
    justify-content: center;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gap-xs);
    padding: var(--gap-md) var(--gap-lg);
    background:
        linear-gradient(135deg,
            rgba(42, 26, 12, 0.7) 0%,
            rgba(30, 20, 10, 0.8) 100%
        );
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(160, 120, 40, 0.15);
    border-radius: var(--radius-sm);
    min-width: 100px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-gold-light);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.new-record-badge {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--accent-gold-light);
    animation: recordPulse 1s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(212, 168, 68, 0.5);
}

@keyframes recordPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.high-score-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-secondary {
    padding: 12px 36px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-secondary);
    background: rgba(42, 26, 12, 0.5);
    border: 1px solid rgba(160, 120, 40, 0.2);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-secondary:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold-light);
    background: rgba(42, 26, 12, 0.7);
}

/* ============================
   SCORE POPUP
   ============================ */
.score-popup {
    position: absolute;
    font-family: var(--font-mono);
    font-weight: 700;
    pointer-events: none;
    z-index: 70;
    animation: scoreFloat 1s ease-out forwards;
}

@keyframes scoreFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(1.3); }
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 480px) {
    .torch { top: 15%; }
    .torch-left { left: 2px; }
    .torch-right { right: 2px; }

    #guillotine-frame {
        width: 140px;
        height: 220px;
    }

    .post {
        width: 18px;
        height: 190px;
    }

    .post-left { left: 12px; }
    .post-right { right: 12px; }

    .top-beam {
        top: 22px;
        height: 20px;
        left: 4px;
        right: 4px;
    }

    #blade-assembly {
        left: 30px;
        right: 30px;
    }

    .blade {
        width: 80px;
        height: 18px;
    }

    .blade-weight {
        width: 76px;
        height: 14px;
    }

    .char-head {
        width: 40px;
        height: 44px;
    }

    .char-body {
        width: 48px;
        height: 24px;
    }

    .guillotine-base {
        height: 22px;
    }

    #question-area {
        padding: var(--gap-sm) var(--gap-md) var(--gap-lg);
        gap: var(--gap-md);
    }

    .btn-answer {
        padding: 12px 8px;
    }

    #hud {
        padding: var(--gap-sm) var(--gap-sm) var(--gap-xs);
    }

    .hud-value {
        font-size: 1.1rem;
    }

    .ceiling-chain {
        height: 40px;
        top: -40px;
    }

    .scaffold-platform {
        left: -14px;
        right: -14px;
    }
}

@media (max-height: 600px) {
    #guillotine-frame {
        height: 180px;
    }
    .post { height: 150px; }
    .torch { top: 10%; }
}

@media (min-width: 601px) {
    #guillotine-frame {
        width: 200px;
        height: 320px;
    }
    .post {
        height: 270px;
        width: 24px;
    }
    .blade { width: 108px; }
    .blade-weight { width: 104px; }
    .scaffold-platform {
        left: -26px;
        right: -26px;
    }
}
