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

body {
    background: #1a1a2e;
    color: #eee;
    font-family: 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

#game-container {
    width: 940px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
}

/* Header */
#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: #16213e;
    border-radius: 8px;
}

#user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

#user-photo {
    border-radius: 50%;
    border: 2px solid #53a8b6;
}

#user-name {
    font-size: 0.85rem;
    color: #53a8b6;
    font-weight: bold;
}

#game-info {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.85rem;
}

#gold-display { color: #ffd700; font-weight: bold; }
#stage-display { color: #aaa; }
#wave-display { color: #aaa; }

#game-info button {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

#save-btn { background: #4ecca3; color: #fff; }
#save-btn:hover { background: #3db88a; }
#out-btn { background: #e94560; color: #fff; }
#out-btn:hover { background: #c73650; }

/* Canvas */
#canvas-wrap {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

#game-canvas {
    display: block;
}

/* Bottom Panels */
#bottom-panels {
    display: grid;
    grid-template-columns: 280px auto 1fr;
    gap: 10px;
}

.count-badge {
    font-size: 0.7rem;
    color: #53a8b6;
    font-weight: normal;
}

/* Right Panels (Bench + Inventory stacked) */
#right-panels {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Bench Panel */
#bench-panel {
    background: #16213e;
    border-radius: 8px;
    padding: 10px 14px;
    max-height: 180px;
    overflow-y: auto;
}

#bench-panel h3 {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 8px;
    border-bottom: 1px solid #2a3a5e;
    padding-bottom: 6px;
}

.bench-hero {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    background: #0f3460;
    border-radius: 5px;
    margin-bottom: 4px;
    position: relative;
}

.bench-hero-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.bench-hero-info:hover {
    opacity: 0.8;
}

.bench-icon { font-size: 1.1rem; }
.bench-name { font-size: 0.75rem; font-weight: bold; }
.bench-class { font-size: 0.6rem; color: #888; }

.bench-actions {
    display: flex;
    gap: 4px;
}

.bench-to-party {
    background: #4ecca3;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.65rem;
    cursor: pointer;
}

.bench-to-party:hover { background: #3db88a; }

.bench-sell {
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.65rem;
    cursor: pointer;
}

.bench-sell:hover { background: #c73650; }

/* Party Panel */
#party-panel {
    background: #16213e;
    border-radius: 8px;
    padding: 12px 14px;
    max-height: 380px;
    overflow-y: auto;
}

#party-panel h3 {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 10px;
    border-bottom: 1px solid #2a3a5e;
    padding-bottom: 6px;
}

.party-hero {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #0f3460;
    border-radius: 6px;
    margin-bottom: 6px;
    position: relative;
}

.hero-icon-wrap {
    width: 44px;
    height: 44px;
    border: 2px solid #555;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #1a1a2e;
}

.hero-icon { font-size: 1.5rem; }

.hero-grade {
    position: absolute;
    top: -6px;
    right: -6px;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
}

.grade-B { background: #7f8c8d; color: #fff; }
.grade-A { background: #9b59b6; color: #fff; }
.grade-S { background: #e67e22; color: #fff; }

.hero-info { flex: 1; }
.hero-name { font-size: 0.85rem; font-weight: bold; margin-bottom: 2px; }
.hero-stats { font-size: 0.7rem; color: #888; margin-bottom: 3px; }

.hero-equips {
    display: flex;
    gap: 4px;
}

.equip-slot {
    width: 22px;
    height: 22px;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
}

.hero-to-bench-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: #555;
    font-size: 0.75rem;
    cursor: pointer;
    title: "Move to bench";
}

.hero-to-bench-btn:hover { color: #f39c12; }

/* Action Panel */
#action-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    padding: 0 10px;
}

#start-wave-btn {
    padding: 14px 28px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

#start-wave-btn:hover {
    background: #ff6b81;
    transform: translateY(-2px);
}

#shop-btn {
    padding: 10px 28px;
    background: #ffd700;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

#shop-btn:hover {
    background: #ffed4a;
    transform: translateY(-2px);
}

/* Inventory Panel */
#inventory-panel {
    background: #16213e;
    border-radius: 8px;
    padding: 12px 14px;
    max-height: 260px;
    overflow-y: auto;
}

#inventory-panel h3 {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 10px;
    border-bottom: 1px solid #2a3a5e;
    padding-bottom: 6px;
}

.inv-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #0f3460;
    border-radius: 5px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.inv-item:hover { background: #1a4a8a; }

.inv-icon { font-size: 1.1rem; }
.inv-name { flex: 1; font-size: 0.8rem; }
.inv-stats { font-size: 0.65rem; color: #888; }

.inv-grade {
    font-size: 0.6rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
}

.empty-msg {
    color: #555;
    font-size: 0.8rem;
    padding: 8px 0;
}

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

.overlay-box {
    background: #16213e;
    border-radius: 14px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.overlay-box h2 {
    margin-bottom: 20px;
    font-size: 1.4rem;
}

/* Reward */
.reward-box { max-width: 700px; }

#reward-cards {
    display: flex;
    gap: 16px;
}

.reward-card {
    flex: 1;
    background: #0f3460;
    border: 2px solid #2a5a8a;
    border-radius: 10px;
    padding: 24px 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.reward-card:hover {
    border-color: #ffd700;
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.2);
}

.reward-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; }
.reward-card h4 { font-size: 0.95rem; margin-bottom: 6px; }
.reward-card p { font-size: 0.75rem; color: #888; }

/* Shop */
.shop-box { max-width: 650px; width: 90%; }

.shop-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid #2a3a5e;
}

.shop-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: #888;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.shop-tab.active {
    color: #ffd700;
    border-bottom-color: #ffd700;
}

.shop-tab:hover { color: #eee; }

.shop-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    justify-content: center;
}

.shop-item {
    width: 110px;
    background: #0f3460;
    border: 2px solid #2a5a8a;
    border-radius: 8px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-item:hover {
    border-color: #ffd700;
    transform: translateY(-2px);
}

.shop-item.sold {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.shop-icon { font-size: 1.8rem; display: block; margin-bottom: 4px; }
.shop-name { font-size: 0.7rem; display: block; margin-bottom: 2px; }
.shop-class { font-size: 0.6rem; display: block; color: #888; margin-bottom: 2px; }
.shop-price { font-size: 0.8rem; color: #ffd700; font-weight: bold; display: block; margin-top: 4px; }

.shop-refresh-btn {
    padding: 8px 20px;
    background: #53a8b6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.shop-refresh-btn:hover {
    background: #4297a5;
}

#shop-close-btn {
    padding: 10px 30px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

#shop-close-btn:hover { background: #c73650; }

/* Save Slots */
.save-box { max-width: 500px; width: 90%; }

#save-slots {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.save-slot-card {
    flex: 1;
    background: #0f3460;
    border: 2px solid #2a5a8a;
    border-radius: 10px;
    padding: 18px 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.save-slot-card:hover {
    border-color: #4ecca3;
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(78, 204, 163, 0.2);
}

.slot-header {
    font-size: 1rem;
    font-weight: bold;
    color: #4ecca3;
    margin-bottom: 8px;
}

.slot-info {
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 4px;
}

.slot-date {
    font-size: 0.65rem;
    color: #666;
    margin-top: 6px;
}

.save-cancel {
    padding: 8px 24px;
    background: #555;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.save-cancel:hover { background: #666; }

/* Game Over */
.gameover-box { max-width: 400px; }
.gameover-box p { color: #aaa; margin-bottom: 20px; }

#restart-btn {
    padding: 12px 30px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
}

#restart-btn:hover { background: #c73650; }

/* Save notification */
#save-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4ecca3;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: none;
    transition: opacity 0.3s;
    z-index: 999;
}
