/* ==========================================
   SHADOW OF ALCHEMY - MODERN PIXEL STYLE SHEET
   ========================================== */

/* Design Tokens & Colors */
:root {
    --bg-dark: #faf4e8;        /* Parchment Floor / Background */
    --bg-card: rgba(244, 236, 216, 0.96); /* Scroll Page background */
    --border-color: #8c7355;   /* Distressed leather/ink border */
    --border-glow: rgba(140, 115, 85, 0.15);
    
    --primary: #2b2621;        /* Charcoal / Main Ink */
    --primary-glow: #5e5246;   /* Faded / Shaded Ink */
    --secondary: #c95d3b;      /* Burnt Orange / Alchemical Spell */
    --accent: #3b8259;         /* Sage Green / Natural Alchemy */
    --accent-glow: #539e72;
    --danger: #9e3636;         /* Crimson Ink / Alerts */
    --text-main: #2b2621;      /* Charcoal text */
    --text-muted: #5e5246;     /* Slate Brown faded text */
    
    --font-ui: 'Outfit', sans-serif;
    --font-pixel: 'Architects Daughter', cursive;
    --font-heading: 'Cinzel', serif;
}

/* Base resets & layout */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    background-color: #1e130c; /* Dark mahogany desk background */
    color: var(--text-main);
    font-family: var(--font-ui);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(244, 236, 216, 0.04) 0%, transparent 70%);
}

/* Game Wrapper: Centers and contains the active container (styled like a leather book cover) */
#game-wrapper {
    position: relative;
    padding: 12px;
    border-radius: 8px;
    background: #4b3621; /* Rich leather brown */
    border: 3px solid #36220f;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), inset 0 0 20px rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Main Box container (aspect locked) */
#game-container {
    position: relative;
    width: 96vw;
    height: 54vw; /* 96 * 9 / 16 */
    max-width: 170.6667vh; /* 96 * 16 / 9 */
    max-height: 96vh;
    aspect-ratio: 16 / 9;
    background-color: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(140, 115, 85, 0.3);
}

/* Canvas styling: SMOOTH hand-drawn vector rendering */
#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: auto;
}

/* ================= OVERLAY PANELS ================= */

.overlay-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(8, 5, 17, 0.65);
    z-index: 10;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.overlay-panel.active {
    opacity: 1;
    visibility: visible;
}

.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Scroll Pages (previously Glassmorphism panels) */
.glass-card {
    background: var(--bg-card);
    border: 4px double var(--border-color);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    padding: 24px;
    width: 85%;
    max-height: 85%;
    display: flex;
    flex-direction: column;
    color: var(--text-main);
    animation: unroll 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

@keyframes unroll {
    from {
        transform: scaleY(0.1);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Typography styles */
h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--text-main);
    text-shadow: none;
    margin-bottom: 16px;
    border-bottom: 2px double var(--border-color);
    padding-bottom: 6px;
}

h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--secondary);
    margin-bottom: 12px;
}

p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-muted);
}

/* Button design - Pressed Ink Stamp style */
.btn-pixel {
    background: rgba(140, 115, 85, 0.08);
    border: 2px solid var(--primary);
    border-radius: 4px;
    color: var(--primary);
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    font-weight: bold;
    padding: 10px 20px;
    cursor: pointer;
    box-shadow: 1px 2px 4px rgba(43, 38, 33, 0.15);
    transition: all 0.2s ease;
    text-transform: uppercase;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    outline: none;
}

.btn-pixel:hover {
    background: rgba(43, 38, 33, 0.06);
    border-color: var(--secondary);
    color: var(--secondary);
    transform: translateY(-1px);
    box-shadow: 2px 4px 8px rgba(43, 38, 33, 0.25);
}

.btn-pixel:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(43, 38, 33, 0.1);
}

.btn-pixel:active {
    transform: translateY(1px) scale(0.98);
}

.font-small {
    font-size: 0.65rem;
    padding: 8px 16px;
}

/* ================= TITLE SCREEN ================= */

#title-screen {
    background: radial-gradient(circle, rgba(244, 236, 216, 0.92) 0%, rgba(43, 38, 33, 0.96) 100%);
}

.title-content {
    text-align: center;
    animation: fadeIn 1s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-title {
    font-family: var(--font-heading);
    font-size: 4.5rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 5px;
    letter-spacing: 4px;
    filter: drop-shadow(1px 2px 3px rgba(43, 38, 33, 0.3));
}

.alchemy-symbol {
    font-size: 3.5rem;
    color: var(--secondary);
    margin: 10px 0;
    text-shadow: none;
    animation: rotateSymbol 12s infinite linear;
}

@keyframes rotateSymbol {
    100% { transform: rotate(360deg); }
}

.subtitle {
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 40px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Help Screen scrolls */
.help-scroll-content {
    overflow-y: auto;
    flex: 1;
    margin-bottom: 20px;
    padding-right: 10px;
}

.help-scroll-content::-webkit-scrollbar {
    width: 6px;
}
.help-scroll-content::-webkit-scrollbar-track {
    background: rgba(43, 38, 33, 0.05);
    border-radius: 4px;
}
.help-scroll-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.help-scroll-content h3 {
    margin-top: 15px;
    font-size: 1.4rem;
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 4px;
}

.help-scroll-content p {
    margin-bottom: 10px;
    font-size: 0.85rem;
}

/* ================= EXPLORATION HUD ================= */

#hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 5;
    animation: fadeInHUD 0.5s ease;
}

@keyframes fadeInHUD {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.hud-left, .hud-right {
    pointer-events: auto;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 10px 14px;
    box-shadow: 2px 4px 10px rgba(43, 38, 33, 0.15);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-box {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    border: 2px solid var(--primary);
    background-color: rgba(43, 38, 33, 0.05);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.stats-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.character-name {
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--text-main);
}

.stat-bar-container {
    position: relative;
    width: 150px;
    height: 14px;
    background: rgba(43, 38, 33, 0.08);
    border: 1.5px solid var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.hp .bar-fill {
    background: var(--danger);
}

.bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    font-weight: bold;
    color: var(--text-main);
    white-space: nowrap;
    text-shadow: none;
}

.currency-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    margin-bottom: 6px;
    color: var(--text-main);
}

.notoriety-display {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    color: var(--text-muted);
}

#notoriety-level {
    color: var(--secondary);
    font-weight: bold;
}

.notoriety-bar {
    width: 120px;
    height: 6px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    overflow: hidden;
}

.notoriety-fill {
    height: 100%;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s ease;
}

/* ================= DIALOGUE ENGINE ================= */

#dialogue-box {
    position: absolute;
    bottom: 16px;
    left: 5%;
    width: 90%;
    height: 120px;
    background: var(--bg-card);
    border: 3px double var(--border-color);
    box-shadow: 0 10px 30px rgba(43, 38, 33, 0.2);
    border-radius: 4px;
    padding: 16px;
    display: flex;
    gap: 16px;
    z-index: 8;
    animation: slideUp 0.3s ease;
}

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

.dialogue-speaker-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    flex-shrink: 0;
}

.speaker-portrait {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    border: 2px solid var(--primary);
    background-color: rgba(43, 38, 33, 0.04);
    margin-bottom: 4px;
}

.speaker-name {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    text-align: center;
    color: var(--primary-glow);
    white-space: nowrap;
    font-weight: bold;
}

.dialogue-text-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
}

#dialogue-text {
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 8px;
    line-height: 1.4;
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 5px;
}

.btn-pixel-option {
    background: rgba(140, 115, 85, 0.05);
    border: 1.5px solid var(--primary);
    border-radius: 4px;
    padding: 6px 12px;
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-pixel-option:hover {
    background: rgba(43, 38, 33, 0.06);
    border-color: var(--secondary);
    color: var(--secondary);
    transform: translateX(4px);
}

.dialogue-next-prompt {
    position: absolute;
    bottom: 0;
    right: 0;
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--secondary);
    animation: flash 0.8s infinite alternate;
}

@keyframes flash {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* ================= HUB / SHOP MENU ================= */

.hub-card {
    height: 90%;
}

.tabs-header {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px double var(--border-color);
    padding-bottom: 8px;
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(43, 38, 33, 0.04);
}

.tab-btn.active {
    color: var(--primary);
    background: rgba(140, 115, 85, 0.12);
    border: 1px solid var(--border-color);
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    padding-right: 6px;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.section-desc {
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mission-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 12px 18px;
    transition: all 0.2s ease;
}

.mission-row:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: var(--primary);
}

.mission-details h4 {
    font-family: var(--font-ui);
    font-size: 1.1rem;
    color: #fff;
}

.mission-details p {
    font-size: 0.8rem;
}

/* Crafting split columns */
.crafting-columns {
    display: flex;
    gap: 16px;
    flex: 1;
}

.recipes-list {
    width: 45%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.recipe-row {
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s ease;
}

.recipe-row:hover, .recipe-row.selected {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
}

.recipe-icon {
    font-size: 1.5rem;
}

.recipe-name {
    font-size: 0.9rem;
    color: #fff;
}

.recipe-details {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.ingredient-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.ingredient-row.insufficient {
    color: var(--danger);
}

.ingredient-row.sufficient {
    color: var(--accent-glow);
}

/* Farming Grid */
.farming-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.farm-plot {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.plot-sprite {
    font-size: 2rem;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Market layouts */
.market-split {
    display: flex;
    gap: 16px;
    flex: 1;
}

.market-buy-section, .market-sell-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.market-buy-section h4, .market-sell-section h4 {
    margin-bottom: 8px;
    font-size: 1rem;
    color: var(--primary-glow);
}

.market-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
}

.market-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.market-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

/* ================= TURN-BASED COMBAT OVERLAY ================= */

#combat-overlay {
    background: radial-gradient(circle at 50% 45%, rgba(10, 6, 24, 0.15) 0%, rgba(8, 5, 17, 0.6) 100%);
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
}

.combat-hud {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.combat-unit-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 18px;
    width: 250px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.enemy-card {
    border-color: rgba(236, 72, 153, 0.4);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.15);
}

.unit-name {
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    margin-bottom: 6px;
    color: #fff;
}

.buffs-list {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.buff-badge {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
}

.combat-action-box {
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 16px;
    position: relative;
}

.combat-log {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-main);
    padding-right: 10px;
    line-height: 1.4;
    overflow-y: auto;
    max-height: 80px;
}

.combat-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 320px;
    flex-shrink: 0;
}

/* Combat Drawer style */
.drawer {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 180px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 12;
    animation: drawerUp 0.2s ease;
}

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

.drawer-header {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--primary-glow);
    align-items: center;
}

.btn-close-drawer {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    cursor: pointer;
}

.drawer-list {
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ================= ROYAL PRISON CELL OVERLAY ================= */

.prison-card {
    max-width: 600px;
    gap: 16px;
}

.prison-escape-options {
    display: flex;
    gap: 16px;
}

.escape-option-box {
    flex: 1;
    padding: 16px;
    background: rgba(140, 115, 85, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}

.escape-option-box h3 {
    font-size: 1.1rem;
    color: var(--secondary);
}

.escape-option-box p {
    font-size: 0.8rem;
}

/* Chemistry Acid mini-game */
.mini-game-box {
    margin-top: 10px;
    border-top: 2px double var(--border-color);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.mini-game-instructions {
    font-size: 0.8rem;
    text-align: center;
}

.chemistry-beaker-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
}

.beaker-container {
    width: 60px;
    height: 100px;
    border: 3px solid var(--text-main);
    border-top: none;
    border-radius: 0 0 16px 16px;
    position: relative;
    overflow: hidden;
    background: rgba(43, 38, 33, 0.05);
}

.beaker-fluid {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, var(--accent), var(--accent-glow));
    transition: height 0.3s ease, background 0.3s ease;
}

.beaker-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: var(--font-pixel);
    font-size: 0.55rem;
}

#acid-percentage {
    color: var(--accent);
    font-weight: bold;
}

#acid-stability {
    color: var(--danger);
    font-weight: bold;
}

.chemistry-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.btn-chem {
    background: rgba(140, 115, 85, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-main);
    padding: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.btn-chem:hover {
    background: rgba(43, 38, 33, 0.06);
    border-color: var(--secondary);
}

/* ================= VICTORY / GAME OVER ================= */

.congrats-text {
    text-align: center;
    color: var(--accent);
    text-shadow: none;
}

.rewards-box {
    margin: 16px 0;
    background: rgba(59, 130, 89, 0.05);
    border: 2px solid var(--accent);
    border-radius: 4px;
    padding: 16px;
}

.artifact-display {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.artifact-icon {
    font-size: 2.5rem;
    color: var(--accent);
    text-shadow: none;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(140, 115, 85, 0.05);
    border: 2px solid var(--border-color);
    border-radius: 4px;
}

.artifact-details strong {
    font-size: 1rem;
    color: var(--text-main);
}

.loot-collected {
    margin-bottom: 24px;
    font-family: var(--font-pixel);
    font-size: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.game-over-title {
    font-family: var(--font-heading);
    font-size: 5rem;
    font-weight: bold;
    color: var(--danger);
    text-shadow: none;
    margin-bottom: 20px;
    letter-spacing: 4px;
}

/* Ending scrolling text */
.ending-card {
    height: 85%;
    max-width: 600px;
}

.ending-title {
    color: var(--secondary);
    text-align: center;
}

.ending-text-box {
    flex: 1;
    overflow-y: auto;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 20px;
    padding-right: 8px;
    white-space: pre-line;
}

/* ================= DEBUG OVERLAY ================= */

#debug-overlay {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid red;
    border-radius: 8px;
    padding: 10px;
    z-index: 100;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.debug-header {
    color: red;
    font-family: var(--font-pixel);
    font-size: 0.45rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 0, 0, 0.3);
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.debug-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.btn-debug {
    background: #111;
    border: 1px solid #444;
    color: #ccc;
    font-size: 0.7rem;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    outline: none;
}

.btn-debug:hover {
    background: #222;
    color: #fff;
    border-color: red;
}
select.btn-debug {
    font-size: 0.65rem;
}
