:root {
    /* Dark Theme Variables (Default) */
    --bg-primary: #1a1d21;
    --bg-secondary: #252932;
    --bg-tertiary: #2f3440;
    --border-light: rgba(255, 255, 255, 0.1);
    --border-dark: rgba(0, 0, 0, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #b3b8c4;
    --text-muted: #71767d;
    --accent-blue: #4a90e2;
    --accent-green: #5cb85c;
    --accent-purple: #8b5cf6;
    --gradient-game: linear-gradient(135deg, #2d4a22 0%, #1f3c27 25%, #264f4f 50%, #1e3a4a 75%, #1a2735 100%);
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --border-light: rgba(0, 0, 0, 0.1);
    --border-dark: rgba(0, 0, 0, 0.2);
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --accent-blue: #0066cc;
    --accent-green: #28a745;
    --accent-purple: #6f42c1;
    --gradient-game: linear-gradient(135deg, #a8e6a3 0%, #88c999 25%, #7fb8d3 50%, #86a8e7 75%, #91a7ff 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== NAVIGATION BAR ===== */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: visible;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.nav-banner {
    width: 160px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: visible;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.nav-item:hover {
    color: var(--text-primary);
}

.nav-item:hover::after {
    transform: scaleX(1);
}

.nav-item.active::after {
    transform: scaleX(1);
    width: 100%;
    background: var(--accent-blue);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.nav-icon img {
    width: 16px;
    height: 16px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    filter: brightness(0.8);
}

.nav-item:hover .nav-icon img {
    opacity: 1;
    filter: brightness(1);
}

.nav-item.active .nav-icon img {
    opacity: 1;
    filter: brightness(1.2) drop-shadow(0 0 2px var(--accent-blue));
}

/* Fallback for broken images */
.nav-icon img[src=""],
.nav-icon img:not([src]),
.nav-icon img[src*="404"] {
    display: none;
}

.nav-icon img[src=""]:after,
.nav-icon img:not([src]):after,
.nav-icon img[src*="404"]:after {
    content: '🎮';
    display: inline-block;
    font-size: 16px;
    width: 16px;
    height: 16px;
    text-align: center;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    justify-content: flex-end;
}

.nav-action {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-action:hover {
    background: var(--bg-primary);
}

.nav-action.primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* ===== MARKETPLACE MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.marketplace-container {
    width: 1200px;
    height: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-tertiary);
}

.modal-header h2, .modal-header h3 {
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.marketplace-content {
    display: flex;
    height: calc(800px - 80px);
}

.marketplace-sidebar {
    width: 300px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.player-marketplace-info {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.player-marketplace-info h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.marketplace-stats .stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    color: var(--accent-green);
    font-weight: 500;
}

.your-inventory {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.your-inventory h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.inventory-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inventory-item.sellable {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.inventory-item.sellable:hover {
    background: var(--bg-primary);
    border-color: var(--accent-blue);
    transform: translateX(4px);
}

.item-icon {
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.item-info {
    flex: 1;
}

.item-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.item-quantity {
    color: var(--text-secondary);
    font-size: 12px;
}

.sell-indicator {
    font-size: 16px;
    opacity: 0.7;
}

.marketplace-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.marketplace-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.filter-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.btn {
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn:hover {
    background: var(--bg-primary);
}

.btn.primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.btn.secondary {
    background: var(--bg-secondary);
}

.btn.danger {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.marketplace-listings {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.marketplace-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.marketplace-item:hover {
    background: var(--bg-primary);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.marketplace-item-image {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.rarity-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.rarity-badge.common {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.rarity-badge.rare {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.rarity-badge.epic {
    background: rgba(147, 51, 234, 0.2);
    color: #9333ea;
}

.rarity-badge.legendary {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.marketplace-item-info h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 16px;
}

.item-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.4;
}

.item-price {
    color: var(--accent-green);
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
}

.listing-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.your-listings-section h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
}

.listings-grid, .inventory-scroll {
    max-height: 200px;
    overflow-y: auto;
}

.your-listing-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.your-listing-item:hover {
    background: var(--bg-primary);
}

.listing-item-icon {
    font-size: 20px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.listing-item-info {
    flex: 1;
}

.listing-item-info h5 {
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.listing-price {
    color: var(--accent-green);
    font-size: 12px;
    font-weight: 500;
}

.listing-expires {
    color: var(--text-muted);
    font-size: 11px;
}

.remove-listing-quick {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.remove-listing-quick:hover {
    background: rgba(220, 53, 69, 0.2);
}

/* Item Detail Modal */
.item-detail-container {
    width: 500px;
    max-height: 600px;
}

.item-detail-content {
    padding: 20px 24px;
}

.item-detail-image {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.item-large-icon {
    font-size: 48px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.item-detail-info {
    margin-bottom: 20px;
}

.item-detail-stats {
    margin: 16px 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.detail-label {
    color: var(--text-secondary);
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

.item-detail-actions {
    display: flex;
    gap: 12px;
}

/* Sell Item Modal */
.sell-item-container {
    width: 400px;
}

.sell-item-content {
    padding: 20px 24px;
}

.selling-item-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 20px;
}

.selling-item-info h4 {
    color: var(--text-primary);
    margin-bottom: 4px;
}

.selling-item-info p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.suggested-price {
    color: var(--text-muted);
    font-size: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group small {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.price-suggestion {
    color: var(--accent-blue);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.no-listings, .no-items {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* Notification styles for marketplace */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    animation: slideInRight 0.3s ease-out;
    max-width: 300px;
}

.notification.success {
    border-left: 4px solid var(--accent-green);
}

.notification.error {
    border-left: 4px solid #dc3545;
}

.notification.info {
    border-left: 4px solid var(--accent-blue);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Ensure navigation stays clickable */
.navbar {
    z-index: 1000;
    position: relative;
}

.nav-item {
    z-index: 1001;
    position: relative;
}

.nav-dropdown {
    z-index: 1002;
}

.nav-action.primary:hover {
    background: #3a7bc8;
}

/* ===== KINGDOM DROPDOWN MENU ===== */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.kingdom-trigger {
    position: relative;
}

.dropdown-arrow {
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.2s ease;
}

.nav-dropdown:active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: fixed;
    top: 64px;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 99999;
    padding: 8px 0;
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Show dropdown when opened via JS */
.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Rotate arrow when open via JS */
.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-item:first-child {
    border-radius: 6px 6px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 6px 6px;
}

.dropdown-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ===== CHARACTER BAR ===== */
.character-bar {
    background: var(--gradient-game);
    padding: 16px 24px;
    display: block;
    margin: 24px auto 24px auto;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px;
    border: 1px solid var(--border-light);
}

.character-info {
    display: flex;
    margin: auto;
    align-items: center;
    gap: 16px;
}

.character-avatar {
    width: 48px;
    height: 48px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    border: 2px solid var(--border-light);
    position: relative;
}

.character-avatar::before {
    content: "🌿";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
}

.character-details h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.level {
    font-size: 14px;
    color: var(--text-secondary);
}

.character-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.action-btn .btn-icon {
    font-size: 16px;
}

.action-btn .btn-label {
    font-weight: 500;
    font-size: 11px;
}


/* ===== CONTENT AREA ===== */
.content-area {
    flex: 1;
    position: relative;
    min-height: 0;
}

.scene-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
}
.map-area {
    background: var(--gradient-game);
    width: 60%;
    height: 75%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 12px;
    overflow: hidden;
    display: block;
    margin: auto;
    border: 5px solid var(--bg-secondary);
}

.game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

/* ===== GAME OVERLAY ===== */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
}

.action-panel {
    display: flex;
    gap: 12px;
    align-self: center;
    pointer-events: all;
}

.action-button {
    background: rgba(37, 41, 50, 0.95);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    pointer-events: all;
}

.action-button:hover {
    background: rgba(47, 52, 64, 0.95);
    transform: translateY(-1px);
}

.dialog-box {
    background: rgba(37, 41, 50, 0.95);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    height: 35%;
    width: 50%;
    max-width: 400px;
    align-self: center;
    text-align: center;
    justify-items: center;
    backdrop-filter: blur(10px);
    pointer-events: all;
    margin: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.dialog-box h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 10px auto;
    color: var(--text-primary);
}

.dialog-box p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 10px auto;
}

.dialog-action {
    background: var(--accent-blue);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin: 15px auto;
    transition: all 0.2s ease;
}

.dialog-action:hover {
    background: #3a7bc8;
    transform: translateY(-1px);
}

/* ===== PAGE SYSTEM ===== */
.page-content {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.page-content.hidden {
    display: none;
}

/* ===== COMMON COMPONENTS ===== */
.btn {
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.btn.primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.btn.secondary {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
}

.btn.danger {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.btn.disabled {
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn.disabled:hover {
    transform: none;
}

/* ===== KINGDOM PAGE ===== */
.kingdom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.kingdom-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kingdom-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.kingdom-card h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.kingdom-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ===== EQUIPMENT PAGE ===== */
.equipment-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 32px;
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.equipment-panel, .inventory-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
}

.equipment-slots {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.equip-slot {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.slot-label {
    min-width: 80px;
    color: var(--text-secondary);
}

.slot-item {
    width: 50px;
    height: 50px;
    border: 2px dashed var(--border-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-item.empty {
    background: var(--bg-primary);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.item-count {
    color: var(--text-muted);
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.inventory-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.inventory-item.empty {
    background: var(--bg-primary);
    border: 2px dashed var(--border-light);
    min-height: 60px;
}

.item-icon {
    font-size: 24px;
}

.item-name {
    flex: 1;
    color: var(--text-primary);
}

.item-quantity {
    color: var(--text-muted);
    font-size: 12px;
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ===== ARENA PAGE ===== */
.arena-layout {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.battle-info {
    text-align: center;
    margin-bottom: 40px;
}

.battle-info h3 {
    font-size: 28px;
    margin-bottom: 8px;
}

.opponents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.opponent-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: transform 0.2s ease;
}

.opponent-card:hover {
    transform: translateY(-2px);
}

.opponent-card.locked {
    opacity: 0.5;
}

.opponent-avatar {
    font-size: 48px;
    margin-bottom: 16px;
}

.opponent-stats {
    display: flex;
    justify-content: space-around;
    margin: 16px 0;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.opponent-stats .stat {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== QUESTS PAGE ===== */
.quests-layout {
    padding: 32px;
    max-width: 1000px;
    margin: 0 auto;
}

.quest-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.quest-tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.quest-tab:hover {
    color: var(--text-primary);
}

.quest-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-blue);
}

.quest-list {
    display: grid;
    gap: 16px;
}

.quest-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
}

.quest-card.active {
    border-color: var(--accent-blue);
}

.quest-card.completed {
    opacity: 0.7;
    border-color: var(--accent-green);
}

.quest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.quest-reward {
    color: var(--accent-green);
    font-size: 14px;
}

.quest-progress {
    margin: 16px 0;
}

.quest-progress span {
    color: var(--text-secondary);
    font-size: 14px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-blue);
    transition: width 0.3s ease;
}

.quest-requirement {
    color: var(--text-muted);
    font-style: italic;
    margin: 12px 0;
}

/* ===== CHARACTER PAGE ===== */
.character-page {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: var(--bg-primary);
    min-height: 100%;
    position: relative;
}

/* Character Header */
.character-header {
    background: var(--gradient-game);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 32px;
    display: flex;
    gap: 32px;
    align-items: flex-start;
    backdrop-filter: blur(10px);
}

.character-portrait-section {
    display: flex;
    gap: 32px;
    flex: 1;
}

.character-portrait {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.portrait-frame {
    position: relative;
    width: 120px;
    height: 120px;
    background: linear-gradient(145deg, var(--accent-blue), var(--accent-purple));
    border-radius: 20px;
    padding: 4px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.portrait-image {
    width: 100%;
    height: 100%;
    background: var(--bg-tertiary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.default-avatar {
    font-size: 60px;
}

.change-portrait-btn {
    padding: 8px 16px;
    background: rgba(47, 52, 64, 0.95);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.change-portrait-btn:hover {
    background: rgba(47, 52, 64, 0.95);
    transform: translateY(-1px);
}

.character-identity {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.character-name h2 {
    font-size: 28px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.character-level {
    color: var(--accent-blue);
    font-size: 16px;
    font-weight: 500;
}

.character-titles h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 16px;
}

.titles-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.title {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
}

.title.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}

.title.earned {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent-green);
}

.title.earned:hover {
    background: var(--accent-green);
    color: white;
}

.title.locked {
    background: var(--bg-primary);
    color: var(--text-muted);
    border-color: var(--border-dark);
    cursor: not-allowed;
    opacity: 0.5;
}

.titles-note {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

.character-progress {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.xp-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 4px;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.progress-bar.xp .progress-fill {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
}

.progress-text {
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 100px;
}

.character-vitals {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 280px;
}

.vital-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(47, 52, 64, 0.95);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    backdrop-filter: blur(10px);
}

.vital-icon {
    font-size: 20px;
    min-width: 24px;
}

.vital-info {
    flex: 1;
}

.vital-label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 4px;
}

.vital-bar {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.vital-stat.health .vital-bar .progress-fill {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.vital-stat.mana .vital-bar .progress-fill {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.vital-stat.energy .vital-bar .progress-fill {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.vital-text {
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 500;
}

.vital-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.vital-percentage {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.vital-values {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}

.vital-current {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.vital-separator {
    color: var(--text-muted);
    font-size: 12px;
}

.vital-max {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ===== PROFILE SECTIONS ===== */
.profile-sections {
    display: grid;
    gap: 24px;
    margin-bottom: 24px;
}

.profile-section {
    background: rgba(37, 41, 50, 0.95);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.section-header {
    background: rgba(47, 52, 64, 0.95);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.section-header h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin: 0;
}

.edit-bio-btn {
    background: var(--accent-blue);
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-bio-btn:hover {
    background: #3a7bc8;
    transform: translateY(-1px);
}

.view-all-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.2s ease;
}

.view-all-link:hover {
    color: #3a7bc8;
}

/* Bio Section */
.bio-content {
    padding: 20px;
}

.bio-text {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    font-size: 14px;
}

/* Feed Section */
.feed-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(47, 52, 64, 0.95);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.feed-item:hover {
    transform: translateX(4px);
    background: rgba(26, 29, 33, 0.95);
}

.feed-icon {
    font-size: 20px;
    min-width: 24px;
    text-align: center;
}

.feed-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feed-activity {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.feed-time {
    color: var(--text-muted);
    font-size: 12px;
}

/* Comments Section */
.comments-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-input {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-textarea {
    background: rgba(47, 52, 64, 0.95);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 14px;
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    transition: all 0.2s ease;
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.comment-textarea::placeholder {
    color: var(--text-muted);
}

.post-comment-btn {
    background: var(--accent-blue);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.post-comment-btn:hover {
    background: #3a7bc8;
    transform: translateY(-1px);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: rgba(47, 52, 64, 0.95);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.comment-item:hover {
    background: rgba(26, 29, 33, 0.95);
}

.comment-avatar {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author {
    color: var(--accent-blue);
    font-size: 14px;
    font-weight: 600;
}

.comment-time {
    color: var(--text-muted);
    font-size: 11px;
}

.comment-text {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

/* Character Content Grid */
.character-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

.panel {
    background: rgba(37, 41, 50, 0.95);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.panel-header {
    background: rgba(47, 52, 64, 0.95);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
}

.panel-header h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin: 0;
}

/* Stats Panel */
.stats-panel .stats-grid {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stat-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: rgba(47, 52, 64, 0.95);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.stat-item:hover {
    background: rgba(26, 29, 33, 0.95);
    transform: translateY(-1px);
}

.stat-icon {
    font-size: 24px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-content {
    flex: 1;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.stat-label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.stat-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-value {
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 16px;
}

.stat-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-light);
    background: var(--accent-blue);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.stat-btn:hover {
    background: var(--accent-purple);
    transform: scale(1.05);
}

.stat-description {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.stat-effects {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-effects span {
    background: rgba(26, 29, 33, 0.95);
    color: var(--accent-green);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.stat-points {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.points-available {
    color: var(--accent-green);
    font-weight: 600;
    font-size: 16px;
}

/* Info Panel */
.info-sections {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-section h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 4px;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.info-label {
    color: var(--text-secondary);
    font-size: 13px;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

.info-value.guild-name {
    color: var(--accent-purple);
}

.info-value.gold {
    color: var(--accent-green);
}

/* Achievements Panel */
.achievements-container {
    padding: 20px;
}

.achievement-categories {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.achievement-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: 12px;
}

.achievement-tab:hover {
    color: var(--text-primary);
}

.achievement-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-blue);
}

.achievement-count {
    color: var(--text-muted);
    font-size: 12px;
}

.achievement-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.achievement {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(47, 52, 64, 0.95);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.achievement.earned {
    background: rgba(26, 29, 33, 0.95);
    border-color: var(--accent-green);
}

.achievement.locked {
    opacity: 0.5;
}

.achievement:hover:not(.locked) {
    transform: translateX(4px);
}

.achievement-icon {
    font-size: 20px;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-icon.legendary {
    filter: drop-shadow(0 0 8px gold);
}

.achievement-icon.epic {
    filter: drop-shadow(0 0 6px purple);
}

.achievement-icon.rare {
    filter: drop-shadow(0 0 4px blue);
}

.achievement-content {
    flex: 1;
}

.achievement-content h4 {
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-primary);
}

.achievement-content p {
    color: var(--text-secondary);
    font-size: 11px;
    margin-bottom: 4px;
}

.achievement-reward {
    color: var(--accent-green);
    font-size: 10px;
    font-weight: 500;
}

.achievement-progress {
    color: var(--text-muted);
    font-size: 10px;
}

.achievement-date {
    color: var(--text-muted);
    font-size: 10px;
    min-width: 60px;
    text-align: right;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .equipment-layout {
        grid-template-columns: 1fr;
    }
    
    .character-content-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .character-header {
        flex-direction: column;
        gap: 24px;
    }
    
    .character-portrait-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .character-vitals {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }
    
    .nav-menu {
        gap: 2px;
    }
    
    .nav-item {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .character-bar {
        padding: 12px 16px;
    }
    
    .character-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .action-btn {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    .action-btn .btn-icon {
        font-size: 14px;
    }
    
    .action-btn .btn-label {
        font-size: 9px;
    }
    
    .dialog-box {
        margin: 0 16px;
        max-width: none;
    }
    
    .action-panel {
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }
    
    .kingdom-grid, .opponents-grid {
        grid-template-columns: 1fr;
    }
    
    .character-content-grid {
        grid-template-columns: 1fr;
    }
    
    .character-page {
        padding: 16px;
    }
    
    .character-header {
        padding: 20px;
    }
    
    .portrait-frame {
        width: 100px;
        height: 100px;
    }
    
    .default-avatar {
        font-size: 50px;
    }
    
    .character-name h2 {
        font-size: 24px;
    }
    
    .titles-list {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .nav-item span:first-child {
        display: none;
    }
    
    .nav-brand {
        min-width: auto;
    }
    
    .nav-actions {
        min-width: auto;
    }
    
    .kingdom-grid, .arena-layout, .quests-layout, .character-layout {
        padding: 16px;
    }
    
    .inventory-grid {
        grid-template-columns: 1fr;
    }
}
