﻿:root {
    --bg: #111;
    --panel-bg: #111;
    --panel-inner: #151515;
    --hud-box: #222;
    --accent-green: #0f0;
    --accent-green-soft: #cfc;
    --accent-gold: gold;
    --accent-gold-soft: #ffe08a;
    --kb-outline: yellow;
    --border-dark: #444;
    --text-white: #fff;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--bg);
    color: var(--accent-green);
    font-family: sans-serif;
    padding: 20px;
    box-sizing: border-box;
    margin: 0;
    overflow: hidden; /* important for full-height viewport */
}

table {
    border-collapse: collapse;
    width: 100%;
}

th, td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
}

th {
    background-color: blueviolet;
}

/* =========================
           Layout
        ========================= */
#topArea {
    display: flex;
    align-items: stretch;
    gap: 10px;
    height: calc(100vh - 40px); /* body padding */
    padding-bottom: 0; /* bottom breathing room */
    box-sizing: border-box;
}

#leftHUD {
    min-width: 200px;
    width: 320px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    /* single source of truth for HUD sizing */
    font-size: 16px;
}

#boardArea {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    position: relative; /* allows board-local overlays (e.g., full-map loading) */
}

#dungeonViewport {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-bottom: 40px;
}

/* =========================
           Player HUD
        ========================= */
#player-health {
    margin-bottom: 10px;
    color: var(--text-white);
}

.health-bar {
    background-color: var(--hud-box);
    border: 1px solid #666;
    width: 100%;
    height: 14px;
    position: relative;
    border-radius: 3px;
    overflow: hidden;
}

.health-fill {
    background-color: limegreen;
    height: 100%;
    width: 100%;
    transition: width 0.2s;
}

#playerStats {
    background-color: var(--hud-box);
    color: var(--text-white);
    width: 100%;
    font-family: Arial, sans-serif;
    box-sizing: border-box;

    /* Compact HUD */
    padding: 6px 8px;
    margin-top: 6px;
}

#player-health {
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.1;
}

#player-health .health-bar {
    margin-top: 4px;
}

.statsGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
}

.statCell {
    min-width: 0;
}

.statSpacer {
    visibility: hidden;
}

.statFull {
    grid-column: 1 / -1;
}

.statLabel {
    font-size: 11px;
    font-weight: 700;
    opacity: 0.9;
    margin-bottom: 1px;
}

.statValue {
    font-size: 15px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.statValue.statEnemy {
    white-space: normal; /* allow wrapping */
    line-height: 1.15;
    max-height: 6.0em;  /* keeps the box compact */
    overflow: hidden;
}

/* =========================
     Dungeon grid / tiles
   ========================= */
#dungeon {
    display: grid;
    position: relative;
    gap: 0;
background-color: #000;
    user-select: none;
}


/* =========================
   Full-map location pings
========================= */
.fullmap-ping-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

.fullmap-ping {
    position: absolute;
    box-sizing: border-box;
    pointer-events: none;
    border: 3px solid transparent;
    border-radius: 2px;
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.35));
}

.fullmap-ping.player { border-color: #ff2fbf; }  /* hot pink */
.fullmap-ping.stairs { border-color: #ffffff; }  /* white */
.fullmap-ping.vendor { border-color: #ffd400; }  /* yellow */

.tile {
    width: 20px;
    height: 20px;
    position: relative;
    box-sizing: border-box;
    image-rendering: pixelated;
    border: none;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

    .tile.stairs-down {
        background-color: #fff;
    }

    /* =========================
       Fire tiles (Dragon breath)
    ========================= */

    .tile.fire-tile {
        position: relative; /* needed for ::after overlay */
    }

        .tile.fire-tile::after {
            content: "";
            position: absolute;
            inset: 0;
            background-image: url("images/AoAFireTile1.gif");
            background-repeat: no-repeat;
            background-position: center;
            background-size: 100% 100%;
            image-rendering: pixelated;
            pointer-events: none;
            z-index: 1;
            /* ✅ let the player/monster show through */
            opacity: 0.55; /* try 0.45 - 0.7 to taste */
        }

    /* If you want fire hidden while totally unseen, keep render logic as written below.
       If you want it to always show even in fog, remove the visibility checks in AbyssGameLogic.renderDungeon(). */


.wall {
    background-color: darkRed; /* #444; */
}

 /* Visible wall texture overlay (bricks) — applied only to walls currently IN SIGHT via JS. */
.wall.wallBrick-0,
.wall.wallBrick-1,
.wall.wallBrick-2,
.wall.wallBrick-3,
.wall.wallBrick-4 {
    /* Keep the base wall background-color intact; only add subtle "mortar" lines. */
    background-image:
        repeating-linear-gradient(to right, rgba(0, 0, 0, 0.12) 0 1px, rgba(0, 0, 0, 0.00) 1px 6px),
        repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.12) 0 1px, rgba(0, 0, 0, 0.00) 1px 5px);
    background-size: 6px 5px;
    background-repeat: repeat;
}

/* Slight per-tile variations so neighboring squares don't look identical. */
.wall.wallBrick-0 { background-position: 0px 0px; }
.wall.wallBrick-1 { background-position: 1px 0px; }
.wall.wallBrick-2 { background-position: 0px 1px; }
.wall.wallBrick-3 { background-position: 2px 1px; }
.wall.wallBrick-4 { background-position: 1px 2px; }


.floor {
    background-color: aquamarine; /* #ccc; */
}

.player {
    background-color: aquamarine;
    background-image: url("images/AbyssOfAlariaMC.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.selected {
    outline: 2px solid var(--kb-outline);
}

.enemy {
    background-color: crimson;
}

.treasure {
    background-color: var(--accent-gold);
    color: #000;
    font-weight: bold;
    text-align: center;
}

.stairs-down {
    background-color: #bfe7ff;
    color: #000;
    font-weight: bold;
    text-align: center;
}

.stairs-symbol {
    font-weight: 900;
    line-height: 1;
    font-size: 18px;
    transform: translateY(-1px);
    user-select: none;
    pointer-events: none;
    text-shadow: 0 1px 0 rgba(0,0,0,0.25);
}

.hidden {
    display: none;
}

/* =========================
           Effects
        ========================= */
.hit-flash {
    animation: hitFlash 0.15s ease-in-out;
}

@keyframes hitFlash {
    0% {
        filter: brightness(2);
        background-color: #ff4444;
    }

    100% {
        filter: brightness(1);
    }
}

.hit-flash-player {
    animation: hitFlashPlayer 0.15s ease-in-out;
}

@keyframes hitFlashPlayer {
    0% {
        filter: brightness(2);
        background-color: pink;
    }

    100% {
        filter: brightness(1);
        background-color: lightpink;
    }
}

.shake {
    animation: shake 0.2s;
}

@keyframes shake {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-3px, 1px);
    }

    50% {
        transform: translate(3px, -1px);
    }

    75% {
        transform: translate(-3px, 1px);
    }

    100% {
        transform: translate(0, 0);
    }
}

.damage-float {
    position: absolute;
    pointer-events: none;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 1px 1px 2px black;
    animation: floatUp 0.6s ease-out forwards;
    z-index: 20;
}

/* =========================
   High Scores UI
========================= */

.hs-list {
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.35);
    border-radius: 10px;
    padding: 8px;
    max-height: 320px;
    overflow: auto;
}

.hs-endgame-title {
    font-size: 40px;
    font-weight: 900;
    text-align: center;
    margin: 4px 0 12px 0;
}

.hs-sub {
    margin: 6px 0 10px 0;
    color: var(--accent-green-soft);
    font-size: 13px;
}

.hs-row {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
}

    .hs-row:last-child {
        border-bottom: none;
    }

    .hs-row.hs-current-run {
        outline: 2px solid #b26bff;
        outline-offset: 2px;
    }

.hs-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.hs-dt {
    font-size: 12px;
    opacity: 0.85;
}

.hs-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-gold);
    color: #000;
    font-weight: 900;
    font-size: 12px;
}

.hs-desc {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.35;
}

.hs-empty {
    padding: 10px;
    opacity: 0.85;
    font-size: 13px;
}

.hs-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

    .hs-buttons button {
        padding: 10px 12px;
        font-size: 15px;
        font-weight: bold;
        cursor: pointer;
        background: var(--hud-box);
        color: var(--text-white);
        border: 1px solid var(--accent-gold);
        border-radius: 8px;
    }

        .hs-buttons button:hover {
            filter: brightness(1.15);
        }

        .hs-buttons button.kb-selected {
            outline: 2px solid var(--kb-outline);
        }

}

@keyframes floatUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-18px);
        opacity: 0;
    }
}


.projectile {
    position: fixed;
    pointer-events: none;
    z-index: 30;
    image-rendering: pixelated;
    transform-origin: center center;
    transition: transform 0.15s linear;
    will-change: transform;
}


.melee-effect {
    position: fixed;
    pointer-events: none;
    z-index: 35; /* above tiles + fire overlay + projectiles */
    image-rendering: pixelated;
    opacity: 1;
    transition: opacity 0.12s linear;
}

    .melee-effect.fade {
        opacity: 0;
    }

/* =========================
           Fog of War
        ========================= */
.fog-unseen {
    background-color: #000 !important;
}

.fog-seen {
    filter: brightness(0.75);
}

    .fog-seen .damage-float,
    .fog-unseen .damage-float {
        display: none;
    }

.fog-unseen * {
    display: none !important;
}

/* =========================
           Log + minimap
        ========================= */
#logArea {
    margin-top: 12px;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#logHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex: 0 0 auto;
}

#logTitle {
    color: var(--text-white);
    font-size: 14px;
    font-weight: bold;
}

#logLinks {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.logLink {
    color: #7ff;
    cursor: pointer;
    text-decoration: underline;
    font-size: 13px;
    user-select: none;
}

    .logLink:hover {
        filter: brightness(1.15);
    }

.logSep {
    color: #7aa;
    opacity: 0.85;
    font-size: 12px;
    user-select: none;
}

#log {
    color: var(--accent-green-soft);
    background: #0b0b0b;
    border: 1px solid var(--accent-green);
    padding: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    font-size: 15px;
    line-height: 1.35;
    flex: 1 1 auto;
    min-height: 0;
}

    #log div {
        margin-bottom: 6px;
        word-break: break-word;
        padding-left: 16px; /* indent wrapped lines */
        text-indent: -16px; /* pull first line back */
    }

#minimapWrap {
    margin-top: 10px;
    flex: 0 0 auto;
}

#minimapTitle {
    color: var(--text-white);
    font-size: 13px;
    margin: 0 0 6px 0;
    font-weight: bold;
}

#minimap {
    display: block;
    width: 100%;
    height: 140px; /* visual size */
    background: #050505;
    border: 1px solid var(--accent-green);
    box-sizing: border-box;
    image-rendering: pixelated;
}

/* =========================
           Info modal
        ========================= */
#infoModalOverlay,
#gameInfoModalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

#infoModal,
#gameInfoModal {
    width: min(900px, 92vw);
    max-height: 85vh;
    overflow: auto;
    background: var(--panel-bg);
    border: 2px solid var(--accent-green);
    padding: 16px;
    box-sizing: border-box;
    color: var(--accent-green-soft);

    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

}

    #infoModal h3,
    #infoModal h4,
    #gameInfoModal h3,
    #gameInfoModal h4 {
        margin: 0.6em 0 0.3em;
        color: var(--text-white);
    }

    #infoModal .closeRow,
    #gameInfoModal .closeRow {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }

#closeInfoBtn,
#closeGameInfoBtn {
    background: var(--hud-box);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
    padding: 6px 10px;
    cursor: pointer;
}

    #closeInfoBtn:hover,
    #closeGameInfoBtn:hover {
        filter: brightness(1.2);
    }


/* Game Info content tweaks */
#gameInfoModal ul {
    margin: 8px 0 0 18px;
    padding: 0;
}
#gameInfoModal li {
    margin: 6px 0;
    line-height: 1.35;
}
#gameInfoModal .gi-note {
    color: var(--text-white);
    opacity: 0.92;
    font-size: 14px;
    margin-top: 8px;
}

/* =========================
           Loading overlay
        ========================= */
#loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

#loadingPanel {
    background: var(--panel-bg);
    border: 2px solid var(--accent-green);
    padding: 18px 22px;
    color: var(--accent-green-soft);
    font-size: 18px;
    box-sizing: border-box;
    text-align: center;
    width: min(420px, 90vw);
}

#loadingSub {
    margin-top: 10px;
    font-size: 14px;
    color: #8f8;
}



/* =========================
           Full-map loading overlay (board-local)
        ========================= */
#fullMapLoadingOverlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    z-index: 150; /* above tiles, below global modals */
    pointer-events: none; /* don't eat clicks; full-map pauses input anyway */
}

.fullMapLoadingPanel {
    background: rgba(0,0,0,0.65);
    border: 2px solid rgba(150, 255, 150, 0.55);
    border-radius: 10px;
    padding: 18px 22px;
    text-align: center;
    width: min(360px, 85vw);
}

.fullMapSpinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px auto;
    border-radius: 50%;
    border: 6px solid rgba(255,255,255,0.25);
    border-top-color: rgba(255,255,255,0.9);
    animation: fullMapSpin 0.9s linear infinite;
}

.fullMapLoadingText {
    font-size: 16px;
    color: #eaffea;
    letter-spacing: 0.2px;
}

@keyframes fullMapSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* =========================
           Inventory + Merchant (shared structure)
        ========================= */
#inventoryUI,
#merchantUI,
#highScoresUI,
#descendUI {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    justify-content: center;
    align-items: center;
}

#inventoryUI {
    z-index: 200;
}

#merchantUI {
    z-index: 250;
}

#highScoresUI {
    z-index: 260;
}

#descendUI {
    z-index: 270;
}

/* Draggable modal headers */
.modalHeader {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    user-select: none;
}

.modal-drag-handle {
    cursor: move;
}

.inventory-panel,
.merchant-panel,
.highscores-panel,
.descend-panel {
    background: var(--panel-bg);
    border: 2px solid var(--accent-gold);
    padding: 14px;
    width: 420px;
    color: var(--text-white);
    box-sizing: border-box;

    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

}

.highscores-panel {
    width: 560px;
    max-width: calc(100vw - 32px);
}

.descend-panel {
    width: 520px;
    max-width: calc(100vw - 32px);
    border-color: var(--accent-green);
}

.descend-choices {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

    .descend-choices button {
        padding: 10px 18px;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
        background: var(--hud-box);
        color: var(--text-white);
        border: 1px solid var(--accent-gold);
        border-radius: 8px;
    }

        .descend-choices button:hover {
            filter: brightness(1.15);
        }

        .descend-choices button.kb-selected {
            outline: 2px solid var(--kb-outline);
        }

/* Transition overlay (dissolve-ish fade) */
#transitionOverlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    pointer-events: none;
    display: none;
    opacity: 0;
    background: #000;
    background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1.5px);
    background-size: 6px 6px;
}

    #transitionOverlay.dissolve-out {
        animation: alariaDissolveOut 420ms steps(12, end) forwards;
    }

    #transitionOverlay.dissolve-in {
        animation: alariaDissolveIn 520ms ease-out forwards;
    }

@keyframes alariaDissolveOut {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes alariaDissolveIn {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.inventory-tabs,
.merchant-tabs {
    display: flex;
    gap: 8px;
    margin: 10px 0 10px 0;
}

    .inventory-tabs button,
    .merchant-tabs button {
        flex: 1 1 auto;
        padding: 10px 12px;
        font-size: 15px;
        font-weight: bold;
        cursor: pointer;
        background: var(--hud-box);
        color: var(--text-white);
        border: 1px solid var(--accent-gold);
        border-radius: 8px;
    }

        .inventory-tabs button:hover,
        .merchant-tabs button:hover {
            filter: brightness(1.15);
        }

        .inventory-tabs button.active,
        .merchant-tabs button.active {
            background: var(--accent-gold);
            color: #000;
            border-color: var(--accent-gold);
        }

        .inventory-tabs button.kb-selected,
        .merchant-tabs button.kb-selected {
            outline: 2px solid var(--kb-outline);
        }

.inventory-item,
.merchant-item {
    border: 1px solid var(--border-dark);
    padding: 8px;
    margin-top: 8px;
    cursor: pointer;
    background: var(--panel-inner);
    border-radius: 6px;
}

.weapon-slot-badges {
    display: inline-flex;
    gap: 4px;
    margin-right: 6px;
    vertical-align: middle;
}

.slot-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid var(--accent-gold);
    background: rgba(0,0,0,0.35);
    color: var(--text-white);
}

.slot-badge.slot-primary {
    border-color: var(--accent-gold);
}

.slot-badge.slot-secondary {
    border-color: var(--accent-green);
    color: var(--accent-green-soft);
}



    .inventory-item:hover,
    .merchant-item:hover {
        filter: brightness(1.1);
    }

    .inventory-item.kb-selected,
    .merchant-item.kb-selected {
        outline: 2px solid var(--kb-outline);
    }

/* Smaller helper text under item names (Inventory + Vendor) */
.item-subtext {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 3px;
    color: var(--accent-green-soft);
    line-height: 1.2;
}

    .inventory-item .item-count {
        color: var(--accent-gold-soft);
    }

.inventory-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

    .inventory-actions button {
        flex: 1 1 auto;
        padding: 8px 10px;
        font-size: 14px;
        font-weight: bold;
        cursor: pointer;
        background: var(--hud-box);
        color: var(--text-white);
        border: 1px solid var(--accent-gold);
        border-radius: 6px;
    }

        .inventory-actions button:hover {
            filter: brightness(1.2);
        }

#closeInventoryBtn,
#closeMerchant {
    width: 100%;
    margin-top: 14px;
    padding: 12px 14px;
    font-size: 16px;
    font-weight: bold;
    background: var(--hud-box);
    color: var(--text-white);
    border: 1px solid var(--accent-gold);
    border-radius: 6px;
    cursor: pointer;
}

    #closeInventoryBtn:hover,
    #closeMerchant:hover {
        filter: brightness(1.2);
    }

    #closeInventoryBtn.kb-selected,
    #closeMerchant.kb-selected {
        outline: 2px solid var(--kb-outline);
    }


/* =========================
   Targeted enemy highlight
   - simple white border around the targeted enemy's tile
========================= */

.tile.targeted-enemy {
    box-shadow: inset 0 0 0 4px #f1f31b;
}


/* Compact HUD layout */
.hud-grid-compact {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: auto;
    gap: 4px 8px;
}

.hud-item.weapon {
    grid-column: 1 / -1; /* full row */
}

.hud-item.coins,
.hud-item.level,
.hud-item.kills,
.hud-item.treasure {
    grid-column: span 1;
}

/* 4-up row inside player stats */
.statsRow4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}


/* 2-up row inside player stats (Player Level + XP) */
.statsRow2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 6px;
}

.statsRow2 .statValue {
    font-size: 15px;
    line-height: 1.15;
}

.miniStat .statLabel {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.85;
}

.miniStat .statValue {
    font-size: 12px;
    line-height: 1.1;
    white-space: nowrap;
}

/* Enlarge mini-stat values (Coins / Level / Kills / Treasure) */
.statsRow4 .statValue {
    font-size: 15px;
    line-height: 1.15;
}


/* =========================
   Header (Title + Run Timer)
========================= */
#headerBar {
    display: grid;
    grid-template-columns: 320px 1fr; /* match #leftHUD width + dungeon column */
    align-items: center;
    column-gap: 10px;
    margin: 0;
}

#gameTitle {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-white);
}

#runTimer {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
}


#runTimer.timer-hidden {
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    filter: grayscale(0.6);
}

#runTimer.timer-hidden:hover {
    color: rgba(255,255,255,0.65);
}


/* =========================
   Start Game Modal
========================= */
#startGameOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#startGameModal {
    width: min(520px, 92vw);
    background: #111;
    border: 1px solid #555;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    color: var(--text-white);
}

#startGameModal h3 {
    margin: 0 0 12px 0;
}

#startGameModal label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

#startPlayerName {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #666;
    background: #0b0b0b;
    color: var(--text-white);
    box-sizing: border-box;
    font-size: 16px;
}

#startGameButtons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

#startGameBtn {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #888;
    background: #1a4;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

#startGameBtn:hover { filter: brightness(1.05); }


/* Full-map mode pause indicator */
#mapPausedIndicator {
    display: none;
    margin-left: 12px;
    font-weight: bold;
    color: #ffef8a;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}


/* =========================
   High Scores: delete entry "x"
========================= */

.hs-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hs-del {
    cursor: pointer;
    user-select: none;
    background: transparent;
    color: var(--text-white);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    padding: 0 7px;
    height: 22px;
    line-height: 20px;
    font-weight: 900;
    font-size: 14px;
}

.hs-del:hover {
    filter: brightness(1.2);
}

.hs-del:active {
    transform: translateY(1px);
}

/* --- HUD readability + Enemies Left --- */
#leftHUD {
    font-size: 18px;
}

#leftHUD .statLabel {
    font-size: 13px;
}

#leftHUD .statValue {
    font-size: 17px;
}

#leftHUD .enemiesLeftLabel {
    font-weight: 800;
    letter-spacing: 1px;
}

#leftHUD .enemiesLeftValue {
    font-size: 22px;
    font-weight: 900;
    text-align: center;
}



/* Temporary blood splat (projectile hits) */
.blood-splat-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    background:
        radial-gradient(circle at 35% 45%, rgba(160, 0, 0, 0.95) 0 18%, rgba(160, 0, 0, 0.0) 19% 100%),
        radial-gradient(circle at 65% 60%, rgba(200, 0, 0, 0.85) 0 14%, rgba(200, 0, 0, 0.0) 15% 100%),
        radial-gradient(circle at 55% 30%, rgba(120, 0, 0, 0.70) 0 10%, rgba(120, 0, 0, 0.0) 11% 100%);
    animation: bloodSplatFade 0.26s ease-out forwards;
    mix-blend-mode: multiply;
}

@keyframes bloodSplatFade {
    0% { opacity: 0.95; transform: scale(1.0); }
    100% { opacity: 0.0; transform: scale(1.08); }
}


/* =========================
           Quick Action Buttons Bar (bottom of map)
        ========================= */
#boardArea {
    position: relative;
}

#dungeonViewport {
    /* make space so the bottom bar doesn't cover tiles */
    padding-bottom: 56px;
    box-sizing: border-box;
}

#actionButtonsBar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    box-sizing: border-box;
    pointer-events: auto;
}

#actionButtonsBar .actionBarBtn {
    font-family: inherit;
    font-size: 12px;
    line-height: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(0,0,0,0.55);
    color: #fff;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

#actionButtonsBar .actionBarBtn:hover {
    background: rgba(255,255,255,0.10);
}

#actionButtonsBar .actionBarBtn:active {
    transform: translateY(1px);
}


.tile.targeted-self {
    box-shadow: inset 0 0 0 4px #f1f31b;
    outline-offset: -4px;
}

.actionBarBtn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.2);
}


/* UI NUDGE HOTFIX (minimap + action bar) */
/* Use a flex column layout so the game area never exceeds the viewport height. */
html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
}

/* Let the main two-column area take the remaining height below the header. */
#topArea {
    flex: 1 1 auto;
    min-height: 0;
    height: auto; /* override previous calc(...) height */
}

/* Keep the action bar a touch higher so it doesn't crowd the bottom edge. */
#boardArea {
    position: relative; /* anchor the absolute action bar */
}

#actionButtonsBar {
    bottom: 13px; /* was 8px */
}


/* =========================
   Action bar disabled look
   (buttons remain clickable)
========================= */
button.actionBarBtn.is-disabled {
    opacity: 0.45;
    filter: grayscale(0.85);
    cursor: not-allowed;
}
button.actionBarBtn.is-disabled:hover {
    opacity: 0.45;
}


/* --- Teleport / Phase Door FX --------------------------------------------------- */
.teleport-fx-clone {
    pointer-events: none;
    z-index: 9;
}

.teleport-fizzle-out {
    animation: teleportFizzleOut 0.18s ease-in forwards;
    z-index: 3;
}

.teleport-fizzle-in {
    animation: teleportFizzleIn 0.22s ease-out forwards;
    z-index: 3;
}

@keyframes teleportFizzleOut {
    0% { opacity: 1; filter: brightness(1.7) blur(0px); transform: scale(1); }
    70% { opacity: 0.55; filter: brightness(2.3) blur(1px); transform: scale(1.08); }
    100% { opacity: 0; filter: brightness(2.8) blur(2px); transform: scale(0.95); }
}

@keyframes teleportFizzleIn {
    0% { opacity: 0; filter: brightness(2.8) blur(2px); transform: scale(0.95); }
    55% { opacity: 0.7; filter: brightness(2.0) blur(1px); transform: scale(1.08); }
    100% { opacity: 1; filter: brightness(1.0) blur(0px); transform: scale(1); }
}

.teleport-ghost {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.10);
    filter: blur(0.2px);
    opacity: 0.75;
    transform: translateZ(0);
    transition: left 0.26s linear, top 0.26s linear, opacity 0.22s ease-out, filter 0.22s ease-out;
}

.teleport-ghost.teleport-ghost-move {
    opacity: 0.55;
    filter: blur(0.9px);
}
