@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --bg-primary: rgba(20, 20, 30, 0.7);
    --bg-secondary: rgba(30, 35, 50, 0.4);
    --bg-tertiary: rgba(40, 45, 60, 0.3);

    --text-primary: #e0e6ed;
    --text-secondary: #94a3b8;

    --accent-color: #00f0ff;
    --accent-color-glow: rgba(0, 240, 255, 0.5);

    --accent-color-danger: #ff2a6d;
    --accent-color-success: #05ffa1;
    --accent-color-warning: #ffbd00;

    --accent-color-epic: #bd00ff;
    --accent-color-legendary: #ff9900;

    --border-color: rgba(255, 255, 255, 0.1);
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);

    --modal-overlay-bg: rgba(5, 5, 10, 0.85);

    --cell-size: clamp(24px, 4.5vh, 48px);
}

body {
    font-family: 'Roboto', sans-serif;
    color: var(--text-primary);
    background: #050510;
    overflow: hidden;
    margin: 0;
    height: 100vh;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(76, 29, 149, 0.2), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.2), transparent 25%);
    animation: bg-pulse 10s ease-in-out infinite alternate;
}

@keyframes bg-pulse {
    0% {
        background-size: 100% 100%;
    }

    100% {
        background-size: 110% 110%;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

/* Typography */
h1,
h2,
h3,
h4,
.panel-title,
.font-tech {
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.label-bold {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Glassmorphism Panels */
.panel {
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Inventory Item Card */
.inventory-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.5rem;
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
    /* Extra space for buttons */
    margin: 4px;
    /* Gap between items */
    min-width: 100px;
    min-height: 140px;
    /* Taller to fit buttons */
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: visible;
    /* Allow tooltip to escape */
}

.inventory-item-card:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--accent-color);
    box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.2);
}

/* Item name pinned to top */
.inventory-item-card .item-name-top {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    text-align: center;
    font-size: 9px;
    font-weight: bold;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel:hover {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Panel Titles - Colored like Log Panel */
.panel-title {
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--accent-color-glow);
    font-weight: bold;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--accent-color);
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.15), transparent);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Game Board */
#gameBoard {
    display: grid;
    grid-template-columns: repeat(var(--board-cols, 20), 1fr);
    grid-template-rows: repeat(var(--board-rows, 15), 1fr);
    gap: 1px;
    background: rgba(0, 0, 0, 0.3);
    border: var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
    width: 100%;
}

.game-cell {
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--cell-size) * 0.85);
    position: relative;
    transition: background-color 0.1s;
    overflow: visible;
}

.game-cell.floor-walkable {
    background: rgba(255, 255, 255, 0.05);
}

.game-cell.wall {
    background: rgba(0, 0, 0, 0.5);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.player-highlight {
    box-shadow: 0 0 15px var(--accent-color-glow);
    border: 1px solid var(--accent-color);
    background: rgba(0, 240, 255, 0.1);
    border-radius: 4px;
    z-index: 2;
}

.monster-highlight {
    box-shadow: 0 0 10px rgba(255, 42, 109, 0.5);
    border: 1px solid var(--accent-color-danger);
    border-radius: 4px;
}

.npc-highlight {
    box-shadow: 0 0 10px rgba(5, 255, 161, 0.5);
    border: 1px solid var(--accent-color-success);
    border-radius: 4px;
}

.chest-highlight {
    box-shadow: 0 0 10px rgba(255, 189, 0, 0.5);
    border: 1px solid var(--accent-color-warning);
    border-radius: 4px;
    animation: chest-pulse 1s ease-in-out infinite alternate;
}

@keyframes chest-pulse {
    from {
        box-shadow: 0 0 5px rgba(255, 189, 0, 0.3);
    }

    to {
        box-shadow: 0 0 15px rgba(255, 189, 0, 0.7);
    }
}

.entity-name-label {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 7px;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    background: rgba(0, 0, 0, 0.8);
    padding: 1px 4px;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
    text-shadow: 0 0 3px rgba(0, 240, 255, 0.5);
    border: 1px solid rgba(0, 240, 255, 0.3);
}

/* Buttons - Enhanced with colorful gradients */
.button {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15) 0%, rgba(59, 130, 246, 0.2) 50%, rgba(139, 92, 246, 0.15) 100%);
    border: 1px solid rgba(0, 240, 255, 0.4);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease-out;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 10px rgba(0, 240, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 8px var(--accent-color-glow);
}

.button:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.3) 0%, rgba(59, 130, 246, 0.35) 50%, rgba(139, 92, 246, 0.3) 100%);
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px var(--accent-color-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-success {
    background: linear-gradient(135deg, #05ffa1 0%, #00e5ff 50%, #05ffa1 100%) !important;
    border-color: var(--accent-color-success) !important;
    box-shadow: 0 0 15px rgba(5, 255, 161, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.2);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    color: #000 !important;
    font-weight: bold;
}

.button-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #00ffcc 0%, #05ffa1 50%, #00e5ff 100%) !important;
    box-shadow: 0 0 25px rgba(5, 255, 161, 0.8), inset 0 0 20px rgba(255, 255, 255, 0.3);
    color: #000 !important;
    transform: translateY(-2px) scale(1.02);
}

.action-button {
    padding: 0.25rem 0.5rem;
    font-size: 0.6rem;
}

.button-danger {
    background: linear-gradient(135deg, var(--accent-color-danger), #a00);
    border-color: var(--accent-color-danger);
    color: white;
}

.button-danger:hover {
    box-shadow: 0 0 15px var(--accent-color-danger);
    background: linear-gradient(135deg, #ff4a7d, var(--accent-color-danger));
}

/* HOTBAR SLOTS */
.hotbar-slot {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    overflow: hidden;
    padding-top: 4px;
}

.hotbar-slot:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color-glow);
    background: rgba(255, 255, 255, 0.05);
}

.hotbar-slot-key {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.55em;
    color: var(--accent-color);
    font-family: 'Orbitron', sans-serif;
    opacity: 0.9;
    text-shadow: 0 0 2px black;
}

.hotbar-slot-name {
    /* Position inside the slot */
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 7px;
    color: var(--text-secondary);
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
}

.hotbar-slot-icon {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 0;
    margin-top: 2px;
}

/* INVENTORY & SKILL SLOTS */
.inventory-slot,
.skill-slot {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    padding: 0.5rem;
}

.inventory-slot:hover,
.skill-slot:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color-glow);
}

/* EQUIPMENT SLOTS */
.equipment-slot {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

/* EMPTY EQUIPMENT SLOTS - Gray styling */
.equipment-slot-empty {
    filter: grayscale(100%) opacity(0.5);
    background: rgba(50, 50, 50, 0.6);
    border-color: rgba(100, 100, 100, 0.3);
}

.equipment-slot-empty:hover {
    filter: grayscale(50%) opacity(0.8);
}

/* EQUIPPED SLOTS - Highlight */
.equipment-slot-equipped {
    border-color: var(--accent-color);
    background: rgba(0, 240, 255, 0.1);
    filter: none;
}

.equipment-slot-large {
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
}

.equipment-slot:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-color-glow);
    background: rgba(0, 240, 255, 0.1);
}

.equipment-slot-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Modals */
.modal {
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(8px);
    z-index: 1500;
}

.modal-content {
    position: relative;
    z-index: 1501;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* MESSAGE LOG - Smaller font */
#messageLog {
    font-size: 0.65rem;
    line-height: 1.3;
}

#messageLog p {
    font-size: 0.65rem;
    margin-bottom: 2px;
    padding: 2px 4px;
    border-radius: 2px;
}

/* CLASS SELECTION - Fixed wrap, no overlap */
#classCardsContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    width: 100%;
}

.class-card {
    flex: 0 0 calc(33.333% - 1rem);
    min-width: 280px;
    max-width: 320px;
    background: var(--bg-tertiary);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    margin: 4px;
}

.class-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 20px var(--accent-color-glow);
    transform: scale(1.02);
}

.class-card.selected {
    border-color: var(--accent-color-success);
    box-shadow: 0 0 25px rgba(5, 255, 161, 0.5);
    transform: scale(1.02);
}

.class-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.class-card-icon {
    font-size: 2rem;
}

.class-card-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: var(--accent-color);
}

.class-card-role {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.class-card-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.class-card-stats {
    font-size: 0.7rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
}

.class-card-passive,
.class-card-skill,
.class-card-equipment {
    font-size: 0.7rem;
    margin-top: 0.25rem;
}

.class-card-talents {
    font-size: 0.65rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

/* Achievements Grid - No description under icon, tooltip only */
.achievement-item {
    width: 50px;
    min-height: 60px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.achievement-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color-glow);
}

.achievement-item.unlocked {
    border-color: var(--accent-color-success);
    background: rgba(5, 255, 161, 0.1);
}

.achievement-item.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

/* Tooltip */
.tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--accent-color);
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

.tooltip-trigger:hover .tooltip {
    display: block;
}

/* Stat Item */
.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

/* Rarity Colors */
.rarity-common {
    color: #9ca3af;
}

.rarity-uncommon {
    color: #22c55e;
}

.rarity-rare {
    color: #3b82f6;
}

.rarity-epic {
    color: var(--accent-color-epic);
}

.rarity-legendary {
    color: var(--accent-color-legendary);
    text-shadow: 0 0 8px var(--accent-color-legendary);
}

.rarity-set {
    color: #22c55e;
    text-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

/* Damage Numbers */
.damage-number {
    position: absolute;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 1rem;
    color: var(--accent-color-danger);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    animation: float-up 1s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

.damage-number.heal {
    color: var(--accent-color-success);
}

.damage-number.crit {
    font-size: 1.4rem;
    color: var(--accent-color-warning);
    text-shadow: 0 0 10px var(--accent-color-warning);
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

/* Themes */
.theme-dark {
    --bg-primary: rgba(20, 20, 30, 0.9);
    --bg-secondary: rgba(30, 35, 50, 0.85);
    --bg-tertiary: rgba(40, 45, 60, 0.8);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: rgba(100, 100, 120, 0.4);
    --input-bg: rgba(30, 30, 40, 0.9);
}

.theme-black {
    --bg-primary: #000000 !important;
    --bg-secondary: #050505 !important;
    --bg-tertiary: #0a0a0a !important;
    --text-primary: #ffffff !important;
    --text-secondary: #999999 !important;
    --border-color: #222222 !important;
    --input-bg: #000000 !important;
    --modal-overlay-bg: rgba(0, 0, 0, 0.95) !important;
}

.theme-black,
.theme-black body,
.theme-black .game-container,
.theme-black .modal-content,
.theme-black .panel,
.theme-black #gameBoard,
.theme-black #gameContainer {
    background-color: #000000 !important;
}

/* ============================================= */
/*           THEME-AWARE SELECT/INPUT            */
/* ============================================= */

/* BLACK THEME */
.theme-black .modal-content,
.theme-black .panel {
    background-color: #000 !important;
    background: #000 !important;
}

.theme-black input,
.theme-black select,
.theme-black textarea,
body.theme-black select,
body.theme-black input {
    background-color: #111 !important;
    background: #111 !important;
    color: #fff !important;
    border: 1px solid #444 !important;
}

.theme-black select option,
body.theme-black option {
    background-color: #111 !important;
    color: #fff !important;
}

/* LIGHT THEME modal/panel fixes */
.theme-light .modal-content,
.theme-light .panel {
    background-color: #ffffff !important;
    background: rgba(255, 255, 255, 0.98) !important;
}

.theme-light select,
.theme-light input,
.theme-light textarea,
body.theme-light select,
body.theme-light input {
    background-color: #f8f8f8 !important;
    background: #f8f8f8 !important;
    color: #1a1a1a !important;
    border: 1px solid #c0c0c0 !important;
}

.theme-light select option {
    background-color: #f8f8f8 !important;
    color: #1a1a1a !important;
}

/* DARK THEME modal fixes */
.theme-dark select,
.theme-dark input,
body.theme-dark select,
body.theme-dark input {
    background-color: #1e2538 !important;
    background: #1e2538 !important;
    color: #e0e6ed !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.theme-dark select option {
    background-color: #1e2538 !important;
    color: #e0e6ed !important;
}

/* Item Tooltip - positioned relative to parent */
.item-tooltip {
    position: absolute;
    bottom: 100%;
    /* Above the item */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 20, 0.98);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 0.75rem;
    min-width: 220px;
    max-width: 320px;
    z-index: 9999;
    pointer-events: none;
    font-size: 0.75rem;
    margin-bottom: 5px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.item-tooltip-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.item-tooltip-type {
    color: var(--text-secondary);
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
}

.item-tooltip-stats {
    margin-bottom: 0.5rem;
}

.item-tooltip-desc {
    color: var(--text-secondary);
    font-style: italic;
}

/* Animation for achievements toast */
@keyframes slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#achievementToast.show {
    display: block;
    animation: slide-in 0.3s ease-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .class-card {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #gameContainer {
        flex-direction: column;
    }

    #gameContainer>div:first-child {
        width: 100%;
        height: 60%;
    }

    #gameContainer>div:last-child {
        width: 100%;
        height: 40%;
    }
}

/* DARK THEME DROPDOWNS */
select {
    background-color: #1a1a2e !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 10px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2300f0ff' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 24px;
}

select:hover {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 8px var(--accent-color-glow);
}

select:focus {
    outline: none;
    border-color: var(--accent-color) !important;
}

select option {
    background-color: #1a1a2e !important;
    color: var(--text-primary) !important;
    padding: 8px;
}

select option:hover,
select option:checked {
    background-color: rgba(0, 240, 255, 0.2) !important;
}

/* ANIMATIONS */
@keyframes ping-fast {

    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.animate-ping-fast {
    animation: ping-fast 0.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.shake-screen {
    animation: shake 0.3s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* THEME DEFINITIONS */
.theme-light {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8e8;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --border-color: #d0d0d0;
    --glass-border: 1px solid rgba(0, 0, 0, 0.15);
    --accent-color: #0ea5e9;
    --modal-overlay-bg: rgba(255, 255, 255, 0.9);
}

/* Force light theme backgrounds */
.theme-light,
body.theme-light,
.theme-light .game-container,
.theme-light #gameContainer {
    background-color: #f0f0f0 !important;
    background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 50%, #e0e0e0 100%) !important;
    color: #1a1a1a !important;
}

.theme-light .panel,
.theme-light .modal-content,
.theme-light #startModal {
    background-color: #ffffff !important;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #1a1a1a !important;
    border-color: #d0d0d0 !important;
}

.theme-light select,
.theme-light input,
.theme-light textarea {
    background-color: #ffffff !important;
    color: #1a1a1a !important;
    border: 1px solid #c0c0c0 !important;
}

.theme-light select option {
    background-color: #ffffff !important;
    color: #1a1a1a !important;
}

.theme-light .button {
    background: rgba(14, 165, 233, 0.15) !important;
    color: #1a1a1a !important;
    border: 1px solid #0ea5e9 !important;
}

.theme-light .button:hover {
    background: rgba(14, 165, 233, 0.3) !important;
}

.theme-light .panel-title,
.theme-light h1,
.theme-light h2,
.theme-light h3,
.theme-light h4 {
    color: #1a1a1a !important;
}

.theme-light .hotbar-slot {
    background-color: rgba(0, 0, 0, 0.05) !important;
    border-color: #c0c0c0 !important;
}

.theme-light .hotbar-slot:hover {
    background-color: rgba(14, 165, 233, 0.2) !important;
}

.theme-black {
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --bg-tertiary: #000000;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --border-color: #333333;
    --glass-border: 1px solid #333;
    --modal-overlay-bg: rgba(0, 0, 0, 0.95);
}

.theme-black select,
.theme-black input,
.theme-black textarea {
    background-color: #111 !important;
    color: #fff !important;
    border-color: #444 !important;
}

/* ============================================= */
/*           SKILL ATTACK ANIMATIONS             */
/* ============================================= */

@keyframes skill-impact {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.7;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes skill-icon-pop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -100%) scale(1);
        opacity: 0;
    }
}

@keyframes shake-screen {

    0%,
    100% {
        transform: translateX(0);
    }

    10% {
        transform: translateX(-5px) rotate(-0.5deg);
    }

    20% {
        transform: translateX(4px) rotate(0.5deg);
    }

    30% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(3px);
    }

    50% {
        transform: translateX(-3px);
    }
}

.shake-screen {
    animation: shake-screen 0.3s ease-out;
}

.skill-projectile {
    pointer-events: none;
    text-shadow: 0 0 10px white, 0 0 20px currentColor;
}

.hotbar-slot.skill-active {
    animation: hotbar-glow 0.5s ease-out;
}

@keyframes hotbar-glow {
    0% {
        box-shadow: 0 0 0 var(--accent-color);
    }

    50% {
        box-shadow: 0 0 30px var(--accent-color);
    }

    100% {
        box-shadow: 0 0 10px var(--accent-color);
    }
}

/* ============================================= */
/*         GAME CELL & ANIMATION FIXES           */
/* ============================================= */

/* Game cells need position:relative for skill animations */
.game-cell {
    position: relative;
    overflow: visible;
}

/* Game board needs position:relative for projectiles */
#gameBoard {
    position: relative;
    overflow: visible;
}

/* ============================================= */
/*         DARK THEME SELECT/INPUT FIXES         */
/* ============================================= */

/* Fix select dropdowns in dark theme */
.theme-dark select,
.theme-dark input,
.theme-dark textarea {
    background-color: rgba(30, 35, 50, 0.9) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.theme-dark select:focus,
.theme-dark input:focus,
.theme-dark textarea:focus {
    border-color: var(--accent-color) !important;
    outline: none;
}

/* Fix select options in dark theme */
.theme-dark select option {
    background-color: #1e2330 !important;
    color: var(--text-primary) !important;
}

/* General modal select fix */
.modal select,
.modal input,
.modal textarea {
    background-color: rgba(30, 35, 50, 0.9);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 6px;
}

.modal select:focus,
.modal input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 5px var(--accent-color-glow);
}

/* ============================================= */
/*           SCREEN FLASH ANIMATION              */
/* ============================================= */

@keyframes screen-flash {
    0% {
        opacity: 0.6;
    }

    100% {
        opacity: 0;
    }
}

/* ============================================= */
/*           HOTBAR POSITIONING FIX              */
/* ============================================= */

/* Hotbars container - same settings as button panel */
#hotbarsContainer {
    display: flex;
    flex-direction: row;
    gap: 4px;
    margin-top: auto !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    flex: none;
}

#skillHotbar,
#itemHotbar {
    margin-bottom: 0 !important;
    flex: 1;
}

/* Game board - separate block with small gap below (same as log/buttons gap) */
#gameBoard {
    margin-bottom: 4px !important;
    flex-grow: 1;
    /* Reduce height slightly to give room for hotbars */
    max-height: calc(100% - 90px);
}

/* Make left column use flexbox properly */
#gameContainer>div:first-child {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-bottom: 8px !important;
}

/* Right column stays as is */
#gameContainer>div:last-child {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Fullscreen mode */
:fullscreen #hotbarsContainer,
:-webkit-full-screen #hotbarsContainer,
:-moz-full-screen #hotbarsContainer {
    margin-top: auto !important;
    margin-bottom: 0 !important;
}

/* ================================================================
   AUTH MODALS & ACHIEVEMENT POPUP
   ================================================================ */

.auth-modal {
    background: linear-gradient(135deg, rgba(15, 20, 35, 0.98), rgba(25, 30, 50, 0.95));
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 16px;
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.8),
        0 0 100px rgba(0, 240, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: modal-appear 0.3s ease-out;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.auth-modal input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

/* User Menu Button */
#userMenu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#userMenu:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--accent-color);
}

#usernameDisplay {
    color: var(--accent-color);
    font-weight: 500;
}

/* Login Button */
#loginButton {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(0, 200, 220, 0.1));
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 8px;
    color: var(--accent-color);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

#loginButton:hover {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.3), rgba(0, 200, 220, 0.2));
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
    transform: translateY(-1px);
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: 20px;
    right: -400px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(189, 0, 255, 0.9), rgba(100, 50, 200, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(189, 0, 255, 0.5);
    z-index: 10001;
    transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-popup.show {
    right: 20px;
}

.achievement-popup-icon {
    font-size: 40px;
    animation: achievement-bounce 0.6s ease infinite alternate;
}

@keyframes achievement-bounce {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

.achievement-popup-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.8);
}

.achievement-popup-name {
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Cloud Save Indicator */
.cloud-save-indicator {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: rgba(5, 255, 161, 0.9);
    border-radius: 20px;
    color: #000;
    font-weight: 500;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 9999;
}

.cloud-save-indicator.show {
    opacity: 1;
}

/* Auth Button Style */
.auth-btn {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: var(--accent-color);
    transition: all 0.2s ease;
}

.auth-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--accent-color);
}

/* Secondary Button */
.button-secondary {
    background: rgba(100, 100, 120, 0.3);
    border: 1px solid rgba(100, 100, 120, 0.5);
    color: var(--text-secondary);
}

.button-secondary:hover {
    background: rgba(100, 100, 120, 0.5);
    border-color: rgba(150, 150, 170, 0.6);
    color: var(--text-primary);
}