/* ===== FANTASY RPG UI STYLESHEET ===== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    /* Colors - Dark Slate Stone */
    --stone-dark: #1a1d21;
    --stone-mid: #252a30;
    --stone-light: #343b44;
    --accent-dark: #4a5568;
    --accent-mid: #718096;
    --accent-light: #a0aec0;
    --health-green: #2d8f2d;
    --health-green-light: #3cb43c;
    --mana-blue: #2563eb;
    --mana-blue-light: #3b82f6;
    --slot-bg: #12151a;
    --slot-border: #3d4550;
    --text-light: #e2e8f0;
    --text-dim: #718096;
    --danger-red: #b91c1c;
    
    /* Legacy aliases for gold (now using accent) */
    --gold-dark: var(--accent-dark);
    --gold-mid: var(--accent-mid);
    --gold-light: var(--accent-light);
    
    /* Sizing */
    --slot-size: 40px;
    --border-width: 2px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Crimson Text', Georgia, serif;
    background-color: #1a1d21;
    background-image: 
        linear-gradient(rgba(26, 29, 33, 0.85), rgba(26, 29, 33, 0.85)),
        url('../assets/tilesets/sprites/tiles/wall/stone_gray0.png');
    background-repeat: repeat;
    background-size: auto, 64px 64px;
    image-rendering: pixelated;
    color: var(--text-light);
}

/* ===== MAIN LAYOUT ===== */
.game-wrapper {
    display: grid;
    grid-template-columns: 1fr 4fr 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    padding: 10px;
    height: 100vh;
    width: 95%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ===== ORNATE PANEL STYLING ===== */
.panel {
    background: linear-gradient(180deg, var(--stone-mid) 0%, var(--stone-dark) 100%);
    border: var(--border-width) solid var(--accent-dark);
    border-radius: 4px;
    position: relative;
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.05),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 4px 12px rgba(0,0,0,0.5);
}

.panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 2px;
    background: 
        linear-gradient(90deg, transparent 0%, rgba(113,128,150,0.03) 50%, transparent 100%);
    pointer-events: none;
}

.panel-header {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-light);
    text-align: center;
    padding: 8px 10px;
    background: linear-gradient(180deg, rgba(74,85,104,0.3) 0%, transparent 100%);
    border-bottom: 1px solid var(--accent-dark);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header .header-title {
    flex: 1;
    text-align: center;
}

.panel-header .collapse-btn {
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dim);
    transition: color 0.2s, transform 0.2s;
    width: 20px;
    text-align: center;
    user-select: none;
}

.panel-header .collapse-btn:hover {
    color: var(--accent-light);
}

.panel.collapsed .collapse-btn {
    transform: rotate(180deg);
}

.panel-content {
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.panel.collapsed .panel-content {
    max-height: 0 !important;
    opacity: 0;
    padding: 0;
    border: none;
}

/* Corner decorations */
.panel-corner {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--accent-mid);
    pointer-events: none;
}
.panel-corner.tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.panel-corner.tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.panel-corner.bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.panel-corner.br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ===== TOP BAR - HEALTH & MANA ===== */
.top-bar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    padding: 8px 16px;
}

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

.player-portrait {
    width: 56px;
    height: 56px;
    border: 2px solid var(--accent-dark);
    border-radius: 4px;
    background: var(--slot-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
}

.player-portrait img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
}

.portrait-placeholder {
    font-family: 'Cinzel', serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dim);
    user-select: none;
}

.player-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-name {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-light);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.player-class {
    font-size: 14px;
    color: var(--text-dim);
    text-transform: capitalize;
}

.resource-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 250px;
    max-width: 400px;
    width: 100%;
    justify-self: center;
}

.resource-bar {
    position: relative;
    height: 24px;
    background: #0a0908;
    border: 2px solid var(--slot-border);
    border-radius: 2px;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}

.resource-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    transition: width 0.3s ease;
}

.resource-bar-fill.health {
    background: linear-gradient(180deg, var(--health-green-light) 0%, var(--health-green) 50%, #1f6b1f 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(45,143,45,0.4);
}

.resource-bar-fill.mana {
    background: linear-gradient(180deg, var(--mana-blue-light) 0%, var(--mana-blue) 50%, #1d4ed8 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(37,99,235,0.4);
}

.resource-bar-fill.stamina {
    background: linear-gradient(180deg, #f87171 0%, #dc2626 50%, #b91c1c 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(220,38,38,0.4);
}

.resource-bar-fill.energy {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(251,191,36,0.4);
}

.resource-bar-fill.focus {
    background: linear-gradient(180deg, #34d399 0%, #10b981 50%, #059669 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(16,185,129,0.4);
}

.resource-bar-fill.essence {
    background: linear-gradient(180deg, #a78bfa 0%, #7c3aed 50%, #5b21b6 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(124,58,237,0.4);
}

.resource-bar-fill.xp {
    background: linear-gradient(180deg, #a855f7 0%, #9333ea 50%, #7e22ce 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(147,51,234,0.4);
}

.xp-bar-container {
    height: 14px;
}

.xp-bar-container .resource-bar-text {
    font-size: 10px;
}

.resource-bar-fill.rage {
    background: linear-gradient(180deg, #f87171 0%, #ef4444 50%, #dc2626 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 8px rgba(239,68,68,0.4);
}

.resource-bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8), 0 0 4px rgba(0,0,0,0.5);
    z-index: 1;
}

/* ===== BUFF/DEBUFF BAR ===== */
.buff-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 10px;
    align-items: center;
    min-height: 32px;
}

.buff-icon {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: default;
    transition: transform 0.1s ease;
}

.buff-icon:hover {
    transform: scale(1.1);
}

.buff-icon.buff {
    background: linear-gradient(135deg, #22543d 0%, #276749 50%, #2f855a 100%);
    border: 1px solid #48bb78;
    box-shadow: 0 0 6px rgba(72, 187, 120, 0.4);
}

.buff-icon.debuff {
    background: linear-gradient(135deg, #742a2a 0%, #9b2c2c 50%, #c53030 100%);
    border: 1px solid #fc8181;
    box-shadow: 0 0 6px rgba(252, 129, 129, 0.4);
}

.buff-icon .effect-icon {
    font-size: 14px;
    line-height: 1;
}

.buff-icon .effect-timer {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-family: 'Cinzel', serif;
    font-size: 9px;
    font-weight: 600;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 0 2px;
    border-radius: 2px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.8);
}

/* Combat log styling for buff/debuff messages */
.chat-message.combat-buff {
    color: #68d391;
}

.chat-message.combat-debuff {
    color: #fc8181;
}

.chat-message.combat-system {
    color: #a0aec0;
    font-style: italic;
}

/* ===== LEFT SIDEBAR - CHARACTER WINDOW ===== */
.sidebar-left {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.character-panel {
    display: flex;
    flex-direction: column;
}

/* Top Row: Stats + Equipment side by side */
.character-top-row {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--accent-dark);
}

/* Stats Column */
.stats-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 70px;
}

.stat-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    min-width: 28px;
}

.stat-value {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-light);
}

/* Equipment Column */
.equipment-column {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipment-grid {
    display: grid;
    grid-template-columns: repeat(3, var(--slot-size));
    grid-template-rows: repeat(4, var(--slot-size));
    gap: 4px;
}

.equipment-slot {
    width: var(--slot-size);
    height: var(--slot-size);
    background: var(--slot-bg);
    border: 2px solid var(--slot-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}

.equipment-slot:hover {
    border-color: var(--accent-mid);
    background: rgba(113,128,150,0.15);
}

.equipment-slot.empty-slot {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    cursor: default;
}

.equipment-slot.empty-slot:hover {
    background: transparent;
    border-color: transparent;
}

.slot-icon {
    font-size: 20px;
    opacity: 0.3;
}

/* Inventory Section - Bag System */
.inventory-section {
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bag-slots {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.bag-slot {
    width: var(--slot-size);
    height: var(--slot-size);
    background: var(--slot-bg);
    border: 2px solid var(--slot-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bag-slot:hover {
    border-color: var(--accent-mid);
    background: rgba(113,128,150,0.15);
}

.bag-slot.has-bag {
    border-color: var(--accent-dark);
}

.bag-slot.expanded {
    border-color: var(--accent-light);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4), 0 0 8px rgba(160,174,192,0.3);
}

.bag-slot .bag-icon {
    font-size: 20px;
    opacity: 0.8;
}

.bag-slot .bag-icon.empty {
    opacity: 0.2;
}

/* Bag Contents Area */
.bag-contents-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bag-contents {
    background: rgba(18, 21, 26, 0.6);
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    padding: 6px;
    display: none;
}

.bag-contents.expanded {
    display: block;
}

.bag-contents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 4px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--slot-border);
}

.bag-contents-header .bag-name {
    font-size: 11px;
    color: var(--accent-light);
    font-family: 'Cinzel', serif;
}

.bag-contents-header .bag-capacity {
    font-size: 10px;
    color: var(--text-dim);
}

.bag-contents-grid {
    display: grid;
    grid-template-columns: repeat(4, var(--slot-size));
    gap: 3px;
}

.inventory-slot {
    width: var(--slot-size);
    height: var(--slot-size);
    background: var(--slot-bg);
    border: 2px solid var(--slot-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}

.inventory-slot:hover {
    border-color: var(--accent-mid);
    background: rgba(113,128,150,0.15);
}

/* ===== CHAT WINDOW ===== */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-panel .panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-channel-select {
    flex: 1;
    text-align: center;
    background: transparent;
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    color: var(--accent-light);
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 8px;
    cursor: pointer;
    outline: none;
}

.chat-channel-select:hover {
    border-color: var(--accent-mid);
}

.chat-channel-select option {
    background: var(--stone-dark);
    color: var(--text-light);
}

.chat-messages {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.4;
}

.chat-messages.combat-log {
    font-size: 13px;
}

.chat-message {
    margin-bottom: 4px;
    word-wrap: break-word;
}

.chat-message .sender {
    font-weight: 600;
    color: var(--accent-light);
}

.chat-message .text {
    color: var(--text-light);
}

.chat-message.system {
    color: var(--text-dim);
    font-style: italic;
}

.chat-message.combat-damage {
    color: #f87171;
}

.chat-message.combat-heal {
    color: #4ade80;
}

.chat-message.combat-ability {
    color: #60a5fa;
}

.chat-message.combat-death {
    color: #fbbf24;
    font-weight: 600;
}

.chat-message.combat-fizzle {
    color: #ff9900;
    font-style: italic;
}

.chat-message.combat-xp {
    color: #a855f7;
}

.chat-message.combat-levelup {
    color: #fbbf24;
    font-weight: 700;
    text-transform: uppercase;
}

.chat-input-container {
    display: flex;
    border-top: 1px solid var(--accent-dark);
}

.chat-input {
    flex: 1;
    background: var(--slot-bg);
    border: none;
    padding: 8px 10px;
    color: var(--text-light);
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 14px;
    outline: none;
}

.chat-input::placeholder {
    color: var(--text-dim);
}

.chat-input:focus {
    background: rgba(26, 21, 16, 0.8);
}

/* ===== CENTER - GAME VIEWPORT ===== */
.center-area {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.game-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    width: 100%;
}

#game-container {
    background: #000;
    border: 3px solid var(--accent-dark);
    border-radius: 4px;
    box-shadow: 
        0 0 0 1px var(--stone-dark),
        0 8px 32px rgba(0,0,0,0.6),
        inset 0 0 60px rgba(0,0,0,0.3);
    position: relative;
    width: 100%;
    height: 100%;
}

#game {
    width: 100%;
    height: 100%;
}

#game-container::before,
#game-container::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent-mid);
}

#game-container::before {
    top: -4px; left: -4px;
    border-right: none; border-bottom: none;
}

#game-container::after {
    bottom: -4px; right: -4px;
    border-left: none; border-top: none;
}

#game canvas {
    display: block;
}

/* ===== SKILL BAR ===== */
.skill-bar-container {
    padding: 8px 10px 12px;
}

.skill-bar {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.skill-slot {
    width: 56px;
    height: 56px;
    background: var(--slot-bg);
    border: 2px solid var(--slot-border);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.skill-slot:hover {
    border-color: var(--accent-mid);
    transform: translateY(-2px);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.4);
}

.skill-slot.drag-over {
    border-color: var(--accent-light);
    background: rgba(74,85,104,0.4);
}

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

.skill-slot.has-skill {
    border-color: var(--accent-dark);
}

.skill-slot .keybind {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-light);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.skill-slot .cooldown-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 700;
    color: white;
    border-radius: 2px;
}

.skill-slot.on-cooldown .cooldown-overlay {
    display: flex;
}

/* ===== RIGHT SIDEBAR - Journal ===== */
.sidebar-right {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

/* ===== JOURNAL PANEL ===== */
.journal-panel {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.journal-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    cursor: pointer;
    font-size: 18px;
    color: var(--text-dim);
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--danger-red);
}

.journal-tabs {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    border-bottom: 1px solid var(--slot-border);
}

.journal-tab {
    flex: 1;
    padding: 8px 12px;
    background: var(--stone-medium);
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    transition: all 0.2s;
}

.journal-tab:hover {
    background: var(--stone-light);
}

.journal-tab.active {
    background: var(--accent-dark);
    border-color: var(--accent-light);
    color: var(--text-light);
}

.journal-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.journal-tab-content {
    display: none;
}

.journal-tab-content.active {
    display: block;
}

#abilities-tab {
    display: block;
}

.abilities-section {
    margin-bottom: 12px;
}

.abilities-section h4 {
    font-size: 14px;
    color: var(--accent-light);
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--slot-border);
}

.abilities-section .help-text {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: normal;
}

.ability-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ability-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--stone-medium);
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.ability-item:hover {
    background: var(--stone-light);
    border-color: var(--accent-light);
}

.ability-item.memorized {
    cursor: grab;
}

.ability-item .ability-icon {
    width: 32px;
    height: 32px;
    background: var(--slot-bg);
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.ability-item .ability-info {
    flex: 1;
    min-width: 0;
}

.ability-item .ability-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 2px;
}

.ability-item .ability-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    line-height: 1.3;
}

.ability-item .ability-cost {
    font-size: 14px;
    color: var(--mana-blue-light);
}

.ability-item .unmemorize-btn {
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.ability-item:hover .unmemorize-btn {
    opacity: 1;
}

.ability-item .unmemorize-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* Memorization Progress */
.memorize-progress {
    margin-top: 12px;
    padding: 8px;
    background: var(--stone-dark);
    border: 1px solid var(--slot-border);
    border-radius: 4px;
}

.memorize-text {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 6px;
}

.memorize-bar {
    height: 8px;
    background: var(--slot-bg);
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    overflow: hidden;
}

.memorize-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
    width: 0%;
    transition: width 0.1s linear;
}

.cancel-memorize-btn {
    margin-top: 6px;
    padding: 4px 8px;
    background: var(--danger-red);
    border: 1px solid #8b4444;
    border-radius: 4px;
    color: var(--text-light);
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    transition: all 0.2s;
}

.cancel-memorize-btn:hover {
    background: #aa4444;
}

.quest-placeholder {
    color: var(--text-dim);
    font-size: 12px;
    text-align: center;
    padding: 20px;
}

/* Skill slot with ability */
.skill-slot.has-ability {
    border-color: var(--accent-light);
    background: linear-gradient(180deg, rgba(74,85,104,0.4) 0%, rgba(37,42,48,0.6) 100%);
}

.skill-slot .ability-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Cinzel', serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-light);
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
}

.skill-slot .ability-icon img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    image-rendering: auto;
    -webkit-image-rendering: auto;
}

/* Journal ability list icons */
.ability-item .ability-icon {
    width: 56px;
    height: 56px;
    min-width: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ability-item .ability-icon img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    image-rendering: auto;
    -webkit-image-rendering: auto;
}

.skill-slot.on-cooldown .cooldown-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-light);
    text-shadow: 0 0 4px black;
}

/* ===== BOTTOM BAR ===== */
.bottom-bar {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 8px;
    font-size: 14px;
    color: var(--text-dim);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger-red);
}

.status-dot.connected {
    background: var(--health-green-light);
    box-shadow: 0 0 6px var(--health-green-light);
}

.controls-hint {
    color: var(--text-dim);
}

.controls-hint kbd {
    background: var(--stone-light);
    border: 1px solid var(--slot-border);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    margin: 0 2px;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--stone-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--stone-light);
    border-radius: 4px;
    border: 1px solid var(--slot-border);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dark);
}

/* ===== DRAG AND DROP ===== */
.dragging {
    opacity: 0.5;
}

.drag-over {
    border-color: var(--accent-light) !important;
    box-shadow: 0 0 12px rgba(160,174,192,0.5) !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .game-wrapper {
        width: 95%;
    }
}

@media (max-width: 900px) {
    .game-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto auto;
        width: 95%;
    }

    .sidebar-left, .sidebar-right {
        display: none;
    }

    .center-area {
        grid-row: 3;
    }
}

/* ===== NPC DIALOG PANEL ===== */
.npc-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.npc-dialog-panel {
    background: linear-gradient(180deg, var(--stone-mid) 0%, var(--stone-dark) 100%);
    border: 2px solid var(--accent-dark);
    border-radius: 6px;
    min-width: 400px;
    max-width: 500px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 8px 32px rgba(0,0,0,0.7);
    position: relative;
}

/* Corner decorations for dialog */
.npc-dialog-panel::before,
.npc-dialog-panel::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent-mid);
}

.npc-dialog-panel::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.npc-dialog-panel::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.npc-dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--accent-dark);
    background: linear-gradient(180deg, rgba(74,85,104,0.3) 0%, transparent 100%);
}

.npc-dialog-portrait {
    width: 48px;
    height: 48px;
    border: 2px solid var(--accent-dark);
    border-radius: 4px;
    background: var(--slot-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
    overflow: hidden;
}

.npc-dialog-portrait img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    object-fit: contain;
}

.npc-dialog-portrait-placeholder {
    font-size: 24px;
    color: var(--text-dim);
}

.npc-dialog-identity {
    flex: 1;
}

.npc-dialog-name {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-light);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.npc-dialog-title {
    font-size: 13px;
    color: var(--text-dim);
    font-style: italic;
}

.npc-dialog-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.npc-dialog-close:hover {
    background: var(--danger-red);
    border-color: var(--danger-red);
    color: white;
}

.npc-dialog-content {
    padding: 16px;
}

.npc-dialog-message {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-light);
    margin-bottom: 16px;
}

.npc-dialog-responses {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.npc-dialog-response {
    padding: 10px 14px;
    background: var(--slot-bg);
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    color: var(--text-light);
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.npc-dialog-response:hover {
    background: var(--stone-light);
    border-color: var(--accent-mid);
    color: var(--accent-light);
}

.npc-dialog-response.farewell {
    color: var(--text-dim);
    font-style: italic;
}

.npc-dialog-response.farewell:hover {
    color: var(--text-light);
}

.npc-dialog-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--accent-dark);
    display: flex;
    justify-content: flex-end;
}

.npc-dialog-footer-hint {
    font-size: 11px;
    color: var(--text-dim);
}

/* ==================== TRAINER DIALOG ==================== */

.trainer-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.trainer-dialog-panel {
    background: linear-gradient(180deg, var(--stone-mid) 0%, var(--stone-dark) 100%);
    border: var(--border-width) solid var(--accent-dark);
    border-radius: 4px;
    min-width: 340px;
    max-width: 420px;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 8px 32px rgba(0,0,0,0.7);
}

.trainer-dialog-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(113,128,150,0.03) 50%, transparent 100%);
    pointer-events: none;
}

.trainer-dialog-header {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-light);
    text-align: center;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(74,85,104,0.3) 0%, transparent 100%);
    border-bottom: 1px solid var(--accent-dark);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trainer-dialog-title {
    flex: 1;
    text-align: center;
}

.trainer-dialog-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.trainer-dialog-close:hover {
    color: var(--danger-red);
}

.trainer-dialog-greeting {
    padding: 12px 16px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 14px;
    font-style: italic;
    color: var(--text-dim);
    border-bottom: 1px solid var(--accent-dark);
    background: rgba(0, 0, 0, 0.15);
    line-height: 1.4;
}

.trainer-dialog-points {
    padding: 12px 16px;
    text-align: center;
    font-family: 'Cinzel', serif;
    background: linear-gradient(180deg, rgba(37,99,235,0.15) 0%, rgba(37,99,235,0.05) 100%);
    border-bottom: 1px solid var(--accent-dark);
}

.trainer-dialog-points .points-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
}

.trainer-dialog-points .points-value {
    color: var(--mana-blue-light);
    font-weight: 700;
    font-size: 22px;
    margin-left: 8px;
    text-shadow: 0 0 10px rgba(37,99,235,0.5);
}

.trainer-stats-container {
    padding: 12px 16px;
}

.trainer-stat-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(74,85,104,0.3);
}

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

.trainer-stat-label {
    flex: 1;
    font-family: 'Crimson Text', Georgia, serif;
    color: var(--text-light);
    font-size: 15px;
}

.trainer-stat-value {
    width: 44px;
    text-align: center;
    font-family: 'Cinzel', serif;
    color: var(--accent-light);
    font-weight: 600;
    font-size: 16px;
}

.trainer-stat-plus {
    width: 28px;
    height: 28px;
    margin-left: 10px;
    background: linear-gradient(180deg, var(--stone-light) 0%, var(--stone-mid) 100%);
    border: 1px solid var(--accent-mid);
    border-radius: 3px;
    color: var(--mana-blue-light);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 2px 4px rgba(0,0,0,0.3);
}

.trainer-stat-plus:hover {
    background: linear-gradient(180deg, var(--mana-blue) 0%, #1d4ed8 100%);
    color: white;
    border-color: var(--mana-blue-light);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        0 0 8px rgba(37,99,235,0.5);
}

.trainer-stat-plus:active {
    transform: scale(0.95);
}

.trainer-derived-container {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--accent-dark);
}

.trainer-derived-title {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.trainer-derived-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.trainer-derived-label {
    font-family: 'Crimson Text', Georgia, serif;
    color: var(--text-dim);
    font-size: 13px;
}

.trainer-derived-value {
    font-family: 'Cinzel', serif;
    color: var(--accent-light);
    font-size: 13px;
    font-weight: 600;
}

.trainer-dialog-done {
    display: block;
    width: calc(100% - 32px);
    margin: 16px 16px;
    padding: 10px 20px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(180deg, var(--stone-light) 0%, var(--stone-mid) 100%);
    border: 1px solid var(--accent-mid);
    border-radius: 3px;
    color: var(--accent-light);
    cursor: pointer;
    transition: all 0.15s;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 2px 4px rgba(0,0,0,0.3);
}

.trainer-dialog-done:hover {
    background: linear-gradient(180deg, var(--accent-mid) 0%, var(--accent-dark) 100%);
    color: var(--text-light);
    border-color: var(--accent-light);
}

/* Trainer Dialog Buttons Container */
.trainer-dialog-buttons {
    display: flex;
    gap: 8px;
    padding: 16px;
    justify-content: flex-end;
}

.trainer-dialog-buttons .trainer-dialog-done {
    display: inline-block;
    width: auto;
    margin: 0;
}

/* Trainer Save/Revert buttons */
.trainer-dialog-save,
.trainer-dialog-revert {
    padding: 8px 16px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 2px 4px rgba(0,0,0,0.3);
}

.trainer-dialog-save {
    background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
    color: white;
    border: 1px solid #22c55e;
}

.trainer-dialog-save:hover {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        0 0 8px rgba(34, 197, 94, 0.5);
}

.trainer-dialog-revert {
    background: linear-gradient(180deg, var(--stone-light) 0%, var(--stone-mid) 100%);
    color: var(--text-light);
    border: 1px solid var(--accent-dark);
}

.trainer-dialog-revert:hover {
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border-color: #ef4444;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        0 0 8px rgba(220, 38, 38, 0.5);
}

/* Trainer Stat Minus button */
.trainer-stat-minus {
    width: 28px;
    height: 28px;
    margin-left: 8px;
    background: linear-gradient(180deg, var(--stone-light) 0%, var(--stone-mid) 100%);
    border: 1px solid var(--accent-dark);
    border-radius: 4px;
    color: var(--text-light);
    font-family: 'Cinzel', serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 2px 4px rgba(0,0,0,0.3);
}

.trainer-stat-minus:hover {
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border-color: #ef4444;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        0 0 8px rgba(220, 38, 38, 0.5);
}

.trainer-stat-minus:active {
    transform: scale(0.95);
}

/* Trainer Stat Pending indicator */
.trainer-stat-pending {
    margin-left: 8px;
    color: #22c55e;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Crimson Text', serif;
}

/* Trainer Tab Bar */
.trainer-tab-bar {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--accent-dark);
}

.trainer-tab {
    flex: 1;
    padding: 10px 16px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.trainer-tab:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.03);
}

.trainer-tab.active {
    color: var(--mana-blue-light);
    border-bottom-color: var(--mana-blue);
    background: rgba(37, 99, 235, 0.1);
}

.trainer-tab-content {
    min-height: 200px;
}

.trainer-tab-pane {
    display: none;
}

.trainer-tab-pane.active {
    display: block;
}

/* Skills Tab */
.trainer-skills-list {
    padding: 12px 16px;
    max-height: 280px;
    overflow-y: auto;
}

.trainer-skill-item {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    transition: all 0.2s;
}

.trainer-skill-item:last-child {
    margin-bottom: 0;
}

.trainer-skill-item:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--accent-mid);
}

.trainer-skill-item.learned {
    border-color: var(--mana-blue);
    background: rgba(37, 99, 235, 0.1);
}

.trainer-skill-icon {
    width: 36px;
    height: 36px;
    background: var(--slot-bg);
    border: 1px solid var(--slot-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

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

.trainer-skill-name {
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 4px;
}

.trainer-skill-desc {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.3;
    margin-bottom: 4px;
}

.trainer-skill-cost {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 11px;
    color: var(--mana-blue-light);
}

.trainer-skill-status {
    margin-left: 10px;
    padding: 4px 8px;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    flex-shrink: 0;
    align-self: center;
}

.trainer-skill-status.learned {
    background: rgba(37, 99, 235, 0.2);
    color: var(--mana-blue-light);
    border: 1px solid var(--mana-blue);
}

.trainer-skill-status.available {
    background: rgba(74, 85, 104, 0.3);
    color: var(--text-dim);
    border: 1px solid var(--slot-border);
}

.trainer-skill-learn {
    margin-left: 10px;
    padding: 6px 14px;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    flex-shrink: 0;
    align-self: center;
    cursor: pointer;
    background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
    color: white;
    border: 1px solid #166534;
    transition: all 0.15s ease;
}

.trainer-skill-learn:hover {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    border-color: #15803d;
    transform: translateY(-1px);
}

.trainer-skill-learn:active {
    transform: translateY(0);
    background: linear-gradient(180deg, #15803d 0%, #166534 100%);
}

.trainer-no-skills {
    padding: 24px 16px;
    text-align: center;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 14px;
    font-style: italic;
    color: var(--text-dim);
}

/* ==================== DUNGEON QUEUE DIALOG ==================== */

.dungeon-queue-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dungeon-queue-panel {
    background: linear-gradient(180deg, var(--stone-mid) 0%, var(--stone-dark) 100%);
    border: var(--border-width) solid var(--accent-dark);
    border-radius: 4px;
    min-width: 320px;
    max-width: 400px;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 8px 32px rgba(0,0,0,0.7);
}

.dungeon-queue-header {
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-light);
    text-align: center;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(74,85,104,0.3) 0%, transparent 100%);
    border-bottom: 1px solid var(--accent-dark);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dungeon-queue-title {
    flex: 1;
    text-align: center;
}

.dungeon-queue-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.dungeon-queue-close:hover {
    color: var(--danger-red);
}

.dungeon-queue-info {
    padding: 16px;
    border-bottom: 1px solid var(--accent-dark);
}

.dungeon-queue-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 14px;
}

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

.dungeon-queue-value {
    color: var(--accent-light);
    font-weight: 600;
}

.dungeon-queue-status {
    padding: 12px 16px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--accent-dark);
}

.dungeon-queue-status .status-idle {
    color: var(--mana-blue-light);
    font-family: 'Cinzel', serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dungeon-queue-status .status-queued {
    color: #fbbf24;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dungeon-queue-buttons {
    padding: 16px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.dungeon-queue-btn {
    flex: 1;
    padding: 10px 16px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.1),
        0 2px 4px rgba(0,0,0,0.3);
}

.dungeon-queue-btn.solo {
    background: linear-gradient(180deg, var(--stone-light) 0%, var(--stone-mid) 100%);
    border: 1px solid var(--accent-mid);
    color: var(--accent-light);
}

.dungeon-queue-btn.solo:hover {
    background: linear-gradient(180deg, var(--accent-mid) 0%, var(--accent-dark) 100%);
    color: var(--text-light);
    border-color: var(--accent-light);
}

.dungeon-queue-btn.queue {
    background: linear-gradient(180deg, var(--mana-blue) 0%, #1d4ed8 100%);
    border: 1px solid var(--mana-blue-light);
    color: white;
}

.dungeon-queue-btn.queue:hover {
    background: linear-gradient(180deg, var(--mana-blue-light) 0%, var(--mana-blue) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        0 0 8px rgba(37,99,235,0.5);
}

.dungeon-queue-waiting {
    padding: 12px 16px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 14px;
    color: var(--text-dim);
    text-align: center;
    font-style: italic;
}

.dungeon-queue-cancel {
    display: block;
    width: calc(100% - 32px);
    margin: 0 16px 16px 16px;
    padding: 8px 16px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 13px;
    background: transparent;
    border: 1px solid var(--slot-border);
    border-radius: 3px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
}

.dungeon-queue-cancel:hover {
    background: rgba(0, 0, 0, 0.2);
    border-color: var(--accent-mid);
    color: var(--text-light);
}

/* ===== PARTY SYSTEM UI ===== */

/* Context Menu (right-click) */
.context-menu {
    position: fixed;
    background: linear-gradient(180deg, var(--stone-mid) 0%, var(--stone-dark) 100%);
    border: var(--border-width) solid var(--accent-dark);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    min-width: 150px;
    z-index: 10000;
    overflow: hidden;
}

.context-menu-item {
    padding: 8px 16px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 14px;
    color: var(--text-light);
    cursor: pointer;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: rgba(113, 128, 150, 0.2);
}

.context-menu-item:active {
    background: rgba(113, 128, 150, 0.3);
}

/* Party Invite Dialog */
.party-invite-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, var(--stone-mid) 0%, var(--stone-dark) 100%);
    border: var(--border-width) solid var(--accent-dark);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    padding: 20px 24px;
    z-index: 10000;
    min-width: 280px;
    text-align: center;
}

.party-invite-message {
    font-family: 'Cinzel', serif;
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 20px;
}

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

.party-invite-btn {
    padding: 8px 20px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.party-invite-btn.accept {
    background: linear-gradient(180deg, var(--health-green-light) 0%, var(--health-green) 100%);
    border: 2px solid #1d6b1d;
    color: white;
}

.party-invite-btn.accept:hover {
    filter: brightness(1.1);
}

.party-invite-btn.decline {
    background: transparent;
    border: 2px solid var(--slot-border);
    color: var(--text-dim);
}

.party-invite-btn.decline:hover {
    background: rgba(185, 28, 28, 0.2);
    border-color: var(--danger-red);
    color: var(--text-light);
}

/* Party Panel */
.party-panel {
    position: fixed;
    top: 80px;
    left: 10px;
    background: linear-gradient(180deg, var(--stone-mid) 0%, var(--stone-dark) 100%);
    border: var(--border-width) solid var(--accent-dark);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    min-width: 180px;
    max-width: 220px;
    z-index: 100;
    overflow: hidden;
}

.party-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(180deg, var(--stone-light) 0%, var(--stone-mid) 100%);
    border-bottom: 1px solid var(--accent-dark);
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-light);
    cursor: grab;
    user-select: none;
}

.party-panel-header:active {
    cursor: grabbing;
}

.party-panel.dragging {
    opacity: 0.9;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

.party-leave-btn {
    padding: 4px 10px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 11px;
    background: transparent;
    border: 1px solid var(--slot-border);
    border-radius: 3px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
}

.party-leave-btn:hover {
    background: rgba(185, 28, 28, 0.2);
    border-color: var(--danger-red);
    color: var(--text-light);
}

.party-member-list {
    padding: 8px;
}

.party-member {
    padding: 8px 10px;
    margin-bottom: 6px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    border: 1px solid var(--slot-border);
}

.party-member:last-child {
    margin-bottom: 0;
}

.party-member-name {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.party-member-health-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.party-member-health-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--health-green) 0%, var(--health-green-light) 100%);
    border-radius: 2px;
    transition: width 0.2s ease-out;
}

.party-member-health-text {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 11px;
    color: var(--text-dim);
    text-align: right;
}
