/* ============ RESET ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: rgba(15, 20, 40, 0.65);
    --bg-card: rgba(25, 35, 60, 0.55);
    --bg-panel: rgba(10, 15, 30, 0.85);
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --gold: #ffd700;
    --gold-dark: #c9a700;
    --star: #f39c12;
    --hp-green: #00b894;
    --hp-red: #e74c3c;
    --boss-red: #ff4757;
    --text-primary: #ffffff;
    --text-secondary: #c0c8e0;
    --text-muted: #8892b0;
    --success: #00b894;
    --danger: #e74c3c;
    --border: rgba(255, 255, 255, 0.12);
    --glass: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --blur: blur(12px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ============ SCREENS ============ */
.screen {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1;
}
.screen.active { display: flex; }

/* ============ LOADING ============ */
#loading-screen {
    background: linear-gradient(135deg, #0a0e1a, #1a1040);
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.loading-content { text-align: center; }
.loading-logo {
    font-size: 80px;
    animation: pulse 1.5s ease-in-out infinite;
    margin-bottom: 16px;
}
.loading-content h1 {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(90deg, var(--gold), var(--star));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
}
.loading-bar {
    width: 200px;
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    margin: 0 auto 16px;
    overflow: hidden;
}
.loading-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 2px;
    transition: width 0.15s ease-out;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============ ERROR ============ */
#error-screen {
    background: var(--bg-primary);
    justify-content: center;
    align-items: center;
}
.error-content { text-align: center; padding: 32px; }
.error-icon { font-size: 64px; margin-bottom: 16px; }
.error-content h2 { color: var(--danger); margin-bottom: 12px; }

/* ============ GAME SCREEN ============ */
#game-screen {
    flex-direction: column;
    background: var(--bg-primary);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background 0.5s ease;
}

/* ============ TOP BAR ============ */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: var(--bg-secondary);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    z-index: 10;
}
.currency {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.gold-currency { color: var(--gold); }
.star-currency { color: var(--star); }
.sparks-display {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ============ ZONE SELECTOR ============ */
.zone-selector {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    background: var(--bg-secondary);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--glass-border);
    gap: 4px;
    flex-shrink: 0;
}
.zone-arrow {
    width: 36px;
    height: 36px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--text-primary);
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.zone-arrow:active { background: var(--accent); color: white; }
.zone-list {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.zone-list::-webkit-scrollbar { display: none; }
.zone-item {
    min-width: 52px;
    height: 52px;
    border-radius: 8px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}
.zone-item .zone-num { font-size: 16px; font-weight: 800; }
.zone-item.active {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.2);
    color: var(--accent-light);
}
.zone-item.boss-zone {
    border-color: var(--boss-red);
}
.zone-item.boss-zone.active {
    background: rgba(255, 71, 87, 0.15);
    border-color: var(--boss-red);
    color: var(--boss-red);
}
.zone-tag {
    font-size: 7px;
    font-weight: 700;
    color: var(--boss-red);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: -2px;
}
.zone-tag-new {
    color: #fff;
    background: var(--success);
    padding: 1px 4px;
    border-radius: 3px;
    animation: new-lvl-pulse 1s ease-in-out infinite;
}
.zone-item.zone-new {
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(0, 206, 130, 0.4);
    animation: zone-new-glow 1.2s ease-in-out infinite;
}
@keyframes new-lvl-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes zone-new-glow {
    0%, 100% { box-shadow: 0 0 6px rgba(0, 206, 130, 0.3); }
    50% { box-shadow: 0 0 14px rgba(0, 206, 130, 0.7), 0 0 4px rgba(0, 206, 130, 0.3) inset; }
}
.zone-item.locked {
    opacity: 0.35;
    cursor: default;
}
.zone-item.completed::after {
    content: "✓";
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 8px;
    color: var(--success);
}

/* ============ ZONE PROGRESS ============ */
.zone-progress {
    text-align: center;
    padding: 4px 12px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.zone-kills {
    font-size: 22px;
    font-weight: 900;
    color: var(--gold);
}
.zone-bonus {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* ============ MONSTER ZONE ============ */
.monster-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    position: relative;
    overflow: hidden;
    background: transparent;
}
.monster-hp-bar {
    width: 80%;
    max-width: 300px;
    height: 22px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 11px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    position: relative;
    margin-bottom: 6px;
    border: 1px solid var(--border);
}
.hp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--hp-green), #55efc4);
    border-radius: 10px;
    transition: width 0.12s ease;
    width: 100%;
}
.hp-fill.low { background: linear-gradient(90deg, #e67e22, #f1c40f); }
.hp-fill.critical { background: linear-gradient(90deg, var(--hp-red), #ff6b6b); }
.hp-fill.boss { background: linear-gradient(90deg, var(--boss-red), #ff6348); }
#monster-hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.monster-name {
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    margin-bottom: 4px;
    padding: 2px 12px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 8px;
}
.boss-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.boss-timer-bar {
    width: 120px;
    height: 6px;
    background: rgba(255, 71, 87, 0.2);
    border-radius: 3px;
    overflow: hidden;
}
.boss-timer-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--boss-red), #ff6b81);
    border-radius: 3px;
    transition: width 1s linear;
}
.boss-timer-label {
    color: var(--boss-red);
    font-size: 14px;
    font-weight: 800;
    animation: pulse 1s ease-in-out infinite;
}
.monster-platform {
    display: none;
}
.monster-container {
    width: 65%;
    max-width: 280px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    z-index: 2;
}
.monster-sprite {
    font-size: 120px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.06s;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
}
.monster-sprite img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease-in;
}
.monster-sprite img.img-loaded {
    opacity: 1;
}
.monster-sprite.hit {
    transform: scale(0.85);
    filter: drop-shadow(0 0 20px rgba(255, 50, 50, 0.6)) brightness(1.5);
}
.monster-sprite.dead {
    animation: monsterDeath 0.35s ease-out forwards;
}
@keyframes monsterDeath {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}
/* Chest sprite glow when monster is a chest */
.monster-sprite.chest-glow {
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.7)) drop-shadow(0 0 40px rgba(255, 215, 0, 0.3));
    animation: chest-pulse 1.5s ease-in-out infinite;
}
@keyframes chest-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.7)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.9)); }
}

/* ============ SKILLS BAR ============ */
.skills-bar {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(10, 14, 26, 0.5);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    flex-wrap: nowrap;
}
.skill-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s, border-color 0.2s;
    overflow: hidden;
    flex-shrink: 1;
}
.skill-btn:active { transform: scale(0.9); }
.skill-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.skill-btn .skill-icon { font-size: 20px; z-index: 1; }
/* Уменьшаем иконки если много навыков */
.skills-bar.skills-compact .skill-btn {
    width: 34px; height: 34px; min-width: 34px;
    border-radius: 8px;
}
.skills-bar.skills-compact .skill-btn .skill-icon { font-size: 16px; }
.skills-bar.skills-compact .skill-help-btn {
    width: 28px !important; height: 28px !important; min-width: 28px !important;
}
.skills-bar.skills-compact .skill-help-btn .skill-icon { font-size: 12px !important; }
.skill-btn.active-skill {
    border-color: var(--success);
    box-shadow: 0 0 8px rgba(0, 184, 148, 0.5);
}
.skill-btn.on-cooldown {
    border-color: var(--text-muted);
}
.skill-btn.energize-glow:not(.on-cooldown):not(.active-skill) {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    animation: energize-pulse 0.8s infinite alternate;
}
@keyframes energize-pulse {
    from { box-shadow: 0 0 6px rgba(255, 215, 0, 0.4); }
    to { box-shadow: 0 0 14px rgba(255, 215, 0, 0.8); }
}
.skill-timer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 184, 148, 0.8);
    color: white;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    padding: 1px 0;
}
.skill-cooldown {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
}

/* Skill help button */
.skill-help-btn {
    background: rgba(108, 92, 231, 0.2) !important;
    border-color: var(--accent) !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    flex-shrink: 0 !important;
}
.skill-help-btn .skill-icon { font-size: 14px !important; }

/* Skill info popup */
.skill-info-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}
.skill-info-row.skill-info-locked { opacity: 0.4; }
.skill-info-icon { font-size: 24px; flex-shrink: 0; margin-top: 2px; }
.skill-info-details { flex: 1; min-width: 0; }
.skill-info-name { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.skill-info-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.skill-info-lock { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ============ STATS BAR ============ */
.stats-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    cursor: pointer;
}
.stat-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}
.stat-emoji { font-size: 22px; }
#open-heroes-btn {
    background: linear-gradient(135deg, rgba(108,92,231,0.2), rgba(162,155,254,0.1));
    padding: 4px 14px;
    border-radius: 10px;
}

/* ============ BOTTOM NAV ============ */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 8px calc(6px + var(--safe-bottom));
    background: var(--bg-secondary);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    padding: 5px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.nav-btn.active {
    color: var(--accent-light);
    background: rgba(108, 92, 231, 0.15);
}
.nav-icon { font-size: 20px; }
.nav-label { font-weight: 600; }

/* ============ PANELS ============ */
.panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 88%;
    background: #0d1220;
    border-radius: 20px 20px 0 0;
    z-index: 50;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
.panel.active { transform: translateY(0); }
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.panel-header h2 { font-size: 17px; }
.panel-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-card);
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px calc(14px + var(--safe-bottom));
    -webkit-overflow-scrolling: touch;
}

/* ============ PANEL TABS (sub-tabs inside panels) ============ */
.panel-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
}
.panel-tabs.scrollable-tabs {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
}
.panel-tabs.scrollable-tabs::-webkit-scrollbar { display: none; }
.panel-tabs.scrollable-tabs .panel-tab {
    flex: 0 0 auto;
    white-space: nowrap;
}
.panel-tab {
    flex: 1;
    padding: 8px 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}
.panel-tab.active {
    color: var(--accent-light);
    background: rgba(108, 92, 231, 0.15);
}
.panel-tab.tab-locked {
    opacity: 0.45;
    color: var(--text-muted);
}
.locked-tab-toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.locked-tab-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.panel-subtab {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 14px calc(14px + var(--safe-bottom));
}
.panel-subtab.active { display: flex; }
.panel-subtab > .panel-content {
    padding: 0;
    overflow: visible;
    flex: none;
}

/* ============ PROFILE ============ */
.profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}
.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    overflow: hidden;
}
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.profile-name { font-size: 16px; font-weight: 700; }
.profile-name-vip {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    animation: vipNameGlow 2s ease-in-out infinite;
}
@keyframes vipNameGlow {
    0%, 100% { text-shadow: 0 0 6px rgba(255, 215, 0, 0.4); }
    50% { text-shadow: 0 0 14px rgba(255, 215, 0, 0.7), 0 0 24px rgba(255, 140, 0, 0.3); }
}
.vip-crown {
    font-size: 14px;
    margin-right: 2px;
    animation: vipCrownBounce 3s ease-in-out infinite;
    display: inline-block;
}
@keyframes vipCrownBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-2px) rotate(-3deg); }
    75% { transform: translateY(-1px) rotate(3deg); }
}
.profile-vip-tag {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    color: #1a1a2e;
    background: linear-gradient(135deg, #ffd700, #ff8c00, #ffd700);
    background-size: 200% 100%;
    animation: vipTagShimmer 2.5s ease infinite;
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 2px;
    letter-spacing: 0.5px;
}
@keyframes vipTagShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.profile-avatar.avatar-vip {
    border: 2.5px solid #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    animation: vipAvatarPulse 3s ease-in-out infinite;
}
@keyframes vipAvatarPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 16px rgba(255, 215, 0, 0.6), 0 0 30px rgba(255, 140, 0, 0.2); }
}

/* Stars Exchange */
.stars-exchange-box {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    margin: 10px 0;
}
.stars-exchange-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
}
.stars-exchange-rate {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 8px;
}
.stars-exchange-row {
    display: flex;
    gap: 8px;
}
.stars-exchange-input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
}
.stars-exchange-btn {
    padding: 8px 16px;
    font-size: 12px;
    white-space: nowrap;
}
.stars-exchange-preview {
    font-size: 11px;
    color: var(--accent-light);
    text-align: center;
    margin-top: 6px;
    min-height: 16px;
}

/* VIP эффекты на игровом экране */
#game-screen.vip-active .top-bar {
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
}
#game-screen.vip-active .gold-currency .currency-icon {
    animation: vipGoldBounce 2s ease-in-out infinite;
}
@keyframes vipGoldBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); filter: brightness(1.3); }
}
#game-screen.vip-active .monster-zone {
    box-shadow: inset 0 0 60px rgba(255, 215, 0, 0.03);
}

/* VIP бейдж в лидерборде */
.lb-vip-row {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.04), transparent) !important;
    border-color: rgba(255, 215, 0, 0.2);
}
.profile-username { font-size: 12px; color: var(--text-muted); }
.profile-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 6px;
    margin-bottom: 14px;
}
.btn-invite-profile {
    width: 100%;
    padding: 10px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.btn-invite-profile:active {
    transform: scale(0.97);
}
.profile-stat-item {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
    border: 1px solid var(--border);
}
.profile-stat-value { font-size: 13px; font-weight: 800; color: var(--accent-light); }
.profile-stat-label { font-size: 8px; color: var(--text-muted); margin-top: 2px; }
.profile-leaderboard-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}
.lb-tab {
    flex: 1;
    padding: 7px 4px;
    border: none;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}
.lb-tab.active {
    color: var(--accent-light);
    background: rgba(108, 92, 231, 0.15);
}
.leaderboard-list { display: flex; flex-direction: column; gap: 4px; }
.lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.lb-row.lb-me { border-color: var(--accent); background: rgba(108, 92, 231, 0.08); }
.lb-rank {
    width: 24px;
    text-align: center;
    font-weight: 800;
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.lb-rank-1 { color: #ffd700; }
.lb-rank-2 { color: #c0c0c0; }
.lb-rank-3 { color: #cd7f32; }
.lb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.lb-name { flex: 1; font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-vip { font-size: 10px; margin-right: 3px; }
/* lb-vip-row border moved to main definition above */
.lb-avatar-vip {
    border: 2px solid #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}
.lb-value { font-size: 13px; font-weight: 700; color: var(--accent-light); flex-shrink: 0; }

/* ============ HERO CARD ============ */
.hero-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    position: relative;
}
.hero-card.has-new-ability {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(108, 92, 231, 0.2);
}
.hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}
.hero-level-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 6px;
    min-width: 20px;
    text-align: center;
}
.hero-info { flex: 1; min-width: 0; }
.hero-name { font-size: 14px; font-weight: 700; }
.hero-stats {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}
.hero-abilities-toggle {
    font-size: 11px;
    color: var(--accent-light);
    cursor: pointer;
    margin-top: 4px;
    user-select: none;
}
.hero-abilities-list {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ability-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
}
.ability-row.locked {
    opacity: 0.45;
}
.ability-row.unlocked {
    background: rgba(108, 92, 231, 0.12);
}
.ability-icon {
    font-size: 12px;
    flex-shrink: 0;
}
.ability-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.ability-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 11px;
}
.ability-desc {
    color: var(--text-muted);
    font-size: 10px;
}
.ability-unlock {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}
.ability-row.unlocked .ability-unlock {
    color: var(--success);
}
.hero-milestone-hint {
    font-size: 10px;
    color: #ff9f43;
    margin-top: 2px;
    font-weight: 600;
    animation: milestoneHintPulse 1.5s ease-in-out infinite;
}
@keyframes milestoneHintPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
.hero-next-ability {
    font-size: 10px;
    color: var(--gold);
    margin-top: 2px;
}

/* Milestone achievement animation */
.milestone-flash {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: msFlashFade 1.2s ease-out forwards;
}
.milestone-flash-inner {
    text-align: center;
    animation: msFlashScale 1.2s ease-out forwards;
}
.milestone-flash-icon {
    font-size: 48px;
    display: block;
    animation: msFlashSpin 0.8s ease-out;
}
.milestone-flash-text {
    font-size: 20px;
    font-weight: 800;
    color: #ff9f43;
    text-shadow: 0 0 20px rgba(255,159,67,0.6), 0 0 40px rgba(255,159,67,0.3);
    margin-top: 8px;
}
.milestone-flash-bonus {
    font-size: 14px;
    color: var(--success);
    font-weight: 700;
    margin-top: 4px;
}
@keyframes msFlashFade {
    0% { opacity: 0; }
    15% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes msFlashScale {
    0% { transform: scale(0.3); }
    20% { transform: scale(1.2); }
    35% { transform: scale(1); }
    100% { transform: scale(1); }
}
@keyframes msFlashSpin {
    0% { transform: rotate(-15deg) scale(0.5); }
    50% { transform: rotate(10deg) scale(1.1); }
    100% { transform: rotate(0deg) scale(1); }
}

/* Hero card milestone glow */
.hero-card.milestone-reached {
    animation: msCardGlow 1.5s ease-out;
}
@keyframes msCardGlow {
    0% { box-shadow: 0 0 0 rgba(255,159,67,0); }
    30% { box-shadow: 0 0 20px rgba(255,159,67,0.5), inset 0 0 10px rgba(255,159,67,0.15); }
    100% { box-shadow: none; }
}

.btn-hero {
    padding: 8px 12px;
    border-radius: 10px;
    border: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
    text-align: center;
}
.btn-hero.upgrade {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #1a1a1a;
}
.btn-hero.hire {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
}
.btn-hero:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* ============ TASK CARD ============ */
.task-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}
.task-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.task-info { flex: 1; min-width: 0; }
.task-title { font-size: 13px; font-weight: 600; }
.task-reward { font-size: 11px; color: var(--star); margin-top: 1px; }
.task-rewards-row { display: flex; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.task-reward-badge {
    font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px;
}
.task-reward-stars { background: rgba(255,215,0,0.15); color: var(--star); }
.task-reward-gold { background: rgba(255,165,0,0.12); color: #ffa500; }
.task-completions { font-size: 9px; color: var(--text-muted); }
.task-card.task-done { opacity: 0.5; }
.task-card.task-completed-anim {
    border-color: var(--success);
    background: rgba(0, 206, 130, 0.08);
}
.task-card { max-height: 120px; transition: opacity 0.4s, transform 0.4s, max-height 0.5s, margin-bottom 0.3s, padding 0.3s, border-color 0.3s, background 0.3s; }
.task-card.task-fade-out {
    opacity: 0;
    transform: scale(0.95);
    max-height: 0;
    margin-bottom: 0;
    padding: 0 10px;
    overflow: hidden;
}
.btn-task {
    padding: 7px 12px;
    border-radius: 8px;
    border: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-task.subscribe { background: linear-gradient(135deg, #0088cc, #00aaff); color: white; }
.btn-task.check { background: linear-gradient(135deg, var(--success), #55efc4); color: white; }
.btn-task.completed { background: var(--bg-secondary); color: var(--success); }

/* ============ AD POPUP ============ */
.ad-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ad-popup-box {
    background: var(--bg-primary);
    border-radius: 16px;
    max-width: 360px;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.ad-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
}
.ad-popup-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ad-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--glass);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ad-close-appear 0.3s ease;
}
@keyframes ad-close-appear {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}
.ad-popup-img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    display: block;
}
#ad-popup-content {
    padding: 16px;
    text-align: center;
}
.ad-popup-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-primary);
}
.ad-popup-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.4;
}
.ad-buttons-wrap { margin-top: 10px; }
.ad-buttons-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 6px; }
.ad-popup-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    flex: 1;
    text-align: center;
    min-width: 0;
}
.ad-popup-btn:active { opacity: 0.8; }
.ad-timer-bar { display: none; }
.ad-timer-fill { display: none; }

/* ============ POPUP ============ */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
}
.popup-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    animation: popupShow 0.3s ease-out;
}
.popup-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 16px;
}
.popup-text { margin-bottom: 20px; }
.popup-text p { margin: 6px 0; font-size: 14px; color: var(--text-secondary); }
.offline-gold { font-size: 24px !important; font-weight: 800; color: var(--gold) !important; }
.btn {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}
.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
}
@keyframes popupShow {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ============ DAMAGE NUMBERS ============ */
#damage-numbers {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 40;
}
.damage-number {
    position: absolute;
    font-size: 22px;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    animation: dmgFloat 0.7s ease-out forwards;
    pointer-events: none;
}
.damage-number.crit {
    font-size: 32px;
    color: #ff4757;
}
@keyframes dmgFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(0.8); }
}

/* ============ GOLD POPUP ============ */
.gold-float {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 22px;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    animation: goldUp 1s ease-out forwards;
    pointer-events: none;
    z-index: 45;
}
@keyframes goldUp {
    0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(0.7); }
}

/* ============ RESPONSIVE ============ */
@media (max-height: 600px) {
    .monster-container { width: 140px; height: 140px; }
    .monster-sprite { font-size: 95px; }
    .zone-item { min-width: 44px; height: 44px; }
    .zone-item .zone-num { font-size: 14px; }
}
@media (min-width: 500px) {
    .monster-container { width: 220px; height: 220px; }
    .monster-sprite { font-size: 150px; }
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 2px; }

/* ============ GUIDE SECTION ============ */
.guide-toggle-bar {
    padding: 8px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.btn-guide-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-guide-toggle:active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--text-primary);
}
.guide-section {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.08), rgba(162, 155, 254, 0.04));
    border-bottom: 1px solid var(--border);
}
.guide-block {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.guide-block:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.guide-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 6px;
}
.guide-subtitle {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 6px;
    margin-bottom: 2px;
}
.guide-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.guide-text b {
    color: var(--text-primary);
}
.guide-red {
    color: var(--danger) !important;
}
.guide-green {
    color: var(--success) !important;
}

/* ============ PATRONS PANEL ============ */
.patron-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.spark-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.spark-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-light);
}
.spark-label {
    font-size: 11px;
    color: var(--text-muted);
}
.spark-bonus {
    font-size: 13px;
    color: var(--success);
    font-weight: 600;
}

.ascension-section {
    padding: 16px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(162, 155, 254, 0.08));
    border-bottom: 1px solid var(--border);
    text-align: center;
}
.ascension-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.ascension-info .accent-text {
    color: var(--accent-light);
    font-weight: 700;
    font-size: 18px;
}
.ascension-warning {
    color: var(--danger) !important;
    font-size: 11px !important;
}
.ascension-keep {
    color: var(--success) !important;
    font-size: 11px !important;
}
.btn-ascend {
    margin-top: 12px;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}
.btn-ascend:active {
    transform: scale(0.97);
}
.btn-ascend:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Summon section */
.summon-section {
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(108, 92, 231, 0.12));
    border-bottom: 1px solid var(--border);
}
.summon-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.summon-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-light);
    margin: 0;
}
.summon-cost-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}
.summon-offers {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.offer-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid rgba(108, 92, 231, 0.3);
}
.offer-icon {
    font-size: 28px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 215, 0, 0.15);
    border-radius: 8px;
    flex-shrink: 0;
}
.offer-info {
    flex: 1;
    min-width: 0;
}
.offer-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.offer-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.offer-summon-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform 0.1s;
}
.offer-summon-btn:active { transform: scale(0.95); }
.offer-summon-btn.can-afford {
    background: linear-gradient(135deg, #ffd700, #f0a500);
    color: #1a1a2e;
}
.offer-summon-btn.cant-afford {
    background: var(--bg-secondary);
    color: var(--text-muted);
}
.btn-reroll {
    width: 100%;
    padding: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}
.btn-reroll:active { transform: scale(0.97); }
.btn-reroll:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.owned-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 12px 16px 4px;
    margin: 0;
}

/* Patron card */
.patron-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}
.patron-icon {
    font-size: 32px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 92, 231, 0.2);
    border-radius: 10px;
    flex-shrink: 0;
}
.patron-info {
    flex: 1;
    min-width: 0;
}
.patron-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.patron-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.patron-level {
    font-size: 12px;
    color: var(--accent-light);
    font-weight: 600;
    margin-top: 3px;
}
.patron-effect-value {
    color: var(--success);
}
.patron-next {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    font-style: italic;
}
.patron-buy-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform 0.1s;
}
.patron-buy-btn:active {
    transform: scale(0.95);
}
.patron-buy-btn.can-afford {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}
.patron-buy-btn.cant-afford {
    background: var(--bg-secondary);
    color: var(--text-muted);
}
.patron-buy-btn.at-max {
    background: var(--bg-secondary);
    color: var(--success);
    cursor: default;
}

/* Ascend popup */
.popup-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.popup-buttons .btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.btn-cancel {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.warning-text {
    color: var(--danger);
    font-weight: 700;
    font-size: 15px;
    margin: 8px 0;
}

/* ============ GOLD x10 & SPARK FLOAT ============ */
.gold-float.gold-x10 {
    font-size: 28px;
    color: #ff6348;
    text-shadow: 0 0 16px rgba(255, 99, 72, 0.8), 0 2px 8px rgba(0,0,0,0.8);
    animation: goldX10Up 1.2s ease-out forwards;
}
@keyframes goldX10Up {
    0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.3); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(0.7); }
}
.gold-float.spark-float {
    color: var(--accent-light);
    font-size: 24px;
    text-shadow: 0 0 16px rgba(162, 155, 254, 0.8), 0 2px 8px rgba(0,0,0,0.8);
    animation: sparkUp 1.5s ease-out forwards;
}
@keyframes sparkUp {
    0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.2); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-70px) scale(0.6); }
}

/* ============ CHEST GOLD FLOAT ============ */
.gold-float.gold-chest {
    font-size: 26px;
    color: var(--gold);
    text-shadow: 0 0 16px rgba(255, 215, 0, 0.8), 0 2px 8px rgba(0,0,0,0.8);
    animation: goldX10Up 1.5s ease-out forwards;
}
.gold-float.primal-float {
    font-size: 28px;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 165, 0, 0.5), 0 2px 8px rgba(0,0,0,0.8);
    animation: primalUp 2s ease-out forwards;
}
@keyframes primalUp {
    0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.5); }
    20% { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.6); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-80px) scale(0.8); }
}

/* ============ ACHIEVEMENTS ============ */
.ach-bonus-bar {
    display: flex;
    justify-content: space-around;
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}
.ach-bonus-bar strong {
    color: var(--accent-light);
}
.ach-progress {
    text-align: center;
    padding: 10px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}
.ach-section {
    margin-bottom: 8px;
}
.ach-section-title {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-light);
    background: rgba(162, 155, 254, 0.08);
}
.ach-card {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}
.ach-card.ach-locked {
    opacity: 0.45;
}
.ach-card.ach-unlocked {
    opacity: 1;
}
.ach-icon {
    font-size: 22px;
    flex-shrink: 0;
    width: 30px;
    text-align: center;
}
.ach-info {
    flex: 1;
    min-width: 0;
}
.ach-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.ach-condition {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}
.ach-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    overflow: hidden;
    margin: 4px 0;
    position: relative;
}
.ach-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 5px;
    transition: width 0.3s ease;
    min-width: 2px;
}
.ach-progress-fill.ach-progress-done {
    background: linear-gradient(90deg, var(--success), #55efc4);
}
.ach-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 7px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}
.ach-bonus {
    font-size: 11px;
    color: var(--accent-light);
}
.ach-check {
    font-size: 18px;
    flex-shrink: 0;
}

/* Achievement float notification */
.gold-float.achievement-float {
    font-size: 20px;
    color: #ffd700;
    text-shadow: 0 0 16px rgba(255, 215, 0, 0.8), 0 2px 8px rgba(0,0,0,0.8);
    animation: achievementUp 2.5s ease-out forwards;
    top: 35%;
}
@keyframes achievementUp {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.8); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.1); }
    70% { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(0.8); }
}

/* ============ REFERRAL POPUP ============ */
.referral-box {
    max-width: 340px;
    width: 90%;
}
.ref-stats {
    font-size: 13px !important;
    color: var(--text-muted) !important;
    margin-top: 8px !important;
}
.ref-stats strong {
    color: var(--accent-light);
}
.ref-link-box {
    margin-bottom: 12px;
}
.ref-link-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 12px;
    text-align: center;
    outline: none;
}
.ref-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.ref-action-btn {
    flex: 1;
    padding: 10px 8px !important;
    font-size: 13px !important;
    border-radius: 10px;
}
.ref-action-btn:not(.btn-accent) {
    background: var(--bg-card);
    color: var(--text-primary);
}
.ref-close-btn {
    margin-top: 4px;
    padding: 8px !important;
    font-size: 13px !important;
}

/* ============ PROFILE BUTTONS GRID ============ */
.profile-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0 14px;
}
.profile-action-btn {
    padding: 12px 8px;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s;
}
.profile-action-btn:active { transform: scale(0.95); }
.profile-btn-vip { background: linear-gradient(135deg, #ffd700, #ff8c00); color: #1a1a2e; }
.profile-btn-bp { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; }
.profile-btn-ref { background: linear-gradient(135deg, #6c5ce7, #a29bfe); color: #fff; }
.profile-btn-clan { background: linear-gradient(135deg, #e74c3c, #c0392b); color: #fff; }
.profile-btn-withdraw {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: #1a1a2e;
    grid-column: 1 / -1;
}
/* Keep old classes for VIP/BP popups */
.btn-vip, .btn-bp {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.btn-vip {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #1a1a2e;
}
.btn-bp {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
}
.profile-shop-row {
    display: flex;
    gap: 8px;
    margin: 8px 0;
}

/* ============ VIP POPUP ============ */
.vip-box {
    max-width: 360px;
}
.vip-status {
    text-align: center;
    margin: 8px 0;
}
.vip-active {
    color: #ffd700;
    font-weight: 700;
    padding: 8px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
}
.vip-inactive {
    color: var(--text-muted);
    padding: 8px;
}
.vip-benefits {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0;
    padding: 10px;
    background: rgba(255, 215, 0, 0.05);
    border-radius: 8px;
    font-size: 13px;
}
.vip-benefit {
    color: var(--text-secondary);
}
.vip-plans {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
}
.btn-vip-plan {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    background: rgba(255, 215, 0, 0.08);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-vip-plan:hover {
    background: rgba(255, 215, 0, 0.15);
}
.btn-close-popup {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
}

/* ============ BATTLE PASS POPUP ============ */
.bp-box {
    max-width: 400px;
    width: 94%;
    max-height: 88vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: #0d1220;
    border: 1px solid rgba(168, 85, 247, 0.25);
}
.bp-info {
    text-align: center;
    margin: 8px 0 12px;
}
.bp-not-owned {
    color: var(--text-muted);
    font-size: 13px;
}
.bp-season-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(124, 58, 237, 0.06));
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(168, 85, 247, 0.2);
}
.bp-season-label { font-weight: 800; color: #a855f7; font-size: 14px; }
.bp-days-left { font-size: 12px; color: var(--text-muted); }
.bp-how-it-works {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin: 8px 0;
    border: 1px solid var(--border);
}
.bp-how-it-works b { color: var(--accent-light); }
.bp-discount-badge {
    display: inline-block;
    padding: 3px 10px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 12px;
    margin-bottom: 8px;
    animation: discountPulse 2s infinite;
}
@keyframes discountPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
.bp-old-price { color: rgba(255,255,255,0.5); text-decoration-color: #ff4757; font-size: 12px; }
.bp-owned {
    padding: 10px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(124, 58, 237, 0.05));
    border-radius: 10px;
    border: 1px solid rgba(168, 85, 247, 0.2);
}
.bp-owned-badge { color: #a855f7; font-weight: 700; font-size: 14px; }
.bp-owned-meta { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.btn-buy-bp {
    display: inline-block;
    margin-top: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
}
.btn-buy-bp:active { transform: scale(0.96); }

/* Calendar header */
.bp-week-header {
    display: none; /* Скрываем — переходим на вертикальный список */
}
.bp-week-day {
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 4px 0;
}

/* Calendar grid — compact 6 columns */
.bp-days-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
}
.bp-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 2px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 10px;
    text-align: center;
    position: relative;
    min-height: 50px;
    justify-content: center;
    transition: all 0.2s;
}
.bp-day-num {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 1px;
}
.bp-icon {
    font-size: 14px;
    line-height: 1.2;
}
.bp-reward-name {
    font-size: 7px;
    color: var(--text-muted);
    line-height: 1.15;
    margin-top: 1px;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
    white-space: normal;
}

/* Today */
.bp-cell.bp-today {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.08);
}
.bp-today-dot {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #a855f7;
}

/* Available */
.bp-cell.bp-available {
    border-color: #a855f7;
    cursor: pointer;
    animation: bpPulse 1.5s infinite;
    background: rgba(168, 85, 247, 0.12);
}
.bp-cell.bp-available:active { transform: scale(0.92); }
@keyframes bpPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.3); }
    50% { box-shadow: 0 0 6px 2px rgba(168, 85, 247, 0.35); }
}

/* Claimed */
.bp-cell.bp-claimed {
    opacity: 0.45;
    background: rgba(34, 197, 94, 0.05);
    border-color: rgba(34, 197, 94, 0.15);
}
.bp-check-mark {
    position: absolute;
    top: 1px;
    right: 3px;
    color: #22c55e;
    font-size: 9px;
    font-weight: 800;
}

/* Locked */
.bp-cell.bp-locked { opacity: 0.25; }
.bp-cell.bp-no-pass { opacity: 0.35; }

/* Milestone days (every 5th) */
.bp-cell.bp-milestone {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.06), rgba(255, 215, 0, 0.06));
    border-color: rgba(255, 215, 0, 0.12);
}
.bp-cell.bp-milestone .bp-day-num { color: #ffd700; }
.bp-cell.bp-milestone.bp-claimed { border-color: rgba(34, 197, 94, 0.15); }
.bp-spinner {
    width: 32px; height: 32px; margin: 0 auto;
    border: 3px solid rgba(168,85,247,0.15);
    border-top-color: #a855f7;
    border-radius: 50%;
    animation: bpSpin 0.7s linear infinite;
}
@keyframes bpSpin { to { transform: rotate(360deg); } }

/* ============ WORLD BOSS ============ */

/* Иконка на экране боя */
.wb-icon-wrap {
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    z-index: 20;
}
.wb-icon-btn {
    background: #140a1e;
    border: 1.5px solid rgba(168, 85, 247, 0.4);
    border-radius: 14px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.3s;
}
.wb-icon-btn:active { transform: scale(0.93); }
.wb-icon-btn.wb-active {
    border-color: #ef4444;
    animation: wbIconPulse 1.2s infinite;
}
@keyframes wbIconPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 10px 3px rgba(239, 68, 68, 0.25); }
}
.wb-icon-btn.wb-reg {
    border-color: #22c55e;
    animation: wbIconPulseGreen 1.5s infinite;
}
@keyframes wbIconPulseGreen {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3); }
    50% { box-shadow: 0 0 10px 3px rgba(34, 197, 94, 0.25); }
}
.wb-icon-emoji { font-size: 20px; }
.wb-icon-label {
    font-size: 11px;
    color: #e2e8f0;
    font-weight: 600;
    white-space: nowrap;
}

/* Попап босса */
.wb-box {
    max-width: 420px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    background: #0d1220;
    border: 1px solid rgba(168, 85, 247, 0.3);
}
.wb-boss-banner {
    text-align: center;
    margin: 8px 0;
}
.wb-boss-img {
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 12px;
    background: radial-gradient(ellipse, rgba(108, 92, 231, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease-in;
}
.wb-boss-img.img-loaded {
    opacity: 1;
}
.wb-boss-emoji {
    font-size: 72px;
    line-height: 1.2;
    margin: 8px 0;
}
.wb-boss-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-light);
    margin-top: 4px;
}
.wb-loading-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.wb-status {
    text-align: center;
    padding: 8px 0;
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.5;
}

/* Зона боя */
.wb-fight-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.wb-boss-visual {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.wb-boss-hp-bar {
    width: 100%;
    height: 22px;
    background: rgba(30, 20, 50, 0.7);
    border-radius: 11px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    position: relative;
    overflow: hidden;
}
.wb-boss-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    border-radius: 11px;
    transition: width 0.3s ease;
    width: 100%;
}
.wb-boss-hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.wb-boss-sprite {
    font-size: 72px;
    line-height: 1;
    transition: transform 0.1s;
    user-select: none;
}
.wb-boss-sprite.wb-hit {
    transform: scale(0.88) rotate(-5deg);
    filter: brightness(1.5) saturate(1.3);
}
.wb-my-damage {
    font-size: 13px;
    color: #94a3b8;
}
.wb-hit-btn {
    font-size: 16px;
    padding: 10px 32px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.wb-hit-btn:active { transform: scale(0.93); }

/* Топ урона */
.wb-top-list {
    width: 100%;
    margin-top: 4px;
}
.wb-top-title {
    font-size: 12px;
    font-weight: 700;
    color: #a855f7;
    text-align: center;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wb-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    color: #e2e8f0;
}
.wb-top-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}
.wb-top-row.wb-top-gold {
    background: rgba(255, 215, 0, 0.08);
    color: #ffd700;
    font-weight: 600;
}
.wb-top-row.wb-top-silver {
    background: rgba(192, 192, 192, 0.06);
    color: #c0c0c0;
    font-weight: 600;
}
.wb-top-row.wb-top-bronze {
    background: rgba(205, 127, 50, 0.06);
    color: #cd7f32;
    font-weight: 600;
}
.wb-top-rank { min-width: 24px; }
.wb-top-name { flex: 1; margin-left: 4px; }
.wb-top-dmg {
    font-family: monospace;
    font-size: 11px;
    color: #94a3b8;
}

/* Кнопка регистрации */
.wb-join-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
    margin-top: 8px;
}

/* Инфо-блок времени */
.wb-timer {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #a855f7;
    padding: 4px 0;
}

/* Фазы */
.wb-phase {
    text-align: center;
    padding: 10px 0;
    line-height: 1.6;
    font-size: 13px;
    color: #cbd5e1;
}
.wb-phase-icon { font-size: 28px; margin-bottom: 4px; }
.wb-phase-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}
.wb-phase-waiting .wb-phase-icon { opacity: 0.7; }
.wb-phase-reg { color: #22c55e; }
.wb-phase-fight { color: #ef4444; }
.wb-phase-done { color: #ffd700; }

/* Бейдж «Вы записаны» */
.wb-joined-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 14px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    font-size: 13px;
    font-weight: 600;
}

/* Мои награды */
.wb-my-rewards {
    text-align: center;
    padding: 10px 12px;
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 10px;
    font-size: 13px;
    color: #e2e8f0;
    line-height: 1.6;
}
.wb-reward-title {
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 4px;
    font-size: 14px;
}
.wb-my-dmg {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}
.wb-rewards {
    margin-top: 8px;
}
.wb-countdown {
    font-size: 28px;
    font-weight: 900;
    color: #ef4444;
    animation: wbCountdownPulse 1s infinite;
    display: inline-block;
}
@keyframes wbCountdownPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
}
.wb-rewards-info {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 10px;
    text-align: left;
}
.wb-rewards-info-title {
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 4px;
    font-size: 12px;
}

/* Подсветка себя в топе */
.wb-top-me {
    background: rgba(168, 85, 247, 0.1) !important;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

/* Приз мишка */
.wb-prize { font-size: 14px; }

/* Статус финиша */
.wb-finished-info {
    text-align: center;
    padding: 12px;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
}

/* ============ MERCENARIES ============ */
.merc-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
}
.merc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.merc-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.merc-level {
    font-size: 12px;
    font-weight: 500;
}
.merc-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.merc-status {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.merc-actions {
    display: flex;
    gap: 8px;
}
.merc-actions .btn {
    flex: 1;
}
.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
}
.merc-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 16px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.merc-quests-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.merc-quest-option {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s;
}
.merc-quest-option:active {
    transform: scale(0.96);
}
.mqo-type {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.mqo-dur {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.mqo-rew {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
}
.merc-counter {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}
.merc-bars {
    display: flex;
    gap: 8px;
    margin: 6px 0;
}
.merc-bar {
    flex: 1;
}
.merc-bar-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.merc-bar-bg {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}
.merc-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}
.merc-idle-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}
.merc-select-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.merc-select-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.merc-select-btn.merc-selected {
    background: rgba(255,255,255,0.1);
    border-width: 2px;
}
.merc-card.merc-dead {
    opacity: 0.8;
}

/* ============ RUBY SHOP ============ */
.ruby-currency {
    color: #e74c3c;
    cursor: pointer;
    position: relative;
}
.ruby-plus {
    font-size: 11px;
    font-weight: 700;
    color: #2ecc71;
    margin-left: 2px;
}
.ruby-shop-box {
    max-height: 85vh;
    overflow-y: auto;
}
.ruby-balance {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #e74c3c;
    margin-bottom: 12px;
}
.ruby-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 8px;
}
.ruby-buy-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.ruby-package {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s;
    position: relative;
    border: 1px solid var(--border);
}
.ruby-package:active {
    transform: scale(0.95);
    border-color: #e74c3c;
}
.ruby-pkg-amount {
    font-size: 16px;
    font-weight: 800;
    color: #e74c3c;
    margin-bottom: 6px;
}
.ruby-pkg-price {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}
.ruby-pkg-bonus {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.ruby-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    gap: 10px;
}
.ruby-item-owned {
    opacity: 0.5;
}
.ruby-item-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ruby-item-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 10px;
}
.ruby-item-text {
    flex: 1;
    min-width: 0;
}
.ruby-item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.ruby-item-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.ruby-item-btn {
    width: 100%;
    text-align: center;
    padding: 10px !important;
    font-size: 13px !important;
}

/* ============ WITHDRAW GIFTS ============ */
.withdraw-box {
    max-width: 340px;
    width: 90%;
}
.withdraw-balance-bar {
    text-align: center;
    font-size: 16px;
    color: var(--star);
    padding: 10px;
    background: rgba(243, 156, 18, 0.08);
    border: 1px solid rgba(243, 156, 18, 0.2);
    border-radius: 10px;
    margin-bottom: 8px;
}
.withdraw-gifts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 8px 0;
}
.withdraw-gift-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 10px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.withdraw-gift-card:active {
    transform: scale(0.95);
    border-color: var(--accent);
}
.withdraw-gift-card.withdraw-gift-locked {
    opacity: 0.35;
    cursor: not-allowed;
}
.withdraw-gift-emoji {
    font-size: 40px;
    margin-bottom: 8px;
    line-height: 1;
}
.withdraw-gift-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.withdraw-gift-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--star);
    padding: 3px 10px;
    background: rgba(243, 156, 18, 0.1);
    border-radius: 8px;
}

.ruby-shop-hint {
    animation: popupShow 0.3s ease-out;
}

/* ============ CLANS ============ */
.clan-icon-wrap {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    z-index: 5;
}
.clan-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: none;
    font-size: 18px;
    cursor: pointer;
}
.clan-header {
    text-align: center;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.raid-weakness {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.raid-hp-bar-wrap {
    height: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
}
.raid-hp-bar {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    border-radius: 6px;
    transition: width 0.3s;
}
.raid-hp-text {
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.clan-class-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-primary);
    padding: 6px 0;
}
.clan-member-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.clan-search-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 13px;
}
/* Clan leaderboard */
.clan-lb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 4px;
    border: 1px solid var(--border);
}
.clan-lb-rank {
    font-size: 14px;
    min-width: 28px;
    text-align: center;
    font-weight: 800;
}
.clan-lb-info { flex: 1; min-width: 0; }
.clan-lb-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.clan-lb-meta { font-size: 10px; color: var(--text-muted); }
.clan-lb-level {
    font-size: 13px;
    font-weight: 800;
    color: var(--accent-light);
    flex-shrink: 0;
}

.clan-chat-messages {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 8px;
}
.clan-chat-msg {
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

/* ============ TRANSCENDENCE ============ */
.transcend-info {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}
.transcend-stat {
    font-size: 13px;
    color: var(--text-primary);
    margin: 4px 0;
}
.outsider-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-left: 3px solid #9b59b6;
}
.outsider-header {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}
.outsider-level {
    color: #9b59b6;
    font-size: 12px;
}
.outsider-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.outsider-effect {
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ============ EQUIPPABLE RELICS ============ */
.forge-cores-bar {
    text-align: center;
    font-size: 14px;
    color: #e67e22;
    margin-bottom: 10px;
    padding: 8px;
    background: var(--bg-card);
    border-radius: 8px;
}
.relic-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 12px 0 6px;
}
.relic-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.relic-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
}
.relic-empty {
    border: 2px dashed var(--border);
    background: transparent;
}
.relic-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.relic-level {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.relic-suffix {
    font-size: 12px;
    color: var(--text-primary);
    padding: 2px 0;
}
.relic-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.relic-actions .btn {
    flex: 1;
}
