/* ===== CSS Variables & Theme ===== */
:root {
    --bg-dark: #0a0d15;
    --bg-panel: rgba(12, 16, 28, 0.92);
    --bg-panel-hover: rgba(20, 28, 50, 0.95);
    --border-color: rgba(100, 140, 255, 0.2);
    --border-glow: rgba(100, 160, 255, 0.5);
    --gold: #f0c040;
    --gold-dark: #b8860b;
    --hp-red: #e63946;
    --hp-red-dark: #8b0000;
    --mp-blue: #4895ef;
    --mp-blue-dark: #1a3a7a;
    --exp-green: #2ec27e;
    --exp-green-dark: #145a32;
    --text-primary: #e8e8f0;
    --text-secondary: #8890b0;
    --accent-cyan: #00f5d4;
    --accent-purple: #9b5de5;
    --accent-orange: #ff6b35;
    --font-pixel: 'Press Start 2P', monospace;
    --font-ui: 'Noto Sans KR', sans-serif;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

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

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow: hidden;
    height: 100vh;
}

.screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Title Screen ===== */
#title-bg-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.title-content {
    position: relative;
    z-index: 1;
    text-align: center;
    animation: fadeInUp 1s ease;
}

.game-title {
    font-family: var(--font-pixel);
    font-size: 72px;
    color: var(--gold);
    text-shadow: 0 0 60px rgba(240, 192, 64, 0.5), 0 4px 0 var(--gold-dark);
    margin-bottom: 16px;
}

.game-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    letter-spacing: 6px;
}

.title-features {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
    color: var(--accent-cyan);
    font-size: 13px;
    flex-wrap: wrap;
}

.title-features span {
    padding: 6px 14px;
    border: 1px solid rgba(0, 245, 212, 0.3);
    border-radius: 20px;
    background: rgba(0, 245, 212, 0.05);
}

.title-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn-primary {
    padding: 16px 48px;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-ui);
    color: var(--bg-dark);
    background: linear-gradient(135deg, var(--gold), #ffdd57);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(240, 192, 64, 0.4);
}

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

.btn-secondary {
    padding: 16px 48px;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-ui);
    color: var(--text-primary);
    background: transparent;
    border: 2px solid var(--border-glow);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-secondary:hover {
    background: rgba(100, 160, 255, 0.1);
    transform: translateY(-3px);
}

/* ===== Character Creation ===== */
#creation-screen {
    background: radial-gradient(ellipse at center, #0f1525 0%, var(--bg-dark) 100%);
}

.creation-wrapper {
    max-width: 900px;
    width: 90vw;
    animation: fadeInUp 0.5s ease;
}

.creation-title {
    font-family: var(--font-pixel);
    font-size: 24px;
    color: var(--gold);
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(240, 192, 64, 0.3);
}

.creation-content {
    display: flex;
    gap: 30px;
}

.creation-left {
    flex: 1;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: var(--font-ui);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: border var(--transition-fast);
}

.form-group input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(240, 192, 64, 0.2);
}

.class-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.class-card {
    padding: 16px;
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-normal);
}

.class-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.class-card.selected {
    border-color: var(--gold);
    box-shadow: 0 0 25px rgba(240, 192, 64, 0.3);
    background: rgba(240, 192, 64, 0.06);
}

.class-icon {
    font-size: 36px;
    margin-bottom: 6px;
}

.class-name {
    font-weight: 700;
    font-size: 16px;
}

.class-desc-short {
    font-size: 11px;
    color: var(--text-secondary);
}

.creation-right {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    text-align: center;
}

.class-preview-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.creation-right h3 {
    font-size: 22px;
    color: var(--gold);
    margin-bottom: 8px;
}

.creation-right p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

.preview-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    font-size: 12px;
    text-align: left;
    margin-bottom: 16px;
    color: var(--accent-cyan);
}

.preview-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.preview-skills .skill-tag {
    padding: 4px 10px;
    background: rgba(0, 245, 212, 0.08);
    border: 1px solid rgba(0, 245, 212, 0.2);
    border-radius: 16px;
    font-size: 11px;
}

.btn-start {
    display: block;
    margin: 30px auto 0;
    width: 260px;
}

/* ===== GAME SCREEN ===== */
#game-screen {
    z-index: 5;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-dark);
}

#game-canvas {
    display: block;
}

#damage-numbers {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

/* ===== HUD ===== */
#hud-top {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 20;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

#hud-player-info {
    display: flex;
    gap: 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    backdrop-filter: blur(10px);
}

#hud-portrait {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border: 2px solid var(--gold-dark);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
}

#hud-info-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 180px;
}

.hud-name-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 2px;
}

#hud-level {
    color: var(--gold);
    font-size: 12px;
}

.bar {
    position: relative;
    height: 14px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 7px;
    overflow: hidden;
}

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

.hp-fill {
    background: linear-gradient(90deg, var(--hp-red-dark), var(--hp-red));
}

.mp-fill {
    background: linear-gradient(90deg, var(--mp-blue-dark), var(--mp-blue));
}

.exp-fill {
    background: linear-gradient(90deg, var(--exp-green-dark), var(--exp-green));
}

.bar-text {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 9px;
    line-height: 14px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 1;
}

#hud-gold {
    position: absolute;
    top: 12px;
    right: 200px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--gold);
    font-weight: 700;
    backdrop-filter: blur(10px);
}

/* Status Effects */
#status-effects {
    display: flex;
    gap: 4px;
    padding: 6px;
}

.status-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    animation: statusPulse 1.5s ease infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Target Info */
#target-info {
    position: absolute;
    top: 80px;
    left: 12px;
    z-index: 20;
    background: var(--bg-panel);
    border: 1px solid rgba(255, 80, 80, 0.3);
    border-radius: 10px;
    padding: 8px 14px;
    min-width: 200px;
}

#target-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--hp-red);
}

.target-hp-bar {
    margin-top: 4px;
    height: 10px;
}

/* Combo Display */
#combo-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    text-align: center;
    pointer-events: none;
    animation: comboPulse 0.3s ease;
}

.combo-count {
    font-family: var(--font-pixel);
    font-size: 48px;
    color: var(--accent-orange);
    text-shadow: 0 0 30px rgba(255, 107, 53, 0.6);
}

.combo-label {
    display: block;
    font-family: var(--font-pixel);
    font-size: 14px;
    color: var(--gold);
    letter-spacing: 4px;
}

@keyframes comboPulse {
    0% {
        transform: translateX(-50%) scale(1.3);
    }

    100% {
        transform: translateX(-50%) scale(1);
    }
}

/* World Event Banner */
#world-event-banner {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    background: linear-gradient(135deg, rgba(240, 192, 64, 0.15), rgba(155, 93, 229, 0.15));
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 8px 24px;
    backdrop-filter: blur(6px);
    animation: eventPulse 2s ease infinite;
}

.event-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
}

@keyframes eventPulse {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(240, 192, 64, 0.2);
    }

    50% {
        box-shadow: 0 0 25px rgba(240, 192, 64, 0.4);
    }
}

/* Map Name */
#map-name {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 20px;
    backdrop-filter: blur(10px);
}

/* ===== Skill Slots ===== */
#hud-bottom {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
}

#skill-slots {
    display: flex;
    gap: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
}

.skill-slot {
    width: 52px;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.skill-slot:hover {
    border-color: var(--gold);
    background: rgba(240, 192, 64, 0.08);
    transform: translateY(-3px);
}

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

.skill-icon {
    font-size: 22px;
}

.skill-key {
    font-size: 9px;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 700;
}

/* ===== Menu Buttons ===== */
#hud-menu {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 20;
    display: flex;
    gap: 6px;
}

.menu-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.menu-btn:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
    background: var(--bg-panel-hover);
}

/* ===== Minimap ===== */
#hud-minimap {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
}

#minimap-canvas {
    width: 160px;
    height: 160px;
    image-rendering: pixelated;
}

/* ===== Chat ===== */
#hud-chat {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 20;
    width: 320px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

#chat-messages {
    height: 120px;
    overflow-y: auto;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.5;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 140, 255, 0.3) transparent;
}

.chat-msg {
    padding: 2px 0;
    word-break: break-all;
}

.chat-msg.system {
    color: var(--accent-cyan);
}

.chat-msg.combat {
    color: var(--hp-red);
}

.chat-msg.quest {
    color: var(--gold);
}

.chat-msg.loot {
    color: var(--accent-purple);
}

#chat-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    font-family: var(--font-ui);
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
    outline: none;
}

/* ===== Game Panels ===== */
.game-panel {
    position: absolute;
    z-index: 40;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    animation: panelSlideIn 0.25s ease;
    min-width: 300px;
    max-height: 80vh;
    overflow-y: auto;
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px)scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0)scale(1);
    }
}

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

.panel-header h3 {
    font-size: 16px;
    color: var(--gold);
}

.close-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.close-btn:hover {
    background: var(--hp-red);
    color: white;
    border-color: var(--hp-red);
}

.panel-body {
    padding: 14px 18px;
}

/* Inventory Panel */
#inventory-panel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.inv-slot {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
}

.inv-slot:hover {
    border-color: var(--gold);
    background: rgba(240, 192, 64, 0.06);
    transform: scale(1.08);
}

.inv-slot.equipped {
    border-color: var(--exp-green);
    box-shadow: inset 0 0 8px rgba(46, 194, 126, 0.3);
}

.item-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Stats Panel */
#stats-panel {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 300px;
}

.stat-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin: 14px 0 8px;
    border-bottom: 1px solid rgba(0, 245, 212, 0.15);
    padding-bottom: 4px;
}

.stat-section-title:first-child {
    margin-top: 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 700;
}

.equip-row {
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 6px;
    transition: background var(--transition-fast);
}

.equip-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Quest Panel */
#quest-panel {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    width: 350px;
}

.quest-item {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: border var(--transition-fast);
}

.quest-item.completed {
    border-color: var(--exp-green);
}

.quest-item.active {
    border-color: var(--gold);
}

.quest-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.quest-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.quest-progress {
    font-size: 12px;
    color: var(--accent-cyan);
    margin-bottom: 4px;
}

.quest-rewards {
    font-size: 11px;
    color: var(--gold);
}

/* ===== SHOP PANEL ===== */
.shop-panel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 450px;
}

.shop-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all var(--transition-fast);
}

.shop-item:hover {
    border-color: var(--gold);
    background: rgba(240, 192, 64, 0.04);
}

.shop-item-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.shop-item-info {
    flex: 1;
}

.shop-item-name {
    font-weight: 700;
    font-size: 13px;
}

.shop-item-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.shop-item-price {
    font-weight: 700;
    font-size: 14px;
    color: var(--gold);
    min-width: 70px;
    text-align: right;
}

.shop-buy-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-family: var(--font-ui);
    font-weight: 700;
    color: var(--bg-dark);
    background: linear-gradient(135deg, var(--gold), #ffdd57);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.shop-buy-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(240, 192, 64, 0.3);
}

/* ===== CRAFT PANEL ===== */
.craft-panel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 420px;
}

.craft-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.craft-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all var(--transition-fast);
}

.craft-item.craftable {
    border-color: rgba(46, 194, 126, 0.4);
}

.craft-item.not-craftable {
    opacity: 0.5;
}

.craft-item:hover {
    border-color: var(--gold);
}

.craft-result {
    display: flex;
    align-items: center;
    gap: 10px;
}

.craft-icon {
    font-size: 26px;
}

.craft-name {
    font-weight: 700;
    font-size: 13px;
}

.craft-materials {
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.has-mat {
    color: var(--exp-green);
}

.no-mat {
    color: var(--hp-red);
}

.craft-btn {
    padding: 6px 16px;
    font-size: 12px;
    font-family: var(--font-ui);
    font-weight: 700;
    color: var(--bg-dark);
    background: linear-gradient(135deg, var(--accent-cyan), #00d4b1);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.craft-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(0, 245, 212, 0.3);
}

.craft-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ===== NPC Dialog ===== */
.npc-dialog-panel {
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 550px;
    max-width: 650px;
}

.dialog-content {
    display: flex;
    gap: 16px;
    padding: 20px;
}

.npc-portrait {
    width: 70px;
    height: 70px;
    border: 2px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.dialog-text {
    flex: 1;
}

.npc-dialog-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--gold);
    margin-bottom: 6px;
}

.npc-dialog-text {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.dialog-choices {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dialog-choice {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    font-family: var(--font-ui);
}

.dialog-choice:hover {
    border-color: var(--gold);
    background: rgba(240, 192, 64, 0.08);
    padding-left: 24px;
}

/* Level Up Overlay */
#level-up-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    animation: levelUpFlash 2s ease forwards;
}

@keyframes levelUpFlash {
    0% {
        background: rgba(240, 192, 64, 0.3);
    }

    50% {
        background: rgba(240, 192, 64, 0.1);
    }

    100% {
        background: transparent;
    }
}

.level-up-text {
    font-family: var(--font-pixel);
    font-size: 48px;
    color: var(--gold);
    text-shadow: 0 0 40px rgba(240, 192, 64, 0.8);
    animation: levelUpBounce 2s ease forwards;
}

@keyframes levelUpBounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    30% {
        transform: scale(1.3);
        opacity: 1;
    }

    60% {
        transform: scale(1);
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Damage Numbers */
.damage-number {
    position: absolute;
    font-family: var(--font-pixel);
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    animation: damageFloat 1s ease-out forwards;
    pointer-events: none;
}

.damage-number.physical {
    color: #ff4444;
}

.damage-number.magical {
    color: #aa44ff;
}

.damage-number.heal {
    color: #44ff44;
}

.damage-number.critical {
    color: #ffff00;
    font-size: 28px;
}

@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    50% {
        opacity: 1;
        transform: translateY(-40px) scale(1.1);
    }

    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.8);
    }
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: -80px;
    right: 20px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    background: linear-gradient(135deg, rgba(240, 192, 64, 0.2), rgba(155, 93, 229, 0.2));
    border: 2px solid var(--gold);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    transition: top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 32px rgba(240, 192, 64, 0.3);
}

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

.ach-icon {
    font-size: 32px;
}

.ach-info {
    display: flex;
    flex-direction: column;
}

.ach-label {
    font-size: 11px;
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 2px;
}

.ach-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    z-index: 200;
    min-width: 220px;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: tooltipFade 0.15s ease;
}

@keyframes tooltipFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.tooltip-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 4px;
}

.tooltip-type {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.tooltip-stats {
    font-size: 12px;
    color: var(--accent-cyan);
    line-height: 1.6;
}

.tooltip-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}

.tooltip-compare {
    font-size: 11px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
}

/* Item rarity colors */
.rarity-common {
    color: #ccc;
}

.rarity-uncommon {
    color: #2ec27e;
}

.rarity-rare {
    color: #4895ef;
}

.rarity-epic {
    color: #9b5de5;
}

.rarity-legendary {
    color: #f0c040;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 140, 255, 0.3);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .game-title {
        font-size: 36px;
    }

    .class-selection {
        grid-template-columns: repeat(2, 1fr);
    }

    .creation-content {
        flex-direction: column;
    }

    #hud-chat {
        width: 260px;
    }

    .npc-dialog-panel {
        min-width: 90vw;
    }

    .shop-panel,
    .craft-panel {
        min-width: 90vw;
    }
}