/* ============================================================
   Aethermoor - Game Styles
   Dark Fantasy Theme: Purple (#4a0e4e), Gold (#ffd700), Dark (#1a0a2e)
   ============================================================ */

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Prevent text/element selection during gameplay ── */
#game-container,
#game-container *,
canvas {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
/* Re-allow selection only inside text inputs / textareas */
#game-container input,
#game-container textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* ── Windowed fullscreen (CSS-based, allows Alt+Tab) ── */
body.windowed-fullscreen #game-container,
body.windowed-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden;
    z-index: 9999;
}
body.windowed-fullscreen canvas#game-canvas {
    width: 100vw !important;
    height: 100vh !important;
}

:root {
    --color-primary: #4a0e4e;
    --color-primary-dark: #2d0a30;
    --color-primary-light: #6b1f6f;
    --color-gold: #ffd700;
    --color-gold-dark: #b8960f;
    --color-dark: #1a0a2e;
    --color-dark-lighter: #2a1540;
    --color-dark-lightest: #3a2055;
    --color-text: #e0d0f0;
    --color-text-dim: #a090b0;
    --color-text-bright: #ffffff;
    --color-hp: #c0392b;
    --color-hp-bg: #5c1a14;
    --color-mana: #2980b9;
    --color-mana-bg: #143c5c;
    --color-xp: #8e44ad;
    --color-xp-bg: #3d1f4d;
    --color-rarity-common: #b0b0b0;
    --color-rarity-magic: #4a90d9;
    --color-rarity-rare: #ffd700;
    --color-rarity-unique: #ff8c00;
    --color-rarity-legendary: #a335ee;
    --color-rarity-set: #00ff00;
    --color-crit: #ffd700;
    --color-normal: #ffffff;
    --color-miss: #808080;
    --color-blocked: #4a90d9;
    --color-dodged: #2ecc71;
    --color-poison: #2ecc71;
    --color-fire: #e74c3c;
    --color-cold: #3498db;
    --color-lightning: #f1c40f;
    --color-shadow: #8e44ad;
    --panel-bg: rgba(26, 10, 46, 0.95);
    --panel-border: 1px solid rgba(74, 14, 78, 0.8);
    --panel-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-heading: 'Georgia', serif;
    --font-mono: 'Consolas', 'Courier New', monospace;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: var(--color-dark);
    color: var(--color-text);
}

/* === Loading Screen === */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-primary-dark) 50%, var(--color-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--color-gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 0 40px rgba(255, 215, 0, 0.3);
    letter-spacing: 0.3em;
    margin-bottom: 2rem;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 0 40px rgba(255, 215, 0, 0.3); }
    to { text-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.5), 0 0 80px rgba(255, 215, 0, 0.3); }
}

.loading-bar-container {
    width: 300px;
    height: 6px;
    background: var(--color-dark-lighter);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto 1rem;
    border: 1px solid var(--color-primary);
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary-light), var(--color-gold));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.loading-text {
    color: var(--color-text-dim);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.loading-version {
    color: var(--color-text-dim);
    font-size: 0.75rem;
    opacity: 0.6;
}

/* === Connection Status Overlay === */
.connection-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--panel-bg);
    border: 2px solid var(--color-gold);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 9999;
    box-shadow: var(--panel-shadow);
}

.connection-icon {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-gold);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.connection-overlay span {
    color: var(--color-gold);
    font-size: 1rem;
}

/* === Auth Screen === */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.auth-container {
    background: var(--panel-bg);
    border: 1px solid var(--color-primary);
    border-radius: 12px;
    padding: 2.5rem;
    width: 400px;
    max-width: 90%;
    box-shadow: var(--panel-shadow);
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--color-gold);
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.auth-form h2 {
    color: var(--color-text);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    color: var(--color-text);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.auth-options a, .auth-switch a {
    color: var(--color-gold);
    text-decoration: none;
}

.auth-options a:hover, .auth-switch a:hover {
    text-decoration: underline;
}

.auth-switch {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-dim);
}

.auth-error {
    background: rgba(192, 57, 43, 0.2);
    border: 1px solid var(--color-hp);
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 1rem;
    color: #e74c3c;
    font-size: 0.85rem;
    text-align: center;
}

.auth-success {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid #2ecc71;
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 1rem;
    color: #2ecc71;
    font-size: 0.85rem;
    text-align: center;
}

.captcha-placeholder {
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--color-text-dim);
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    cursor: pointer;
}

/* === Character Selection === */
.character-select {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-primary-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 8000;
}

.character-select h1 {
    font-family: var(--font-heading);
    color: var(--color-gold);
    font-size: 2rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.character-list {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.char-select-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.character-card {
    background: var(--panel-bg);
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    padding: 1.5rem;
    width: 200px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.character-card:hover {
    border-color: var(--color-gold);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.2);
}

.character-card.selected {
    border-color: var(--color-gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.character-card .char-name {
    color: var(--color-gold);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.character-card .char-class {
    color: var(--color-text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.character-card .char-level {
    color: var(--color-text);
    font-size: 0.9rem;
}

/* === Game Container === */
.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--color-dark);
}

/* === Game Canvas === */
#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    cursor: crosshair;
}

/* === HUD Overlay === */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.hud > * {
    pointer-events: auto;
}

/* === Top Bar === */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, rgba(26, 10, 46, 0.9) 0%, rgba(26, 10, 46, 0.7) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    border-bottom: 1px solid var(--color-primary);
}

.hud-logout-btn {
    background: rgba(180, 30, 30, 0.5);
    border: 1px solid rgba(220, 80, 80, 0.6);
    color: #ffaaaa;
    border-radius: 4px;
    padding: 0 .6rem;
    height: 26px;
    font-size: .75rem;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.hud-logout-btn:hover {
    background: rgba(220, 50, 50, 0.75);
    color: #fff;
}

.hud-quit-btn {
    background: rgba(60, 60, 60, 0.5);
    border: 1px solid rgba(150, 150, 150, 0.4);
    color: #aaa;
    border-radius: 4px;
    padding: 0 .6rem;
    height: 26px;
    font-size: .75rem;
    cursor: pointer;
    transition: background .15s, color .15s;
    margin-left: 4px;
}
.hud-quit-btn:hover {
    background: rgba(100, 30, 30, 0.7);
    color: #fff;
    border-color: rgba(200, 80, 80, 0.5);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.player-name {
    color: var(--color-gold);
    font-weight: bold;
    font-size: 0.95rem;
}

.player-level {
    background: var(--color-primary);
    color: var(--color-gold);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

.zone-name {
    color: var(--color-text);
    font-size: 0.85rem;
    font-style: italic;
}

.fps-counter, .ping-display {
    color: var(--color-text-dim);
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

/* === Resource Bars === */
.resource-bars {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(400px, calc(100vw - 40px));
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bar-container {
    position: relative;
    height: 22px;
    background: var(--color-dark-lighter);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(74, 14, 78, 0.6);
}

.bar-label {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--color-text-bright);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

.bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.hp-bar { background: linear-gradient(180deg, #e74c3c, var(--color-hp)); }
.mana-bar { background: linear-gradient(180deg, #3498db, var(--color-mana)); }
.xp-bar { background: linear-gradient(180deg, #9b59b6, var(--color-xp)); }

.bar-text {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--color-text-bright);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
    font-family: var(--font-mono);
}

/* === Buff/Debuff Bar === */
.buff-bar {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.buff-icons, .debuff-icons {
    display: flex;
    gap: 4px;
}

.buff-icon, .debuff-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.buff-icon { border-color: rgba(46, 204, 113, 0.5); }
.debuff-icon { border-color: rgba(231, 76, 60, 0.5); }

.buff-icon .duration, .debuff-icon .duration {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 0.6rem;
    color: var(--color-text-bright);
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
}

/* === Skill Bar === */
.skill-bar {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    max-width: calc(100vw - 20px);
}

.skill-slot {
    width: clamp(40px, 4.5vw, 52px);
    height: clamp(40px, 4.5vw, 52px);
    background: var(--panel-bg);
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: all 0.15s;
    overflow: hidden;
}

.skill-slot:hover {
    border-color: var(--color-gold);
    transform: translateY(-2px);
}

.skill-slot.on-cooldown {
    opacity: 0.6;
}

.skill-slot .skill-key {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.65rem;
    color: var(--color-text-dim);
    font-family: var(--font-mono);
}

.skill-slot .skill-cooldown {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-bright);
    font-size: 1rem;
    font-weight: bold;
    font-family: var(--font-mono);
}

/* === HUD drag handles === */
.hud-drag-handle {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    cursor: grab;
    user-select: none;
    z-index: 10;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
}

#resource-bars:hover .hud-drag-handle,
#skill-bar:hover .hud-drag-handle,
#minimap-container:hover .hud-drag-handle,
#buff-bar:hover .hud-drag-handle {
    opacity: 1;
}

.hud-drag-handle:active {
    cursor: grabbing;
    color: var(--color-gold, #d4a017);
}

/* Ensure HUD draggable elements are position:absolute and support relative child positioning */
#resource-bars, #skill-bar, #minimap-container, #buff-bar {
    position: absolute;
}

/* === Minimap === */
.minimap-container {
    position: absolute;
    top: 50px;
    right: 10px;
    width: clamp(140px, 15vw, 200px);
    height: clamp(140px, 15vw, 200px);
}

#minimap-canvas {
    width: 100%;
    height: 100%;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    background: rgba(26, 10, 46, 0.8);
}

.minimap-controls {
    position: absolute;
    bottom: -30px;
    right: 0;
    display: flex;
    gap: 4px;
}

.minimap-controls button {
    width: 26px;
    height: 26px;
    background: var(--panel-bg);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    color: var(--color-text);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.15s;
}

.minimap-controls button:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

/* === Panels Container === */
.panels-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
}

/* === Context Menu === */
.context-menu {
    position: fixed;
    background: var(--panel-bg);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    padding: 4px 0;
    min-width: 160px;
    box-shadow: var(--panel-shadow);
    z-index: 10000;
}

.context-menu-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--color-text);
    transition: background 0.1s;
}

.context-menu-item:hover {
    background: var(--color-primary);
    color: var(--color-gold);
}

.context-menu-separator {
    height: 1px;
    background: var(--color-primary);
    margin: 4px 0;
}

/* === Tooltip === */
.tooltip {
    position: fixed;
    background: rgba(26, 10, 46, 0.97);
    border: 1px solid var(--color-gold);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    max-width: 300px;
    box-shadow: var(--panel-shadow);
    z-index: 10001;
    pointer-events: none;
    font-size: 0.85rem;
}

.tooltip .item-name {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.tooltip .item-type {
    color: var(--color-text-dim);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.tooltip .item-stat {
    color: #2ecc71;
    font-size: 0.8rem;
}

.tooltip .item-stat.negative {
    color: #e74c3c;
}

.tooltip .item-flavor {
    color: var(--color-gold);
    font-style: italic;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.tooltip .item-compare {
    color: var(--color-text-dim);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* === Notifications === */
.notification-container {
    position: fixed;
    top: 50px;
    right: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9500;
    pointer-events: none;
}

.notification {
    background: var(--panel-bg);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    min-width: 250px;
    max-width: 350px;
    box-shadow: var(--panel-shadow);
    animation: slideIn 0.3s ease;
    pointer-events: auto;
}

.notification.info { border-left: 3px solid var(--color-mana); }
.notification.success { border-left: 3px solid #2ecc71; }
.notification.warning { border-left: 3px solid var(--color-gold); }
.notification.error { border-left: 3px solid var(--color-hp); }
.notification.loot { border-left: 3px solid var(--color-rarity-legendary); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* === NPC Dialogue === */
.npc-dialogue {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90%;
    background: var(--panel-bg);
    border: 2px solid var(--color-gold);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    z-index: 500;
    box-shadow: var(--panel-shadow);
}

.dialogue-portrait {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    flex-shrink: 0;
}

.dialogue-content h3 {
    color: var(--color-gold);
    margin-bottom: 0.5rem;
    font-family: var(--font-heading);
}

.dialogue-content p {
    color: var(--color-text);
    line-height: 1.5;
    margin-bottom: 1rem;
    min-height: 2.5em;
}

.dialogue-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dialogue-option {
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: var(--color-text);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.dialogue-option:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

.dialogue-footer {
    position: absolute;
    bottom: 8px;
    right: 1rem;
    font-size: 0.7rem;
    color: var(--color-text-dim);
}

/* === Cutscene Overlay === */
.cutscene-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cutscene-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
}

.cutscene-text {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    text-align: center;
    color: var(--color-text);
    font-size: 1.1rem;
    line-height: 1.6;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

.cutscene-skip {
    position: absolute;
    bottom: 5%;
    right: 5%;
    color: var(--color-text-dim);
    font-size: 0.8rem;
    z-index: 2;
}

/* === Death Screen === */
.death-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 8500;
}

.death-screen h1 {
    font-family: var(--font-heading);
    color: var(--color-hp);
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(192, 57, 43, 0.5);
}

.death-screen p {
    color: var(--color-text-dim);
    margin-bottom: 2rem;
}

.death-options {
    display: flex;
    gap: 1rem;
}

/* === Waypoint Modal === */
.waypoint-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8600;
}

.waypoint-modal-content {
    background: var(--color-panel-bg);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.waypoint-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-panel-header);
}

.waypoint-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--color-text);
}

.waypoint-list {
    padding: 1rem;
    overflow-y: auto;
    max-height: 60vh;
}

.waypoint-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.waypoint-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--color-panel-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.waypoint-item:hover {
    background: var(--color-hover);
    border-color: var(--color-accent);
}

.waypoint-item.current-spawn {
    border-color: var(--color-gold);
    background: rgba(255, 215, 0, 0.1);
}

.waypoint-icon {
    font-size: 1.5rem;
    color: var(--color-accent);
}

.waypoint-name {
    flex: 1;
    color: var(--color-text);
    font-weight: 500;
}

.waypoint-status {
    font-size: 0.8rem;
    color: var(--color-text-dim);
}

.waypoint-item.current-spawn .waypoint-status {
    color: var(--color-gold);
}

.no-waypoints {
    text-align: center;
    color: var(--color-text-dim);
    padding: 2rem;
}

/* === Combat Dialogue === */
.combat-dialogue {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(26, 10, 46, 0.9);
    border: 1px solid var(--color-hp);
    border-radius: 8px;
    padding: 1rem 2rem;
    z-index: 400;
    animation: combatFade 2s ease forwards;
}

@keyframes combatFade {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    85% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* === Damage Numbers === */
.damage-numbers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 300;
}

.damage-number {
    position: absolute;
    font-weight: bold;
    font-family: var(--font-mono);
    animation: damageFloat 1.5s ease-out forwards;
    pointer-events: none;
}

.damage-number.normal { color: var(--color-normal); font-size: 1rem; }
.damage-number.crit { color: var(--color-crit); font-size: 1.3rem; text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
.damage-number.miss { color: var(--color-miss); font-size: 0.9rem; }
.damage-number.blocked { color: var(--color-blocked); font-size: 0.9rem; }
.damage-number.dodged { color: var(--color-dodged); font-size: 0.9rem; }

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

/* === Debug Console === */
.debug-console {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 600px;
    height: 300px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--color-primary);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    z-index: 9998;
    display: flex;
    flex-direction: column;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--color-primary-dark);
    border-radius: 8px 8px 0 0;
    font-size: 0.85rem;
    color: var(--color-gold);
}

.debug-header button {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    font-size: 1rem;
}

.debug-output {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-text);
}

.debug-output .debug-line { margin-bottom: 2px; }
.debug-output .debug-line.info { color: #3498db; }
.debug-output .debug-line.warn { color: var(--color-gold); }
.debug-output .debug-line.error { color: #e74c3c; }
.debug-output .debug-line.success { color: #2ecc71; }

.debug-input {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--color-dark-lighter);
    border: none;
    border-top: 1px solid var(--color-primary);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.debug-input:focus {
    outline: none;
    background: var(--color-dark-lightest);
}

/* === Utility Classes === */
.hidden { display: none !important; }

.btn-primary {
    background: linear-gradient(180deg, var(--color-gold-dark), var(--color-gold));
    color: var(--color-dark);
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--color-gold), #ffe44d);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--color-dark-lighter);
    color: var(--color-text);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    padding: 0.6rem 1.5rem;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

.btn-small {
    background: var(--color-dark-lighter);
    color: var(--color-text);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.btn-small:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

.search-input {
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    color: var(--color-text);
    font-size: 0.85rem;
    width: 100%;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-gold);
}

/* === Scrollbar Styling === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-dark-lighter);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-light);
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 8500;
}

.modal-content {
    background: var(--panel-bg);
    border: 2px solid var(--color-gold);
    border-radius: 12px;
    padding: 2rem;
    width: 400px;
    max-width: 90%;
    box-shadow: var(--panel-shadow);
}

.modal-content h2 {
    color: var(--color-gold);
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 0.6rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    color: var(--color-text);
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* === Tab System === */
.tab-btn, .chat-tab {
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    border-bottom: none;
    color: var(--color-text-dim);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
    border-radius: 4px 4px 0 0;
}

.tab-btn:hover, .chat-tab:hover {
    color: var(--color-text);
    background: var(--color-dark-lightest);
}

.tab-btn.active, .chat-tab.active {
    background: var(--panel-bg);
    color: var(--color-gold);
    border-color: var(--color-gold);
}

/* === DPS Meter === */
#dps-meter {
    position: fixed;
    top: 50px;
    right: 10px;
    width: 220px;
    background: var(--panel-bg);
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    padding: 0;
    font-size: 0.8rem;
    z-index: 500;
    box-shadow: var(--panel-shadow);
    transition: all 0.2s ease;
}

#dps-meter.minimized {
    width: auto;
}

#dps-meter.minimized .dps-content {
    display: none;
}

.dps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--color-primary-dark);
    border-radius: 7px 7px 0 0;
    border-bottom: 1px solid var(--color-primary);
}

.dps-title {
    color: var(--color-gold);
    font-weight: bold;
    font-size: 0.85rem;
}

.dps-toggle {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dps-toggle:hover {
    color: var(--color-gold);
}

.dps-content {
    padding: 0.75rem;
}

.dps-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0.5rem;
}

.dps-current {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dps-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-gold);
    font-family: var(--font-mono);
    line-height: 1;
}

.dps-label {
    color: var(--color-text-dim);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.dps-peak {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dps-value-small {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-text);
    font-family: var(--font-mono);
}

.dps-label-small {
    color: var(--color-text-dim);
    font-size: 0.65rem;
    text-transform: uppercase;
}

.dps-hps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-top: 1px solid var(--color-primary);
    border-bottom: 1px solid var(--color-primary);
    margin: 0.5rem 0;
}

.dps-total {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.dps-label {
    color: var(--color-text-dim);
}

.dps-total-value {
    color: var(--color-text);
    font-family: var(--font-mono);
}

.dps-breakdown {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-primary);
}

.dps-breakdown-title {
    color: var(--color-text-dim);
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.dps-breakdown-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-bottom: 2px;
}

.dps-breakdown-item .dmg-type {
    color: var(--color-text-dim);
}

.dps-breakdown-item .dmg-value {
    font-family: var(--font-mono);
}

.dps-breakdown-item .dmg-type.physical { color: #c0392b; }
.dps-breakdown-item .dmg-type.fire { color: #e74c3c; }
.dps-breakdown-item .dmg-type.cold { color: #3498db; }
.dps-breakdown-item .dmg-type.lightning { color: #f1c40f; }
.dps-breakdown-item .dmg-type.shadow { color: #9b59b6; }
.dps-breakdown-item .dmg-type.chaos { color: #e67e22; }
.dps-breakdown-item .dmg-type.heal { color: #2ecc71; }

.dps-time {
    text-align: center;
    color: var(--color-text-dim);
    font-size: 0.7rem;
    margin-top: 0.5rem;
}

.dps-crits {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 0.7rem;
    color: var(--color-text-dim);
    margin-top: 0.25rem;
}

.dps-crits .crit-count {
    color: var(--color-crit);
}

/* === Skill Layout Editor === */
#skill-layout-editor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#skill-layout-editor.hidden {
    display: none;
}

.skill-layout-editor {
    background: var(--panel-bg);
    border: 2px solid var(--color-gold);
    border-radius: 12px;
    width: 700px;
    max-width: 95%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.2);
}

.sle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--color-primary-dark);
    border-bottom: 1px solid var(--color-primary);
}

.sle-header h2 {
    color: var(--color-gold);
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin: 0;
}

.sle-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.sle-select {
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    padding: 0.4rem 0.75rem;
    color: var(--color-text);
    font-size: 0.85rem;
}

.sle-select:focus {
    outline: none;
    border-color: var(--color-gold);
}

.sle-content {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
}

.sle-preview {
    flex: 1;
    min-width: 300px;
}

.sle-preview h3 {
    color: var(--color-text);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sle-skill-bar {
    display: flex;
    gap: 6px;
    background: var(--color-dark-lighter);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--color-primary);
    justify-content: center;
}

.sle-skill-slot {
    width: 52px;
    height: 52px;
    background: var(--panel-bg);
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.sle-skill-slot:hover {
    border-color: var(--color-gold);
    transform: translateY(-2px);
}

.sle-skill-slot.filled {
    background: var(--color-dark-lightest);
}

.sle-skill-slot.drag-over {
    border-color: var(--color-gold);
    background: rgba(255, 215, 0, 0.1);
}

.sle-skill-slot.dragging {
    opacity: 0.5;
}

.sle-skill-icon {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.sle-skill-key {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.6rem;
    color: var(--color-text-dim);
    font-family: var(--font-mono);
}

.sle-skill-name {
    font-size: 0.6rem;
    color: var(--color-text);
    text-align: center;
    margin-top: 2px;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sle-slot-empty {
    font-size: 1.5rem;
    color: var(--color-text-dim);
}

.sle-page-indicator {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 1rem;
}

.sle-page-btn {
    width: 28px;
    height: 28px;
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    color: var(--color-text-dim);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.sle-page-btn:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

.sle-page-btn.active {
    background: var(--color-primary);
    border-color: var(--color-gold);
    color: var(--color-gold);
}

.sle-skills-library {
    flex: 1;
    min-width: 280px;
}

.sle-skills-library h3 {
    color: var(--color-text);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sle-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    color: var(--color-text);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.sle-search:focus {
    outline: none;
    border-color: var(--color-gold);
}

.sle-skills-list {
    max-height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sle-skill-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--color-dark-lighter);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.15s;
}

.sle-skill-item:hover {
    border-color: var(--color-primary);
    background: var(--color-dark-lightest);
}

.sle-skill-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.sle-skill-item .sle-skill-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sle-skill-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sle-skill-info .sle-skill-name {
    font-size: 0.85rem;
    color: var(--color-text);
    margin: 0;
    max-width: none;
}

.sle-skill-type {
    font-size: 0.7rem;
    color: var(--color-text-dim);
}

.sle-instructions {
    padding: 0.75rem 1.5rem;
    background: var(--color-dark-lighter);
    border-top: 1px solid var(--color-primary);
}

.sle-instructions p {
    color: var(--color-text-dim);
    font-size: 0.75rem;
    margin: 0;
}

/* === Skill Bar Edit Button === */
.skill-bar-edit-btn {
    position: absolute;
    bottom: 8px;
    right: -30px;
    width: 24px;
    height: 24px;
    background: var(--panel-bg);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    color: var(--color-text-dim);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.skill-bar-edit-btn:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

/* === AoE Targeting Indicators === */
.aoe-indicator {
    position: absolute;
    pointer-events: none;
    z-index: 150;
    border: 2px dashed;
    background: rgba(255, 215, 0, 0.1);
}

.aoe-indicator.circle {
    border-radius: 50%;
}

.aoe-indicator.cone {
    border-radius: 0;
    clip-path: polygon(0% 100%, 50% 0%, 100% 100%);
}

.aoe-indicator.line {
    border-radius: 2px;
}

.aoe-indicator.rectangle {
    border-radius: 2px;
}
