/* ============================================================
   TIKLA FETHET v3.2 — Psychology-Powered CSS + PWA Ready
   Color Psychology, Dopamine Effects, Scarcity Indicators
   Green=Buy, Red=Can't Afford, Orange=FOMO, Purple=Rare
   ============================================================ */

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

:root {
    --bg: #0a0e1a;
    --bg2: #111827;
    --bg3: #1a2236;
    --card: #1e293b;
    --card-hover: #253349;
    --gold: #f59e0b;
    --gold-dark: #b45309;
    --gold-light: #fbbf24;
    --gem: #8b5cf6;
    --green: #22c55e;
    --green-dark: #15803d;
    --red: #ef4444;
    --blue: #3b82f6;
    --cyan: #06b6d4;
    --pink: #ec4899;
    --orange: #f97316;
    --text: #f1f5f9;
    --text2: #94a3b8;
    --text3: #64748b;
    --border: rgba(255,255,255,0.06);
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
    --radius: 12px;
    --radius-sm: 8px;
    /* Psychology-based colors */
    --afford-glow: rgba(34, 197, 94, 0.4);
    --cant-afford: rgba(239, 68, 68, 0.3);
    --urgent: #f97316;
    --rare: #a855f7;
    --epic: #ec4899;
    --legendary: #f59e0b;
}

html {
    height: 100%;
    height: var(--app-h, 100vh); /* fallback for browsers without dvh */
}
@supports (height: 100dvh) {
    html { height: 100dvh; } /* dvh handles toolbar natively — override JS var */
}
body {
    height: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    /* PWA safe areas for notched phones */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Flex layout: top-bar + game-area + bottom-nav */
    display: flex;
    flex-direction: column;
    margin: 0;
}

/* PWA standalone mode tweaks */
@media (display-mode: standalone) {
    #top-bar {
        padding-top: max(8px, env(safe-area-inset-top));
    }
    #bottom-nav {
        padding-bottom: max(4px, env(safe-area-inset-bottom));
    }
}

/* ===== SVG ICON SYSTEM ===== */
.game-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.game-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Inline icons in buttons and text */
.build-btn .game-icon,
.hero-btn .game-icon,
.upgrade-cost .game-icon,
.ach-reward .game-icon,
.hero-dps .game-icon,
.hero-level .game-icon,
.sale-original .game-icon,
.sale-price .game-icon {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 2px;
}

/* Panel header inline icons */
.panel-header h2 span .game-icon {
    display: inline-flex;
    vertical-align: middle;
    margin-right: 2px;
}

/* Fight button icon */
.nav-icon-svg .game-icon {
    display: inline-flex;
    vertical-align: middle;
}

/* Icon in building cards */
.build-icon .game-icon {
    width: 36px !important;
    height: 36px !important;
}

/* Icon in hero cards */
.hero-icon-wrap .game-icon {
    width: 32px !important;
    height: 32px !important;
}

/* Icon in kingdom scene */
.kingdom-mini-building .game-icon {
    width: 28px !important;
    height: 28px !important;
}

/* Boss preview icon */
#boss-preview-icon .game-icon {
    width: 40px !important;
    height: 40px !important;
}

/* Resource icons */
.res-icon .game-icon {
    width: 22px !important;
    height: 22px !important;
}

/* Tap circle icon — 3D canvas container */
#tap-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
#tap-icon canvas {
    border-radius: 50% !important;
    pointer-events: none;
}
#tap-icon .game-icon {
    width: 80px !important;
    height: 80px !important;
}

/* ===== PARTICLE CANVAS ===== */
#particle-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 60;
    width: 100%;
    height: 100%;
}

/* ===== TOP BAR ===== */
#top-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    height: 56px;
    z-index: 10;
    position: relative;
    flex-shrink: 0;
}

.resource {
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s;
}

.resource.bump {
    animation: resBump 0.3s ease-out;
}

@keyframes resBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.res-icon {
    font-size: 22px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.res-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.res-amount {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.res-rate {
    font-size: 11px;
    color: var(--gold);
    font-weight: 600;
}

#res-gold .res-amount { color: var(--gold-light); }
#res-gems .res-amount { color: var(--gem); }
#res-prestige .res-amount { color: var(--gold); }

/* ===== MAIN GAME AREA ===== */
#game-area {
    flex: 1 1 0%;
    min-height: 0; /* flex child overflow fix */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#game-area::-webkit-scrollbar { width: 3px; }
#game-area::-webkit-scrollbar-thumb { background: var(--text3); border-radius: 3px; }

/* ===== KINGDOM VIEW ===== */
#kingdom-view {
    text-align: center;
    padding: 12px 0 8px;
}

#kingdom-title {
    margin-bottom: 8px;
}

#kingdom-name {
    font-size: 22px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

#kingdom-level {
    font-size: 12px;
    color: var(--text2);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ===== KINGDOM SCENE ===== */
#kingdom-scene {
    position: relative;
    height: 55px;
    margin: 2px auto;
    max-width: 320px;
    overflow: hidden;
    transition: height 0.3s, opacity 0.3s;
}

#kingdom-scene.empty {
    height: 0;
    opacity: 0;
    margin: 0;
}

#kingdom-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: linear-gradient(180deg, #2d4a2e, #1a3a1a);
    border-radius: 6px 6px 0 0;
}

#kingdom-buildings-visual {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 4px;
    align-items: flex-end;
    height: 48px;
    padding: 0 8px;
}

.kingdom-mini-building {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: buildingPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kingdom-mini-building .kb-icon {
    font-size: 20px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

.kingdom-mini-building .kb-level {
    font-size: 7px;
    font-weight: 900;
    color: var(--gold);
    background: rgba(0,0,0,0.5);
    padding: 0 3px;
    border-radius: 3px;
    margin-top: -2px;
}

@keyframes buildingPop {
    0% { transform: scale(0) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Tap Circle */
#tap-area {
    position: relative;
    display: inline-block;
    margin: 6px 0;
    touch-action: manipulation;
}

#tap-circle {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 30%, #2d3f5a 0%, #1a2740 45%, #0f172a 100%);
    border: 4px solid var(--gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.08s cubic-bezier(0.2,0,0.4,1), box-shadow 0.08s;
    box-shadow:
        0 0 0 6px rgba(245, 158, 11, 0.12),
        0 0 30px rgba(245, 158, 11, 0.28),
        0 10px 36px rgba(0,0,0,0.55),
        inset 0 -8px 20px rgba(0,0,0,0.45),
        inset 0 4px 10px rgba(255,255,255,0.06);
    position: relative;
    z-index: 2;
    animation: tapGlow 2.5s ease-in-out infinite;
    overflow: visible;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Üst highlight şeridi — 3D buton hissi */
#tap-circle::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 58%;
    height: 26%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.14) 0%, transparent 80%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

@keyframes tapGlow {
    0%, 100% {
        box-shadow:
            0 0 0 5px rgba(245, 158, 11, 0.10),
            0 0 22px rgba(245, 158, 11, 0.22),
            0 10px 36px rgba(0,0,0,0.55),
            inset 0 -8px 20px rgba(0,0,0,0.45),
            inset 0 4px 10px rgba(255,255,255,0.06);
    }
    50% {
        box-shadow:
            0 0 0 11px rgba(245, 158, 11, 0.18),
            0 0 55px rgba(245, 158, 11, 0.45),
            0 0 100px rgba(245, 158, 11, 0.12),
            0 10px 36px rgba(0,0,0,0.55),
            inset 0 -8px 20px rgba(0,0,0,0.45),
            inset 0 4px 10px rgba(255,255,255,0.06);
    }
}

#tap-circle:active {
    transform: scale(0.87) translateY(5px);
    box-shadow:
        0 0 0 4px rgba(245, 158, 11, 0.22),
        0 0 65px rgba(245, 158, 11, 0.60),
        0 4px 14px rgba(0,0,0,0.55),
        inset 0 -3px 8px rgba(0,0,0,0.35),
        inset 0 2px 6px rgba(255,255,255,0.04);
}

#tap-icon {
    width: 155px;
    height: 155px;
    font-size: 80px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
    transition: transform 0.08s cubic-bezier(0.2,0,0.4,1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

#tap-circle:active #tap-icon {
    transform: scale(1.06) rotate(-2deg);
}

#tap-text {
    font-size: 11px;
    color: var(--gold);
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 4px;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.7), 0 1px 3px rgba(0,0,0,0.8);
    position: relative;
    z-index: 2;
    animation: tapTextPulse 2.5s ease-in-out infinite;
}

@keyframes tapTextPulse {
    0%, 100% { opacity: 0.75; }
    50%       { opacity: 1; text-shadow: 0 0 14px rgba(245, 158, 11, 0.95), 0 1px 3px rgba(0,0,0,0.8); }
}

#tap-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

/* Combo indicator */
.combo-text {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 900;
    color: var(--pink);
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
    animation: comboPulse 0.5s ease-out;
    pointer-events: none;
}

@keyframes comboPulse {
    0% { transform: translateX(-50%) scale(1.5); opacity: 1; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* DPS Display */
#dps-display {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text2);
}

#dps-value {
    font-size: 20px;
    font-weight: 900;
    color: var(--gold);
    margin: 0 2px;
}

#dps-suffix { color: var(--text3); }

/* ===== LUCKY EVENT ===== */
#lucky-event {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(34,197,94,0.1));
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 8px 0;
    position: relative;
    overflow: hidden;
    animation: luckyShine 2s infinite;
}

#lucky-event.hidden { display: none; }

@keyframes luckyShine {
    0%, 100% { border-color: rgba(245,158,11,0.3); }
    50% { border-color: rgba(245,158,11,0.6); }
}

#lucky-icon { font-size: 24px; }
#lucky-text { flex: 1; font-size: 12px; font-weight: 700; color: var(--gold-light); }

#lucky-timer-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0,0,0,0.3);
}

#lucky-timer-fill {
    height: 100%;
    background: var(--gold);
    transition: width 0.5s linear;
    width: 100%;
}

/* ===== MILESTONE BAR ===== */
#milestone-bar {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin: 8px 0;
    border: 1px solid var(--border);
}

#milestone-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
}

#milestone-label { color: var(--text3); font-weight: 600; }
#milestone-target { color: var(--gold); font-weight: 700; }

#milestone-progress {
    height: 6px;
    background: rgba(0,0,0,0.4);
    border-radius: 3px;
    overflow: hidden;
}

#milestone-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

/* ===== MINI STATS ===== */
#mini-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 8px 0;
}

.mini-stat {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 8px 4px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-value {
    display: block;
    font-size: 15px;
    font-weight: 900;
    color: var(--gold-light);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    display: block;
    font-size: 8px;
    color: var(--text3);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ===== BOSS PREVIEW ===== */
#boss-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(239,68,68,0.08), rgba(239,68,68,0.02));
    border: 1px solid rgba(239,68,68,0.15);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 8px 0;
}

#boss-preview.hidden { display: none; }

#boss-preview-icon {
    font-size: 32px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
    animation: bossFloat 3s ease-in-out infinite;
}

@keyframes bossFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

#boss-preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#boss-preview-name {
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
}

#boss-preview-hp {
    font-size: 10px;
    color: var(--red);
    font-weight: 600;
    margin-top: 2px;
}

.btn-boss {
    background: linear-gradient(135deg, var(--red), #dc2626);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.1s;
    white-space: nowrap;
}

.btn-boss:active { transform: scale(0.95); }
.btn-boss:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== BOSS SECTION ===== */
#boss-section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 10px 0;
    border: 1px solid rgba(239, 68, 68, 0.2);
    transition: border-color 0.3s, box-shadow 0.3s;
}

#boss-section.boss-battle-active {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.1), inset 0 0 15px rgba(239, 68, 68, 0.03);
    animation: bossBattleBorder 2s ease-in-out infinite;
}

@keyframes bossBattleBorder {
    0%, 100% { border-color: rgba(239, 68, 68, 0.3); box-shadow: 0 0 10px rgba(239, 68, 68, 0.08); }
    50% { border-color: rgba(239, 68, 68, 0.6); box-shadow: 0 0 20px rgba(239, 68, 68, 0.15); }
}

#boss-section.hidden { display: none; }

#boss-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

#boss-name {
    font-weight: 800;
    color: var(--red);
    font-size: 15px;
}

#boss-timer {
    font-weight: 700;
    color: var(--text2);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
}

#boss-timer.timer-danger {
    color: #ef4444;
    font-weight: 900;
    animation: timerDangerPulse 0.5s ease-in-out infinite;
}

@keyframes timerDangerPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.15); }
}

#boss-hp-bar {
    height: 24px;
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

#boss-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--red), #f87171);
    border-radius: 12px;
    transition: width 0.15s ease;
    width: 100%;
    position: relative;
}

#boss-hp-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15), transparent);
    border-radius: 12px 12px 0 0;
}

#boss-hp-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* ===== ACHIEVEMENT BANNER ===== */
#achievements-banner {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    width: 90%;
    max-width: 380px;
}

#achievements-banner.hidden { display: none; }

#achievement-popup {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(59,130,246,0.15));
    border: 1px solid rgba(139,92,246,0.4);
    border-radius: var(--radius);
    padding: 12px 14px;
    animation: achieveSlide 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 32px rgba(139,92,246,0.2);
}

@keyframes achieveSlide {
    0% { transform: translateY(-30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

#achievement-icon { font-size: 28px; }
#achievement-info { flex: 1; display: flex; flex-direction: column; }
#achievement-title { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; }
#achievement-desc { font-size: 13px; font-weight: 800; color: var(--text); }
#achievement-reward { font-size: 13px; font-weight: 800; color: var(--gem); }

/* ===== PANELS ===== */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

#buildings-count, #heroes-count, #achievements-progress, .panel-header span {
    font-size: 12px;
    color: var(--text3);
    font-weight: 600;
}

#buildings-panel { margin-top: 8px; }
#upgrades-panel { margin-top: 16px; }
#heroes-panel { margin-top: 8px; }
#achievements-panel { margin-top: 8px; }

#buildings-list, #upgrades-list, #heroes-list, #achievements-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Building Card */
.building-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 10px 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, border-color 0.15s;
}

.building-card:active {
    transform: scale(0.98);
    background: var(--card-hover);
}

.building-card.affordable {
    border-color: rgba(34, 197, 94, 0.4);
    animation: affordPulse 2s ease-in-out infinite;
}

.building-card.affordable:hover {
    border-color: rgba(34, 197, 94, 0.6);
    background: var(--card-hover);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.15);
}

@keyframes affordPulse {
    0%, 100% { border-color: rgba(34, 197, 94, 0.3); box-shadow: none; }
    50% { border-color: rgba(34, 197, 94, 0.6); box-shadow: 0 0 12px rgba(34, 197, 94, 0.1); }
}

.building-card.locked {
    opacity: 0.4;
    pointer-events: none;
}

.build-icon {
    font-size: 34px;
    width: 78px;
    height: 78px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 3D depth illusion — layered shadows + gradient highlight */
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.13) 0%, rgba(0,0,0,0.35) 100%),
                var(--bg3);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.18),   /* top highlight */
        inset 0 -2px 4px rgba(0,0,0,0.35),       /* bottom shadow */
        0 4px 12px rgba(0,0,0,0.5),              /* outer drop */
        0 1px 3px rgba(0,0,0,0.4);               /* tight shadow */
    flex-shrink: 0;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.building-card.affordable .build-icon {
    border-color: rgba(34,197,94,0.25);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.22),
        inset 0 -2px 4px rgba(0,0,0,0.35),
        0 4px 14px rgba(0,0,0,0.55),
        0 0 8px rgba(34,197,94,0.18);
}

.build-info {
    flex: 1;
    min-width: 0;
}

.build-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.build-level {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
}
/* Level badge color tiers */
.build-level.lv-zero { color: #94a3b8; background: rgba(148,163,184,0.15); }
.build-level.lv-low  { color: var(--gold); background: rgba(245,158,11,0.15); }
.build-level.lv-mid  { color: #60a5fa; background: rgba(96,165,250,0.15); }
.build-level.lv-high { color: #c084fc; background: rgba(192,132,252,0.15); }
.build-level.lv-max  { color: #fbbf24; background: rgba(251,191,36,0.2); box-shadow: 0 0 6px rgba(251,191,36,0.35); }

.build-desc {
    font-size: 10px;
    color: var(--text3);
    margin-top: 1px;
}

.build-production {
    font-size: 11px;
    color: var(--green);
    font-weight: 700;
    margin-top: 2px;
}

.build-production-next {
    font-size: 10px;
    color: rgba(96, 165, 250, 0.75);
    font-weight: 600;
    margin-top: 1px;
}

.build-btn {
    background: var(--gold-dark);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    flex-shrink: 0;
}

.building-card.affordable .build-btn {
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
    animation: btnPulse 1.6s ease-in-out infinite;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(34,197,94,0.3); }
    50% { box-shadow: 0 2px 16px rgba(34,197,94,0.55); transform: scale(1.03); }
}

/* Can't afford — red tint on cost */
.building-card:not(.affordable) .build-btn {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Purchase success flash — green burst */
.building-card.just-bought {
    animation: purchaseBurst 0.5s ease-out !important;
}

@keyframes purchaseBurst {
    0% { background: rgba(34, 197, 94, 0.25); box-shadow: 0 0 30px rgba(34, 197, 94, 0.4); transform: scale(1.02); }
    100% { background: var(--card); box-shadow: none; transform: scale(1); }
}

.build-btn:active { transform: scale(0.95); }

/* Hero Card */
.hero-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 10px 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}

.hero-card.affordable {
    border-color: rgba(139, 92, 246, 0.3);
}

.hero-card.locked {
    opacity: 0.35;
    pointer-events: none;
}

.hero-card .hero-icon-wrap {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 3D depth illusion — gem-tinted */
    background: radial-gradient(circle at 35% 30%, rgba(139,92,246,0.22) 0%, rgba(0,0,0,0.4) 100%),
                var(--bg3);
    border-radius: 12px;
    border: 1px solid rgba(139,92,246,0.18);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.18),
        inset 0 -2px 4px rgba(0,0,0,0.35),
        0 4px 12px rgba(0,0,0,0.5),
        0 0 10px rgba(139,92,246,0.12);
    flex-shrink: 0;
    transition: box-shadow 0.15s ease;
}

.hero-card .hero-info { flex: 1; }
.hero-card .hero-name { font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.hero-card .hero-level { font-size: 10px; font-weight: 700; color: var(--gem); background: rgba(139,92,246,0.15); padding: 1px 6px; border-radius: 4px; }
.hero-card .hero-desc { font-size: 10px; color: var(--text3); margin-top: 1px; }
.hero-card .hero-dps { font-size: 11px; color: var(--cyan); font-weight: 700; margin-top: 1px; }

.hero-card .hero-btn {
    background: var(--gem);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.hero-card:active { transform: scale(0.98); }

/* Upgrade Card */
.upgrade-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 10px 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.upgrade-card.purchased {
    opacity: 0.4;
    pointer-events: none;
    border-color: var(--green-dark);
}

.upgrade-card.affordable {
    border-color: rgba(139, 92, 246, 0.3);
}

.upgrade-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.upgrade-info { flex: 1; }

.upgrade-name {
    font-size: 12px;
    font-weight: 800;
}

.upgrade-desc {
    font-size: 10px;
    color: var(--text3);
    margin-top: 1px;
}

.upgrade-cost {
    font-size: 12px;
    font-weight: 800;
    color: var(--gold);
    white-space: nowrap;
}

/* Achievement Card */
.achievement-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border-radius: var(--radius);
    padding: 10px 12px;
    border: 1px solid var(--border);
    transition: all 0.15s;
}

.achievement-card.unlocked {
    border-color: rgba(139,92,246,0.3);
    background: linear-gradient(135deg, rgba(139,92,246,0.05), transparent);
}

.achievement-card.locked {
    opacity: 0.4;
}

.achievement-card .ach-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.achievement-card .ach-info { flex: 1; }
.achievement-card .ach-name { font-size: 12px; font-weight: 800; }
.achievement-card .ach-desc { font-size: 10px; color: var(--text3); margin-top: 1px; }
.achievement-card .ach-reward { font-size: 11px; font-weight: 800; color: var(--gem); white-space: nowrap; }

/* ===== BOTTOM NAV ===== */
#bottom-nav {
    display: flex;
    height: 56px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    z-index: 10;
    padding: 0 2px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    /* Samsung Internet: bottom toolbar covers content — shrink-0 ensures nav stays visible */
    flex-shrink: 0;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    background: none;
    border: none;
    color: var(--text3);
    cursor: pointer;
    transition: color 0.15s;
    position: relative;
    padding: 4px 0;
    min-width: 0;
    overflow: hidden;
}

.nav-btn.active {
    color: var(--gold);
}

.nav-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 2px;
    background: var(--gold);
    border-radius: 0 0 2px 2px;
}

.nav-icon { font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center; min-height: 22px; }
.nav-icon .game-icon { width: 22px !important; height: 22px !important; }
.nav-icon .game-icon svg { color: var(--text); opacity: 0.7; }
.nav-btn.active .nav-icon .game-icon svg { color: var(--gold); opacity: 1; }
.nav-label { font-size: 8px; font-weight: 700; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center; }

.nav-btn .notify-dot {
    position: absolute;
    top: 6px;
    right: 20%;
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--bg2);
    animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ===== OVERLAYS ===== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.overlay.hidden { display: none; }

.overlay-content {
    background: var(--bg3);
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    animation: overlayPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes overlayPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.overlay-content h2 {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 8px;
}

.overlay-content p {
    font-size: 14px;
    color: var(--text2);
    margin-bottom: 16px;
}

#prestige-preview {
    background: var(--bg2);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 16px;
}

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

.prestige-stat span:first-child { color: var(--text2); }
.prestige-stat span:last-child { font-weight: 800; color: var(--gold); }

.big-number {
    font-size: 36px;
    font-weight: 900;
    color: var(--gold);
    margin: 12px 0 4px;
}

#offline-time {
    font-size: 13px;
    color: var(--text3);
}

/* Buttons */
.btn-gold {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #000;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
    margin-top: 8px;
}

.btn-gold:active { transform: scale(0.97); }
.btn-gold:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
    width: 100%;
    padding: 12px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text2);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
}

/* ===== FLOATING TEXT ===== */
#float-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.float-text {
    position: absolute;
    font-size: 18px;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
    animation: floatUp 0.9s ease-out forwards;
    pointer-events: none;
    white-space: nowrap;
}

.float-text.crit {
    font-size: 26px;
    color: var(--pink);
    text-shadow: 0 0 20px rgba(236,72,153,0.5), 0 2px 6px rgba(0,0,0,0.6);
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-70px) scale(0.7); }
}

/* ===== PURCHASE FLASH ===== */
.purchase-flash {
    animation: flashGreen 0.3s ease-out;
}

@keyframes flashGreen {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50% { box-shadow: 0 0 20px 4px rgba(34, 197, 94, 0.3); }
    100% { box-shadow: none; }
}

/* Level Up Pulse */
.level-up-pulse {
    animation: levelPulse 0.5s ease-out;
}

@keyframes levelPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* Tap ripple */
.tap-ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,158,11,0.4), transparent);
    pointer-events: none;
    animation: rippleOut 0.5s ease-out forwards;
}

@keyframes rippleOut {
    0% { width: 20px; height: 20px; opacity: 1; }
    100% { width: 160px; height: 160px; opacity: 0; }
}

/* ===== BOSS DEFEAT ===== */
.boss-defeated {
    animation: bossDefeatFlash 0.6s ease-out;
}

@keyframes bossDefeatFlash {
    0% { background: rgba(34, 197, 94, 0.3); }
    100% { background: var(--card); }
}

/* ===== SCREEN SHAKE ===== */
.screen-shake {
    animation: shake 0.3s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}

/* ===== BOSS RESULT OVERLAY ===== */
.boss-result-content {
    position: relative;
    overflow: hidden;
}

.boss-result-content::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    z-index: -1;
    opacity: 0;
    animation: bossResultGlow 2s ease-in-out infinite;
}

.boss-result-win {
    border: 2px solid rgba(34, 197, 94, 0.6) !important;
    box-shadow: 0 0 40px rgba(34, 197, 94, 0.15), 0 20px 60px rgba(0,0,0,0.5);
    animation: overlayPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), bossWinShimmer 3s ease-in-out infinite;
}

.boss-result-win::before {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), rgba(16, 185, 129, 0.2), rgba(245, 158, 11, 0.2));
    opacity: 1;
}

.boss-result-win h2 {
    font-size: 28px;
    background: linear-gradient(135deg, #22c55e, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.boss-result-lose {
    border: 2px solid rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.15), 0 20px 60px rgba(0,0,0,0.5);
    animation: overlayPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), bossLoseShimmer 3s ease-in-out infinite;
}

.boss-result-lose::before {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(220, 38, 38, 0.2), rgba(251, 146, 60, 0.2));
    opacity: 1;
}

.boss-result-lose h2 {
    font-size: 28px;
    background: linear-gradient(135deg, #ef4444, #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes bossResultGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes bossWinShimmer {
    0%, 100% { box-shadow: 0 0 30px rgba(34, 197, 94, 0.15), 0 20px 60px rgba(0,0,0,0.5); }
    50% { box-shadow: 0 0 50px rgba(34, 197, 94, 0.3), 0 20px 60px rgba(0,0,0,0.5); }
}

@keyframes bossLoseShimmer {
    0%, 100% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.15), 0 20px 60px rgba(0,0,0,0.5); }
    50% { box-shadow: 0 0 50px rgba(239, 68, 68, 0.3), 0 20px 60px rgba(0,0,0,0.5); }
}

/* Boss Result Icon */
.boss-result-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 36px;
    position: relative;
}

.boss-result-icon-wrap::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 3px solid transparent;
}

.win-icon {
    background: radial-gradient(circle, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.05));
    animation: winIconPulse 1.5s ease-in-out infinite;
}

.win-icon::after {
    border-color: rgba(34, 197, 94, 0.5);
    animation: winRingRotate 3s linear infinite;
}

.lose-icon {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.05));
    animation: loseIconShake 0.5s ease-out;
}

.lose-icon::after {
    border-color: rgba(239, 68, 68, 0.5);
}

@keyframes winIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes winRingRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes loseIconShake {
    0% { transform: translateX(0); }
    15% { transform: translateX(-6px) rotate(-3deg); }
    30% { transform: translateX(6px) rotate(3deg); }
    45% { transform: translateX(-4px) rotate(-2deg); }
    60% { transform: translateX(4px) rotate(2deg); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

/* Boss Reward Lines */
.boss-reward-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 18px;
    font-weight: 800;
}

.reward-amount {
    color: var(--gold);
    font-size: 20px;
}

/* Boss WIN — prominent WhatsApp share CTA */
.btn-boss-wp-share {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px 16px;
    background: #25d366;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.15s, transform 0.1s;
}
.btn-boss-wp-share:hover { background: #1da851; }
.btn-boss-wp-share:active { transform: scale(0.97); }

#boss-result-rewards {
    background: var(--bg2);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 12px 0;
}

/* Boss HP Remaining (Defeat) */
.boss-hp-remaining {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text2);
    margin-bottom: 8px;
}

.hp-value {
    color: #ef4444;
    font-weight: 800;
}

.boss-hp-bar-mini {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.boss-hp-bar-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Near-Miss Feedback */
#boss-result-nearmiss {
    margin-top: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: rgba(251, 146, 60, 0.1);
    border: 1px solid rgba(251, 146, 60, 0.3);
    animation: nearmissPulse 1s ease-in-out infinite;
}

#boss-result-nearmiss.hidden { display: none; }

.nearmiss-text {
    color: #fb923c;
    font-size: 14px;
    font-weight: 800;
}

@keyframes nearmissPulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(251, 146, 60, 0.1);
        border-color: rgba(251, 146, 60, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(251, 146, 60, 0.3);
        border-color: rgba(251, 146, 60, 0.6);
    }
}

/* Boss Result Buttons */
.btn-boss-ok {
    margin-top: 16px;
    font-size: 16px;
    padding: 14px;
    border-radius: var(--radius);
    border: none;
    width: 100%;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.1s;
}

.btn-boss-ok:active { transform: scale(0.97); }

.btn-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Screen Flash Red (Boss Defeat) */
.screen-flash-red {
    animation: screenFlashRed 0.5s ease-out;
}

@keyframes screenFlashRed {
    0% { background-color: rgba(239, 68, 68, 0.3); }
    100% { background-color: transparent; }
}

/* ===== KINGDOM NAMING OVERLAY ===== */
.kingdom-name-content {
    max-width: 340px;
}

.kingdom-name-crown {
    font-size: 48px;
    margin-bottom: 8px;
    animation: crownBounce 2s ease-in-out infinite;
}

@keyframes crownBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-4px) rotate(-3deg); }
    75% { transform: translateY(-4px) rotate(3deg); }
}

#kingdom-name-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
    margin: 12px 0 8px;
    box-sizing: border-box;
}

#kingdom-name-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}

#kingdom-name-input::placeholder {
    color: var(--text3);
    font-weight: 400;
}

.kingdom-name-preview {
    font-size: 12px;
    color: var(--text3);
    margin-bottom: 12px;
    min-height: 20px;
}

#kingdom-name-preview-text {
    font-weight: 700;
    color: var(--gold);
}

/* ===== DAILY REWARD OVERLAY ===== */
#daily-reward-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110;
    backdrop-filter: blur(6px);
}

#daily-reward-overlay.hidden { display: none; }

#daily-reward-content {
    background: linear-gradient(145deg, #1a2236, #111827);
    border-radius: 20px;
    padding: 24px 20px;
    max-width: 340px;
    width: 92%;
    text-align: center;
    border: 2px solid var(--gold);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.2), 0 20px 60px rgba(0,0,0,0.5);
    animation: dailyPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dailyPop {
    0% { transform: scale(0.5) rotate(-5deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

#daily-reward-content h2 {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--gold-light), var(--orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#daily-reward-content .daily-subtitle {
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 14px;
}

.daily-days {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 14px 0;
}

.daily-day {
    width: 40px;
    height: 48px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text3);
    transition: all 0.3s;
}

.daily-day .day-icon {
    font-size: 18px;
}

.daily-day.claimed {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--green);
    color: var(--green);
}

.daily-day.today {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
    border-color: var(--gold);
    color: var(--gold);
    animation: todayGlow 1.5s ease-in-out infinite;
    transform: scale(1.1);
}

@keyframes todayGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.2); }
    50% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.4); }
}

.daily-day.upcoming {
    opacity: 0.3;
}

#daily-streak-display {
    font-size: 13px;
    color: var(--orange);
    font-weight: 800;
    margin: 8px 0;
}

#btn-daily-claim {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--gold), var(--orange));
    color: #000;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.1s;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

#btn-daily-claim:active { transform: scale(0.97); }

/* ===== STREAK INDICATOR (Top bar) ===== */
.lang-btn {
    position: absolute;
    top: 2px;
    right: 150px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    padding: 4px 6px;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10;
}
.lang-btn:hover { opacity: 1; }
.lang-btn:active { transform: scale(1.15); }

.cloud-btn {
    position: absolute;
    top: 2px;
    right: 115px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    padding: 4px 6px;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10;
}
.cloud-btn:hover { opacity: 1; }
.cloud-btn:active { transform: scale(1.15); }

.sound-btn {
    position: absolute;
    top: 2px;
    right: 80px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    padding: 2px 6px;
    border-radius: 4px;
    transition: opacity 0.2s;
    z-index: 10;
}
.sound-btn:hover { opacity: 1; }
.sound-btn.muted { opacity: 0.3; }

#streak-indicator {
    position: absolute;
    top: 2px;
    right: 8px;
    font-size: 9px;
    font-weight: 800;
    color: var(--orange);
    background: rgba(249, 115, 22, 0.15);
    padding: 1px 6px;
    border-radius: 8px;
    display: none;
}

#streak-indicator.active {
    display: block;
    animation: streakPulse 2s ease-in-out infinite;
}

@keyframes streakPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; text-shadow: 0 0 8px rgba(249, 115, 22, 0.5); }
}

/* ===== FLASH SALE BANNER ===== */
#flash-sale {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2), rgba(239, 68, 68, 0.15));
    border: 2px solid rgba(249, 115, 22, 0.5);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 8px 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: flashSaleGlow 1s ease-in-out infinite;
    transition: transform 0.1s;
}

#flash-sale:active { transform: scale(0.98); }
#flash-sale.hidden { display: none; }

@keyframes flashSaleGlow {
    0%, 100% { border-color: rgba(249, 115, 22, 0.4); box-shadow: 0 0 10px rgba(249, 115, 22, 0.1); }
    50% { border-color: rgba(249, 115, 22, 0.8); box-shadow: 0 0 25px rgba(249, 115, 22, 0.2); }
}

#flash-sale .sale-icon { font-size: 24px; animation: saleShake 0.5s ease-in-out infinite; }
@keyframes saleShake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

#flash-sale .sale-info { flex: 1; }
#flash-sale .sale-title { font-size: 11px; font-weight: 900; color: var(--orange); text-transform: uppercase; letter-spacing: 0.5px; }
#flash-sale .sale-desc { font-size: 12px; font-weight: 700; color: var(--text); margin-top: 1px; }
#flash-sale .sale-original { text-decoration: line-through; color: var(--red); font-size: 10px; }
#flash-sale .sale-price { font-size: 14px; font-weight: 900; color: var(--green); }
#flash-sale .sale-timer { font-size: 11px; font-weight: 800; color: var(--red); font-variant-numeric: tabular-nums; }

#flash-sale .sale-timer-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: rgba(0,0,0,0.3);
}

#flash-sale .sale-timer-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--red), var(--orange));
    transition: width 0.5s linear;
}

/* ===== MINI REWARD POPUP (Tap Jackpot) ===== */
.jackpot-text {
    position: absolute;
    font-size: 20px;
    font-weight: 900;
    color: var(--gold-light);
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.8), 0 2px 6px rgba(0,0,0,0.6);
    animation: jackpotFloat 1.5s ease-out forwards;
    pointer-events: none;
    white-space: nowrap;
    z-index: 55;
}

@keyframes jackpotFloat {
    0% { opacity: 1; transform: translateY(0) scale(1.5); }
    30% { opacity: 1; transform: translateY(-20px) scale(1.8); }
    100% { opacity: 0; transform: translateY(-100px) scale(0.8); }
}

/* ===== NEAR-MISS BOSS EFFECT ===== */
#boss-hp-fill.near-death {
    animation: nearDeathPulse 0.3s ease-in-out infinite;
    background: linear-gradient(90deg, var(--green), #4ade80) !important;
}

@keyframes nearDeathPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.boss-near-miss-text {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 900;
    color: var(--orange);
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
    animation: nearMissBounce 0.5s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes nearMissBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}

/* ===== GOLD COUNTER ANIMATION ===== */
.gold-counting {
    animation: goldCountPulse 0.1s ease-out;
}

@keyframes goldCountPulse {
    0% { transform: scale(1.08); color: #fff; }
    100% { transform: scale(1); }
}

/* ===== NUMBER ODOMETER EFFECT ===== */
.res-amount {
    transition: transform 0.15s ease-out;
}

.res-amount.tick-up {
    animation: tickUp 0.2s ease-out;
}

@keyframes tickUp {
    0% { transform: translateY(2px); opacity: 0.7; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ===== BUILDING LEVEL-UP BADGE ===== */
.level-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--green);
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 10px;
    animation: badgePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 5;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* ===== RARITY BORDERS (for special items) ===== */
.rarity-rare { border-color: var(--blue) !important; }
.rarity-epic { border-color: var(--epic) !important; }
.rarity-legendary {
    border-color: var(--legendary) !important;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
}

/* ===== PROGRESS RING for collection ===== */
.collection-progress {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text2);
    margin-top: 4px;
}

.progress-ring {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: conic-gradient(var(--green) var(--pct, 0%), var(--bg) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: 900;
    color: var(--text);
    position: relative;
}

.progress-ring::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--card);
    position: absolute;
}

.progress-ring span {
    position: relative;
    z-index: 1;
}

/* ===== TUTORIAL SYSTEM ===== */
#tutorial-banner {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    width: 92%;
    max-width: 380px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(59, 130, 246, 0.15));
    border: 2px solid rgba(34, 197, 94, 0.5);
    border-radius: var(--radius);
    padding: 12px 16px;
    animation: tutorialPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), tutorialGlow 2s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.2);
}

#tutorial-banner.tutorial-complete {
    border-color: rgba(245, 158, 11, 0.5);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
    animation: tutorialPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tutorialPop {
    0% { transform: translateX(-50%) scale(0.8) translateY(-20px); opacity: 0; }
    100% { transform: translateX(-50%) scale(1) translateY(0); opacity: 1; }
}

@keyframes tutorialGlow {
    0%, 100% { border-color: rgba(34, 197, 94, 0.5); box-shadow: 0 8px 32px rgba(34, 197, 94, 0.15); }
    50% { border-color: rgba(34, 197, 94, 0.8); box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3), 0 0 20px rgba(34, 197, 94, 0.1); }
}

#tutorial-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

#tutorial-icon {
    font-size: 24px;
    animation: tutBounce 1s ease-in-out infinite;
}

@keyframes tutBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

#tutorial-text {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.3;
}

#tutorial-progress {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}

.tut-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transition: all 0.3s;
}

.tut-dot.active {
    background: var(--green);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* Tutorial floating arrow */
#tutorial-arrow {
    position: fixed;
    z-index: 85;
    font-size: 28px;
    animation: arrowBounce 0.8s ease-in-out infinite;
    pointer-events: none;
    filter: drop-shadow(0 2px 8px rgba(34, 197, 94, 0.5));
}

@keyframes arrowBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* Tutorial highlight on building card */
.tutorial-highlight {
    border-color: rgba(34, 197, 94, 0.6) !important;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05)) !important;
    animation: tutHighlight 1.5s ease-in-out infinite !important;
    position: relative;
}

.tutorial-highlight::after {
    content: '👆 Buraya Tıkla!';
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--green);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 12px;
    white-space: nowrap;
    animation: tutLabelPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

@keyframes tutHighlight {
    0%, 100% {
        border-color: rgba(34, 197, 94, 0.4);
        box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
    }
    50% {
        border-color: rgba(34, 197, 94, 0.8);
        box-shadow: 0 0 25px rgba(34, 197, 94, 0.25), inset 0 0 10px rgba(34, 197, 94, 0.05);
    }
}

@keyframes tutLabelPop {
    0% { transform: translateX(-50%) scale(0); opacity: 0; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ===== CLOUD SAVE OVERLAY ===== */
.cloud-save-content {
    text-align: center;
    max-width: 320px;
    margin: 0 auto;
}
.cloud-save-content h2 {
    margin-bottom: 8px;
    font-size: 1.3rem;
    color: var(--gold);
}
#cloud-status {
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text);
}
#cloud-info {
    margin-bottom: 12px;
    min-height: 30px;
}
.cloud-detail {
    font-size: 0.8rem;
    color: var(--text2);
    margin: 2px 0;
}
.cloud-pin-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 12px 0;
}
.cloud-pin-row label {
    font-size: 0.85rem;
    color: var(--text2);
}
#cloud-pin {
    width: 80px;
    padding: 8px 12px;
    font-size: 1.2rem;
    text-align: center;
    letter-spacing: 6px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}
#cloud-pin:focus {
    border-color: var(--gold);
}
.cloud-msg {
    font-size: 0.85rem;
    min-height: 22px;
    margin: 6px 0;
    transition: all 0.3s;
}
.cloud-msg.success { color: #4ade80; }
.cloud-msg.error { color: #f87171; }
.cloud-msg.info { color: var(--gold); }
.cloud-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 12px 0 8px;
}
.cloud-actions .btn-gold,
.cloud-actions .btn-ghost {
    flex: 1;
    max-width: 160px;
    font-size: 0.85rem;
    padding: 10px 8px;
}
.cloud-note {
    font-size: 0.72rem;
    color: var(--text2);
    opacity: 0.7;
    margin: 8px 0 4px;
    line-height: 1.4;
}
.cloud-player-id {
    margin: 6px 0;
}
.cloud-player-id small {
    font-size: 0.7rem;
    color: var(--text2);
    opacity: 0.5;
    word-break: break-all;
}
.cloud-close-btn {
    margin-top: 8px;
    font-size: 0.85rem;
    padding: 8px 20px;
}

/* ===== SOCIAL & SETTINGS PANEL ===== */
.social-settings-content {
    max-width: 420px;
    width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0 0 16px;
}
.social-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 2;
    border-radius: var(--radius) var(--radius) 0 0;
}
.social-tab {
    flex: 1;
    padding: 12px 4px;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.social-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}
.social-panel {
    padding: 16px;
}
.social-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
}
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.nickname-input-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}
.nickname-input {
    background: var(--bg3);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    width: 120px;
}
.nickname-input:focus { border-color: var(--gold); }
.nick-save-btn {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}
.avatar-selector {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.avatar-btn {
    width: 34px;
    height: 34px;
    border: 2px solid rgba(255,255,255,0.1);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.15s;
}
.avatar-btn.active {
    border-color: var(--gold);
    background: rgba(245, 158, 11, 0.15);
}
.avatar-btn:hover { border-color: var(--gold-light); }

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg3);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
}
.toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; bottom: 3px;
    background: var(--text2);
    border-radius: 50%;
    transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--gold); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); background: #fff; }

/* Profile mini stats */
.profile-stats-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 12px 0;
}
.pstat {
    background: var(--bg3);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}

/* Share section */
.share-section { margin-top: 16px; }
.share-section h4 { font-size: 0.9rem; margin-bottom: 8px; color: var(--text2); }
.share-actions {
    display: flex;
    gap: 8px;
}
.share-btn {
    padding: 10px 16px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}
.share-btn:hover { background: var(--card-hover); }
.whatsapp-btn {
    background: #25D366 !important;
    border-color: #128C7E !important;
    color: #fff !important;
}
.whatsapp-btn:hover { background: #1da851 !important; }

/* Boss result share buttons */
.boss-result-actions {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    flex-wrap: wrap;
    justify-content: center;
}
.boss-result-actions .share-btn,
.boss-result-actions .challenge-btn {
    flex: none;
    padding: 8px 14px;
    font-size: 0.8rem;
}
.challenge-btn {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--blue);
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.challenge-btn:hover { background: rgba(59, 130, 246, 0.25); }

/* Leaderboard */
.lb-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.lb-tab {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.lb-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.leaderboard-container { min-height: 100px; }
.lb-header {
    padding: 8px 12px;
    background: var(--bg3);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
}
.lb-list { display: flex; flex-direction: column; gap: 2px; }
.lb-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    gap: 8px;
    font-size: 0.85rem;
    background: var(--card);
    transition: background 0.2s;
}
.lb-row:hover { background: var(--card-hover); }
.lb-row.lb-me { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.2); }
.lb-rank { min-width: 28px; text-align: center; font-weight: 700; color: var(--gold); flex-shrink: 0; }
.lb-avatar { font-size: 1rem; flex-shrink: 0; }
.lb-nick { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { color: var(--gold-light); font-weight: 600; flex-shrink: 0; }
.lb-cities { color: var(--text2); font-size: 0.8rem; flex-shrink: 0; }
.lb-empty, .lb-loading { padding: 24px; text-align: center; color: var(--text3); font-size: 0.9rem; }

/* Notification section */
.kf-notif-section { margin-top: 8px; }
.kf-notif-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}
.kf-notif-info { display: flex; align-items: center; gap: 10px; }
.kf-notif-icon { font-size: 1.3rem; }
.kf-notif-text { display: flex; flex-direction: column; }
.kf-notif-label { font-size: 0.9rem; font-weight: 600; }
.kf-notif-status-text { font-size: 0.75rem; }
.kf-notif-status-text.on { color: var(--green); }
.kf-notif-status-text.off { color: var(--text3); }
.kf-notif-switch {
    position: relative;
    display: inline-block;
    width: 48px; height: 26px;
}
.kf-notif-switch input { opacity: 0; width: 0; height: 0; }
.kf-notif-slider {
    position: absolute;
    inset: 0;
    background: var(--bg3);
    border-radius: 26px;
    cursor: pointer;
    transition: 0.3s;
}
.kf-notif-slider:before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 3px; bottom: 3px;
    background: var(--text2);
    border-radius: 50%;
    transition: 0.3s;
}
.kf-notif-switch input:checked + .kf-notif-slider { background: var(--gold); }
.kf-notif-switch input:checked + .kf-notif-slider:before { transform: translateX(22px); background: #fff; }
.kf-notif-time-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 12px;
}
.kf-notif-time-label { font-size: 0.85rem; color: var(--text2); }
.kf-notif-time-select {
    background: var(--bg3);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* ===== QUEST SYSTEM ===== */
.quest-section {
    margin-bottom: 16px;
}

.quest-section-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text2);
    margin: 12px 0 8px;
    padding-left: 4px;
}

.quest-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.quest-card.quest-complete {
    border-color: rgba(34, 197, 94, 0.4);
    background: linear-gradient(135deg, var(--card), rgba(34, 197, 94, 0.05));
}

.quest-card.quest-claimed {
    opacity: 0.5;
    border-color: var(--border);
}

.quest-icon {
    font-size: 24px;
    width: 36px;
    text-align: center;
    flex-shrink: 0;
}

.quest-info {
    flex: 1;
    min-width: 0;
}

.quest-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 2px;
}

.quest-desc {
    font-size: 11px;
    color: var(--text3);
    margin-bottom: 4px;
}

.quest-progress-bar {
    height: 6px;
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2px;
}

.quest-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--orange));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.quest-complete .quest-progress-fill {
    background: linear-gradient(90deg, var(--green), #4ade80);
}

.quest-progress-text {
    font-size: 10px;
    color: var(--text3);
    font-variant-numeric: tabular-nums;
}

.quest-reward-area {
    flex-shrink: 0;
    text-align: center;
}

.quest-claim-btn {
    background: linear-gradient(135deg, var(--green), #16a34a);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    animation: questClaimPulse 1.5s ease-in-out infinite;
}

@keyframes questClaimPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(34, 197, 94, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 0 16px rgba(34, 197, 94, 0.4); }
}

.quest-claim-btn:active { transform: scale(0.95); }

.quest-reward-preview {
    font-size: 11px;
    color: var(--text3);
    white-space: nowrap;
}

.quest-done-check {
    font-size: 18px;
}

#quests-panel { margin-top: 8px; }

/* ===== TRAVELING MERCHANT ===== */
#merchant-banner {
    margin: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #1a0a2e 0%, #2d1b4e 50%, #1a0a2e 100%);
    border: 2px solid #8B5CF6;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    animation: merchantGlow 2s ease-in-out infinite;
}

@keyframes merchantGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.6), 0 0 40px rgba(139, 92, 246, 0.2); }
}

.merchant-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.merchant-icon { font-size: 24px; }

.merchant-title-area { flex: 1; }

.merchant-title {
    font-size: 14px;
    font-weight: 800;
    color: #C4B5FD;
}

.merchant-timer {
    font-size: 11px;
    color: #A78BFA;
    font-weight: 600;
}

.merchant-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.merchant-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    transition: all 0.2s;
}

.merchant-item:not(.purchased):not(.too-expensive):hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.6);
}

.merchant-item.purchased {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.merchant-item.too-expensive {
    opacity: 0.6;
}

.merchant-item-icon { font-size: 22px; flex-shrink: 0; }

.merchant-item-info { flex: 1; min-width: 0; }

.merchant-item-name {
    font-size: 12px;
    font-weight: 700;
    color: #E9D5FF;
}

.merchant-item-desc {
    font-size: 10px;
    color: #A78BFA;
}

.merchant-buy-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #7C3AED, #6D28D9);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}

.merchant-buy-btn:not(:disabled):active { transform: scale(0.95); }
.merchant-buy-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.merchant-buy-btn.sold {
    background: #374151;
    color: #9CA3AF;
}

.merchant-timer-bar {
    height: 3px;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.merchant-timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #8B5CF6, #A78BFA);
    border-radius: 2px;
    transition: width 1s linear;
    width: 100%;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 500px) {
    #game-area { max-width: 480px; margin: 0 auto; }
    #top-bar, #bottom-nav { max-width: 480px; margin: 0 auto; }
    body { align-items: center; }
}

@media (max-height: 600px) {
    #tap-circle { width: 130px; height: 130px; }
    #tap-icon { width: 108px; height: 108px; font-size: 60px; }
    #kingdom-view { padding: 4px 0; }
    #kingdom-scene { height: 40px; }
}

/* ===== BOSS INTRO OVERLAY ===== */
.boss-intro-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    width: 88vw;
    max-width: 340px;
    max-height: 90vh;
    overflow: hidden;
    box-sizing: border-box;
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0014 70%) !important;
    border: 2px solid #f44;
    border-radius: 16px;
    animation: bossIntroGlow 1s ease-in-out infinite alternate;
    text-align: center;
}
.boss-intro-gif {
    width: 100%;
    max-width: 260px;
    max-height: 40vh;
    object-fit: contain;
    border-radius: 12px;
    border: 2px solid rgba(255, 68, 68, 0.5);
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.3);
}
.boss-intro-title {
    font-size: 20px;
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.8);
    margin: 0;
    animation: bossIntroFlash 0.5s ease-in-out infinite alternate;
}
.boss-intro-enemy {
    font-size: 16px;
    color: #ffd700;
    margin: 0;
}
.boss-intro-countdown {
    font-size: 40px;
    font-weight: 900;
    color: #ff4444;
    text-shadow: 0 0 30px rgba(255, 68, 68, 0.8), 0 0 60px rgba(255, 68, 68, 0.4);
    animation: countdownPulse 1s ease-in-out infinite;
}
@keyframes bossIntroGlow {
    from { box-shadow: 0 0 20px rgba(255, 68, 68, 0.3); }
    to   { box-shadow: 0 0 40px rgba(255, 68, 68, 0.6), 0 0 80px rgba(255, 68, 68, 0.2); }
}
@keyframes bossIntroFlash {
    from { opacity: 0.8; }
    to   { opacity: 1; }
}
@keyframes countdownPulse {
    0%   { transform: scale(1);   opacity: 1; }
    50%  { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1);   opacity: 1; }
}

/* ===== TOAST NOTIFICATIONS ===== */
@keyframes toastIn {
    0% { opacity: 0; transform: translateY(20px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-10px) scale(0.9); }
}

/* ===== MULTIPLAYER SECTION ===== */
#mp-live-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(139,92,246,0.08));
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: var(--radius);
    padding: 8px 14px;
    margin: 8px 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--blue);
    animation: mpLivePulse 3s ease-in-out infinite;
}
#mp-live-bar.hidden { display: none; }
#mp-live-dot {
    width: 8px; height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: mpDotPulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes mpDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}
@keyframes mpLivePulse {
    0%, 100% { border-color: rgba(59,130,246,0.2); }
    50% { border-color: rgba(59,130,246,0.4); }
}
#mp-live-text { flex: 1; }
#mp-live-count { font-weight: 900; color: var(--green); }

/* Multiplayer Challenge Card */
.mp-challenge-card {
    background: linear-gradient(135deg, rgba(236,72,153,0.1), rgba(139,92,246,0.08));
    border: 1px solid rgba(236,72,153,0.3);
    border-radius: var(--radius);
    padding: 12px;
    margin: 8px 0;
    text-align: center;
    animation: challengeShine 3s ease-in-out infinite;
}
.mp-challenge-card.hidden { display: none; }
@keyframes challengeShine {
    0%, 100% { border-color: rgba(236,72,153,0.2); }
    50% { border-color: rgba(236,72,153,0.5); }
}
.mp-challenge-title {
    font-size: 14px; font-weight: 900; color: var(--pink);
    margin-bottom: 6px;
}
.mp-challenge-desc {
    font-size: 11px; color: var(--text2); margin-bottom: 8px;
}
.mp-challenge-timer {
    font-size: 18px; font-weight: 900; color: var(--gold);
    font-variant-numeric: tabular-nums;
}
.mp-challenge-participants {
    display: flex; gap: 4px; justify-content: center;
    margin-top: 8px; flex-wrap: wrap;
}
.mp-participant {
    background: var(--bg2);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 10px;
    color: var(--text2);
}
.mp-participant.me {
    background: rgba(245,158,11,0.2);
    color: var(--gold);
    font-weight: 800;
}

/* Multiplayer Race Bar */
.mp-race-bar {
    background: var(--card);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 8px 0;
    border: 1px solid var(--border);
}
.mp-race-bar.hidden { display: none; }
.mp-race-title {
    font-size: 12px; font-weight: 800; color: var(--text);
    margin-bottom: 8px;
}
.mp-race-entry {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 4px; font-size: 11px;
}
.mp-race-rank {
    width: 20px; text-align: center; font-weight: 900;
    color: var(--gold);
}
.mp-race-name { flex: 1; color: var(--text2); }
.mp-race-score { font-weight: 800; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.mp-race-bar-track {
    height: 4px; background: rgba(0,0,0,0.3);
    border-radius: 2px; margin-top: 2px; overflow: hidden;
}
.mp-race-bar-fill {
    height: 100%; border-radius: 2px;
    transition: width 0.5s ease;
}
.mp-race-entry:nth-child(1) .mp-race-bar-fill { background: var(--gold); }
.mp-race-entry:nth-child(2) .mp-race-bar-fill { background: var(--blue); }
.mp-race-entry:nth-child(3) .mp-race-bar-fill { background: var(--gem); }
.mp-race-entry .mp-race-bar-fill { background: var(--text3); }
.mp-race-entry.me .mp-race-name { color: var(--gold); font-weight: 800; }

/* AI bot tag */
.mp-bot-tag {
    font-size: 9px;
    background: rgba(255,255,255,0.12);
    color: var(--text3);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin-left: 2px;
}

/* Near-death boss HP pulsing */
#boss-hp-fill.near-death {
    animation: nearDeathPulse 0.4s ease-in-out infinite;
}
@keyframes nearDeathPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Boss near-miss text */
.boss-near-miss-text {
    position: absolute;
    bottom: -22px; left: 50%; transform: translateX(-50%);
    font-size: 12px; font-weight: 900;
    color: var(--orange);
    text-shadow: 0 0 10px rgba(249,115,22,0.5);
    animation: nearMissTextPulse 0.6s ease-in-out infinite;
    white-space: nowrap;
}
@keyframes nearMissTextPulse {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateX(-50%) scale(1.05); }
}
