/* === DESIGN SYSTEM (WoW-inspired, derived from action bar) === */
:root {
    /* Core backgrounds */
    --ui-bg: linear-gradient(to bottom, #1a1814, #0e0c0a);
    --ui-bg-solid: #141210;
    --ui-bg-dark: #0a0908;
    --ui-bg-panel: rgba(14, 12, 10, 0.97);
    --ui-bg-header: linear-gradient(to bottom, #2a2418, #1a1610);
    --ui-bg-input: rgba(10, 8, 5, 0.7);
    --ui-bg-hover: rgba(201, 170, 88, 0.08);
    --ui-bg-slot: #1e1a14;
    --ui-bg-slot-empty: #161412;

    /* Borders */
    --ui-border: #554422;
    --ui-border-dark: #332a1e;
    --ui-border-highlight: #c9aa58;
    --ui-border-subtle: #3a3020;

    /* Text */
    --ui-text: #e8d8b0;
    --ui-text-dim: #998866;
    --ui-text-muted: #6a5a3a;
    --ui-text-bright: #fff;

    /* Accent gold */
    --ui-accent: #c9aa58;
    --ui-accent-hover: #e0c878;
    --ui-accent-glow: rgba(201, 170, 88, 0.3);
    --ui-accent-glow-strong: rgba(201, 170, 88, 0.5);

    /* Danger/Close */
    --ui-danger: #cc4444;
    --ui-danger-hover: #ee6666;
    --ui-danger-bg: #3a1a1a;

    /* Shadows */
    --ui-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
    --ui-shadow-heavy: 0 8px 40px rgba(0, 0, 0, 0.8);
    --ui-inner-glow: inset 0 1px 0 rgba(201, 170, 88, 0.1);

    /* Radius */
    --ui-radius: 4px;
    --ui-radius-sm: 3px;
}

/* === RESET & BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--ui-bg-dark);
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* === SHARED SCREEN STYLES === */
.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    position: relative;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, var(--ui-bg-dark) 70%);
}

.screen-title {
    font-size: 36px;
    color: var(--ui-accent);
    text-shadow: 0 0 20px var(--ui-accent-glow);
    margin-bottom: 24px;
    letter-spacing: 3px;
    text-align: center;
}

/* === SCREEN 1: LOGIN === */
.login-bg-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

.login-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.login-logo {
    text-align: center;
    margin-bottom: 8px;
}

.game-title {
    font-size: 52px;
    color: var(--ui-accent);
    text-shadow: 0 0 30px var(--ui-accent-glow-strong), 0 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 5px;
    animation: titleGlow 4s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 30px rgba(201, 170, 88, 0.4), 0 2px 4px rgba(0,0,0,0.8); }
    50% { text-shadow: 0 0 50px rgba(201, 170, 88, 0.7), 0 0 80px rgba(201, 170, 88, 0.3), 0 2px 4px rgba(0,0,0,0.8); }
}

.game-subtitle {
    color: var(--ui-text-muted);
    font-size: 14px;
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-top: 4px;
}

.login-box {
    width: 360px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    padding: 0 28px 28px;
    box-shadow: var(--ui-shadow-heavy), var(--ui-inner-glow);
}

.login-tabs {
    display: flex;
    margin: 0 -28px 20px;
    border-bottom: 1px solid var(--ui-border-dark);
    background: var(--ui-bg-header);
}

.login-tab {
    flex: 1;
    padding: 14px;
    background: transparent;
    border: none;
    color: var(--ui-text-muted);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
    border-bottom: 2px solid transparent;
}

.login-tab:hover { color: var(--ui-accent); }

.login-tab.active {
    color: var(--ui-accent);
    border-bottom-color: var(--ui-accent);
    background: var(--ui-bg-hover);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 11px;
    color: var(--ui-text-dim);
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--ui-accent);
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

.form-group input::placeholder { color: var(--ui-text-muted); }

.form-error {
    color: var(--ui-danger);
    font-size: 11px;
    min-height: 16px;
    margin-bottom: 8px;
    text-align: center;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--ui-bg-header);
    border: 2px solid var(--ui-accent);
    border-radius: var(--ui-radius);
    color: var(--ui-accent);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: var(--ui-inner-glow);
}

.btn-primary:hover {
    background: var(--ui-bg-hover);
    box-shadow: 0 0 16px var(--ui-accent-glow);
    transform: translateY(-1px);
    color: var(--ui-accent-hover);
    border-color: var(--ui-accent-hover);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--ui-text-muted);
    font-size: 11px;
}

.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ui-border-dark);
}

.login-divider span { padding: 0 12px; }

.btn-offline {
    width: 100%;
    padding: 10px;
    background: var(--ui-bg-header);
    border: 1px solid var(--ui-border-subtle);
    border-radius: var(--ui-radius);
    color: var(--ui-text-dim);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.btn-offline:hover {
    border-color: var(--ui-border);
    color: var(--ui-text);
    background: var(--ui-bg-hover);
}

.server-url-group {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.server-url-group:hover { opacity: 0.8; }

.server-url-group label {
    font-size: 10px;
    color: var(--ui-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.server-url-group input {
    width: 180px;
    padding: 4px 8px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: 2px;
    color: var(--ui-text-muted);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    outline: none;
    transition: border-color 0.15s;
}

.server-url-group input:focus {
    border-color: var(--ui-border);
    color: var(--ui-text);
}

/* === SCREEN 2: CHARACTER SELECT === */
.charselect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 720px;
    width: 100%;
    padding: 10px 20px;
}

.charselect-subtitle {
    margin-bottom: 0;
    text-align: center;
}

.character-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    width: 100%;
    min-height: 120px;
    padding: 0;
}

.character-list-empty {
    color: var(--ui-text-muted);
    font-size: 12px;
    text-align: center;
    padding: 40px 0;
    letter-spacing: 1px;
    grid-column: 1 / -1;
}

.char-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border-dark);
    border-radius: var(--ui-radius);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--ui-inner-glow);
}

.char-card:hover {
    border-color: var(--ui-border);
    background: var(--ui-bg-hover);
}

.char-card.selected {
    border-color: var(--ui-accent);
    box-shadow: 0 0 12px var(--ui-accent-glow);
    background: var(--ui-bg-panel);
}

.char-card-portrait {
    flex-shrink: 0;
    width: 56px;
    height: 64px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--ui-border-dark);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.char-card-portrait canvas {
    image-rendering: pixelated;
    width: 48px;
    height: 48px;
}

.char-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.char-card-name {
    color: var(--ui-accent);
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.char-card-race-class {
    color: var(--ui-text-dim);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.char-card-level {
    color: #6a8a6a;
    font-size: 10px;
    letter-spacing: 0.5px;
}

/* Character select action buttons */
.charselect-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

.charselect-enter {
    width: 100%;
    font-size: 14px;
    padding: 10px 20px;
    letter-spacing: 2px;
}

.charselect-secondary-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.charselect-secondary-actions .btn-secondary,
.charselect-secondary-actions .btn-danger,
.charselect-secondary-actions .btn-back {
    flex: 1;
    font-size: 10px;
    padding: 6px 10px;
    text-align: center;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--ui-bg-header);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.btn-secondary:hover {
    border-color: var(--ui-accent);
    color: var(--ui-accent);
    background: var(--ui-bg-hover);
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

.btn-danger {
    padding: 10px 20px;
    background: var(--ui-danger-bg);
    border: 1px solid var(--ui-danger);
    border-radius: var(--ui-radius);
    color: var(--ui-danger);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    border-color: var(--ui-danger-hover);
    color: var(--ui-danger-hover);
    background: var(--ui-danger-bg);
    box-shadow: 0 0 8px rgba(204, 102, 68, 0.2);
}

.btn-danger:disabled, .btn-secondary:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-back {
    padding: 10px 20px;
    background: var(--ui-bg);
    border: 1px solid var(--ui-border-subtle);
    border-radius: var(--ui-radius);
    color: var(--ui-text-dim);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    border-color: var(--ui-border);
    color: var(--ui-text);
    background: var(--ui-bg-header);
}

/* === SCREEN 3: CHARACTER CREATION === */
/* ==================== CHARACTER CREATE SCREEN ==================== */
.charcreate-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 720px;
    width: 100%;
    padding: 10px 20px;
}

.charcreate-layout {
    display: flex;
    gap: 20px;
    width: 100%;
    align-items: stretch;
}

/* --- Left column: Preview + Race + Class --- */
.charcreate-left {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.charcreate-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.preview-frame {
    width: 180px;
    height: 200px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.5), var(--ui-inner-glow);
}

#char-preview-canvas {
    image-rendering: pixelated;
    width: 160px;
    height: 160px;
    position: relative;
    z-index: 1;
}

.preview-pedestal {
    position: absolute;
    bottom: 16px;
    width: 80px;
    height: 10px;
    background: radial-gradient(ellipse, rgba(60,50,30,0.5) 0%, transparent 70%);
    z-index: 0;
}

.preview-class-label {
    font-size: 13px;
    color: var(--ui-accent);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--ui-accent-glow);
}

/* Section labels */
.section-label {
    display: block;
    font-size: 10px;
    color: var(--ui-text-dim);
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.charcreate-section {
    padding: 0;
}

/* --- Race grid: 2x4 compact grid --- */
.race-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.race-grid .option-btn {
    text-align: center;
    padding: 6px 4px;
    font-size: 9px;
    white-space: nowrap;
}

/* --- Class grid: 3x2 with sprite + label --- */
.class-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.class-card-create {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px 6px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border-dark);
    border-radius: var(--ui-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.class-card-create:hover {
    border-color: var(--ui-border);
    background: var(--ui-bg-hover);
}

.class-card-create.selected {
    border-color: var(--ui-accent);
    background: var(--ui-bg-panel);
    box-shadow: 0 0 10px var(--ui-accent-glow);
}

.class-card-preview {
    image-rendering: pixelated;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.class-card-name {
    font-size: 9px;
    color: var(--ui-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.class-card-create.selected .class-card-name {
    color: var(--ui-accent);
}

/* --- Right column: Appearance + Name + Buttons --- */
.charcreate-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    padding: 16px;
    box-shadow: var(--ui-inner-glow);
}

.charcreate-right > .charcreate-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- Name input row --- */
.charcreate-name-row {
    padding-top: 10px;
    border-top: 1px solid var(--ui-border-dark);
}

#char-name-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#char-name-input:focus {
    border-color: var(--ui-accent);
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

#char-name-input::placeholder { color: var(--ui-text-muted); }

.name-info {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 9px;
}

.char-count { color: var(--ui-text-muted); }
.name-error { color: var(--ui-danger); }

/* --- Buttons --- */
.charcreate-buttons {
    display: flex;
    gap: 8px;
}

.charcreate-buttons .btn-primary {
    flex: 1;
}

.charcreate-buttons .btn-back {
    flex: 0 0 auto;
}

/* --- Color swatches --- */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--ui-border-dark);
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.15);
    border-color: var(--ui-border);
    box-shadow: 0 0 6px rgba(255,255,255,0.15);
}

.color-swatch.selected {
    border-color: var(--ui-accent);
    box-shadow: 0 0 8px var(--ui-accent-glow);
    transform: scale(1.1);
}

.color-swatch.selected::after {
    content: '';
    position: absolute;
    top: -4px; left: -4px;
    right: -4px; bottom: -4px;
    border: 1px solid var(--ui-accent-glow);
    border-radius: 50%;
}

/* --- Option selectors (hair style, face type, etc.) --- */
.option-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.option-btn {
    padding: 5px 10px;
    background: var(--ui-bg-slot, rgba(20,18,15,0.8));
    border: 1px solid var(--ui-border-dark);
    border-radius: 3px;
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: capitalize;
}

.option-btn:hover {
    border-color: var(--ui-border);
    background: var(--ui-bg-hover, rgba(40,35,25,0.9));
}

.option-btn.selected {
    border-color: var(--ui-accent);
    background: var(--ui-bg-hover);
    color: var(--ui-accent);
    box-shadow: 0 0 6px var(--ui-accent-glow);
}

/* Appearance panel option buttons */
.appearance-option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.appearance-option-btn {
    padding: 3px 8px;
    background: var(--ui-bg-slot, rgba(20,18,15,0.8));
    border: 1px solid var(--ui-border-dark);
    border-radius: 3px;
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: capitalize;
}

.appearance-option-btn:hover {
    border-color: var(--ui-border);
    background: var(--ui-bg-hover, rgba(40,35,25,0.9));
}

.appearance-option-btn.selected {
    border-color: var(--ui-accent);
    background: var(--ui-bg-hover);
    color: var(--ui-accent);
}

/* Spec Selection (Character Creation) */
/* Spellbook spec indicator */
.spellbook-spec-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--ui-bg-slot);
    border: 1px solid var(--ui-border-dark);
    border-radius: 4px;
    margin-bottom: 8px;
}

.spellbook-spec-name {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.spellbook-spec-change {
    font-size: 10px;
    color: var(--ui-accent);
    cursor: pointer;
    margin-left: auto;
    background: none;
    border: 1px solid var(--ui-border-dark);
    border-radius: 3px;
    padding: 2px 8px;
    transition: all 0.15s;
}

.spellbook-spec-change:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
    color: var(--ui-accent-hover);
}

/* Spec change modal overlay */
.spec-change-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.spec-change-modal {
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: var(--ui-radius);
    padding: 20px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: var(--ui-shadow-heavy);
}

.spec-change-modal h3 {
    color: var(--ui-accent);
    font-size: 14px;
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 1px;
}

.spec-change-modal .spec-cost {
    font-size: 11px;
    color: var(--ui-text-dim);
    text-align: center;
    margin-bottom: 12px;
}

.spec-change-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.spec-change-card {
    background: var(--ui-bg-slot);
    border: 1px solid var(--ui-border-dark);
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.spec-change-card:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-border);
}

.spec-change-card.current {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
    cursor: default;
}

.spec-change-card .spec-card-name {
    font-size: 12px;
    font-weight: bold;
}

.spec-change-card .spec-card-desc {
    font-size: 10px;
    color: var(--ui-text-dim);
    line-height: 1.3;
}

.spec-change-card .current-label {
    font-size: 9px;
    color: var(--ui-accent);
    float: right;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.spec-change-close {
    display: block;
    margin: 0 auto;
    background: none;
    border: 1px solid var(--ui-border);
    border-radius: 4px;
    color: var(--ui-text-dim);
    padding: 4px 20px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s;
}

.spec-change-close:hover {
    border-color: var(--ui-accent);
    color: var(--ui-text);
}

/* Delete confirmation modal */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-dialog {
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-danger);
    border-radius: var(--ui-radius);
    padding: 24px;
    text-align: center;
    max-width: 350px;
    box-shadow: var(--ui-shadow-heavy), var(--ui-inner-glow);
}

.confirm-dialog h3 {
    color: var(--ui-danger);
    margin-bottom: 12px;
}

.confirm-dialog p {
    color: var(--ui-text);
    font-size: 12px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-buttons button {
    padding: 8px 24px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border-radius: var(--ui-radius-sm);
    cursor: pointer;
    background: var(--ui-bg-header);
    border: 1px solid var(--ui-border);
    color: var(--ui-text);
    transition: all 0.15s;
}

.confirm-buttons button:hover {
    border-color: var(--ui-accent);
    color: var(--ui-accent);
}

/* === LEGACY CLASS SELECT (kept for compatibility) === */
.class-options {
    display: flex;
    gap: 24px;
}

.subtitle {
    color: var(--ui-text-dim);
    font-size: 16px;
    margin-bottom: 40px;
    letter-spacing: 2px;
}

/* === GAME SCREEN === */
#game-screen {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    touch-action: none;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    cursor: crosshair;
    touch-action: none;
    -webkit-touch-callout: none;
}

#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform-origin: top left;
}

#game-ui > * {
    pointer-events: auto;
}

/* === UNIT FRAMES === */
.unit-frame {
    position: absolute;
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    min-width: 200px;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

#player-frame {
    top: 12px;
    left: 12px;
}

#target-frame {
    top: 12px;
    left: 240px;
}

#target-portrait {
    border-color: #a33;
}

.unit-portrait {
    width: 40px;
    height: 40px;
    background: var(--ui-bg-dark);
    border: 2px solid var(--ui-border);
    border-radius: 2px;
    flex-shrink: 0;
    overflow: hidden;
}

.unit-portrait canvas {
    display: block;
    image-rendering: pixelated;
}

.unit-info {
    flex: 1;
    min-width: 140px;
}

.unit-name {
    font-size: 12px;
    font-weight: bold;
    color: var(--ui-text-bright);
    margin-bottom: 2px;
}

.unit-level {
    font-size: 10px;
    color: var(--ui-text-dim);
    margin-bottom: 4px;
}

.bar-container {
    height: 14px;
    background: var(--ui-bg-dark);
    border: 1px solid var(--ui-border-dark);
    border-radius: 2px;
    margin-bottom: 2px;
    position: relative;
    overflow: hidden;
}

.hp-bar {
    height: 100%;
    background: linear-gradient(to bottom, #4a2, #282);
    width: 100%;
    transition: width 0.3s;
    position: relative;
}

.mana-bar {
    height: 100%;
    background: linear-gradient(to bottom, #33a, #228);
    width: 100%;
    transition: width 0.3s;
    position: relative;
}

.breath-bar-container {
    margin-top: 1px;
}

.breath-bar {
    height: 100%;
    background: linear-gradient(to bottom, #3388bb, #226688);
    width: 100%;
    transition: width 0.3s;
    position: relative;
}

.bar-container span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    color: #fff;
    text-shadow: 1px 1px 1px #000;
    z-index: 1;
    white-space: nowrap;
}

/* === CAST BAR (WoW-style, centered above action bar) === */
#cast-bar {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 20px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    z-index: 110;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

#cast-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(to bottom, #e8c840, #c9aa30, #a08020);
    border-radius: 1px;
    transition: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

#cast-bar-text {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    z-index: 2;
    pointer-events: none;
    white-space: nowrap;
}

#cast-bar-timer {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    z-index: 2;
    pointer-events: none;
}

#cast-bar.interrupted #cast-bar-fill {
    background: linear-gradient(to bottom, #cc3333, #992222);
}

#cast-bar.interrupted #cast-bar-text {
    color: var(--ui-danger);
    font-weight: bold;
}

/* GCD sweep overlay on action bar slots */
.ability-gcd-sweep {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    pointer-events: none;
    border-radius: 3px;
    z-index: 1;
}

/* === ACTION BAR (12 slots, WoW-style) === */
#action-bar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: stretch;
    z-index: 100;
}

#action-bar-slots {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: var(--ui-bg);
    border-top: 2px solid var(--ui-border);
    border-bottom: 2px solid var(--ui-border-dark);
    border-left: 1px solid var(--ui-border-dark);
    border-right: 1px solid var(--ui-border-dark);
}

.action-bar-end {
    width: 12px;
    background: var(--ui-bg-header);
    border: 1px solid var(--ui-border);
}
.action-bar-end.left {
    border-radius: var(--ui-radius) 0 0 var(--ui-radius);
    border-right: none;
    background: var(--ui-bg-header);
    border-color: var(--ui-border);
}
.action-bar-end.right {
    border-radius: 0 var(--ui-radius) var(--ui-radius) 0;
    border-left: none;
    background: var(--ui-bg-header);
    border-color: var(--ui-border);
}

.ability-slot {
    width: 40px;
    height: 50px;
    position: relative;
    cursor: pointer;
}

.ability-slot.empty-slot .ability-icon {
    background: var(--ui-bg-slot-empty);
    border-color: var(--ui-border-dark);
}

.ability-icon {
    width: 40px;
    height: 40px;
    background: var(--ui-bg-slot);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s;
}

.ability-slot:not(.empty-slot):hover .ability-icon {
    border-color: var(--ui-accent);
    box-shadow: 0 0 6px var(--ui-accent-glow);
}

.ability-icon.usable {
    border-color: #88aa44;
    box-shadow: inset 0 0 8px rgba(136, 170, 68, 0.15);
}

.ability-icon.on-cooldown {
    filter: brightness(0.35) saturate(0.3);
}

.ability-cooldown-sweep {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    pointer-events: none;
    border-radius: 3px;
    z-index: 2;
}

.ability-cooldown {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    z-index: 3;
}

.ability-key {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--ui-accent);
    text-shadow: 1px 1px 1px #000;
}

.ability-name {
    display: none;
}

.ability-slot:hover .ability-name {
    display: block;
    position: absolute;
    bottom: 54px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    padding: 6px 10px;
    font-size: 11px;
    white-space: normal;
    width: 200px;
    color: var(--ui-text-bright);
    border-radius: var(--ui-radius-sm);
    z-index: 200;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.ability-slot.not-enough-mana .ability-icon {
    border-color: #334488;
}

/* === MICRO MENU BAR === */
/* === MICRO MENU BAR (WoW-style bottom-right) === */
#micro-menu {
    position: fixed;
    bottom: 34px;
    right: 12px;
    display: flex;
    gap: 2px;
    z-index: 500;
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    border-top: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    padding: 3px;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

.micro-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--ui-bg-header);
    border: 1px solid var(--ui-border-subtle);
    border-radius: 2px;
    position: relative;
    transition: all 0.15s ease;
}

.micro-btn:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
    box-shadow: 0 0 6px var(--ui-accent-glow);
    transform: scale(1.08);
}

.micro-btn:active {
    background: var(--ui-bg-dark);
    transform: scale(0.95);
}

.micro-btn .micro-icon {
    font-size: 15px;
    color: var(--ui-text-dim);
    line-height: 1;
    transition: color 0.15s, text-shadow 0.15s;
}

.micro-btn:hover .micro-icon {
    color: var(--ui-accent-hover);
    text-shadow: 0 0 4px var(--ui-accent-glow);
}

/* Micro menu tooltip */
.micro-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 38px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    color: var(--ui-text);
    font-size: 11px;
    font-family: 'Courier New', monospace;
    padding: 5px 10px;
    white-space: nowrap;
    border-radius: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 300;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.micro-btn:hover::after {
    opacity: 1;
}

/* === BAG BAR === */
#bag-bar {
    position: fixed;
    bottom: 80px;
    right: 12px;
    display: flex;
    gap: 3px;
    z-index: 490;
    align-items: flex-end;
}

.bag-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--ui-bg-header);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    transition: all 0.15s;
}

.bag-btn:hover {
    border-color: var(--ui-accent);
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

.bag-icon {
    font-size: 18px;
    color: var(--ui-text-dim);
}

.bag-btn:hover .bag-icon {
    color: var(--ui-accent);
}

/* === XP BAR === */
#xp-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 16px;
    background: var(--ui-bg-dark);
    border-top: 2px solid var(--ui-border);
}

#xp-bar {
    height: 100%;
    background: linear-gradient(to bottom, #6a3d9a, #4a2d7a);
    width: 0%;
    transition: width 0.5s;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

#xp-bar-rested {
    height: 100%;
    background: linear-gradient(to bottom, #2a5599, #1a3566);
    width: 0%;
    transition: width 0.5s;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    display: none;
}

#xp-bar span {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    line-height: 16px;
    color: #ddd;
    text-shadow: 1px 1px 1px #000;
    white-space: nowrap;
    z-index: 3;
    pointer-events: none;
}

/* === QUEST TRACKER === */
/* === QUEST TRACKER (floating below minimap, right side) === */
#quest-tracker {
    position: absolute;
    top: 226px;
    right: 8px;
    width: 200px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 19;
    pointer-events: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-accent-glow) transparent;
}

#quest-tracker::-webkit-scrollbar { width: 4px; }
#quest-tracker::-webkit-scrollbar-track { background: transparent; }
#quest-tracker::-webkit-scrollbar-thumb { background: var(--ui-accent-glow); border-radius: 2px; }

#quest-tracker-header {
    font-size: 11px;
    color: var(--ui-text-dim);
    margin-bottom: 4px;
    text-align: right;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 1px 1px 3px #000, 0 0 6px #000;
}

#quest-tracker-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.qt-quest {
    margin-bottom: 4px;
}

.qt-quest-title {
    color: var(--ui-accent);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    text-shadow: 1px 1px 3px #000, 0 0 6px #000;
    line-height: 1.4;
    text-align: right;
}

.qt-quest-title:hover {
    color: var(--ui-accent-hover);
    text-decoration: underline;
}

.qt-quest-title.qt-ready {
    color: var(--ui-accent);
}

.qt-objective {
    color: var(--ui-text-dim);
    font-size: 11px;
    font-family: 'Courier New', monospace;
    padding-right: 0;
    text-shadow: 1px 1px 3px #000, 0 0 6px #000;
    line-height: 1.3;
    text-align: right;
}

.qt-objective.qt-obj-done {
    color: #55aa55;
}

.qt-ready-text {
    color: #55aa55;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    text-shadow: 1px 1px 3px #000, 0 0 6px #000;
    text-align: right;
}

/* === CHAT PANEL (WoW-style) === */
#chat-panel {
    position: absolute;
    bottom: 80px;
    left: 12px;
    width: 360px;
    height: 160px;
    min-height: 80px;
    max-height: 500px;
    display: flex;
    flex-direction: column;
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
    z-index: 40;
    transition: opacity 0.3s;
}

#chat-panel.chat-faded {
    opacity: 0.5;
}

#chat-panel:hover,
#chat-panel.chat-focused {
    opacity: 1;
}

/* Resize handle */
#chat-resize-handle {
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    z-index: 42;
}

#chat-resize-handle::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--ui-border);
    border-radius: 2px;
    margin: 3px auto 0;
    opacity: 0;
    transition: opacity 0.2s;
}

#chat-panel:hover #chat-resize-handle::after,
#chat-resize-handle:hover::after {
    opacity: 1;
}

/* Chat header */
#chat-header {
    display: flex;
    flex-shrink: 0;
    background: var(--ui-bg-header);
    border-bottom: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius) var(--ui-radius) 0 0;
    overflow: hidden;
    align-items: center;
    cursor: move;
    user-select: none;
}

#chat-header-label {
    font-size: 10px;
    font-family: 'Courier New', monospace;
    color: var(--ui-accent);
    padding: 4px 10px;
    user-select: none;
}

#chat-emote-btn {
    padding: 4px 8px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    color: #ff8c40;
    cursor: pointer;
    border-right: 1px solid var(--ui-border-dark);
    background: var(--ui-bg);
    white-space: nowrap;
    user-select: none;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}

#chat-emote-btn:hover {
    color: #ffaa66;
    background: var(--ui-bg-hover);
}

/* Scroll indicator */
#chat-scroll-indicator {
    display: none;
    text-align: center;
    font-size: 9px;
    color: var(--ui-text-dim);
    padding: 2px 0;
    background: linear-gradient(to bottom, var(--ui-bg-panel), transparent);
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}

#chat-scroll-indicator:hover {
    color: var(--ui-accent);
}

/* Combat log (now inside chat panel) */
#combat-log {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    font-size: 11px;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-border-dark) transparent;
}

#combat-log::-webkit-scrollbar {
    width: 4px;
}

#combat-log::-webkit-scrollbar-track {
    background: transparent;
}

#combat-log::-webkit-scrollbar-thumb {
    background: var(--ui-border-dark);
    border-radius: 2px;
}

#combat-log-content {
    display: flex;
    flex-direction: column;
}

.log-entry {
    margin-bottom: 2px;
    line-height: 1.3;
    transition: opacity 0.3s;
}

.log-timestamp {
    color: var(--ui-text-muted);
    font-size: 9px;
    margin-right: 4px;
    opacity: 0.7;
}

/* Message fade effect (older messages fade when not focused) */
#chat-panel.chat-faded .log-entry {
    opacity: 0.6;
}

#chat-panel.chat-faded .log-entry:nth-last-child(-n+3) {
    opacity: 0.8;
}

#chat-panel.chat-faded .log-entry:last-child {
    opacity: 1;
}

#chat-panel:hover .log-entry,
#chat-panel.chat-focused .log-entry {
    opacity: 1;
}

.log-damage { color: #c44; }
.log-heal { color: #4c4; }
.log-info { color: #cc4; }
.log-loot { color: #4cc; }
.log-quest { color: #c9aa58; }
.log-xp { color: #a4a; }
.log-system { color: #888; }

/* Chat input area (integrated into chat panel) */
#chat-input-area {
    display: none;
    flex-shrink: 0;
    padding: 4px;
    border-top: 1px solid var(--ui-border-dark);
}

#chat-input-area.visible {
    display: block;
}

#chat-input {
    width: 100%;
    padding: 5px 8px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: 2px;
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

#chat-input:focus {
    border-color: var(--ui-accent);
    box-shadow: 0 0 6px var(--ui-accent-glow);
}

#chat-input::placeholder {
    color: var(--ui-text-muted);
    font-size: 10px;
}

/* === MINI MAP (WoW-style circular) === */
#mini-map {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#mini-map-frame {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: var(--ui-radius);
    overflow: hidden;
    border: 3px solid var(--ui-border);
    box-shadow:
        0 0 0 1px var(--ui-border-dark),
        0 0 8px rgba(0, 0, 0, 0.8),
        inset 0 0 6px rgba(0, 0, 0, 0.5),
        0 0 15px var(--ui-accent-glow);
    background: var(--ui-bg-dark);
}

#mini-map-canvas {
    display: block;
    image-rendering: pixelated;
    border-radius: 4px;
}

#mini-map-zone-name {
    margin-top: 4px;
    padding: 2px 10px;
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border-subtle);
    border-radius: var(--ui-radius-sm);
    color: var(--ui-accent);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    text-align: center;
    text-shadow: 1px 1px 2px #000;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === PANEL COMMON === */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--ui-bg-header);
    border-bottom: 1px solid var(--ui-border);
    cursor: move;
    user-select: none;
}

.panel-header h3 {
    font-size: 14px;
    color: var(--ui-accent);
    letter-spacing: 1px;
}

.close-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--ui-text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 2px;
    transition: all 0.15s;
}

.close-btn:hover {
    color: var(--ui-danger);
    border-color: var(--ui-danger);
    background: var(--ui-danger-bg);
}

.gold-display {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--ui-accent);
    border-bottom: 1px solid var(--ui-border-dark);
    background: var(--ui-bg-input);
}

.bag-bar-btn {
    width: 36px;
    height: 36px;
    background: var(--ui-bg-header);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: var(--ui-accent);
    position: relative;
    transition: border-color 0.15s, background 0.15s;
}

.bag-bar-btn:hover {
    border-color: var(--ui-accent);
    background: var(--ui-bg-hover);
    box-shadow: 0 0 6px var(--ui-accent-glow);
}

.bag-bar-btn.bag-active {
    border-color: var(--ui-accent);
    background: var(--ui-bg-hover);
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

.bag-bar-btn.bag-empty {
    background: var(--ui-bg-slot-empty);
    border-color: var(--ui-border-dark);
    cursor: pointer;
}

.bag-bar-btn.bag-empty:hover {
    border-color: var(--ui-border-subtle);
    background: var(--ui-bg-slot-hover, rgba(255,255,255,0.05));
}

.bag-bar-openall {
    font-size: 14px;
    font-weight: bold;
    color: var(--ui-accent);
    margin-right: 4px;
}

.bag-count-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--ui-bg-panel);
    color: var(--ui-text-dim);
    font-size: 8px;
    padding: 0 3px;
    border-radius: 2px;
    pointer-events: none;
    line-height: 12px;
}

.bag-bar-btn canvas {
    image-rendering: pixelated;
}

/* Equipment is managed by the Character Panel (#character-panel) */

/* === BAG WINDOWS === */
.bag-window {
    position: fixed;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    z-index: 98;
    min-width: 170px;
    user-select: none;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

.bag-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: var(--ui-bg-header);
    border-bottom: 1px solid var(--ui-border);
    cursor: move;
    border-radius: 2px 2px 0 0;
}

.bag-window-header.rarity-uncommon { border-bottom-color: #1eff00; }
.bag-window-header.rarity-rare { border-bottom-color: #0070dd; }
.bag-window-header.rarity-epic { border-bottom-color: #a335ee; }

.bag-window-title {
    font-size: 11px;
    color: var(--ui-accent);
    font-weight: bold;
}

.bag-close-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--ui-text-dim);
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    border-radius: 2px;
    transition: all 0.15s;
}

.bag-close-btn:hover {
    color: var(--ui-danger);
    border-color: var(--ui-danger);
}

.bag-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.bag-slot {
    width: 36px;
    height: 36px;
    background: var(--ui-bg-slot);
    border: 1px solid var(--ui-border-dark);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color 0.1s;
}

.inv-slot canvas, .char-equip-slot canvas {
    image-rendering: pixelated;
}

.bag-slot:hover { border-color: var(--ui-border); }

.bag-slot.has-item { cursor: grab; }

.bag-slot canvas {
    image-rendering: pixelated;
}

.bag-slot-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bag-slot .bag-item-placeholder {
    font-size: 9px;
    text-align: center;
}

/* Stack count */
.stack-count {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 1px #000, -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000;
    pointer-events: none;
    z-index: 2;
    line-height: 1;
}

/* Drag states */
.bag-slot.dragging {
    opacity: 0.4;
    border-color: var(--ui-accent);
}

.bag-slot.drag-over {
    border-color: var(--ui-accent) !important;
    background: var(--ui-bg-hover);
}

/* Item rarity borders (WoW: grey=poor, white=common, green=uncommon, blue=rare, purple=epic) */
.rarity-poor { border-color: #666 !important; }
.rarity-common { border-color: #888 !important; }
.rarity-uncommon { border-color: #1eff00 !important; }
.rarity-rare { border-color: #0070dd !important; }
.rarity-epic { border-color: #a335ee !important; }
.rarity-legendary { border-color: #ff8000 !important; }

/* === WOW-STYLE CHARACTER PANEL === */
#character-panel {
    position: fixed;
    width: 600px;
    max-height: 85vh;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    z-index: 50;
    overflow-y: auto;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

#char-panel-body {
    padding: 0;
}

#char-panel-columns {
    display: flex;
    flex-direction: row;
}

#char-paperdoll {
    flex: 0 0 310px;
    border-right: 1px solid var(--ui-border-dark);
    background: linear-gradient(180deg, rgba(26,24,20,0.3) 0%, rgba(14,12,10,0.1) 100%);
}

#char-panel-columns #char-stats {
    flex: 1;
    overflow-y: auto;
    max-height: 70vh;
    background: linear-gradient(180deg, rgba(20,18,14,0.3) 0%, rgba(10,8,6,0.1) 100%);
}

@media (max-width: 640px) {
    #character-panel { width: 95vw; max-width: 400px; }
    #char-panel-columns { flex-direction: column; }
    #char-paperdoll { flex: none; border-right: none; border-bottom: 1px solid var(--ui-border-dark); }
    #char-panel-columns #char-stats { max-height: 260px; }
}

#char-equip-area {
    display: flex;
    justify-content: space-between;
    padding: 8px 6px 4px;
    background: linear-gradient(180deg, rgba(26,24,20,0.8) 0%, rgba(14,12,10,0.6) 100%);
    border-bottom: 1px solid var(--ui-border-dark);
}

.char-slot-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 44px;
}

.char-equip-slot {
    width: 44px;
    height: 44px;
    background: var(--ui-bg-slot);
    border: 2px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.15s;
}

.char-equip-slot:hover {
    border-color: var(--ui-border);
}

.char-equip-slot.has-item:hover {
    border-color: var(--ui-accent);
    box-shadow: 0 0 6px var(--ui-accent-glow);
}

.char-equip-slot .slot-icon {
    image-rendering: pixelated;
    width: 36px;
    height: 36px;
    pointer-events: none;
}

.char-equip-slot .slot-label {
    display: none;
}

.char-equip-slot:not(.has-item):hover .slot-label {
    display: block;
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: var(--ui-text-muted);
    white-space: nowrap;
    z-index: 10;
    background: rgba(0,0,0,0.85);
    padding: 1px 4px;
    border-radius: 2px;
}

/* Character model area */
#char-model-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 8px 4px;
}

#char-model-canvas {
    image-rendering: pixelated;
    width: 96px;
    height: 128px;
    border: 1px solid var(--ui-border-dark);
    background: radial-gradient(ellipse at center, rgba(42, 36, 20, 0.5) 0%, rgba(14, 12, 10, 0.8) 100%);
    border-radius: var(--ui-radius);
    margin-bottom: 6px;
}

#char-model-name {
    font-size: 13px;
    color: var(--ui-accent);
    font-weight: bold;
    text-align: center;
}

#char-model-level {
    font-size: 11px;
    color: var(--ui-text-dim);
    text-align: center;
}

/* Bottom weapon slots */
#char-slots-bottom {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--ui-bg-input);
    border-bottom: 1px solid var(--ui-border-dark);
}

#char-slots-bottom .char-equip-slot {
    width: 50px;
    height: 50px;
}

#char-slots-bottom .char-equip-slot .slot-icon {
    width: 40px;
    height: 40px;
}

/* Stats panel in character screen */
#char-stats {
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.6;
}

#char-stats hr {
    border: none;
    border-top: 1px solid var(--ui-border-dark);
    margin: 5px 0;
}

#char-stats .stats-section-title {
    color: var(--ui-accent);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
    margin-top: 2px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
}

.stat-label { color: var(--ui-text-dim); }
.stat-value { color: var(--ui-text-bright); }
.stat-bonus { color: #4c4; }
.stat-value-derived { color: var(--ui-text-dim); }

/* === QUEST DIALOG === */
#quest-dialog {
    position: fixed;
    z-index: 100;
}

.quest-dialog-content {
    width: 400px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: var(--ui-radius);
    padding: 20px;
    box-shadow: var(--ui-shadow-heavy), 0 0 30px var(--ui-accent-glow);
}

.quest-dialog-content h3 {
    color: var(--ui-accent);
    font-size: 16px;
    margin-bottom: 8px;
    cursor: move;
    user-select: none;
    letter-spacing: 1px;
}

#quest-dialog-giver {
    color: var(--ui-text-dim);
    font-size: 12px;
    margin-bottom: 12px;
    font-style: italic;
}

#quest-dialog-desc {
    color: var(--ui-text);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}

#quest-dialog-rewards {
    padding: 8px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    margin-bottom: 16px;
    font-size: 12px;
}

#quest-dialog-rewards .reward-title {
    color: var(--ui-accent);
    margin-bottom: 4px;
}

.quest-dialog-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.quest-dialog-buttons button {
    padding: 6px 20px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    transition: all 0.15s;
}

#quest-accept-btn, #quest-complete-btn {
    background: linear-gradient(to bottom, #2a4a2a, #1a2e1a);
    color: #6c6;
    border-color: #4a4;
}

#quest-accept-btn:hover, #quest-complete-btn:hover {
    background: linear-gradient(to bottom, #3a5a3a, #2a3e2a);
    box-shadow: 0 0 8px rgba(68, 170, 68, 0.3);
}

#quest-decline-btn {
    background: linear-gradient(to bottom, #3a2a2a, #2a1a1a);
    color: #c66;
    border-color: #a44;
}

#quest-decline-btn:hover {
    background: linear-gradient(to bottom, #4a3a3a, #3a2a2a);
    box-shadow: 0 0 8px rgba(204, 68, 68, 0.2);
}

/* === LOOT POPUP === */
/* === WOW-STYLE LOOT WINDOW === */
#loot-popup {
    position: fixed;
    width: 240px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    z-index: 80;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

.loot-panel-header {
    background: var(--ui-bg-header) !important;
    border-bottom: 1px solid var(--ui-border) !important;
    padding: 6px 10px !important;
    cursor: move;
    user-select: none;
}

.loot-panel-header h3.loot-header-name {
    font-size: 12px;
    color: var(--ui-accent);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}

#loot-items {
    padding: 4px;
    max-height: 300px;
    overflow-y: auto;
}

/* Loot item row */
.loot-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid var(--ui-border-dark);
    transition: background 0.15s;
    border-radius: 3px;
    margin: 1px 0;
}

.loot-row:hover {
    background: var(--ui-bg-hover);
}

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

/* Loot item icon with quality border */
.loot-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: 2px solid #666;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.loot-coin-icon {
    border-color: var(--ui-accent);
}

/* Loot item name */
.loot-name {
    flex: 1;
    font-size: 12px;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Gold row */
.loot-gold-row .loot-name {
    color: var(--ui-accent);
}

/* Coin denomination colors */
.coin-gold { color: #ffd700; font-weight: bold; }
.coin-silver { color: #c0c0c0; }
.coin-copper { color: #c08050; }

/* Loot All button */
.loot-all-btn {
    justify-content: center;
    color: var(--ui-accent) !important;
    font-weight: bold;
    text-align: center;
    border-top: 1px solid var(--ui-border) !important;
    margin-top: 2px;
    padding: 6px !important;
    font-size: 11px;
    letter-spacing: 1px;
}

.loot-all-btn:hover {
    background: var(--ui-bg-hover) !important;
    color: var(--ui-accent-hover) !important;
}

/* Legacy loot styles (kept for compatibility) */
.loot-item {
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid var(--ui-border-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.loot-item:hover {
    background: var(--ui-bg-hover);
}

.loot-item:last-child { border-bottom: none; }

.loot-gold { color: var(--ui-accent); }

/* === LEVEL UP EFFECT === */
#level-up-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 200;
    pointer-events: none;
    animation: levelUpAnim 3s ease-out forwards;
}

.level-up-text {
    font-size: 48px;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.9), 0 0 60px rgba(255, 215, 0, 0.5), 0 0 100px rgba(255, 200, 0, 0.3);
    letter-spacing: 6px;
}

.level-up-level {
    font-size: 24px;
    color: #fff4cc;
    margin-top: 8px;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

@keyframes levelUpAnim {
    0% { opacity: 0; transform: translate(-50%, -40%) scale(0.5); }
    10% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
    20% { transform: translate(-50%, -50%) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* === DEATH SCREEN === */
#death-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: deathFadeIn 2s ease-out forwards;
}

@keyframes deathFadeIn {
    0% { background: rgba(0, 0, 0, 0); }
    100% { background: rgba(40, 0, 0, 0.75); }
}

#death-screen h2 {
    font-size: 56px;
    color: #a33;
    text-shadow: 0 0 30px rgba(200, 50, 50, 0.6), 0 0 60px rgba(200, 50, 50, 0.3);
    margin-bottom: 16px;
    letter-spacing: 8px;
    animation: deathTextPulse 3s ease-in-out infinite;
}

@keyframes deathTextPulse {
    0%, 100% { text-shadow: 0 0 30px rgba(200, 50, 50, 0.6); }
    50% { text-shadow: 0 0 50px rgba(200, 50, 50, 0.9), 0 0 80px rgba(200, 50, 50, 0.5); }
}

#death-screen p {
    color: var(--ui-text-dim);
    margin-bottom: 24px;
    font-size: 14px;
}

#respawn-btn {
    padding: 10px 30px;
    background: linear-gradient(to bottom, #2e1810, #1a0e0a);
    border: 2px solid #c44;
    color: #c44;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--ui-radius);
    transition: all 0.2s;
    letter-spacing: 1px;
}

#respawn-btn:hover {
    background: linear-gradient(to bottom, #3a2018, #2a1410);
    box-shadow: 0 0 12px rgba(204, 68, 68, 0.3);
    border-color: #e66;
    color: #e66;
}

/* === GHOST MODE UI — WoW-style Death Overlay === */
#ghost-mode-ui {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 350;
    pointer-events: none;
}

#death-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0);
    animation: deathBackdropFadeIn 2s ease-out forwards;
    pointer-events: none;
}

@keyframes deathBackdropFadeIn {
    0%   { background: rgba(0, 0, 0, 0); }
    100% { background: rgba(5, 0, 0, 0.55); }
}

#death-banner {
    position: relative;
    margin-top: 14vh;
    z-index: 2;
    animation: deathBannerSlideIn 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
}

@keyframes deathBannerSlideIn {
    0%   { opacity: 0; transform: translateY(-30px) scale(0.95); }
    60%  { opacity: 1; transform: translateY(4px) scale(1.01); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

#death-banner-border {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 60px 24px;
    background: linear-gradient(180deg, rgba(15, 8, 4, 0.95) 0%, rgba(25, 12, 6, 0.92) 40%, rgba(10, 5, 2, 0.95) 100%);
    border: 2px solid #8b6914;
    border-radius: 6px;
    box-shadow:
        0 0 40px rgba(180, 120, 30, 0.15),
        0 0 80px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(180, 140, 60, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    min-width: 380px;
    pointer-events: all;
}

/* Gold corner accents */
#death-banner-border::before,
#death-banner-border::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border-color: #c4a030;
    border-style: solid;
}
#death-banner-border::before {
    top: -1px; left: -1px;
    border-width: 3px 0 0 3px;
    border-radius: 4px 0 0 0;
}
#death-banner-border::after {
    top: -1px; right: -1px;
    border-width: 3px 3px 0 0;
    border-radius: 0 4px 0 0;
}

#death-banner-skull {
    font-size: 36px;
    margin-bottom: 4px;
    filter: grayscale(0.3);
    opacity: 0.85;
    animation: skullPulse 3s ease-in-out infinite;
}

@keyframes skullPulse {
    0%, 100% { opacity: 0.7; text-shadow: 0 0 8px rgba(200, 50, 30, 0.3); }
    50%      { opacity: 0.95; text-shadow: 0 0 20px rgba(200, 50, 30, 0.6); }
}

#ghost-death-text {
    font-size: 42px;
    font-weight: bold;
    color: #cc2020;
    text-shadow:
        0 0 20px rgba(200, 30, 20, 0.7),
        0 0 50px rgba(200, 30, 20, 0.35),
        0 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 6px;
    text-transform: uppercase;
    animation: deathTextGlow 3s ease-in-out infinite;
    margin-bottom: 4px;
}

@keyframes deathTextGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(200, 30, 20, 0.7), 0 0 50px rgba(200, 30, 20, 0.35), 0 2px 4px rgba(0, 0, 0, 0.8); color: #cc2020; }
    50%      { text-shadow: 0 0 30px rgba(220, 40, 20, 0.9), 0 0 70px rgba(220, 40, 20, 0.5), 0 2px 4px rgba(0, 0, 0, 0.8); color: #dd3030; }
}

#death-banner-separator {
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8b6914, transparent);
    margin: 10px 0 14px;
}

#ghost-instructions {
    color: var(--ui-text);
    font-size: 13px;
    margin-bottom: 6px;
    letter-spacing: 1px;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

#ghost-corpse-distance {
    color: #8899bb;
    font-size: 12px;
    margin-bottom: 14px;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* "Release Spirit" button — shown immediately on death */
#release-spirit-btn {
    padding: 10px 36px;
    background: linear-gradient(to bottom, #3a1a10, #2a0e08);
    border: 2px solid #c44;
    color: #ee8866;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    border-radius: var(--ui-radius);
    transition: all 0.2s;
    letter-spacing: 2px;
    text-transform: uppercase;
    pointer-events: all;
    margin-bottom: 6px;
    animation: releaseBtnPulse 2.5s ease-in-out infinite;
}

@keyframes releaseBtnPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(204, 68, 68, 0.25), inset 0 1px 0 rgba(255, 150, 100, 0.1); }
    50%      { box-shadow: 0 0 22px rgba(204, 68, 68, 0.5), inset 0 1px 0 rgba(255, 150, 100, 0.2); }
}

#release-spirit-btn:hover {
    background: linear-gradient(to bottom, #4a2418, #3a1810);
    box-shadow: 0 0 20px rgba(204, 68, 68, 0.5);
    border-color: #e88;
    color: #ffaa88;
}

/* "Resurrect Now" button — shown when near corpse in ghost form */
#resurrect-btn {
    margin-top: 8px;
    padding: 10px 36px;
    background: linear-gradient(to bottom, #1a3a20, #0e2a14);
    border: 2px solid #44cc66;
    color: #88eebb;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    border-radius: var(--ui-radius);
    transition: all 0.2s;
    letter-spacing: 2px;
    text-transform: uppercase;
    pointer-events: all;
    animation: resBtnPulse 2s ease-in-out infinite;
}

@keyframes resBtnPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(68, 204, 100, 0.3); }
    50%      { box-shadow: 0 0 20px rgba(68, 204, 100, 0.6); }
}

#resurrect-btn:hover {
    background: linear-gradient(to bottom, #2a4a30, #1a3a20);
    box-shadow: 0 0 18px rgba(68, 204, 100, 0.5);
    border-color: #66ee88;
    color: #aaffcc;
}

#spirit-healer-btn {
    margin-top: 6px;
    padding: 8px 28px;
    background: linear-gradient(to bottom, #2a1a3a, #1a0e2a);
    border: 2px solid #aa66cc;
    color: #cc99ee;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    border-radius: var(--ui-radius);
    transition: all 0.2s;
    letter-spacing: 1px;
    text-transform: uppercase;
    pointer-events: all;
}

#spirit-healer-btn:hover {
    background: linear-gradient(to bottom, #3a2a4a, #2a1a3a);
    box-shadow: 0 0 14px rgba(170, 100, 204, 0.5);
    border-color: #cc88ee;
    color: #ddbbff;
}

/* Res sickness warning */
#death-res-sickness-warning {
    color: #cc8844;
    font-size: 11px;
    margin-top: 10px;
    letter-spacing: 0.5px;
    text-align: center;
    opacity: 0.85;
}

#death-res-sickness-warning .warning-icon {
    color: #ddaa44;
    margin-right: 4px;
}

/* Corpse-run state: compact top banner (after releasing spirit) */
#ghost-mode-ui.corpse-run #death-backdrop {
    animation: none;
    background: none;
}

#ghost-mode-ui.corpse-run #death-banner {
    margin-top: 8px;
    animation: none;
    opacity: 1;
    transform: none;
}

#ghost-mode-ui.corpse-run #death-banner-border {
    padding: 10px 30px 12px;
    min-width: auto;
    background: linear-gradient(180deg, rgba(15, 18, 30, 0.9) 0%, rgba(10, 12, 22, 0.88) 100%);
    border-color: #4466aa;
    box-shadow: 0 0 20px rgba(40, 60, 120, 0.2), 0 4px 16px rgba(0, 0, 0, 0.6);
}

#ghost-mode-ui.corpse-run #death-banner-skull {
    display: none;
}

#ghost-mode-ui.corpse-run #ghost-death-text {
    font-size: 18px;
    color: #8899cc;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(80, 120, 200, 0.5), 0 1px 2px rgba(0, 0, 0, 0.6);
    animation: none;
    margin-bottom: 0;
}

#ghost-mode-ui.corpse-run #death-banner-separator {
    margin: 6px 0 8px;
    background: linear-gradient(90deg, transparent, #4466aa, transparent);
}

#ghost-mode-ui.corpse-run #ghost-instructions {
    color: #8899bb;
    font-size: 12px;
    margin-bottom: 4px;
}

#ghost-mode-ui.corpse-run #ghost-corpse-distance {
    margin-bottom: 8px;
}

#ghost-mode-ui.corpse-run #release-spirit-btn {
    display: none;
}

#ghost-mode-ui.corpse-run #death-res-sickness-warning {
    display: none !important;
}

/* === SPIRIT HEALER DIALOG === */
#spirit-healer-dialog {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(20, 30, 50, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 350;
}

#spirit-healer-content {
    background: linear-gradient(to bottom, #1a2236, #0e1520);
    border: 2px solid #4488bb;
    border-radius: var(--ui-radius);
    padding: 24px 32px;
    max-width: 400px;
    color: #c0d0e0;
    box-shadow: 0 0 30px rgba(60, 120, 180, 0.3), inset 0 1px 0 rgba(100, 160, 220, 0.1);
}

#spirit-healer-content h3 {
    color: #88bbee;
    font-size: 20px;
    margin-bottom: 12px;
    text-shadow: 0 0 8px rgba(100, 150, 220, 0.4);
    letter-spacing: 2px;
}

#spirit-healer-content p {
    margin-bottom: 10px;
    line-height: 1.5;
    font-size: 13px;
}

#spirit-healer-content ul {
    list-style: none;
    padding: 0;
    margin: 0 0 14px 0;
}

#spirit-healer-content ul li {
    padding: 4px 0;
    color: #cc6666;
    font-size: 12px;
}

#spirit-healer-content ul li::before {
    content: '\2022 ';
    color: #cc6666;
}

.spirit-healer-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.spirit-healer-buttons button {
    flex: 1;
    padding: 8px 16px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--ui-radius);
    transition: all 0.2s;
}

#spirit-healer-accept {
    background: linear-gradient(to bottom, #2a1810, #1a0e0a);
    border: 2px solid #cc6644;
    color: #cc8866;
}

#spirit-healer-accept:hover {
    background: linear-gradient(to bottom, #3a2818, #2a1810);
    border-color: #ee8866;
    color: #eeaa88;
    box-shadow: 0 0 10px rgba(204, 100, 68, 0.3);
}

#spirit-healer-decline {
    background: linear-gradient(to bottom, #182a18, #0e1a0e);
    border: 2px solid #448844;
    color: #66aa66;
}

#spirit-healer-decline:hover {
    background: linear-gradient(to bottom, #283a28, #1a2a1a);
    border-color: #66cc66;
    color: #88cc88;
    box-shadow: 0 0 10px rgba(68, 136, 68, 0.3);
}

/* === ITEM TOOLTIP === */
#item-tooltip {
    position: absolute;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    padding: 10px;
    min-width: 180px;
    max-width: 250px;
    z-index: 500;
    pointer-events: none;
    font-size: 12px;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

.tooltip-name {
    font-weight: bold;
    margin-bottom: 4px;
}

.tooltip-type {
    color: var(--ui-text-dim);
    font-size: 11px;
    margin-bottom: 6px;
}

.tooltip-stat {
    color: #4c4;
    margin-bottom: 1px;
}

.tooltip-flavor {
    color: var(--ui-text-dim);
    font-style: italic;
    margin-top: 6px;
    font-size: 11px;
}

/* === BUFF/DEBUFF DISPLAY (WoW-style, left of minimap) === */
#buff-container {
    position: absolute;
    top: 12px;
    right: 198px; /* to the left of the minimap (minimap is ~188px from right edge) */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    z-index: 20;
}

#buff-row {
    display: flex;
    flex-direction: row-reverse; /* grow leftward, rightmost buff closest to minimap */
    gap: 3px;
    align-items: flex-start;
}

#debuff-row {
    display: flex;
    flex-direction: row-reverse; /* grow leftward */
    gap: 3px;
    align-items: flex-start;
}

.buff-icon {
    width: 26px;
    height: 26px;
    background: var(--ui-bg-input);
    border: 1.5px solid var(--ui-border);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    position: relative;
    cursor: default;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.buff-icon:hover {
    border-color: var(--ui-accent);
    box-shadow: 0 0 6px var(--ui-accent-glow);
    z-index: 5;
}

.buff-icon.is-debuff {
    border-color: #882222;
    background: rgba(40, 8, 8, 0.92);
}

.buff-icon.is-debuff:hover {
    border-color: #cc4444;
    box-shadow: 0 0 6px rgba(200, 50, 50, 0.4);
}

.buff-icon-inner {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 13px;
    line-height: 1;
    color: var(--ui-text);
}

.buff-icon-sprite {
    width: 22px !important;
    height: 22px !important;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}

.buff-timer {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: #4a4;
    border-radius: 0 0 1px 1px;
    transition: width 0.25s linear;
}

.buff-time-text {
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    font-family: 'Courier New', monospace;
    color: var(--ui-text-dim);
    white-space: nowrap;
    text-shadow: 0 1px 2px #000;
    pointer-events: none;
}

/* Buff tooltip */
.buff-icon .buff-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--ui-bg-panel);
    border: 1.5px solid var(--ui-accent);
    border-radius: var(--ui-radius-sm);
    padding: 6px 10px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    color: var(--ui-text);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 300;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
    text-align: center;
    min-width: 100px;
}

.buff-icon .buff-tooltip.is-debuff {
    border-color: #cc4444;
    box-shadow: var(--ui-shadow);
}

.buff-tooltip .buff-tooltip-name {
    color: var(--ui-accent);
    font-weight: bold;
    font-size: 11px;
    margin-bottom: 3px;
}

.buff-icon .buff-tooltip.is-debuff .buff-tooltip-name {
    color: var(--ui-danger-hover);
}

.buff-tooltip .buff-tooltip-desc {
    color: var(--ui-text-dim);
    font-size: 9px;
    margin-bottom: 2px;
}

.buff-tooltip .buff-tooltip-time {
    color: var(--ui-text-dim);
    font-size: 9px;
    margin-top: 3px;
    padding-top: 3px;
    border-top: 1px solid var(--ui-border-dark);
}

.buff-icon:hover .buff-tooltip {
    opacity: 1;
}

/* === SHOP PANEL === */
#shop-panel {
    position: fixed;
    width: 280px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: var(--ui-radius);
    z-index: 90;
    box-shadow: var(--ui-shadow), 0 0 20px var(--ui-accent-glow);
}

#shop-tabs {
    display: flex;
    border-bottom: 1px solid var(--ui-border-dark);
}

.shop-tab {
    flex: 1;
    padding: 8px;
    background: var(--ui-bg-input);
    border: none;
    color: var(--ui-text-dim);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.shop-tab.active {
    color: var(--ui-accent);
    border-bottom-color: var(--ui-accent);
    background: var(--ui-bg-hover);
}

.shop-tab:hover { color: var(--ui-text); }

#shop-items {
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.shop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid var(--ui-border-dark);
    cursor: pointer;
    font-size: 12px;
    transition: background 0.1s;
    border-radius: 2px;
}

.shop-item:hover { background: var(--ui-bg-hover); }
.shop-item:last-child { border-bottom: none; }
.shop-item-name { flex: 1; color: var(--ui-text); }
.shop-item-price { color: var(--ui-accent); margin-left: 8px; }

/* === TOOLTIP COMPARISON === */
.tooltip-comparison {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--ui-border-dark);
    font-size: 11px;
}

.tooltip-compare-better { color: #4c4; }
.tooltip-compare-worse { color: #c44; }
.tooltip-compare-label { color: var(--ui-text-dim); font-size: 10px; margin-bottom: 2px; }
.tooltip-sell-price { color: var(--ui-accent); margin-top: 4px; font-size: 10px; }

/* === QUEST LOG PANEL === */
#quest-log-panel {
    position: fixed;
    width: 560px;
    max-height: 80vh;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow-heavy), var(--ui-inner-glow);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

#quest-log-panel .quest-log-header {
    background: var(--ui-bg-header);
    border-bottom: 1px solid var(--ui-border);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

#quest-log-panel .quest-log-header h3 {
    color: var(--ui-accent);
    font-size: 16px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
}

#quest-log-body {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#quest-log-list {
    width: 220px;
    min-width: 220px;
    overflow-y: auto;
    border-right: 1px solid var(--ui-border-dark);
    scrollbar-width: thin;
    scrollbar-color: var(--ui-accent-glow) transparent;
}
#quest-log-list::-webkit-scrollbar { width: 5px; }
#quest-log-list::-webkit-scrollbar-track { background: transparent; }
#quest-log-list::-webkit-scrollbar-thumb { background: var(--ui-accent-glow); border-radius: 2px; }

#quest-log-detail {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-accent-glow) transparent;
}
#quest-log-detail::-webkit-scrollbar { width: 5px; }
#quest-log-detail::-webkit-scrollbar-track { background: transparent; }
#quest-log-detail::-webkit-scrollbar-thumb { background: var(--ui-accent-glow); border-radius: 2px; }

/* Quest log list items */
.ql-zone-header {
    color: var(--ui-accent);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 10px 4px;
    border-bottom: 1px solid var(--ui-border-dark);
    background: var(--ui-bg-input);
    font-weight: bold;
}

.ql-quest-item {
    padding: 6px 10px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.1s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ql-quest-item:hover {
    background: var(--ui-bg-hover);
}

.ql-quest-item.ql-selected {
    background: var(--ui-bg-hover);
    border-left-color: var(--ui-accent);
}

.ql-quest-level {
    color: var(--ui-text-dim);
    font-size: 10px;
    min-width: 20px;
    text-align: center;
}

.ql-quest-name {
    font-size: 12px;
    color: var(--ui-text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ql-quest-item.ql-complete .ql-quest-name {
    color: #55aa55;
}

.ql-quest-status {
    font-size: 9px;
    color: var(--ui-text-dim);
    min-width: 14px;
    text-align: center;
}

.ql-quest-status.ql-status-complete {
    color: #55aa55;
}

/* Completed quests collapsible section */
.ql-completed-header {
    padding: 8px 10px;
    cursor: pointer;
    color: var(--ui-text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-top: 1px solid var(--ui-border-dark);
    border-bottom: 1px solid var(--ui-border-dark);
    background: var(--ui-bg-input);
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.ql-completed-header:hover {
    background: var(--ui-bg-hover);
}

.ql-completed-arrow {
    font-size: 8px;
    transition: transform 0.15s;
}

.ql-completed-arrow.ql-expanded {
    transform: rotate(90deg);
}

.ql-completed-list {
    display: none;
}

.ql-completed-list.ql-show {
    display: block;
}

.ql-completed-item {
    padding: 4px 10px;
    color: var(--ui-text-muted);
    font-size: 11px;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.ql-completed-item:hover {
    background: var(--ui-bg-hover);
}

.ql-completed-item.ql-selected {
    background: var(--ui-bg-hover);
    border-left-color: var(--ui-text-muted);
}

.ql-no-quests {
    color: var(--ui-text-muted);
    font-size: 12px;
    text-align: center;
    padding: 30px 10px;
    font-style: italic;
}

/* Quest log detail pane */
.ql-detail-empty {
    color: var(--ui-text-muted);
    font-size: 12px;
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

.ql-detail-content {
    padding: 14px 16px;
}

.ql-detail-title {
    color: var(--ui-accent);
    font-size: 16px;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.ql-detail-level {
    color: var(--ui-text-dim);
    font-size: 11px;
    margin-bottom: 10px;
}

.ql-detail-desc {
    color: var(--ui-text);
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 14px;
    padding: 10px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
}

.ql-detail-section-title {
    color: var(--ui-accent);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--ui-border-dark);
}

.ql-detail-obj {
    font-size: 12px;
    color: var(--ui-text);
    margin-bottom: 4px;
    padding-left: 4px;
}

.ql-detail-obj.ql-obj-done {
    color: #55aa55;
}

.ql-detail-obj-bar {
    height: 3px;
    background: var(--ui-border-dark);
    border-radius: 2px;
    margin: 2px 0 6px 4px;
    overflow: hidden;
}

.ql-detail-obj-bar-fill {
    height: 100%;
    background: var(--ui-accent);
    border-radius: 2px;
    transition: width 0.2s;
}

.ql-detail-obj-bar-fill.ql-bar-complete {
    background: #55aa55;
}

.ql-detail-rewards {
    margin-top: 12px;
    padding: 8px 10px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
}

.ql-detail-reward-item {
    font-size: 11px;
    color: var(--ui-text);
    margin-top: 3px;
}

.ql-detail-reward-item.ql-reward-xp {
    color: #aa44aa;
}

.ql-detail-reward-item.ql-reward-gold {
    color: var(--ui-accent);
}

.ql-detail-reward-item.ql-reward-item-name {
    color: #4488cc;
}

/* Quest log action buttons */
.ql-detail-actions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.ql-detail-actions button {
    padding: 5px 14px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: var(--ui-radius-sm);
    transition: all 0.15s;
}

.ql-btn-track {
    background: transparent;
    border: 1px solid var(--ui-border);
    color: var(--ui-text-dim);
}

.ql-btn-track:hover {
    border-color: var(--ui-accent);
    color: var(--ui-accent);
}

.ql-btn-track.ql-tracking {
    border-color: var(--ui-accent);
    color: var(--ui-accent);
    background: var(--ui-bg-hover);
}

.ql-btn-abandon {
    background: transparent;
    border: 1px solid var(--ui-danger);
    color: var(--ui-danger);
}

.ql-btn-abandon:hover {
    background: var(--ui-danger-bg);
    color: var(--ui-danger-hover);
}

/* Quest log turn-in badge */
.ql-turnin-badge {
    display: inline-block;
    color: #55aa55;
    font-size: 10px;
    font-weight: bold;
    margin-top: 8px;
    padding: 3px 8px;
    background: rgba(85, 170, 85, 0.1);
    border: 1px solid rgba(85, 170, 85, 0.3);
    border-radius: var(--ui-radius-sm);
}

/* === WORLD MAP === */
#world-map-overlay { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.85); display:flex; align-items:center; justify-content:center; z-index:200; }
#world-map-wrapper { position:fixed; display:flex; flex-direction:row; align-items:stretch; z-index:201; max-height:90vh; }
#world-map-content { display:flex; flex-direction:column; align-items:center; background:var(--ui-bg-panel); border:2px solid var(--ui-border); border-radius:var(--ui-radius); padding:0 0 8px; box-shadow:var(--ui-shadow-heavy), var(--ui-inner-glow); }
#world-map-title-bar { display:flex; align-items:center; justify-content:space-between; width:100%; background:var(--ui-bg-header); border-bottom:1px solid var(--ui-border); border-radius:var(--ui-radius) var(--ui-radius) 0 0; padding:0 8px 0 0; }
#world-map-title { color:var(--ui-accent); font-size:18px; padding:10px 16px 8px; font-family:"Courier New"; cursor:move; user-select:none; flex:1; text-align:center; letter-spacing:2px; }
#world-map-canvas { border:none; image-rendering:pixelated; margin:8px; }
#world-map-hint { color:var(--ui-text-dim); font-size:11px; font-family:"Courier New"; }

/* World map legend */
#world-map-legend {
    display: flex;
    gap: 12px;
    padding: 4px 12px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    color: var(--ui-text-dim);
    flex-wrap: wrap;
    justify-content: center;
}
.map-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.legend-player { background: #00ff00; }
.legend-npc { background: #ccaa22; }
.legend-quest-avail { background: #ffcc00; box-shadow: 0 0 4px #ffcc00; }
.legend-quest-turnin { background: #ffcc00; border: 1px solid #fff; }
.legend-mob { background: rgba(180, 50, 50, 0.7); }

/* === SPELLBOOK PANEL (replaces talent panel) === */
#talent-panel {
    position: fixed;
    width: 520px;
    max-height: 85vh;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    z-index: 150;
    overflow-y: auto;
    font-family: "Courier New", monospace;
    color: var(--ui-text);
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

.spellbook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--ui-bg-header);
    border-bottom: 2px solid var(--ui-border);
    position: relative;
    cursor: move;
    user-select: none;
}

.spellbook-header h3 {
    color: var(--ui-accent);
    font-size: 16px;
    margin: 0;
    letter-spacing: 2px;
}

.spellbook-class {
    color: var(--ui-text-dim);
    font-size: 11px;
}

.spellbook-close {
    position: absolute;
    right: 12px;
    top: 8px;
    background: none;
    border: 1px solid transparent;
    color: var(--ui-text-dim);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 2px;
    transition: all 0.15s;
}
.spellbook-close:hover {
    color: var(--ui-danger);
    border-color: var(--ui-danger);
}

/* School Tabs */
.spellbook-tabs {
    display: flex;
    border-bottom: 2px solid var(--ui-border-dark);
    background: var(--ui-bg-panel);
}

.spellbook-tab {
    flex: 1;
    padding: 8px 6px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--ui-text-dim);
    font-family: "Courier New", monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.spellbook-tab:hover {
    color: var(--ui-text);
    background: var(--ui-bg-hover);
}

.spellbook-tab.active {
    color: var(--ui-accent);
    background: var(--ui-bg-hover);
    border-bottom-color: var(--ui-accent);
}

/* Spell List */
.spellbook-content {
    padding: 8px;
    max-height: 45vh;
    overflow-y: auto;
}

.spellbook-spell {
    display: flex;
    gap: 10px;
    padding: 8px;
    margin-bottom: 4px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius);
    transition: border-color 0.2s, background 0.2s;
    align-items: flex-start;
}

.spellbook-spell:hover {
    border-color: var(--ui-border);
    background: var(--ui-bg-hover);
}

.spellbook-spell.learned {
    border-color: #4a4;
    background: rgba(25, 40, 25, 0.5);
}

.spellbook-spell.locked {
    opacity: 0.45;
    border-color: var(--ui-bg-slot-empty);
}

.spellbook-spell-icon {
    font-size: 28px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ui-bg-dark);
    border: 2px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    flex-shrink: 0;
}

.spellbook-spell.learned .spellbook-spell-icon {
    border-color: #4a4;
}

.spellbook-spell-info {
    flex: 1;
    min-width: 0;
}

.spellbook-spell-name {
    color: var(--ui-text-bright);
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 2px;
}

.spellbook-rank {
    color: var(--ui-accent);
    font-weight: normal;
    font-size: 10px;
}

.spellbook-spell-cost {
    color: var(--ui-text-dim);
    font-size: 10px;
    margin-bottom: 3px;
}

.spellbook-spell-desc {
    color: var(--ui-text-dim);
    font-size: 10px;
    line-height: 1.3;
}

.spellbook-spell-desc.locked-desc {
    color: var(--ui-danger);
    font-weight: bold;
    margin-bottom: 2px;
}

.spellbook-next-rank {
    color: var(--ui-text-dim);
    font-size: 9px;
    font-style: italic;
    margin-top: 3px;
}

/* Spell action buttons */
.spellbook-spell-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 50px;
}

.spellbook-assign-btn {
    background: var(--ui-bg-slot);
    border: 1px solid var(--ui-border);
    color: var(--ui-text);
    font-family: "Courier New", monospace;
    font-size: 9px;
    padding: 3px 6px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.spellbook-assign-btn:hover {
    background: var(--ui-bg-hover);
    color: var(--ui-text-bright);
}

.spellbook-bar-slot {
    color: var(--ui-accent);
    font-size: 9px;
    background: var(--ui-bg-hover);
    padding: 1px 4px;
    border-radius: 2px;
}

.spellbook-status {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 2px;
}

.spellbook-status.available {
    color: #4a4;
    background: rgba(68, 170, 68, 0.15);
}

.spellbook-status.locked {
    color: #a44;
    background: rgba(170, 68, 68, 0.15);
}

/* Action Bar Assignment */
.spellbook-actionbar {
    padding: 10px 12px;
    border-top: 2px solid var(--ui-border);
    background: var(--ui-bg-panel);
}

.spellbook-actionbar-title {
    color: var(--ui-accent);
    font-size: 10px;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.spellbook-actionbar-slots {
    display: flex;
    gap: 3px;
    justify-content: center;
}

.spellbook-bar-slot-box {
    width: 42px;
    height: 50px;
    background: var(--ui-bg-slot);
    border: 2px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
    position: relative;
}

.spellbook-bar-slot-box:hover {
    border-color: var(--ui-border);
}

.spellbook-bar-slot-box.assigning {
    border-color: #4a4;
    animation: assignPulse 0.6s ease-in-out infinite;
}

@keyframes assignPulse {
    0%, 100% { border-color: #4a4; }
    50% { border-color: #8f8; box-shadow: 0 0 6px rgba(68, 255, 68, 0.3); }
}

.spellbook-bar-key {
    position: absolute;
    bottom: 1px;
    font-size: 8px;
    color: var(--ui-accent);
}

.spellbook-bar-icon {
    font-size: 18px;
}

.spellbook-bar-icon.empty {
    color: var(--ui-text-muted);
    font-size: 14px;
}

.spellbook-bar-name {
    font-size: 7px;
    color: var(--ui-text-dim);
    max-width: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* New Spell Toast Notification */
.spell-toast {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transition: top 0.5s ease;
    box-shadow: 0 0 20px var(--ui-accent-glow);
    min-width: 280px;
    font-family: "Courier New", monospace;
}

.spell-toast.show {
    top: 60px;
}

.spell-toast-icon {
    font-size: 32px;
    line-height: 1;
}

.spell-toast-info {
    flex: 1;
}

.spell-toast-label {
    font-size: 10px;
    color: var(--ui-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.spell-toast-name {
    font-size: 16px;
    color: var(--ui-accent);
    font-weight: bold;
}

/* Empty ability slot styling */
.ability-icon.empty-slot {
    background: var(--ui-bg-slot-empty);
    border-color: var(--ui-border-dark);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--ui-bg-dark); }
::-webkit-scrollbar-thumb { background: var(--ui-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ui-accent); }

/* Combo Points */
#combo-points {
    pointer-events: none;
}

/* Combo point pulse animation */
@keyframes comboPulse {
    0% { transform: scale(1.5); box-shadow: 0 0 12px rgba(255, 170, 0, 0.9); }
    100% { transform: scale(1); box-shadow: 0 0 6px rgba(255, 170, 0, 0.6); }
}

/* Stealth mode indicator */
#stealth-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 50;
}

/* Energy tick markers */
.energy-tick-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* Rogue not-enough-energy border */
.ability-slot.not-enough-mana .ability-icon {
    border-color: #553300;
}

/* Hearthstone button */
#hearthstone-btn:hover {
    border-color: var(--ui-accent) !important;
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

#hearthstone-btn.on-cooldown {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Achievement Toast */
.achievement-toast {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: 8px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transition: top 0.5s ease;
    box-shadow: 0 0 20px var(--ui-accent-glow);
    min-width: 280px;
}

.achievement-toast.show {
    top: 20px;
}

.achievement-icon {
    font-size: 36px;
    line-height: 1;
}

.achievement-info {
    flex: 1;
}

.achievement-label {
    font-size: 10px;
    color: var(--ui-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-title {
    font-size: 16px;
    color: var(--ui-accent);
    font-weight: bold;
}

.achievement-desc {
    font-size: 11px;
    color: var(--ui-text-dim);
    margin-top: 2px;
}

/* === GAME PANELS (shared base) === */
.game-panel {
    position: fixed;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    z-index: 160;
    font-family: 'Courier New', monospace;
    min-width: 320px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

.game-panel .panel-header {
    background: var(--ui-bg-header);
    border-bottom: 1px solid var(--ui-border);
    padding: 10px 14px;
    cursor: move;
    user-select: none;
}

.game-panel .panel-header h3 {
    color: var(--ui-accent);
    font-size: 15px;
    letter-spacing: 1px;
}

/* === SOCIAL PANEL === */
#social-panel {
    width: 340px;
}

#social-content {
    padding: 12px;
}

.social-section {
    margin-bottom: 14px;
}

.social-section h4 {
    color: var(--ui-accent);
    font-size: 12px;
    border-bottom: 1px solid var(--ui-border-dark);
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.social-empty {
    color: var(--ui-text-muted);
    font-size: 11px;
    font-style: italic;
    padding: 6px 0;
}

/* === ACHIEVEMENTS PANEL === */
#achievements-panel {
    width: 420px;
}

#achievements-content {
    padding: 12px;
    max-height: 60vh;
    overflow-y: auto;
}

.achievement-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 4px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    transition: border-color 0.2s;
}

.achievement-entry:hover {
    border-color: var(--ui-border);
}

.achievement-entry.earned {
    border-color: var(--ui-accent);
    background: var(--ui-bg-hover);
}

.achievement-entry .ach-icon {
    font-size: 24px;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.achievement-entry .ach-info {
    flex: 1;
}

.achievement-entry .ach-title {
    color: var(--ui-text);
    font-size: 12px;
    font-weight: bold;
}

.achievement-entry.earned .ach-title {
    color: var(--ui-accent);
}

.achievement-entry .ach-desc {
    color: var(--ui-text-dim);
    font-size: 10px;
    margin-top: 2px;
}

.achievement-entry .ach-status {
    font-size: 10px;
    color: var(--ui-text-dim);
    flex-shrink: 0;
}

/* === HELP PANEL === */
#help-panel {
    width: 380px;
}

#help-content {
    padding: 12px;
}

.help-section {
    margin-bottom: 14px;
}

.help-section h4 {
    color: var(--ui-accent);
    font-size: 12px;
    border-bottom: 1px solid var(--ui-border-dark);
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.help-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 11px;
    color: var(--ui-text);
}

.help-key {
    background: var(--ui-bg-header);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    padding: 2px 8px;
    color: var(--ui-accent);
    font-size: 10px;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

/* === MAIN MENU PANEL === */
#main-menu-panel {
    width: 280px;
    text-align: center;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    box-shadow: var(--ui-shadow-heavy), var(--ui-inner-glow);
}

.main-menu-content {
    padding: 24px 20px;
}

.main-menu-content h3 {
    color: var(--ui-accent);
    font-size: 18px;
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--ui-accent-glow);
    cursor: move;
    user-select: none;
}

.main-menu-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 6px;
    background: var(--ui-bg-header);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 1px;
}

.main-menu-btn:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
    color: var(--ui-accent);
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

.main-menu-btn.logout-btn {
    margin-top: 12px;
    border-color: var(--ui-danger);
    color: var(--ui-danger);
}

.main-menu-btn.logout-btn:hover {
    background: var(--ui-danger-bg);
    border-color: var(--ui-danger-hover);
    color: var(--ui-danger-hover);
    box-shadow: 0 0 8px rgba(204, 102, 68, 0.2);
}

/* === SETTINGS PANEL === */
#settings-panel {
    width: 380px;
}

#settings-content {
    padding: 16px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--ui-border-dark);
    font-size: 12px;
    color: var(--ui-text-dim);
}

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

.settings-row label {
    flex: 1;
    color: var(--ui-text);
}

.settings-row input[type="range"] {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--ui-bg-dark);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    outline: none;
    margin: 0 8px;
}

.settings-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: linear-gradient(to bottom, var(--ui-accent), var(--ui-text-dim));
    border: 1px solid var(--ui-border);
    border-radius: 50%;
    cursor: pointer;
}

.settings-row input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: linear-gradient(to bottom, var(--ui-accent), var(--ui-text-dim));
    border: 1px solid var(--ui-border);
    border-radius: 50%;
    cursor: pointer;
}

#volume-value {
    font-size: 11px;
    color: var(--ui-accent);
    min-width: 30px;
    text-align: right;
}

.settings-value-label {
    font-size: 11px;
    color: var(--ui-accent);
    min-width: 36px;
    text-align: right;
}

.settings-section-label {
    font-size: 11px;
    font-weight: bold;
    color: var(--ui-accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 10px 0 4px 0;
    border-bottom: 1px solid var(--ui-border);
    margin-bottom: 2px;
}

.settings-section-label:first-child {
    padding-top: 0;
}

.settings-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stepper-btn {
    width: 26px;
    height: 26px;
    background: linear-gradient(to bottom, var(--ui-bg-hover), var(--ui-bg-dark));
    border: 1px solid var(--ui-border);
    border-radius: 3px;
    color: var(--ui-accent);
    font-size: 14px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: background 0.1s, border-color 0.1s;
    padding: 0;
    line-height: 1;
}

.stepper-btn:hover {
    background: linear-gradient(to bottom, var(--ui-bg-panel), var(--ui-bg-hover));
    border-color: var(--ui-accent);
}

.stepper-btn:active {
    background: var(--ui-bg-dark);
}

.settings-stepper .settings-value-label {
    min-width: 40px;
    text-align: center;
}

.settings-reset-row {
    text-align: center;
    padding: 12px 0 4px 0;
}

.settings-reset-btn {
    background: var(--ui-danger-bg);
    border: 1px solid var(--ui-danger);
    color: var(--ui-danger);
    padding: 6px 18px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
}

.settings-reset-btn:hover {
    background: var(--ui-danger-bg);
    border-color: var(--ui-danger-hover);
    color: var(--ui-danger-hover);
}

/* Toggle Switch */
.toggle-switch {
    width: 40px;
    height: 20px;
    background: var(--ui-bg-dark);
    border: 1px solid var(--ui-border-dark);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.toggle-switch[data-on="true"] {
    background: #2a3a1a;
    border-color: #4a6a2a;
}

.toggle-slider {
    width: 16px;
    height: 16px;
    background: linear-gradient(to bottom, var(--ui-text-dim), var(--ui-text-muted));
    border-radius: 50%;
    position: absolute;
    top: 1px;
    left: 1px;
    transition: all 0.2s;
}

.toggle-switch[data-on="true"] .toggle-slider {
    left: 21px;
    background: linear-gradient(to bottom, #88cc44, #66aa22);
}

/* === PROFESSION PANEL === */
#profession-panel {
    position: fixed;
    width: 520px;
    max-height: 80vh;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    z-index: 150;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    color: var(--ui-text);
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

#profession-content {
    padding: 8px 12px 12px;
}

.prof-section-title {
    color: var(--ui-accent);
    font-size: 13px;
    font-weight: bold;
    margin: 8px 0 6px;
    border-bottom: 1px solid var(--ui-border-dark);
    padding-bottom: 4px;
}

.prof-summary {
    margin-bottom: 8px;
}

.prof-empty {
    color: var(--ui-text-dim);
    font-size: 11px;
    padding: 8px 0;
    text-align: center;
    font-style: italic;
}

.prof-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
}

.prof-row-name {
    width: 130px;
    font-weight: bold;
}

.prof-row-skill {
    width: 60px;
    text-align: right;
    color: var(--ui-text-dim);
    font-size: 11px;
}

.prof-skill-bar-outer {
    flex: 1;
    height: 8px;
    background: var(--ui-bg-dark);
    border: 1px solid var(--ui-border-dark);
    border-radius: 2px;
    overflow: hidden;
}

.prof-skill-bar-inner {
    height: 100%;
    background: linear-gradient(to bottom, #4a7a2a, #2a4a1a);
    transition: width 0.3s;
}

.prof-unlearn-btn {
    background: #3a2222;
    border: 1px solid #855;
    color: #c88;
    padding: 3px 10px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 2px;
    margin: 2px 4px;
}

.prof-unlearn-btn:hover {
    background: #4a2a2a;
}

/* Recipe Section */
.prof-recipe-section {
    margin-bottom: 8px;
}

.prof-recipe-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 5px 4px;
    border-bottom: 1px solid var(--ui-border-dark);
    font-size: 11px;
}

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

.prof-recipe-name {
    font-weight: bold;
    min-width: 160px;
}

.prof-recipe-mats {
    flex: 1;
    color: var(--ui-text-dim);
    font-size: 10px;
}

.prof-mat-have {
    color: #8a8;
}

.prof-mat-need {
    color: #c66;
}

.prof-recipe-amount {
    color: var(--ui-text-dim);
    font-size: 10px;
    margin-left: 4px;
}

.prof-craft-btn {
    background: linear-gradient(to bottom, #2a4a2a, #1a2e1a);
    border: 1px solid #4a4;
    color: #6c6;
    padding: 3px 12px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 2px;
    white-space: nowrap;
    transition: all 0.15s;
}

.prof-craft-btn:hover {
    background: linear-gradient(to bottom, #3a5a3a, #2a3e2a);
    box-shadow: 0 0 6px rgba(68, 170, 68, 0.2);
}

.prof-craft-btn:disabled {
    background: var(--ui-bg-input);
    border-color: var(--ui-border-dark);
    color: var(--ui-text-muted);
    cursor: not-allowed;
}

.prof-hint {
    color: var(--ui-text-muted);
    font-size: 10px;
    text-align: center;
    margin-top: 8px;
    border-top: 1px solid var(--ui-border-dark);
    padding-top: 6px;
}

/* Profession Trainer Dialog */
#profession-trainer-dialog {
    position: fixed;
    z-index: 100;
}

.prof-trainer-info {
    padding: 8px 0;
}

.prof-trainer-recipe {
    padding: 6px 8px;
    color: #4cc;
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid var(--ui-border-dark);
    transition: background 0.1s;
    border-radius: 2px;
}

.prof-trainer-recipe:hover {
    background: rgba(68, 204, 204, 0.1);
}

#prof-learn-btn {
    display: block;
    width: 100%;
    padding: 8px 20px;
    background: linear-gradient(to bottom, #2a4a2a, #1a2e1a);
    border: 1px solid #4a4;
    color: #6c6;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--ui-radius-sm);
    margin-top: 8px;
    transition: all 0.15s;
}

#prof-learn-btn:hover {
    background: linear-gradient(to bottom, #3a5a3a, #2a3e2a);
    box-shadow: 0 0 6px rgba(68, 170, 68, 0.2);
}

#prof-trainer-close {
    background: var(--ui-danger-bg);
    color: var(--ui-danger);
    border-color: var(--ui-danger);
}

#prof-trainer-close:hover {
    background: var(--ui-danger-bg);
}

/* Class Trainer Dialog */
#class-trainer-dialog {
    position: fixed;
    z-index: 100;
}

.class-trainer-content {
    max-height: 70vh;
    overflow-y: auto;
}

.class-trainer-gold {
    color: var(--ui-accent);
    font-size: 12px;
    text-align: right;
    margin-bottom: 8px;
    padding: 4px 8px;
    background: var(--ui-bg-input);
    border-radius: var(--ui-radius-sm);
}

.class-trainer-spell-row {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid var(--ui-border-dark);
    gap: 8px;
    transition: background 0.1s;
}

.class-trainer-spell-row:hover {
    background: var(--ui-bg-hover);
}

.class-trainer-spell-row.known {
    opacity: 0.5;
}

.class-trainer-spell-row.too-high {
    opacity: 0.4;
}

.class-trainer-spell-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    image-rendering: pixelated;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border);
    border-radius: 2px;
}

.class-trainer-spell-info {
    flex: 1;
    min-width: 0;
}

.class-trainer-spell-name {
    color: var(--ui-text-bright);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.class-trainer-spell-name .rank-tag {
    color: var(--ui-text-dim);
    font-size: 10px;
    margin-left: 4px;
}

.class-trainer-spell-level {
    color: var(--ui-text-dim);
    font-size: 10px;
}

.class-trainer-spell-level.too-high-level {
    color: var(--ui-danger);
}

.class-trainer-spell-cost {
    color: var(--ui-accent);
    font-size: 11px;
    white-space: nowrap;
    min-width: 50px;
    text-align: right;
}

.class-trainer-spell-cost.cant-afford {
    color: var(--ui-danger);
}

.class-trainer-spell-action {
    min-width: 60px;
    text-align: right;
}

.class-trainer-learn-btn {
    padding: 3px 10px;
    background: linear-gradient(to bottom, #2a4a2a, #1a2e1a);
    border: 1px solid #4a4;
    color: #6c6;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
    border-radius: var(--ui-radius-sm);
    transition: all 0.15s;
}

.class-trainer-learn-btn:hover {
    background: linear-gradient(to bottom, #3a5a3a, #2a3e2a);
    box-shadow: 0 0 6px rgba(68, 170, 68, 0.2);
}

.class-trainer-learn-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.class-trainer-known-label {
    color: var(--ui-text-dim);
    font-size: 10px;
    font-style: italic;
}

.class-trainer-locked-label {
    color: var(--ui-danger);
    font-size: 10px;
}

.class-trainer-section-header {
    color: var(--ui-accent);
    font-size: 11px;
    padding: 8px 8px 4px;
    border-bottom: 1px solid var(--ui-border-dark);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.class-trainer-wrong-class {
    color: var(--ui-danger);
    text-align: center;
    padding: 20px 10px;
    font-size: 13px;
}

#class-trainer-close {
    background: var(--ui-danger-bg);
    color: var(--ui-danger);
    border-color: var(--ui-danger);
}

#class-trainer-close:hover {
    background: var(--ui-danger-bg);
}

/* Crafting Progress Bar */
#crafting-progress {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: var(--ui-radius);
    padding: 16px;
    z-index: 200;
    text-align: center;
    font-family: 'Courier New', monospace;
    box-shadow: var(--ui-shadow), 0 0 20px var(--ui-accent-glow);
}

#crafting-progress-label {
    color: var(--ui-accent);
    font-size: 13px;
    margin-bottom: 10px;
}

#crafting-progress-bar-container {
    height: 14px;
    background: var(--ui-bg-dark);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    overflow: hidden;
}

#crafting-progress-bar {
    height: 100%;
    background: linear-gradient(to right, #2a6a2a, #4aba4a);
    width: 0%;
    transition: width 0.1s linear;
}

/* === DUNGEON UI === */

/* Boss Health Bar */
#boss-bar {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    z-index: 200;
    text-align: center;
}

.boss-bar-name {
    font-size: 14px;
    color: #ff8800;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 136, 0, 0.6);
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.boss-bar-container {
    position: relative;
    width: 100%;
    height: 20px;
    background: var(--ui-bg-panel);
    border: 2px solid #884400;
    border-radius: var(--ui-radius-sm);
    overflow: hidden;
    box-shadow: var(--ui-shadow);
}

.boss-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(to bottom, #cc3300, #991100);
    transition: width 0.2s ease;
}

.boss-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    font-weight: bold;
}

/* Boss Warning */
#boss-warning {
    position: fixed;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    color: #ff4444;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.8), 0 0 20px rgba(255, 0, 0, 0.4);
    z-index: 200;
    text-align: center;
    animation: warningPulse 0.5s ease-in-out infinite alternate;
    white-space: nowrap;
}

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

/* Dungeon Timer */
#dungeon-timer {
    position: fixed;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--ui-text);
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    padding: 2px 12px;
    border-radius: var(--ui-radius-sm);
    z-index: 150;
    letter-spacing: 1px;
}

/* Dungeon Enter Confirmation */
#dungeon-confirm {
    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: 500;
}

.dungeon-confirm-content {
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    padding: 30px 40px;
    text-align: center;
    max-width: 380px;
    box-shadow: var(--ui-shadow-heavy), 0 0 30px rgba(136, 68, 34, 0.3);
}

.dungeon-confirm-content h3 {
    font-size: 22px;
    color: var(--ui-accent);
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--ui-accent-glow);
}

.dungeon-confirm-content p {
    font-size: 13px;
    color: var(--ui-text);
    margin-bottom: 8px;
    line-height: 1.4;
}

.dungeon-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.dungeon-confirm-buttons button {
    padding: 8px 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    cursor: pointer;
    transition: all 0.2s;
}

#dungeon-enter-btn {
    background: var(--ui-bg-header);
    color: var(--ui-accent);
    border-color: var(--ui-accent);
}

#dungeon-enter-btn:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent-hover);
    box-shadow: 0 0 12px var(--ui-accent-glow);
}

#dungeon-cancel-btn {
    background: var(--ui-bg);
    color: var(--ui-text-dim);
}

#dungeon-cancel-btn:hover {
    background: var(--ui-bg-header);
    border-color: var(--ui-border);
    color: var(--ui-text);
}

/* Dungeon Leave Prompt */
#dungeon-leave {
    position: fixed;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: var(--ui-accent);
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    padding: 8px 16px;
    border-radius: var(--ui-radius);
    z-index: 200;
    text-align: center;
    box-shadow: var(--ui-shadow);
}

#dungeon-leave strong {
    color: var(--ui-accent-hover);
}

/* Dungeon portal glow effect on world map */
.dungeon-portal-marker {
    animation: portalGlow 2s ease-in-out infinite alternate;
}

@keyframes portalGlow {
    0% { box-shadow: 0 0 5px rgba(136, 68, 34, 0.5); }
    100% { box-shadow: 0 0 15px rgba(201, 170, 88, 0.8), 0 0 25px rgba(136, 68, 34, 0.4); }
}

/* === APPEARANCE PANEL === */
#appearance-panel {
    position: fixed;
    width: 560px;
    max-height: 80vh;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: var(--ui-radius);
    z-index: 160;
    font-family: 'Courier New', monospace;
    color: var(--ui-text);
    box-shadow: var(--ui-shadow), 0 0 30px var(--ui-accent-glow);
}

#appearance-panel .panel-header {
    background: var(--ui-bg-header);
    border-bottom: 1px solid var(--ui-accent);
}

#appearance-panel .panel-header h3 {
    color: var(--ui-accent);
    font-size: 13px;
}

#appearance-content {
    display: flex;
    flex-wrap: wrap;
    padding: 12px;
    gap: 12px;
}

#appearance-preview {
    width: 136px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

#appearance-preview-canvas {
    width: 128px;
    height: 128px;
    background: var(--ui-bg-dark);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    image-rendering: pixelated;
}

#appearance-preview-label {
    font-size: 10px;
    color: var(--ui-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#appearance-options {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.appearance-section {
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    padding: 6px 8px;
    background: var(--ui-bg-input);
}

.appearance-section-label {
    font-size: 11px;
    color: var(--ui-accent);
    margin-bottom: 6px;
    font-weight: bold;
}

.appearance-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.appearance-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--ui-border-dark);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    position: relative;
}

.appearance-swatch:hover {
    border-color: var(--ui-border);
    transform: scale(1.15);
    z-index: 1;
}

.appearance-swatch.selected {
    border-color: var(--ui-accent);
    box-shadow: 0 0 8px var(--ui-accent-glow-strong);
}

.appearance-swatch-tooltip {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    padding: 3px 8px;
    font-size: 10px;
    white-space: nowrap;
    color: var(--ui-text);
    border-radius: var(--ui-radius-sm);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
    box-shadow: var(--ui-shadow);
}

.appearance-swatch:hover .appearance-swatch-tooltip {
    opacity: 1;
}

#appearance-buttons {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 0;
    border-top: 1px solid var(--ui-border-dark);
}

#appearance-cost {
    font-size: 12px;
    color: var(--ui-accent);
    margin-right: auto;
}

#appearance-cost-amount {
    font-weight: bold;
}

#appearance-apply-btn {
    padding: 6px 18px;
    background: linear-gradient(to bottom, #2a4a2a, #1a2e1a);
    color: #6c6;
    border: 1px solid #4a4;
    border-radius: var(--ui-radius-sm);
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    transition: all 0.15s;
}

#appearance-apply-btn:hover {
    background: linear-gradient(to bottom, #3a5a3a, #2a3e2a);
    box-shadow: 0 0 6px rgba(68, 170, 68, 0.2);
}

#appearance-apply-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#appearance-reset-btn {
    padding: 6px 12px;
    background: var(--ui-bg-header);
    color: var(--ui-text-dim);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    transition: all 0.15s;
}

#appearance-reset-btn:hover {
    background: var(--ui-bg-hover);
    color: var(--ui-text);
}

#appearance-cancel-btn {
    padding: 6px 12px;
    background: var(--ui-danger-bg);
    color: var(--ui-danger);
    border: 1px solid var(--ui-danger);
    border-radius: var(--ui-radius-sm);
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    transition: all 0.15s;
}

#appearance-cancel-btn:hover {
    background: var(--ui-danger-bg);
    box-shadow: 0 0 6px rgba(204, 102, 68, 0.15);
}

/* === CHAT UI === */
/* (chat-input-container removed — now integrated into #chat-panel) */

.chat-message {
    margin-bottom: 1px;
    font-size: 11px;
    line-height: 1.3;
}

.chat-name {
    font-weight: bold;
}

.chat-name-warrior { color: #c79c6e; }
.chat-name-mage { color: #69ccf0; }
.chat-name-priest { color: #ffffff; }
.chat-name-rogue { color: #fff569; }
.chat-name-paladin { color: #F58CBA; }

.chat-text { color: #ddd; }
.chat-whisper { color: #ff88ff; }
.chat-system-msg { color: #ffff00; }

/* Chat channel colors in combat log */
.log-chat-say { color: #ddd; }
.log-chat-yell { color: #ff4444; }
.log-chat-party { color: #aaaaff; }
.log-chat-whisper { color: #ff88ff; }
.log-chat-emote { color: #ff8c40; font-style: italic; }

/* === PARTY FRAME (WoW-style raid frames) === */
#party-frame,
.party-frame {
    position: fixed;
    top: 120px;
    left: 8px;
    width: 160px;
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    z-index: 50;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    padding: 4px;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

.party-frame-header {
    color: var(--ui-accent);
    font-weight: bold;
    font-size: 11px;
    padding: 2px 4px 4px;
    border-bottom: 1px solid var(--ui-border-dark);
    margin-bottom: 4px;
}

.party-member {
    padding: 3px 4px;
    margin-bottom: 2px;
    background: var(--ui-bg-input);
    border-radius: 2px;
}

.party-member-info {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
}

.party-leader-icon {
    color: var(--ui-accent);
    font-size: 10px;
}

.party-member-name {
    font-weight: bold;
    font-size: 10px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.party-member-level {
    color: var(--ui-text-dim);
    font-size: 9px;
}

.party-member-hp-container {
    position: relative;
    width: 100%;
    height: 10px;
    background: var(--ui-bg-dark);
    border: 1px solid var(--ui-border-dark);
    border-radius: 1px;
    overflow: hidden;
}

.party-member-hp-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #4a2;
    transition: width 0.3s;
}

.party-member-hp-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 8px;
    color: #ddd;
    line-height: 10px;
    z-index: 1;
    text-shadow: 0 0 2px #000;
}

/* === PARTY INVITE POPUP === */
.party-invite-popup {
    position: fixed;
    top: 200px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: var(--ui-radius);
    padding: 16px;
    z-index: 600;
    text-align: center;
    font-family: 'Courier New', monospace;
    color: var(--ui-text);
    box-shadow: var(--ui-shadow), 0 0 20px var(--ui-accent-glow);
}

.party-invite-text {
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1.4;
}

.party-invite-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.party-invite-accept,
.party-invite-decline {
    padding: 6px 18px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.party-invite-accept {
    background: linear-gradient(to bottom, #2a4a2a, #1a2e1a);
    color: #8f8;
    border-color: #4a4;
}

.party-invite-accept:hover {
    background: linear-gradient(to bottom, #3a5a3a, #2a3e2a);
    box-shadow: 0 0 6px rgba(68, 170, 68, 0.2);
}

.party-invite-decline {
    background: linear-gradient(to bottom, #3a1a1a, #2a1010);
    color: #f88;
    border-color: #a44;
}

.party-invite-decline:hover {
    background: linear-gradient(to bottom, #4a2a2a, #3a1a1a);
    box-shadow: 0 0 6px rgba(204, 68, 68, 0.2);
}

/* === PLAYER CONTEXT MENU === */
.player-context-menu {
    position: fixed;
    min-width: 140px;
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    z-index: 700;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    overflow: hidden;
    box-shadow: var(--ui-shadow);
}

.ctx-menu-header {
    padding: 6px 10px;
    color: var(--ui-accent);
    font-weight: bold;
    border-bottom: 1px solid var(--ui-border-dark);
    background: var(--ui-bg-hover);
}

.ctx-menu-item {
    padding: 6px 10px;
    color: var(--ui-text);
    cursor: pointer;
    transition: background 0.1s;
}

.ctx-menu-item:hover {
    background: var(--ui-bg-hover);
    color: var(--ui-accent);
}

/* === CONNECTION STATUS === */
#connection-status {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    padding: 2px 10px;
    border-radius: var(--ui-radius-sm);
    z-index: 10;
    pointer-events: none;
}

#connection-status.online {
    color: #4a4;
    background: rgba(0, 40, 0, 0.5);
    border: 1px solid #2a2;
}

#connection-status.offline {
    color: #a44;
    background: rgba(40, 0, 0, 0.5);
    border: 1px solid #a22;
}

/* === ONLINE PLAYERS INDICATOR === */
#online-players {
    position: absolute;
    bottom: 24px;
    right: 12px;
    font-size: 10px;
    color: var(--ui-text-dim);
    z-index: 10;
    pointer-events: none;
}

/* === REPUTATION PANEL === */
#reputation-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-height: 500px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow-heavy);
    z-index: 200;
    overflow: hidden;
}

#reputation-content {
    padding: 8px;
    max-height: 440px;
    overflow-y: auto;
}

.rep-faction {
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    padding: 10px;
    margin-bottom: 8px;
}

.rep-faction:hover {
    border-color: var(--ui-border);
    background: var(--ui-bg-hover);
}

.rep-faction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.rep-faction-name {
    font-weight: bold;
    font-size: 13px;
}

.rep-faction-standing {
    font-size: 12px;
    font-weight: bold;
}

.rep-bar-container {
    position: relative;
    width: 100%;
    height: 14px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.rep-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 2px;
    opacity: 0.7;
}

.rep-bar-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--ui-text);
    text-shadow: 0 1px 2px #000;
    z-index: 1;
}

.rep-faction-desc {
    font-size: 10px;
    color: var(--ui-text-dim);
    margin-top: 4px;
    line-height: 1.3;
    display: none;
}

.rep-faction:hover .rep-faction-desc {
    display: block;
}

.rep-rewards {
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid var(--ui-border-dark);
}

.rep-reward-item {
    font-size: 10px;
    padding: 2px 0;
}

.rep-reward-item.locked {
    opacity: 0.5;
}

.rep-reward-level {
    color: var(--ui-text-dim);
    font-weight: bold;
    font-size: 9px;
}

.rep-reward-locked {
    color: var(--ui-text-muted);
    font-size: 9px;
    font-style: italic;
}

/* === FLIGHT MAP OVERLAY === */
#flight-map-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

#flight-map-content {
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow-heavy);
    padding: 0;
    text-align: center;
    min-width: 440px;
}

#flight-map-title {
    background: var(--ui-bg-header);
    border-bottom: 1px solid var(--ui-border);
    padding: 8px 16px;
    font-size: 16px;
    font-weight: bold;
    color: var(--ui-accent);
    cursor: move;
}

#flight-map-greeting {
    padding: 6px 16px;
    font-size: 11px;
    color: var(--ui-text-dim);
    font-style: italic;
    border-bottom: 1px solid var(--ui-border-dark);
    background: var(--ui-bg-hover);
}

#flight-map-canvas {
    display: block;
    margin: 0 auto;
    border-bottom: 1px solid var(--ui-border-dark);
    cursor: pointer;
}

#flight-map-info {
    padding: 8px;
    font-size: 12px;
    color: var(--ui-text);
    min-height: 24px;
}

#flight-map-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 8px 16px 12px;
}

#flight-map-fly-btn,
#flight-map-close-btn {
    padding: 6px 20px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: var(--ui-radius-sm);
    border: 1px solid var(--ui-border);
    background: var(--ui-bg-header);
    color: var(--ui-text);
    transition: all 0.15s;
}

#flight-map-fly-btn:hover:not(:disabled) {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
    color: var(--ui-accent);
}

#flight-map-fly-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#flight-map-close-btn:hover {
    background: var(--ui-danger-bg);
    border-color: var(--ui-danger);
    color: var(--ui-danger);
}

/* === COMBAT LOG REP COLOR === */
.log-rep {
    color: #bb88ff;
}

/* === COMPARISON TOOLTIP === */
#compare-tooltip {
    position: absolute;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: var(--ui-radius);
    padding: 10px;
    min-width: 180px;
    max-width: 250px;
    z-index: 501;
    pointer-events: none;
    font-size: 12px;
    box-shadow: var(--ui-shadow), var(--ui-inner-glow);
}

.compare-header {
    color: var(--ui-accent);
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--ui-border-dark);
}

/* === BANK PANEL === */
#bank-panel {
    position: fixed;
    width: 320px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: var(--ui-radius);
    z-index: 90;
    box-shadow: var(--ui-shadow), 0 0 20px var(--ui-accent-glow);
}

#bank-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    padding: 8px;
}

.bank-slot {
    width: 38px;
    height: 38px;
    background: var(--ui-bg-slot);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s, background 0.15s;
}

.bank-slot:hover {
    border-color: var(--ui-accent);
    background: var(--ui-bg-hover);
}

/* === SOCIAL BUTTONS (Emote & Pet buttons near action bar) === */
#social-buttons {
    position: fixed;
    bottom: 52px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 100;
    margin-left: -200px;
}

.social-action-btn {
    width: 28px;
    height: 28px;
    background: var(--ui-bg);
    border: 1px solid var(--ui-border);
    border-radius: 4px;
    color: var(--ui-text);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
    padding: 0;
    line-height: 1;
}

.social-action-btn:hover {
    border-color: var(--ui-accent);
    background: var(--ui-bg-hover);
}

.bank-slot.has-item {
    border-color: var(--ui-border);
}

.bank-slot.rarity-uncommon { border-color: #1eff00; }
.bank-slot.rarity-rare { border-color: #0070dd; }
.bank-slot.rarity-epic { border-color: #a335ee; }
.bank-slot.rarity-legendary { border-color: #ff8000; }

.bank-slot canvas {
    display: block;
}

/* === REPAIR BUTTON === */
.shop-repair-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    margin: 4px 8px 8px;
    background: var(--ui-bg-header);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.shop-repair-btn:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
}

.repair-anvil {
    font-size: 16px;
    color: var(--ui-accent);
}

.repair-cost {
    font-size: 11px;
}

/* === DURABILITY INDICATORS === */
.char-equip-slot.dur-broken {
    border-color: #ff4444 !important;
    box-shadow: 0 0 6px rgba(255, 68, 68, 0.5);
}

.char-equip-slot.dur-low {
    border-color: #ffaa00 !important;
    box-shadow: 0 0 4px rgba(255, 170, 0, 0.4);
}

/* Durability bar under equipment slots */
.dur-bar-container {
    position: absolute;
    bottom: 0;
    left: 2px;
    right: 2px;
    height: 3px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 0 0 2px 2px;
}

.dur-bar-fill {
    height: 100%;
    border-radius: 0 0 2px 2px;
    transition: width 0.3s;
}

/* === BROKEN GEAR WARNING === */
#broken-gear-warning {
    position: fixed;
    top: 10px;
    left: 280px;
    width: 28px;
    height: 28px;
    background: rgba(180, 0, 0, 0.8);
    border: 2px solid #ff4444;
    border-radius: var(--ui-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #ff6666;
    z-index: 100;
    cursor: help;
    animation: brokenPulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.5);
}

@keyframes brokenPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(255, 68, 68, 0.5); }
    50% { opacity: 0.7; box-shadow: 0 0 16px rgba(255, 68, 68, 0.8); }
}

/* === PET PANEL === */
#pet-panel {
    width: 240px;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: 4px;
    z-index: 200;
}

#pet-panel .panel-header {
    background: var(--ui-bg-header);
    border-bottom: 1px solid var(--ui-border);
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

#pet-panel .panel-header h3 {
    margin: 0;
    font-size: 13px;
    color: var(--ui-accent);
}

.pet-entry:hover {
    border-color: var(--ui-accent) !important;
    background: var(--ui-bg-hover) !important;
}

.pet-active {
    border-color: var(--ui-accent) !important;
    background: var(--ui-bg-hover) !important;
}

/* === EDIT MODE (WoW-style UI layout editor) === */
#edit-mode-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9000;
    pointer-events: none;
}

#edit-mode-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: var(--ui-bg-header);
    border-bottom: 2px solid var(--ui-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
}

.edit-mode-title {
    color: var(--ui-accent);
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--ui-accent-glow);
}

.edit-mode-hint {
    color: var(--ui-text-dim);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    margin-left: 12px;
}

.edit-mode-btn {
    padding: 6px 16px;
    background: var(--ui-bg-header);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 1px;
}

.edit-mode-btn:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
    color: var(--ui-accent);
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

.edit-mode-btn.edit-mode-done {
    border-color: var(--ui-accent);
    color: var(--ui-accent);
}

.edit-mode-btn.edit-mode-done:hover {
    border-color: var(--ui-accent-hover);
    color: var(--ui-accent-hover);
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

/* Edit mode element highlights */
.edit-mode-active .edit-mode-element {
    outline: 2px dashed var(--ui-accent) !important;
    outline-offset: 2px;
    cursor: move !important;
    position: relative;
}

.edit-mode-active .edit-mode-element:hover {
    outline-color: #ffd700 !important;
    outline-style: solid !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.edit-mode-active .edit-mode-element.edit-mode-dragging {
    outline-color: #66ccff !important;
    outline-style: solid !important;
    box-shadow: 0 0 16px rgba(102, 204, 255, 0.5);
    opacity: 0.9;
}

/* Edit mode element labels */
.edit-mode-label {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ui-accent);
    color: var(--ui-bg-dark);
    font-family: 'Courier New', monospace;
    font-size: 9px;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 2px;
    white-space: nowrap;
    z-index: 9500;
    pointer-events: none;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Ensure edit mode elements are above the overlay */
.edit-mode-active .edit-mode-element {
    z-index: 9100 !important;
}

/* === EMOTE MENU === */
#emote-menu {
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    border-radius: 6px;
    padding: 8px;
    z-index: 300;
}

/* ============================================================ */
/* === MOBILE & RESPONSIVE STYLES === */
/* ============================================================ */

/* --- Mobile-only elements (hidden by default, shown via JS) --- */
.mobile-only { display: none !important; }
body.is-mobile .mobile-only { display: block !important; }
body.is-mobile #mobile-micro-menu { display: flex !important; }

/* --- Mobile: Pre-game screens need scrolling despite body touch-action:none --- */
body.is-mobile #login-screen,
body.is-mobile #character-select-screen,
body.is-mobile #character-create-screen {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* --- Mobile: Login Screen --- */
body.is-mobile #login-screen {
    padding: 20px 16px;
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top, 20px);
    overflow-y: auto;
}

body.is-mobile .login-container {
    gap: 16px;
    width: 100%;
    max-width: 400px;
}

body.is-mobile .game-title {
    font-size: 28px;
    letter-spacing: 3px;
}

body.is-mobile .game-subtitle {
    font-size: 12px;
    letter-spacing: 4px;
}

body.is-mobile .login-box {
    width: 100%;
    max-width: 100%;
    padding: 0 20px 20px;
}

body.is-mobile .login-tabs {
    margin: 0 -20px 16px;
}

body.is-mobile .login-tab {
    padding: 14px 12px;
    font-size: 14px;
    min-height: 44px;
}

body.is-mobile .form-group label {
    font-size: 12px;
    margin-bottom: 6px;
}

body.is-mobile .form-group input {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 44px;
}

body.is-mobile .btn-primary {
    font-size: 15px;
    padding: 14px;
    min-height: 48px;
}

body.is-mobile .btn-offline {
    font-size: 14px;
    padding: 12px;
    min-height: 44px;
}

body.is-mobile .server-url-group {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

body.is-mobile .server-url-group input {
    width: 160px;
    font-size: 12px;
    padding: 6px 8px;
    min-height: 36px;
}

/* --- Mobile: Character Select Screen --- */
body.is-mobile #character-select-screen {
    padding: 20px 12px;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.is-mobile .charselect-container {
    max-width: 100%;
    padding: 12px 8px;
    gap: 12px;
}

body.is-mobile #character-select-screen .screen-title {
    font-size: 24px;
    margin-bottom: 4px;
}

body.is-mobile .character-list {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: auto;
}

body.is-mobile .char-card {
    padding: 10px 12px;
}

body.is-mobile .char-card-portrait canvas {
    width: 40px;
    height: 40px;
}

body.is-mobile .char-card-name {
    font-size: 14px;
}

body.is-mobile .char-card-race-class {
    font-size: 11px;
}

body.is-mobile .char-card-level {
    font-size: 11px;
}

body.is-mobile .charselect-actions {
    max-width: 100%;
}

body.is-mobile .charselect-enter {
    min-height: 48px;
    font-size: 14px;
}

body.is-mobile .charselect-secondary-actions {
    flex-direction: column;
}

body.is-mobile .charselect-secondary-actions .btn-secondary,
body.is-mobile .charselect-secondary-actions .btn-danger,
body.is-mobile .charselect-secondary-actions .btn-back {
    min-height: 44px;
    font-size: 13px;
    padding: 10px 16px;
}

/* --- Mobile: Character Creation Screen --- */
body.is-mobile #character-create-screen {
    padding: 12px 8px;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.is-mobile .charcreate-container {
    max-width: 100%;
    padding: 8px 4px;
    gap: 12px;
}

body.is-mobile #character-create-screen .screen-title {
    font-size: 22px;
    margin-bottom: 4px;
}

/* Mobile: single-column layout */
body.is-mobile .charcreate-layout {
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

body.is-mobile .charcreate-left {
    flex: none;
    width: 100%;
    max-width: 360px;
}

body.is-mobile .charcreate-preview {
    flex-direction: row;
    gap: 16px;
    justify-content: center;
}

body.is-mobile .preview-frame {
    width: 120px;
    height: 140px;
}

body.is-mobile #char-preview-canvas {
    width: 112px;
    height: 112px;
}

body.is-mobile .preview-pedestal {
    bottom: 12px;
    width: 60px;
    height: 8px;
}

body.is-mobile .preview-class-label {
    font-size: 12px;
}

body.is-mobile .race-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

body.is-mobile .race-grid .option-btn {
    padding: 8px 4px;
    font-size: 11px;
    min-height: 36px;
}

body.is-mobile .class-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

body.is-mobile .class-card-create {
    padding: 10px 6px 8px;
}

body.is-mobile .class-card-preview {
    width: 44px;
    height: 44px;
}

body.is-mobile .class-card-name {
    font-size: 10px;
}

body.is-mobile .charcreate-right {
    flex: none;
    width: 100%;
    max-width: 360px;
    padding: 14px;
}

body.is-mobile #char-name-input {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 44px;
}

body.is-mobile .color-swatches {
    gap: 8px;
}

body.is-mobile .color-swatch {
    width: 36px;
    height: 36px;
}

body.is-mobile .option-btn {
    padding: 8px 14px;
    font-size: 12px;
    min-height: 36px;
}

body.is-mobile .charcreate-buttons {
    flex-direction: column;
    gap: 10px;
}

body.is-mobile .charcreate-buttons .btn-primary {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
    padding: 14px;
}

body.is-mobile .charcreate-buttons .btn-back {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
    padding: 12px;
}

/* Spec change modal: mobile-friendly */
body.is-mobile .spec-change-modal {
    min-width: auto;
    max-width: calc(100vw - 32px);
    width: 100%;
    padding: 16px;
}

body.is-mobile .spec-change-modal h3 {
    font-size: 15px;
}

body.is-mobile .spec-change-card {
    padding: 12px 14px;
    min-height: 48px;
}

body.is-mobile .spec-change-card .spec-card-name {
    font-size: 14px;
}

body.is-mobile .spec-change-card .spec-card-desc {
    font-size: 12px;
}

body.is-mobile .spec-change-close {
    min-height: 44px;
    font-size: 13px;
    padding: 8px 24px;
}

/* Delete confirmation dialog: mobile-friendly */
body.is-mobile .confirm-dialog {
    max-width: calc(100vw - 32px);
    padding: 20px 16px;
}

body.is-mobile .confirm-dialog h3 {
    font-size: 16px;
}

body.is-mobile .confirm-dialog p {
    font-size: 14px;
}

body.is-mobile .confirm-buttons {
    flex-direction: column;
    gap: 10px;
}

body.is-mobile .confirm-buttons button {
    padding: 12px 24px;
    font-size: 14px;
    min-height: 44px;
    width: 100%;
}

/* --- Virtual Joystick --- */
#mobile-joystick {
    position: fixed;
    bottom: 80px;
    left: 20px;
    z-index: 600;
    pointer-events: auto;
    touch-action: none;
}

/* Move joystick to right side on mobile, above the action bar */
body.is-mobile #mobile-joystick {
    left: auto;
    right: 20px;
    bottom: 130px;
}

#joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

#joystick-knob {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 170, 88, 0.5), rgba(201, 170, 88, 0.2));
    border: 2px solid rgba(201, 170, 88, 0.5);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: none;
    box-shadow: 0 0 10px rgba(201, 170, 88, 0.2);
}

/* --- Mobile Action Buttons (right side) --- */
#mobile-action-buttons {
    position: fixed;
    bottom: 90px;
    right: 15px;
    z-index: 600;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
}

body.is-mobile #mobile-action-buttons {
    display: none !important;
}

.mobile-action-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ui-accent);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
    touch-action: none;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: background 0.15s, border-color 0.15s;
}

.mobile-action-btn:active {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
}

/* --- Mobile Micro Menu (bottom tab bar) --- */
#mobile-micro-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--ui-bg);
    border-top: 2px solid var(--ui-border);
    align-items: center;
    justify-content: space-around;
    z-index: 700;
    padding: 0 env(safe-area-inset-left) env(safe-area-inset-bottom) env(safe-area-inset-right);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.6);
}

.mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    min-width: 48px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    transition: color 0.15s;
}

.mobile-tab-icon {
    font-size: 20px;
    color: var(--ui-text-dim);
    line-height: 1;
    transition: color 0.15s;
}

.mobile-tab-label {
    font-size: 9px;
    color: var(--ui-text-muted);
    font-family: 'Courier New', monospace;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-tab:active .mobile-tab-icon,
.mobile-tab.active .mobile-tab-icon {
    color: var(--ui-accent);
    text-shadow: 0 0 6px var(--ui-accent-glow);
}

.mobile-tab:active .mobile-tab-label,
.mobile-tab.active .mobile-tab-label {
    color: var(--ui-accent);
}

/* --- Mobile Chat Toggle (hidden on mobile — chat is in micro menu now) --- */
#mobile-chat-toggle {
    position: fixed;
    bottom: 64px;
    left: 10px;
    z-index: 650;
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border);
    border-radius: 4px;
    padding: 6px 12px;
    color: var(--ui-text-dim);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

body.is-mobile #mobile-chat-toggle {
    display: none !important;
}

#mobile-chat-toggle:active {
    background: var(--ui-bg-hover);
    color: var(--ui-accent);
    border-color: var(--ui-accent);
}

/* --- Mobile Panel Overlay Mode --- */
body.is-mobile .mobile-panel-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 56px !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    height: auto !important;
    border-radius: 0 !important;
    z-index: 800 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

body.is-mobile .mobile-panel-overlay .panel-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--ui-bg-header);
}

body.is-mobile .mobile-panel-overlay .close-btn {
    font-size: 24px;
    padding: 4px 10px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================ */
/* === MEDIA QUERIES — PHONE PORTRAIT (~375px) === */
/* ============================================================ */
@media screen and (max-width: 480px) {
    /* Login screen */
    .login-box { width: 90vw; max-width: 340px; padding: 0 16px 16px; }
    .game-title { font-size: 28px; letter-spacing: 2px; }
    .game-subtitle { font-size: 11px; letter-spacing: 3px; }

    /* Character creation */
    .charcreate-layout { flex-direction: column; gap: 12px; }
    .charcreate-left { flex: none; width: 100%; }
    .charcreate-right { flex: none; width: 100%; }
    .charselect-container { padding: 8px; }
    .character-list { grid-template-columns: 1fr; }
    .char-card { padding: 8px 10px; }

    /* Unit frames */
    .unit-frame { min-width: 160px; padding: 5px; gap: 5px; }
    #player-frame { top: 6px; left: 6px; }
    #target-frame { top: 6px; left: 175px; }
    .unit-portrait { width: 30px; height: 30px; }
    .unit-name { font-size: 10px; }
    .unit-level { font-size: 9px; }
    .bar-container { height: 12px; }
    .bar-container span { font-size: 8px; }
    .unit-info { min-width: 110px; }

    /* Action bar */
    #action-bar {
        bottom: 60px;
        transform: translateX(-50%) scale(0.85);
        transform-origin: bottom center;
    }
    #action-bar-slots { gap: 1px; padding: 4px 5px; }
    .ability-slot { width: 44px; height: 54px; }
    .ability-icon { width: 44px; height: 44px; }
    .ability-cooldown-sweep, .ability-gcd-sweep, .ability-cooldown {
        width: 44px; height: 44px;
    }
    .ability-key { font-size: 8px; }

    /* Hide action bar end caps on small screens for more room */
    .action-bar-end { width: 6px; }

    /* Cast bar */
    #cast-bar { bottom: 125px; width: 200px; }

    /* Minimap */
    #mini-map-frame { width: 120px; height: 120px; }
    #mini-map-canvas { width: 120px; height: 120px; }
    #mini-map-zone-name { font-size: 8px; max-width: 120px; }

    /* Quest tracker */
    #quest-tracker { top: 158px; width: 160px; max-height: 180px; }
    .qt-quest-title { font-size: 10px; }
    .qt-objective { font-size: 9px; }

    /* Chat panel */
    #chat-panel {
        width: calc(100vw - 24px);
        left: 6px;
        bottom: 60px;
        height: 120px;
        max-height: 180px;
    }
    #combat-log { font-size: 10px; }
    #chat-input { font-size: 14px; padding: 8px; }

    /* XP bar */
    #xp-bar-container { height: 12px; }
    #xp-bar span { font-size: 8px; line-height: 12px; }

    /* Quest dialog */
    .quest-dialog-content { width: 90vw; max-width: 380px; padding: 14px; }
    .quest-dialog-content h3 { font-size: 14px; }
    #quest-dialog-desc { font-size: 12px; }

    /* Loot popup */
    #loot-popup { width: 90vw; max-width: 260px; }

    /* Character panel */
    #character-panel { width: 100vw; }
    #char-panel-columns { flex-direction: column; }
    #char-paperdoll { flex: none; border-right: none; border-bottom: 1px solid var(--ui-border-dark); }
    #char-panel-columns #char-stats { max-height: 260px; }

    /* Hide extra ability slots (11-12) on phone */
    .ability-slot[data-slot="10"],
    .ability-slot[data-slot="11"] {
        display: none;
    }
}

/* ============================================================ */
/* === MEDIA QUERIES — PHONE LANDSCAPE (~667px) === */
/* ============================================================ */
@media screen and (max-width: 812px) and (orientation: landscape) {
    .unit-frame { min-width: 170px; padding: 5px; gap: 5px; }
    .unit-portrait { width: 32px; height: 32px; }
    .bar-container { height: 12px; }
    .bar-container span { font-size: 8px; }

    #action-bar {
        bottom: 60px;
    }
    .ability-slot { width: 42px; height: 52px; }
    .ability-icon { width: 42px; height: 42px; }
    .ability-cooldown-sweep, .ability-gcd-sweep, .ability-cooldown {
        width: 42px; height: 42px;
    }

    #cast-bar { bottom: 120px; width: 220px; }

    #mini-map-frame { width: 130px; height: 130px; }
    #mini-map-canvas { width: 130px; height: 130px; }

    #chat-panel { width: 280px; height: 120px; bottom: 60px; }

    /* Joystick position adjustments for landscape */
    #mobile-joystick { bottom: 120px; }
    #joystick-base { width: 100px; height: 100px; }
    #joystick-knob { width: 42px; height: 42px; }

    #mobile-action-buttons { bottom: 70px; right: 10px; }
    .mobile-action-btn { width: 44px; height: 44px; font-size: 10px; }

    #quest-tracker { max-height: 120px; width: 160px; top: 155px; }

    .ability-slot[data-slot="10"],
    .ability-slot[data-slot="11"] {
        display: none;
    }
}

/* ============================================================ */
/* === MEDIA QUERIES — TABLET (~768px) === */
/* ============================================================ */
@media screen and (max-width: 1024px) and (min-width: 481px) and (orientation: portrait) {
    .login-box { width: 80vw; max-width: 400px; }
    .game-title { font-size: 40px; }

    .unit-frame { min-width: 180px; }
    .bar-container { height: 13px; }

    #action-bar { bottom: 60px; }
    .ability-slot { width: 44px; height: 54px; }
    .ability-icon { width: 44px; height: 44px; }
    .ability-cooldown-sweep, .ability-gcd-sweep, .ability-cooldown {
        width: 44px; height: 44px;
    }

    #mini-map-frame { width: 150px; height: 150px; }
    #mini-map-canvas { width: 150px; height: 150px; }

    #chat-panel { width: 320px; bottom: 60px; height: 140px; }

    #quest-tracker { top: 190px; width: 180px; }

    .quest-dialog-content { width: 80vw; max-width: 420px; }

    #mobile-joystick { bottom: 130px; }

    .ability-slot[data-slot="10"],
    .ability-slot[data-slot="11"] {
        display: none;
    }
}

/* ============================================================ */
/* === MOBILE BODY CLASS OVERRIDES === */
/* ============================================================ */
body.is-mobile {
    /* Prevent pull-to-refresh and overscroll */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
}

body.is-mobile #game-screen {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body.is-mobile #game-canvas {
    touch-action: none;
    -webkit-touch-callout: none;
}

/* Unit frames on mobile — stack vertically, ensure visible above canvas */
body.is-mobile .unit-frame {
    z-index: 500;
    min-width: 150px;
}

body.is-mobile #player-frame {
    top: 12px;
    left: 8px;
}

body.is-mobile #target-frame {
    top: 100px;
    left: 8px;
}

/* Mobile action bar — vertical layout on left side (portrait only) */
body.is-mobile #action-bar {
    position: fixed;
    bottom: auto;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    align-items: stretch;
}

body.is-mobile #action-bar-slots {
    flex-direction: column;
    gap: 2px;
    padding: 5px 4px;
    border-top: 1px solid var(--ui-border-dark);
    border-bottom: 1px solid var(--ui-border-dark);
    border-left: 2px solid var(--ui-border);
    border-right: 2px solid var(--ui-border-dark);
}

body.is-mobile .action-bar-end {
    display: none;
}

/* Mobile landscape — revert action bar to horizontal at bottom */
@media screen and (orientation: landscape) {
    body.is-mobile #action-bar {
        position: fixed;
        bottom: 60px;
        left: 50%;
        top: auto;
        transform: translateX(-50%);
        flex-direction: row;
        align-items: stretch;
    }

    body.is-mobile #action-bar-slots {
        flex-direction: row;
        gap: 1px;
        padding: 4px 5px;
        border-top: 2px solid var(--ui-border);
        border-bottom: 2px solid var(--ui-border-dark);
        border-left: 1px solid var(--ui-border-dark);
        border-right: 1px solid var(--ui-border-dark);
    }

    body.is-mobile .action-bar-end {
        display: block;
        width: 6px;
    }
}

/* Larger touch targets on mobile for action bar */
body.is-mobile .ability-slot {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
}

body.is-mobile .ability-icon {
    width: 40px;
    height: 40px;
}

body.is-mobile .ability-cooldown-sweep,
body.is-mobile .ability-gcd-sweep,
body.is-mobile .ability-cooldown {
    width: 40px;
    height: 40px;
}

/* Hide slots 10-11 on mobile (already hidden by media query, reinforce here) */
body.is-mobile .ability-slot[data-slot="10"],
body.is-mobile .ability-slot[data-slot="11"] {
    display: none;
}

/* Hide keyboard shortcut labels on mobile */
body.is-mobile .ability-key {
    display: none;
}

/* Chat panel mobile — use fixed positioning to avoid layout shift from keyboard */
body.is-mobile #chat-panel {
    position: fixed;
    bottom: 66px; /* above mobile micro menu (56px + 10px gap) */
    left: 6px;
    right: 6px;
    width: auto;
    height: 160px;
    max-height: 40vh;
    z-index: 650;
    pointer-events: auto;
    touch-action: manipulation;
}

/* Chat panel mobile collapsed state */
body.is-mobile #chat-panel.mobile-collapsed {
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden;
    border: none;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

/* When keyboard is open on mobile, move chat panel above the keyboard */
body.is-mobile.mobile-keyboard-open #chat-panel {
    bottom: calc(var(--keyboard-height, 0px) + 10px);
    max-height: 35vh;
}

/* Hide resize handle on mobile — not needed */
body.is-mobile #chat-resize-handle {
    display: none;
}

/* Make chat input touch-friendly on mobile (min 44px touch target) */
body.is-mobile #chat-input {
    font-size: 16px; /* prevents iOS auto-zoom on focus */
    padding: 10px 12px;
    min-height: 44px;
    border-radius: 4px;
    box-sizing: border-box;
    /* Allow user-select and touch-action inside the input for text editing */
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
}

body.is-mobile #chat-input-area {
    padding: 6px;
    touch-action: manipulation;
}

body.is-mobile #chat-input::placeholder {
    font-size: 14px;
}

/* Allow scrolling in chat log on mobile */
body.is-mobile #combat-log {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* Allow touch interaction with chat header */
body.is-mobile #chat-header {
    touch-action: manipulation;
}

/* Prevent joystick and action bar from being blocked by chat panel pointer-events */
body.is-mobile #mobile-joystick,
body.is-mobile #action-bar,
body.is-mobile #mobile-micro-menu {
    z-index: 700;
}

/* When keyboard is open, hide joystick and action bar to avoid confusion */
body.is-mobile.mobile-keyboard-open #mobile-joystick {
    display: none;
}

/* Keep action bar visible but behind the chat */
body.is-mobile.mobile-keyboard-open #action-bar {
    opacity: 0.3;
    pointer-events: none;
}

/* Desktop micro menu — hide on mobile body */
body.is-mobile #micro-menu { display: none !important; }
body.is-mobile #bag-bar { display: none !important; }

/* === MOBILE BAG WINDOWS === */
/* On mobile, hide individual bag windows — they are rendered inside #mobile-bag-panel instead */
body.is-mobile .bag-window {
    display: none !important;
}

/* Combined mobile bag panel */
body.is-mobile #mobile-bag-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px; /* above mobile micro menu */
    z-index: 800;
    background: var(--ui-bg-panel);
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.is-mobile #mobile-bag-panel .mobile-bag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--ui-bg-header);
    border-bottom: 2px solid var(--ui-border);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

body.is-mobile #mobile-bag-panel .mobile-bag-header-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--ui-accent);
    letter-spacing: 1px;
}

body.is-mobile #mobile-bag-panel .mobile-bag-gold {
    font-size: 13px;
    color: var(--ui-accent);
}

body.is-mobile #mobile-bag-panel .mobile-bag-close {
    background: none;
    border: 1px solid var(--ui-border-dark);
    color: var(--ui-text-dim);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
}

body.is-mobile #mobile-bag-panel .mobile-bag-close:active {
    color: var(--ui-danger);
    border-color: var(--ui-danger);
    background: rgba(200, 50, 50, 0.1);
}

body.is-mobile #mobile-bag-panel .mobile-bag-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
}

body.is-mobile #mobile-bag-panel .mobile-bag-section {
    margin-bottom: 10px;
}

body.is-mobile #mobile-bag-panel .mobile-bag-section-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--ui-accent);
    padding: 4px 6px 6px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ui-border-dark);
    margin-bottom: 6px;
}

body.is-mobile #mobile-bag-panel .mobile-bag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 4px;
    padding: 2px;
}

body.is-mobile #mobile-bag-panel .mobile-bag-slot {
    width: 100%;
    aspect-ratio: 1;
    min-width: 44px;
    min-height: 44px;
    background: var(--ui-bg-slot);
    border: 2px solid var(--ui-border-dark);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color 0.1s, background 0.1s;
}

body.is-mobile #mobile-bag-panel .mobile-bag-slot.has-item {
    border-color: var(--ui-border);
}

body.is-mobile #mobile-bag-panel .mobile-bag-slot.has-item:active {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
}

body.is-mobile #mobile-bag-panel .mobile-bag-slot.mobile-tooltip-active {
    border-color: var(--ui-accent) !important;
    box-shadow: 0 0 8px var(--ui-accent-glow);
    background: var(--ui-bg-hover);
}

/* Rarity borders for mobile bag slots */
body.is-mobile #mobile-bag-panel .mobile-bag-slot.rarity-poor { border-color: #666 !important; }
body.is-mobile #mobile-bag-panel .mobile-bag-slot.rarity-common { border-color: #888 !important; }
body.is-mobile #mobile-bag-panel .mobile-bag-slot.rarity-uncommon { border-color: #1eff00 !important; }
body.is-mobile #mobile-bag-panel .mobile-bag-slot.rarity-rare { border-color: #0070dd !important; }
body.is-mobile #mobile-bag-panel .mobile-bag-slot.rarity-epic { border-color: #a335ee !important; }

body.is-mobile #mobile-bag-panel .mobile-bag-slot canvas {
    image-rendering: pixelated;
    width: 100%;
    height: 100%;
    max-width: 40px;
    max-height: 40px;
}

body.is-mobile #mobile-bag-panel .mobile-bag-slot .stack-count {
    position: absolute;
    bottom: 1px;
    right: 3px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 1px #000, -1px -1px 1px #000, 1px -1px 1px #000, -1px 1px 1px #000;
    pointer-events: none;
    z-index: 2;
    line-height: 1;
}

/* === MOBILE ITEM TOOLTIP (tap-to-show) === */
body.is-mobile #mobile-item-tooltip {
    position: fixed;
    background: var(--ui-bg-panel);
    border: 2px solid var(--ui-accent);
    border-radius: var(--ui-radius);
    padding: 12px;
    min-width: 200px;
    max-width: 280px;
    z-index: 900;
    font-size: 13px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), var(--ui-inner-glow);
    pointer-events: auto;
    touch-action: manipulation;
}

body.is-mobile #mobile-item-tooltip .tooltip-name {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 14px;
}

body.is-mobile #mobile-item-tooltip .tooltip-type {
    color: var(--ui-text-dim);
    font-size: 12px;
    margin-bottom: 6px;
}

body.is-mobile #mobile-item-tooltip .tooltip-stat {
    color: #4c4;
    margin-bottom: 2px;
}

body.is-mobile #mobile-item-tooltip .tooltip-flavor {
    color: var(--ui-text-dim);
    font-style: italic;
    margin-top: 6px;
    font-size: 12px;
}

body.is-mobile #mobile-item-tooltip .tooltip-comparison {
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid var(--ui-border-dark);
}

body.is-mobile #mobile-item-tooltip .mobile-tooltip-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--ui-border-dark);
}

body.is-mobile #mobile-item-tooltip .mobile-tooltip-btn {
    flex: 1;
    padding: 10px 8px;
    border: 1px solid var(--ui-border);
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

body.is-mobile #mobile-item-tooltip .mobile-tooltip-btn-use {
    background: linear-gradient(to bottom, #2a3a1a, #1a2a10);
    color: #4c4;
    border-color: #4c4;
}

body.is-mobile #mobile-item-tooltip .mobile-tooltip-btn-use:active {
    background: linear-gradient(to bottom, #3a4a2a, #2a3a1a);
    box-shadow: 0 0 8px rgba(68, 204, 68, 0.3);
}

body.is-mobile #mobile-item-tooltip .mobile-tooltip-btn-sell {
    background: var(--ui-bg-header);
    color: var(--ui-accent);
    border-color: var(--ui-accent);
}

body.is-mobile #mobile-item-tooltip .mobile-tooltip-btn-sell:active {
    background: var(--ui-bg-hover);
    box-shadow: 0 0 8px var(--ui-accent-glow);
}

body.is-mobile #mobile-item-tooltip .mobile-tooltip-btn-dismiss {
    background: var(--ui-bg);
    color: var(--ui-text-dim);
    border-color: var(--ui-border-dark);
    flex: 0 0 auto;
    padding: 10px 14px;
}

body.is-mobile #mobile-item-tooltip .mobile-tooltip-btn-dismiss:active {
    background: var(--ui-bg-hover);
}

/* Backdrop behind mobile tooltip to catch dismiss taps */
body.is-mobile #mobile-tooltip-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 899;
    background: rgba(0, 0, 0, 0.3);
}

/* Safe area support for mobile bag panel */
@supports (padding: env(safe-area-inset-bottom)) {
    body.is-mobile #mobile-bag-panel {
        bottom: calc(56px + env(safe-area-inset-bottom));
    }
}

/* Rogue buttons on mobile — position right of the vertical action bar */
body.is-mobile #stealth-btn {
    bottom: 140px !important;
    left: 60px !important;
    right: auto !important;
    width: 46px !important;
    height: 46px !important;
}

body.is-mobile #evasion-btn {
    bottom: 195px !important;
    left: 60px !important;
    right: auto !important;
    width: 46px !important;
    height: 46px !important;
}

/* XP bar positioning for mobile (above mobile micro menu) */
body.is-mobile #xp-bar-container {
    bottom: 56px;
    height: 10px;
}

body.is-mobile #xp-bar span {
    bottom: 56px;
    font-size: 8px;
    line-height: 10px;
}

/* Ensure tooltips don't overflow on mobile */
body.is-mobile .ability-slot:hover .ability-name {
    display: none;
}

/* Prevent text selection on game elements */
body.is-mobile #game-ui {
    -webkit-user-select: none;
    user-select: none;
}

/* Safe area insets for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
    body.is-mobile #mobile-micro-menu {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(56px + env(safe-area-inset-bottom));
    }
    body.is-mobile #xp-bar-container {
        bottom: calc(56px + env(safe-area-inset-bottom));
    }
    body.is-mobile #xp-bar span {
        bottom: calc(56px + env(safe-area-inset-bottom));
    }
    body.is-mobile #mobile-joystick {
        bottom: calc(130px + env(safe-area-inset-bottom));
    }
    body.is-mobile #chat-panel {
        bottom: calc(66px + env(safe-area-inset-bottom));
    }
    body.is-mobile.mobile-keyboard-open #chat-panel {
        bottom: calc(var(--keyboard-height, 0px) + 10px);
    }
    body.is-mobile #mobile-chat-toggle {
        bottom: calc(64px + env(safe-area-inset-bottom));
    }
    body.is-mobile #action-bar {
        left: env(safe-area-inset-left);
    }
}

/* Safe area insets for landscape — action bar back to bottom positioning */
@supports (padding: env(safe-area-inset-bottom)) {
    @media screen and (orientation: landscape) {
        body.is-mobile #action-bar {
            left: 50%;
            bottom: calc(60px + env(safe-area-inset-bottom));
        }
    }
}

/* === ADMIN PANEL === */
.admin-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: var(--ui-bg-panel);
    display: flex;
    flex-direction: column;
    font-family: 'Courier New', monospace;
    color: var(--ui-text);
    overflow: hidden;
}

.admin-header {
    background: var(--ui-bg-header);
    border-bottom: 2px solid var(--ui-border);
    padding: 0;
    flex-shrink: 0;
}

.admin-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px 8px;
}

.admin-title {
    color: var(--ui-accent);
    font-size: 18px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--ui-accent-glow);
    margin: 0;
}

.admin-close {
    color: var(--ui-text-dim);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
    padding: 4px 8px;
}

.admin-close:hover {
    color: var(--ui-danger);
}

.admin-tabs {
    display: flex;
    gap: 0;
    padding: 0 16px;
}

.admin-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--ui-radius) var(--ui-radius) 0 0;
    color: var(--ui-text-dim);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.15s;
}

.admin-tab:hover {
    color: var(--ui-text);
    background: var(--ui-bg-hover);
}

.admin-tab.active {
    color: var(--ui-accent);
    background: var(--ui-bg-hover);
    border-color: var(--ui-border);
    border-bottom: 1px solid transparent;
    margin-bottom: -2px;
    padding-bottom: 10px;
}

.admin-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.admin-body::-webkit-scrollbar {
    width: 8px;
}

.admin-body::-webkit-scrollbar-track {
    background: var(--ui-bg-dark);
}

.admin-body::-webkit-scrollbar-thumb {
    background: var(--ui-border-dark);
    border-radius: 4px;
}

.admin-body::-webkit-scrollbar-thumb:hover {
    background: var(--ui-border);
}

/* Sections */
.admin-section {
    margin-bottom: 24px;
}

.admin-section-title {
    color: var(--ui-accent);
    font-size: 14px;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--ui-border-dark);
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.admin-section-title.admin-title-danger {
    color: var(--ui-danger);
    border-bottom-color: rgba(204, 68, 68, 0.3);
}

.admin-subtitle {
    color: var(--ui-text-dim);
    font-size: 12px;
    font-weight: normal;
    margin-left: 8px;
}

/* Stats grid */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.admin-stat-card {
    background: var(--ui-bg);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius);
    padding: 14px 12px;
    text-align: center;
}

.admin-stat-value {
    color: var(--ui-accent);
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 4px;
}

.admin-stat-label {
    color: var(--ui-text-dim);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.admin-stat-muted {
    color: var(--ui-text-muted);
    font-size: 12px;
    font-style: italic;
}

/* Key-value rows */
.admin-kv {
    margin-bottom: 8px;
}

.admin-kv-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--ui-border-dark);
    font-size: 12px;
}

.admin-kv-key {
    color: var(--ui-text-dim);
}

.admin-kv-val {
    color: var(--ui-text);
    text-align: right;
}

.admin-badge {
    background: var(--ui-bg-hover);
    color: var(--ui-accent);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    letter-spacing: 1px;
    border: 1px solid var(--ui-border-dark);
}

.admin-badge-off {
    background: var(--ui-bg-hover);
    color: var(--ui-text-muted);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    letter-spacing: 1px;
    border: 1px solid var(--ui-border-dark);
}

/* Current character */
.admin-current-char {
    background: var(--ui-bg);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius);
    padding: 12px;
    margin-top: 8px;
}

.admin-char-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 4px;
}

.admin-char-details {
    font-size: 12px;
    color: var(--ui-text-dim);
    margin-bottom: 8px;
}

.admin-spec {
    color: var(--ui-text-muted);
    margin-left: 4px;
}

.admin-char-stats-row {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: var(--ui-text-dim);
    margin-bottom: 2px;
}

/* Tables */
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.admin-table thead th {
    background: var(--ui-bg);
    color: var(--ui-accent);
    padding: 8px 10px;
    text-align: left;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--ui-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.admin-sortable {
    cursor: pointer;
    user-select: none;
}

.admin-sortable:hover {
    color: var(--ui-accent-hover) !important;
}

.admin-table tbody tr {
    border-bottom: 1px solid var(--ui-border-dark);
    transition: background 0.1s;
}

.admin-table tbody tr:hover {
    background: var(--ui-bg-hover);
}

.admin-table tbody td {
    padding: 7px 10px;
    color: var(--ui-text);
}

.admin-row-active {
    background: var(--ui-bg-hover) !important;
}

.admin-td-name {
    font-weight: bold;
}

.admin-empty {
    color: var(--ui-text-muted);
    text-align: center;
    padding: 20px;
    font-style: italic;
    font-size: 12px;
}

/* Small buttons */
.admin-btn-sm {
    padding: 3px 10px;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    margin-right: 4px;
    border: 1px solid;
}

.admin-btn-primary {
    background: var(--ui-bg-hover);
    border-color: var(--ui-border-dark);
    color: var(--ui-accent);
}

.admin-btn-primary:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
}

.admin-btn-danger {
    background: rgba(204, 68, 68, 0.1);
    border-color: rgba(204, 68, 68, 0.3);
    color: var(--ui-danger);
}

.admin-btn-danger:hover {
    background: rgba(204, 68, 68, 0.2);
    border-color: var(--ui-danger);
}

/* Inspector */
.admin-inspector-select {
    margin-bottom: 16px;
}

.admin-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.admin-select:focus {
    border-color: var(--ui-accent);
}

.admin-inspector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 700px) {
    .admin-inspector-grid {
        grid-template-columns: 1fr;
    }
}

.admin-inspector-col {
    min-width: 0;
}

.admin-col-title {
    color: var(--ui-accent);
    font-size: 12px;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--ui-border-dark);
    padding-bottom: 4px;
    margin-bottom: 8px;
}

/* Equipment slots */
.admin-equip-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 11px;
    border-bottom: 1px solid var(--ui-border-dark);
}

.admin-equip-label {
    color: var(--ui-text-dim);
    min-width: 70px;
}

.admin-equip-item {
    text-align: right;
}

.admin-equip-empty {
    color: var(--ui-text-muted);
    font-style: italic;
    text-align: right;
}

/* Item rarity colors */
.admin-rarity-common { color: var(--ui-text); }
.admin-rarity-uncommon { color: #1eff00; }
.admin-rarity-rare { color: #0070dd; }
.admin-rarity-epic { color: #a335ee; }
.admin-rarity-legendary { color: #ff8000; }

/* Sublists (quests, professions) */
.admin-sublist {
    margin: 4px 0 8px 8px;
    border-left: 2px solid var(--ui-border-dark);
    padding-left: 10px;
}

.admin-sublist-item {
    font-size: 11px;
    color: var(--ui-text-dim);
    padding: 2px 0;
}

/* Bar charts (distributions) */
.admin-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.admin-bar-label {
    font-size: 11px;
    min-width: 80px;
    text-align: right;
}

.admin-bar-track {
    flex: 1;
    height: 14px;
    background: var(--ui-bg-input);
    border: 1px solid var(--ui-border-dark);
    border-radius: 2px;
    overflow: hidden;
}

.admin-bar-fill {
    height: 100%;
    border-radius: 2px;
    opacity: 0.7;
    transition: width 0.3s ease;
    min-width: 2px;
}

.admin-bar-value {
    font-size: 11px;
    color: var(--ui-text-dim);
    min-width: 50px;
}

/* Action buttons */
.admin-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.admin-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: var(--ui-bg);
    border: 1px solid var(--ui-border-dark);
    border-radius: var(--ui-radius);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.admin-action-btn:hover {
    border-color: var(--ui-accent);
    background: var(--ui-bg-hover);
    box-shadow: 0 0 12px var(--ui-accent-glow);
}

.admin-action-danger {
    border-color: rgba(204, 68, 68, 0.2);
}

.admin-action-danger:hover {
    border-color: var(--ui-danger);
    background: var(--ui-danger-bg);
    box-shadow: 0 0 12px rgba(204, 68, 68, 0.15);
}

.admin-action-icon {
    font-size: 24px;
    color: var(--ui-accent);
    margin-bottom: 6px;
}

.admin-action-danger .admin-action-icon {
    color: var(--ui-danger);
}

.admin-action-label {
    color: var(--ui-text);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
}

.admin-action-desc {
    color: var(--ui-text-muted);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    line-height: 1.4;
}

/* Status messages */
.admin-action-status {
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: var(--ui-radius);
    font-size: 12px;
    display: none;
}

.admin-status-success {
    background: rgba(30, 120, 30, 0.15);
    border: 1px solid rgba(30, 180, 30, 0.3);
    color: #5ccc5c;
}

.admin-status-error {
    background: rgba(204, 68, 68, 0.1);
    border: 1px solid rgba(204, 68, 68, 0.3);
    color: var(--ui-danger);
}

.admin-status-info {
    background: var(--ui-bg-hover);
    border: 1px solid var(--ui-border-dark);
    color: var(--ui-accent);
}

/* Admin button in main menu */
.main-menu-btn.admin-menu-btn {
    border-color: var(--ui-border);
    color: var(--ui-accent);
    position: relative;
}

.main-menu-btn.admin-menu-btn::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--ui-accent);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 6px var(--ui-accent-glow);
}

.main-menu-btn.admin-menu-btn:hover {
    background: var(--ui-bg-hover);
    border-color: var(--ui-accent);
    box-shadow: 0 0 12px var(--ui-accent-glow);
}
