* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #fff;
    color: #333;
    line-height: 1.6;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #eee;
    z-index: 100;
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
    text-decoration: none;
}

.header-menu {
    display: flex;
    gap: 24px;
    margin-left: 40px;
}

.menu-link {
    color: #555;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    filter: grayscale(1);
}

.menu-link:hover {
    color: #000;
    filter: grayscale(0);
}

.nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #555;
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-link:hover {
    color: #000;
}

.btn-login {
    padding: 8px 16px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-login:hover {
    background: #000;
}

.btn-login.logged-in {
    background: #d1d5db;
    color: #374151;
}

.btn-login.logged-in:hover {
    background: #9ca3af;
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
    margin-left: 8px;
}

.profile-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #f5f5f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

.profile-btn:hover {
    background: #eee;
    border-color: #ccc;
}

.dropdown-menu {
    position: absolute;
    top: 48px;
    right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    overflow: hidden;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: none;
    border: none;
    color: #333;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-divider {
    margin: 4px 0;
    border: none;
    border-top: 1px solid #eee;
}

/* Main */
.main {
    padding-top: 60px;
}

.hero {
    text-align: center;
    padding: 100px 20px 80px;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.hero p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.btn-start {
    padding: 12px 32px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-start:hover {
    background: #1d4ed8;
}

/* Features */
.features {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 32px;
}

.feature {
    padding: 24px;
    border: 1px solid #eee;
    border-radius: 12px;
}

.feature h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.feature p {
    color: #666;
    font-size: 0.95rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid #eee;
    color: #999;
    font-size: 0.85rem;
}

/* ================================
   Shop Page
   ================================ */
.shop-page {
    min-height: calc(100vh - 60px);
}

.shop-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    gap: 40px;
}

/* Character Preview */
.character-preview {
    width: 200px;
    flex-shrink: 0;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px 10px;
    height: fit-content;
    position: sticky;
    top: 100px;
    margin-top: 62px;
}

.preview-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.character-display {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.character-avatar {
    position: relative;
    width: 120px;
    height: 160px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.character-body {
    font-size: 60px;
}

.equipment-slot {
    position: absolute;
    width: 32px;
    height: 32px;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-head { top: 0; left: 50%; transform: translateX(-50%); }
.slot-face { top: 30px; right: 10px; }
.slot-shoulder { top: 60px; left: 0; }
.slot-chest { top: 80px; right: 0; }
.slot-cape { top: 100px; left: 0; }
.slot-hands { top: 120px; right: 0; }
.slot-weapon { top: 140px; left: 0; }
.slot-legs { bottom: 30px; right: 10px; }
.slot-feet { bottom: 0; left: 50%; transform: translateX(-50%); }

.character-info {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.info-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 4px;
}

.info-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
}

/* Sidebar */
.sidebar {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 100px;
    height: fit-content;
    margin-top: 62px;
}

.sidebar .character-preview {
    width: 100%;
    position: static;
    margin-top: 0;
}

/* Equipped Items Box (Inventory) */
.equipped-items-box {
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px;
}

.equipped-items-box .preview-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}

.equipped-items-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.equipped-item-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 4px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipped-item-card:hover {
    border-color: #16a34a;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.2);
    transform: scale(1.05);
}

.equipped-item-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipped-item-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.equipped-items-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    font-size: 0.8rem;
    padding: 12px 0;
}

/* Shop Content */
.shop-content {
    flex: 1;
}

.shop-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.category-tab {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #eee;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.category-tab:hover {
    background: #eee;
}

.category-tab.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.item-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.item-card:hover {
    border-color: #ddd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.item-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.item-info {
    margin-bottom: 12px;
}

.item-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.item-desc {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 4px;
}

.item-price {
    font-size: 0.85rem;
    color: #666;
}

.item-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
}

.btn-detail {
    flex: 1;
    padding: 8px 12px;
    background: #f5f5f5;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-detail:hover {
    background: #eee;
    border-color: #ccc;
}

.btn-buy {
    flex: 1;
    padding: 8px 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-buy:hover {
    background: #1d4ed8;
}

/* Inventory Styles */
.item-status {
    font-size: 0.85rem;
    color: #999;
}

.item-status.status-equipped {
    color: #16a34a;
    font-weight: 500;
}

.item-card.equipped {
    border-color: #16a34a;
    background: #f0fdf4;
}

.btn-equip {
    flex: 1;
    padding: 8px 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-equip:hover {
    background: #1d4ed8;
}

.btn-equip.btn-unequip {
    background: #d1d5db;
    color: #374151;
}

.btn-equip.btn-unequip:hover {
    background: #9ca3af;
}

.no-items,
.loading {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 40px;
}

.item-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 12px;
}

.item-card.purchased {
    opacity: 0.6;
}

.btn-buy.btn-purchased {
    background: #d1d5db;
    color: #6b7280;
    cursor: not-allowed;
}

/* ================================
   Modal
   ================================ */
.modal-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;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    transform: scale(0.9);
    transition: transform 0.2s;
}

.modal-overlay.open .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px 20px;
    text-align: center;
}

.modal-item-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.modal-item-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-item-name {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-item-category {
    font-size: 0.9rem;
    color: #888;
}

.modal-item-price {
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
}

.modal-item-desc {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.5;
}

.modal-item-status {
    font-size: 0.95rem;
    color: #999;
    font-weight: 500;
}

.modal-item-status.status-equipped {
    color: #16a34a;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #eee;
}

.btn-modal {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cancel {
    background: #f5f5f5;
    color: #333;
}

.btn-cancel:hover {
    background: #eee;
}

.btn-confirm {
    background: #2563eb;
    color: #fff;
}

.btn-confirm:hover {
    background: #1d4ed8;
}

.btn-unequip-modal {
    background: #ef4444;
    color: #fff;
}

.btn-unequip-modal:hover {
    background: #dc2626;
}

/* Shop Responsive */
@media (max-width: 768px) {
    .shop-container {
        flex-direction: column;
    }
    
    .character-preview {
        width: 100%;
        position: static;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        margin-top: 0;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .sidebar .character-preview,
    .sidebar .equipped-items-box {
        flex: 1;
        min-width: 180px;
    }
    
    .character-avatar {
        width: 120px;
        height: 160px;
    }
    
    .character-body {
        font-size: 60px;
    }
    
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* Responsive */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
}

