* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #0a0a1a;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #e0e0e0;
    user-select: none;
    -webkit-user-select: none;
}

#gameCanvas {
    display: block;
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

/* Screens */
.screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    z-index: 100;
    background: rgba(8, 8, 24, 0.95);
    backdrop-filter: blur(16px) saturate(1.2);
    overflow-y: auto;
}
.screen.hidden { display: none; }
.hidden { display: none !important; }

/* Main Menu */
.menu-container {
    text-align: center;
    animation: fadeIn 0.5s ease;
    padding: 40px 20px;
    margin: auto;
}

/* ─── Three-Column Menu Layout ─── */
.menu-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.menu-center {
    flex: 0 1 420px;
    min-width: 320px;
}

.menu-panel {
    flex: 0 1 280px;
    min-width: 220px;
    max-width: 300px;
    background: rgba(15, 15, 30, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    margin-top: 30px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.menu-panel::-webkit-scrollbar { width: 4px; }
.menu-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.panel-title {
    font-size: 0.85rem;
    color: #8888aa;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 700;
}

/* Left panel: stash */
.menu-stash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
}
.menu-stash-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 2px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
    cursor: default;
    transition: background 0.15s;
    position: relative;
}
.menu-stash-item:hover { background: rgba(255,255,255,0.08); }
.menu-stash-item .stash-icon { font-size: 1.3rem; }
.menu-stash-item .stash-rarity { font-size: 0.55rem; font-weight: 700; margin-top: 2px; }
.menu-stash-empty { color: #555; font-size: 0.75rem; text-align: center; padding: 20px 0; }

/* Right panel: drop rates + mob stats */
.menu-droprate-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 8px;
}
.menu-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    outline: none;
}
.menu-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00f0ff;
    cursor: pointer;
}
.menu-droprate-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}
.menu-droprate-table td, .menu-droprate-table th {
    padding: 3px 4px;
    text-align: left;
}
.menu-droprate-table th {
    color: #666;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
}
.menu-droprate-bar {
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.1);
    overflow: hidden;
    margin-bottom: 2px;
}
.menu-droprate-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.menu-petal-info {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.menu-petal-info::-webkit-scrollbar { width: 3px; }
.menu-petal-info::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.menu-petal-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.72rem;
    color: #ccc;
    cursor: pointer;
    transition: background 0.15s;
}
.menu-petal-entry:hover { background: rgba(255,255,255,0.05); }
.menu-petal-entry .pe-icon { font-size: 1.1rem; }
.menu-petal-entry .pe-name { font-weight: 600; }
.menu-petal-entry .pe-desc { color: #888; font-size: 0.65rem; }
.menu-petal-entry .pe-dmg { margin-left: auto; color: #ff6666; font-weight: 600; font-size: 0.65rem; }

/* ─── Panel Tabs & Stats Tables ─── */
.panel-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 8px;
}
.panel-tab {
    padding: 3px 7px;
    font-size: 0.6rem;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    color: #888;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.03em;
}
.panel-tab:hover { background: rgba(255,255,255,0.1); color: #ccc; }
.panel-tab.active {
    background: rgba(0, 240, 255, 0.15);
    border-color: rgba(0, 240, 255, 0.3);
    color: #00f0ff;
}

.menu-stats-table {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.menu-stats-table::-webkit-scrollbar { width: 3px; }
.menu-stats-table::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* Stats card (used for both petal & mob detail) */
.stats-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
}
.stats-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.stats-card-icon { font-size: 1.2rem; }
.stats-card-name { font-size: 0.8rem; font-weight: 700; color: #eee; }
.stats-card-type { font-size: 0.6rem; color: #666; text-transform: uppercase; letter-spacing: 0.08em; margin-left: auto; }
.stats-card-desc { font-size: 0.65rem; color: #888; margin-bottom: 6px; line-height: 1.3; }
.stats-card-abilities {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 6px;
}
.stats-ability-tag {
    font-size: 0.55rem;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(192, 132, 252, 0.12);
    color: #c084fc;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.stats-ability-tag.dmg { background: rgba(255, 102, 102, 0.12); color: #ff6666; }
.stats-ability-tag.def { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.stats-ability-tag.util { background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.stats-ability-tag.mob { background: rgba(255, 136, 68, 0.12); color: #ff8844; }

/* Rarity stat rows (like drop rate bars) */
.stats-rarity-grid {
    width: 100%;
    border-collapse: collapse;
}
.stats-rarity-grid td {
    padding: 2px 4px;
    font-size: 0.62rem;
}
.stats-rarity-grid .sr-name { font-weight: 700; width: 55px; }
.stats-rarity-grid .sr-bar-cell { width: 50%; }
.stats-rarity-grid .sr-val { text-align: right; color: #aaa; font-weight: 600; font-size: 0.6rem; }
.stats-bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08); overflow: hidden; margin-bottom: 1px; }
.stats-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.stats-bar-row { display: flex; gap: 4px; align-items: center; }
.stats-bar-label { font-size: 0.55rem; color: #666; width: 28px; text-align: right; }
.stats-bar-value { font-size: 0.55rem; color: #aaa; width: 35px; }

/* Mob shape badges */
.mob-shape {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 4px;
    vertical-align: middle;
}
.mob-shape.circle { border-radius: 50%; }
.mob-shape.square { border-radius: 2px; }
.mob-shape.triangle { clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }
.mob-shape.diamond { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }

/* Responsive: stack panels below center on smaller screens */
@media (max-width: 900px) {
    .menu-layout {
        flex-direction: column;
        align-items: center;
    }
    .menu-panel {
        max-width: 420px;
        width: 100%;
        max-height: 300px;
        margin-top: 0;
    }
    .menu-center { order: -1; }
}
.game-title {
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #00f0ff, #c084fc, #ff6b00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.15em;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.3));
    margin-bottom: 0.3em;
    line-height: 1.1;
}
.subtitle {
    font-size: 1.2rem;
    color: #8888aa;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}
.menu-stats {
    margin-bottom: 1.5rem;
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.8;
}

/* Buttons */
.btn {
    display: block;
    margin: 0.5rem auto;
    padding: 0.75rem 2.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: 0.08em;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 260px;
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.06) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.5s;
}
.btn:hover::after {
    transform: translateX(100%);
}
.btn-play {
    background: linear-gradient(135deg, #00d4ff, #0066cc);
    color: #fff;
    box-shadow: 0 2px 16px rgba(0, 140, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
    border: 1px solid rgba(0, 180, 255, 0.3);
}
.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 24px rgba(0, 180, 255, 0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-secondary {
    background: rgba(255,255,255,0.04);
    color: #bbb;
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(4px);
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}
.controls-hint {
    margin-top: 2rem;
    color: #666;
    font-size: 0.85rem;
    line-height: 1.8;
}

/* HUD */
#hud { z-index: 50; pointer-events: none; }
#hud > * { pointer-events: auto; }

.hud-top {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: min(500px, 80vw);
    z-index: 50;
}
.hp-bar-bg, .xp-bar-bg {
    position: relative;
    width: 100%;
    height: 22px;
    background: rgba(0,0,0,0.6);
    border-radius: 11px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 4px;
}
.hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ff6666);
    border-radius: 11px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}
.xp-bar-bg { height: 14px; border-radius: 7px; }
.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ccff, #00ffcc);
    border-radius: 7px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 200, 255, 0.5);
}
.hp-text, .xp-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    white-space: nowrap;
}

.hud-left {
    position: fixed;
    top: 60px;
    left: 15px;
    z-index: 50;
}
.wave-display {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 15px rgba(0, 200, 255, 0.5);
}
.zone-display {
    font-size: 0.85rem;
    color: #aaa;
    margin-top: 2px;
}
.kill-streak {
    font-size: 0.85rem;
    color: #ffaa00;
    margin-top: 6px;
    font-weight: 700;
}
.timer-display {
    font-size: 0.8rem;
    color: #888;
    margin-top: 4px;
}

/* Pet HUD */
.pet-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(136, 221, 255, 0.08);
    border: 1px solid rgba(136, 221, 255, 0.15);
    border-radius: 8px;
}
.pet-icon {
    font-size: 1rem;
}
.pet-hp-bar-bg {
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}
.pet-hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #88ddff);
    border-radius: 3px;
    transition: width 0.2s ease;
}
.pet-hp-text {
    font-size: 0.65rem;
    color: #88ddff;
    min-width: 30px;
}
.pet-status.pet-dead {
    opacity: 0.5;
}
.pet-status.pet-dead .pet-hp-bar-fill {
    background: #666;
}

.hud-right {
    position: fixed;
    top: 60px;
    right: 15px;
    z-index: 50;
}
.stats-panel {
    font-size: 0.75rem;
    color: #aaa;
    text-align: right;
    line-height: 1.6;
}

.hud-bottom {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}
.orbital-slots {
    display: flex;
    gap: 6px;
}
.orbital-slot {
    width: 52px;
    height: 52px;
    background: rgba(5,5,20,0.6);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}
.orbital-slot canvas {
    border-radius: 6px;
}
.orbital-slot .orbital-level {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 0.6rem;
    font-weight: 800;
    background: rgba(0,0,0,0.8);
    padding: 1px 4px;
    border-radius: 4px;
    color: #fff;
}
.orbital-slot.filled {
    cursor: default;
    transition: all 0.2s ease;
    position: relative;
}
.orbital-slot.filled:hover {
    transform: scale(1.1);
    border-color: rgba(255,255,255,0.4) !important;
}
.slot-number {
    position: absolute;
    top: -2px;
    left: -2px;
    font-size: 0.55rem;
    font-weight: 800;
    background: rgba(0,0,0,0.8);
    color: #888;
    padding: 0px 3px;
    border-radius: 4px;
    line-height: 1.2;
    pointer-events: none;
}
.orbital-slot .orbital-rarity-dot {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.5);
}
.orbital-slot.empty {
    border-style: dashed;
    border-color: rgba(255,255,255,0.08);
}

.minimap-container {
    position: fixed;
    bottom: 80px;
    right: 15px;
    z-index: 50;
}
#minimap {
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(0,0,0,0.5);
}

/* Level Up Screen — side panel */
#levelUpScreen {
    position: fixed;
    top: 0;
    right: 0;
    width: auto;
    max-width: 260px;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(5, 5, 20, 0.88);
    backdrop-filter: blur(14px);
    overflow-y: auto;
    pointer-events: auto;
    border-left: 1px solid rgba(0,240,255,0.08);
    box-shadow: -4px 0 30px rgba(0,0,0,0.4);
}
#levelUpScreen.hidden { display: none; }
.levelup-container {
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 16px;
}
.levelup-title {
    font-size: 1.4rem;
    font-weight: 900;
    color: #00f0ff;
    text-shadow: 0 0 30px rgba(0,240,255,0.5);
    margin-bottom: 0.3rem;
}
.levelup-subtitle {
    color: #888;
    margin-bottom: 1.5rem;
}
.upgrade-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    align-items: center;
}
.upgrade-card {
    width: 220px;
    padding: 1rem;
    background: rgba(15, 15, 35, 0.85);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.upgrade-card:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 240, 255, 0.5);
    box-shadow: 0 6px 24px rgba(0, 200, 255, 0.2), inset 0 0 20px rgba(0, 200, 255, 0.03);
    background: rgba(20, 20, 50, 0.9);
}
.upgrade-card .icon {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}
.upgrade-card .name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.3rem;
}
.upgrade-card .desc {
    font-size: 0.8rem;
    color: #999;
    line-height: 1.4;
}
.upgrade-card .rarity-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 0.5rem;
    letter-spacing: 0.05em;
}

/* Death Screen */
.death-container {
    text-align: center;
    animation: fadeIn 0.5s ease;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px 20px;
    margin: auto;
}
.death-title {
    font-size: 2.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ff4444, #ff7744);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(255, 68, 68, 0.4));
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
}
.death-stats {
    margin-bottom: 1.5rem;
    line-height: 2;
    font-size: 1rem;
}
.death-stats .highlight {
    color: #00f0ff;
    font-weight: 700;
}
.death-stats .stardust {
    color: #ffaa00;
    font-weight: 700;
}

/* Shop */
.shop-container, .achievement-container {
    text-align: center;
    max-width: 700px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    margin: auto;
}
.shop-container h2, .achievement-container h2 {
    font-size: 2rem;
    color: #ffaa00;
    margin-bottom: 0.5rem;
}
.currency-display {
    color: #ffaa00;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}
.shop-item {
    padding: 1rem;
    background: rgba(15, 15, 35, 0.8);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.shop-item:hover {
    border-color: rgba(255,170,0,0.5);
    background: rgba(25, 25, 55, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255,170,0,0.15);
}
.shop-item.maxed {
    border-color: rgba(74,222,128,0.3);
    opacity: 0.65;
}
.shop-item .item-name {
    font-weight: 700;
    margin-bottom: 0.3rem;
}
.shop-item .item-level {
    font-size: 0.8rem;
    color: #888;
}
.shop-item .item-cost {
    color: #ffaa00;
    font-weight: 700;
    margin-top: 0.4rem;
    font-size: 0.9rem;
}
.shop-item .item-effect {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 0.3rem;
}

/* Achievements */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
    text-align: left;
}
.ach-item {
    padding: 0.8rem;
    background: rgba(20, 20, 40, 0.7);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
}
.ach-item.unlocked {
    border-color: #4ade80;
    background: rgba(20, 40, 20, 0.5);
}
.ach-item .ach-name {
    font-weight: 700;
    font-size: 0.9rem;
}
.ach-item .ach-desc {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}
.ach-item .ach-reward {
    font-size: 0.7rem;
    color: #ffaa00;
    margin-top: 4px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 50px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 10px 18px;
    background: rgba(12, 12, 30, 0.92);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    font-size: 0.85rem;
    color: #fff;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    backdrop-filter: blur(10px);
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast.rarity-toast {
    border-width: 2px;
    font-weight: 700;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}
@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}
@keyframes pulse { 
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

/* Inventory Panel */
.inventory-panel {
    position: fixed;
    bottom: 80px;
    left: 15px;
    z-index: 50;
    background: rgba(8, 8, 24, 0.82);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    padding: 10px;
    min-width: 180px;
    max-width: 250px;
    max-height: 320px;
    backdrop-filter: blur(12px);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
}
.inventory-panel.drag-over {
    border-color: #00f0ff;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}
.inventory-header {
    font-size: 0.7rem;
    font-weight: 700;
    color: #666;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    text-transform: uppercase;
}
.inv-count {
    color: #00f0ff;
    margin-left: 4px;
}
.inventory-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 6px;
}
.inv-item {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.15s ease;
}
.inv-item:hover {
    transform: scale(1.15);
    border-color: rgba(255,255,255,0.4);
    z-index: 2;
}
.inv-item:active {
    transform: scale(0.95);
}
.inv-item.dragging {
    opacity: 0.4;
    transform: scale(0.9);
}
.inv-item.rainbow {
    animation: rainbow 2s linear infinite;
}
.inv-icon {
    font-size: 1.1rem;
    pointer-events: none;
}
.inv-rarity-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.5);
    pointer-events: none;
}
.inventory-merge {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.merge-btn {
    padding: 5px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
    text-align: center;
}
.merge-btn:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Mobile */
@media (max-width: 600px) {
    .game-title { font-size: 3rem; }
    .upgrade-grid { flex-direction: column; align-items: center; }
    .upgrade-card { width: 200px; }
    .minimap-container { display: none; }
    .hud-right { display: none; }
}

/* ─── Petal Pick (Death Screen) ─── */
.petal-pick-section {
    margin: 16px 0;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
}
.petal-pick-section.hidden { display: none; }
.petal-pick-title {
    color: #00ffcc;
    font-size: 1rem;
    letter-spacing: 0.1em;
    margin: 0 0 4px;
}
.petal-pick-subtitle {
    color: #888;
    font-size: 0.75rem;
    margin: 0 0 10px;
}
.petal-pick-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-height: 180px;
    overflow-y: auto;
}
.petal-pick-item {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.petal-pick-item:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-2px);
    box-shadow: 0 3px 12px rgba(0,0,0,0.4);
}
.petal-pick-item.selected {
    border-color: #00ffcc;
    border-width: 3px;
    box-shadow: 0 0 20px rgba(0,255,204,0.6), inset 0 0 10px rgba(0,255,204,0.15);
    background: rgba(0,255,204,0.15);
}
.petal-pick-item.pick-saved {
    border-color: #00ffcc;
    border-width: 3px;
    box-shadow: 0 0 24px rgba(0,255,204,0.7), inset 0 0 12px rgba(0,255,204,0.2);
    background: rgba(0,255,204,0.2);
    transform: scale(1.1);
    pointer-events: none;
}
.petal-pick-item.pick-saved::after {
    content: '✓';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #00ffcc;
    color: #000;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}
.petal-pick-item.pick-disabled {
    opacity: 0.35;
    pointer-events: none;
    filter: grayscale(0.8);
}
.petal-pick-item.pick-disabled.pick-saved {
    opacity: 1;
    filter: none;
    pointer-events: none;
}
.petal-pick-item.pick-in-stash {
    opacity: 0.4;
    filter: grayscale(0.6);
    cursor: not-allowed;
}
.petal-pick-item .pick-icon { font-size: 1.4rem; }
.petal-pick-item .pick-rarity-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    position: absolute;
    bottom: 4px;
    right: 4px;
}
.petal-pick-item .pick-name {
    font-size: 0.5rem;
    color: #ccc;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 48px;
    text-align: center;
}

/* ─── Permanent Stash Screen ─── */
.stash-container {
    background: rgba(10,10,26,0.92);
    border: 1px solid rgba(0,255,204,0.15);
    border-radius: 16px;
    padding: 30px;
    width: 90vw;
    max-width: 600px;
    text-align: center;
    margin: auto;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.stash-container h2 {
    color: #00ffcc;
    letter-spacing: 0.15em;
    font-size: 1.6rem;
    margin-bottom: 6px;
}
.stash-subtitle {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.perm-stash-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    max-height: 350px;
    overflow-y: auto;
}
.stash-item {
    width: 64px;
    height: 70px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.15s;
}
.stash-item:hover {
    background: rgba(255,255,255,0.08);
}
.stash-item .stash-icon { font-size: 1.6rem; }
.stash-item .stash-rarity-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    position: absolute;
    bottom: 5px;
    right: 5px;
}
.stash-item .stash-name {
    font-size: 0.55rem;
    color: #ccc;
    margin-top: 2px;
    white-space: nowrap;
}
.stash-item .stash-delete {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.6rem;
    color: #ff4444;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.stash-item:hover .stash-delete { opacity: 1; }
.stash-empty {
    color: #555;
    font-style: italic;
    font-size: 0.85rem;
    margin: 20px 0;
}

/* ─── Pre-Run Petal Selection ─── */
.prerun-container {
    background: rgba(10,10,26,0.92);
    border: 1px solid rgba(0,255,204,0.15);
    border-radius: 16px;
    padding: 30px;
    width: 90vw;
    max-width: 550px;
    text-align: center;
    margin: auto;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.prerun-container h2 {
    color: #00ffcc;
    letter-spacing: 0.1em;
    font-size: 1.4rem;
    margin-bottom: 6px;
}
.prerun-subtitle {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 16px;
}
.prerun-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    max-height: 280px;
    overflow-y: auto;
}
.prerun-item {
    width: 64px;
    height: 70px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
}
.prerun-item:hover {
    background: rgba(255,255,255,0.12);
    transform: translateY(-2px);
    box-shadow: 0 3px 12px rgba(0,0,0,0.4);
}
.prerun-item.selected {
    border-color: #00ffcc;
    box-shadow: 0 0 14px rgba(0,255,204,0.4);
    background: rgba(0,255,204,0.1);
}
.prerun-item .prerun-icon { font-size: 1.6rem; }
.prerun-item .prerun-rarity-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    position: absolute;
    bottom: 5px;
    right: 5px;
}
.prerun-item .prerun-name {
    font-size: 0.55rem;
    color: #ccc;
    margin-top: 2px;
    white-space: nowrap;
}

/* ─── Drop Rate Screen ─── */
#dropRateScreen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 20, 0.97);
    z-index: 200;
    gap: 16px;
}
.droprate-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-height: 90vh;
    overflow-y: auto;
}
.droprate-container h2 {
    color: #fff;
    letter-spacing: 2px;
    font-size: 1.3rem;
}
.droprate-subtitle {
    color: #666;
    font-size: 0.8rem;
}
.droprate-wave-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #aaa;
    font-size: 0.95rem;
}
.droprate-wave-selector input[type="range"] {
    width: 260px;
    accent-color: #4ade80;
}
.droprate-wave-selector span {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    min-width: 28px;
    text-align: center;
}
.droprate-grid {
    border-collapse: collapse;
    min-width: 340px;
}
.droprate-grid th {
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    text-align: left;
    border-bottom: 1px solid #222;
}
.droprate-grid td {
    padding: 6px 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid #181828;
    vertical-align: middle;
}
.droprate-grid td:last-child {
    display: flex;
    align-items: center;
    gap: 8px;
}
.droprate-bar-bg {
    width: 120px;
    height: 8px;
    background: #181828;
    border-radius: 4px;
    overflow: hidden;
}
.droprate-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.25s ease;
}

/* ─── Secret Code ─── */
.secret-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}
.secret-input {
    background: #111122;
    border: 1px solid #333;
    color: #888;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    width: 160px;
    outline: none;
    font-family: inherit;
}
.secret-input:focus {
    border-color: #555;
    color: #ccc;
}
.btn-small {
    padding: 6px 14px;
    font-size: 0.75rem;
    background: #222;
    color: #888;
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
}
.btn-small:hover {
    background: #333;
    color: #ccc;
}

/* ─── Tutorial Overlay ─── */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tutorial-overlay.hidden { display: none; }
.tutorial-card {
    background: rgba(12, 12, 32, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 36px 40px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 60px rgba(0, 200, 255, 0.08), 0 0 0 1px rgba(0,200,255,0.05);
    backdrop-filter: blur(16px);
}
.tutorial-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}
.tutorial-title {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 10px;
    letter-spacing: 1px;
}
.tutorial-text {
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
}
.tutorial-step-indicator {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 16px;
}
.tut-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
    transition: background 0.2s;
}
.tut-dot.active {
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
}
.tutorial-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}
.btn-tut {
    min-width: 100px;
    padding: 10px 24px !important;
    font-size: 0.85rem !important;
}

/* ─── Petal Encyclopedia ─── */
.petal-info-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 30px 20px;
    max-height: 90vh;
    overflow-y: auto;
}
.petal-info-container h2 {
    color: #fff;
    letter-spacing: 2px;
    font-size: 1.3rem;
}
.petal-info-subtitle {
    color: #666;
    font-size: 0.8rem;
}
.petal-info-table {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    max-width: 900px;
}
.petal-info-section {
    background: rgba(15, 15, 30, 0.8);
    border: 1px solid #222;
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 200px;
    max-width: 260px;
}
.petal-info-type {
    color: #ddd;
    font-size: 1rem;
    margin-bottom: 4px;
}
.petal-info-desc {
    color: #777;
    font-size: 0.7rem;
    margin-bottom: 8px;
    line-height: 1.4;
}
.petal-info-grid {
    border-collapse: collapse;
    width: 100%;
}
.petal-info-grid th {
    color: #666;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 6px;
    text-align: left;
    border-bottom: 1px solid #222;
}
.petal-info-grid td {
    padding: 3px 6px;
    font-size: 0.8rem;
    color: #ccc;
    border-bottom: 1px solid #111;
}

/* ─── Skin Shop ─── */
.skin-container {
    text-align: center;
    max-width: 650px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    margin: auto;
    padding: 30px 20px;
}
.skin-container h2 {
    color: #c084fc;
    letter-spacing: 0.15em;
    font-size: 1.6rem;
    margin-bottom: 6px;
}
.skin-subtitle {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.skin-preview-area {
    margin: 16px auto;
    display: flex;
    justify-content: center;
}
#skinPreviewCanvas {
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.4);
}
.skin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.skin-item {
    padding: 14px 10px;
    background: rgba(15, 15, 35, 0.8);
    border: 1.5px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    backdrop-filter: blur(6px);
}
.skin-item:hover {
    transform: translateY(-2px);
    border-color: rgba(192,132,252,0.4);
    box-shadow: 0 4px 16px rgba(192,132,252,0.15);
    background: rgba(25, 25, 55, 0.9);
}
.skin-item.skin-active {
    border-color: rgba(0,240,255,0.6);
    box-shadow: 0 0 20px rgba(0,240,255,0.2);
    background: rgba(0,240,255,0.06);
}
.skin-item.skin-locked {
    opacity: 0.55;
}
.skin-item .skin-icon { font-size: 1.8rem; margin-bottom: 4px; }
.skin-item .skin-name { font-weight: 700; font-size: 0.85rem; color: #ddd; margin-bottom: 2px; }
.skin-item .skin-cost { font-size: 0.75rem; color: #ffaa00; font-weight: 600; }
.skin-item .skin-owned { font-size: 0.7rem; color: #4ade80; font-weight: 600; letter-spacing: 0.05em; }
.skin-item .skin-equipped { font-size: 0.7rem; color: #00ccff; font-weight: 700; letter-spacing: 0.05em; }
.skin-color-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-top: 4px;
    border: 1px solid rgba(255,255,255,0.2);
}

/* ─── PVP Screens ─── */
.pvp-container {
    text-align: center;
    max-width: 700px;
    width: 92vw;
    margin: auto;
    padding: 40px 20px;
}
.pvp-container h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, #00ccff, #ff4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.15em;
    margin-bottom: 6px;
}
.pvp-subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* PVP Zone Grid */
.pvp-zone-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 500px) {
    .pvp-zone-grid { grid-template-columns: 1fr; }
}
.pvp-zone-card {
    background: rgba(15, 15, 35, 0.85);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    text-align: center;
}
.pvp-zone-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    border-color: currentColor;
}
.pvp-zone-card.pvp-zone-locked {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.5);
}
.pvp-zone-card.pvp-zone-locked:hover {
    transform: none;
    box-shadow: none;
}
.pvp-zone-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}
.pvp-zone-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.pvp-zone-desc {
    color: #999;
    font-size: 0.78rem;
    margin-bottom: 10px;
}
.pvp-zone-stats {
    display: flex;
    justify-content: center;
    gap: 12px;
    font-size: 0.72rem;
    color: #bbb;
    flex-wrap: wrap;
}
.pvp-zone-lock {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 10px;
    font-weight: 600;
}
.pvp-zone-enter {
    color: #4ade80;
    font-size: 0.85rem;
    margin-top: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* PVP Victory / Death */
.pvp-victory-container {
    text-align: center;
    margin: auto;
    padding: 40px 20px;
    max-width: 500px;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pvp-victory-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 16px;
    letter-spacing: 0.1em;
}
.pvp-victory-stats {
    color: #aaa;
    font-size: 1rem;
    line-height: 2;
    margin-bottom: 20px;
}
.pvp-final-lb {
    margin: 16px auto;
    max-width: 340px;
}

/* PVP HUD */
#pvpHud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
}
.pvp-hud-top {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 51;
}
.pvp-hp-section {
    min-width: 200px;
}
.pvp-hp-bar-bg {
    width: 220px;
    height: 20px;
    background: rgba(0,0,0,0.6);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    backdrop-filter: blur(4px);
    position: relative;
}
.pvp-hp-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.15s ease, background 0.3s ease;
}
.pvp-hp-p1 {
    background: linear-gradient(90deg, #22c55e, #4ade80);
    box-shadow: 0 0 10px rgba(74,222,128,0.3);
}
.pvp-hp-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.pvp-score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.pvp-score-label {
    font-size: 0.6rem;
    color: #888;
    letter-spacing: 0.15em;
    font-weight: 700;
}
.pvp-score-value {
    font-size: 1.3rem;
    font-weight: 900;
    color: #facc15;
    text-shadow: 0 0 12px rgba(250,204,21,0.4);
}
.pvp-zone-label {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

/* PVP Leaderboard */
.pvp-leaderboard {
    position: fixed;
    top: 50px;
    right: 12px;
    width: 180px;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 10px 12px;
    z-index: 51;
}
.pvp-lb-title {
    font-size: 0.65rem;
    color: #888;
    letter-spacing: 0.15em;
    font-weight: 800;
    margin-bottom: 6px;
    text-align: center;
}
.pvp-lb-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 0.72rem;
}
.pvp-lb-rank {
    color: #666;
    font-weight: 800;
    min-width: 16px;
}
.pvp-lb-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}
.pvp-lb-score {
    color: #facc15;
    font-weight: 700;
    font-size: 0.68rem;
}
.pvp-lb-dead {
    opacity: 0.35;
    text-decoration: line-through;
}
.pvp-lb-you {
    background: rgba(0,204,255,0.08);
    border-radius: 4px;
    padding: 3px 4px;
    margin: 0 -4px;
}
.pvp-lb-you .pvp-lb-rank { color: #00ccff; }

/* PVP Exit Button */
.btn-pvp-exit {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 52;
    pointer-events: auto;
    background: rgba(220, 38, 38, 0.7);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 8px 18px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background 0.2s;
    letter-spacing: 0.05em;
}
.btn-pvp-exit:hover {
    background: rgba(220, 38, 38, 0.9);
}

/* PVP Main Menu Button */
.btn-pvp-main {
    background: linear-gradient(135deg, #dc2626, #f97316) !important;
    color: #fff !important;
    font-weight: 900 !important;
    letter-spacing: 0.1em;
    font-size: 1.1rem !important;
    padding: 14px 32px !important;
    border: 2px solid rgba(255,100,50,0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    animation: pvpGlow 2s ease-in-out infinite;
}
@keyframes pvpGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(220,38,38,0.3); }
    50% { box-shadow: 0 0 35px rgba(249,115,22,0.5); }
}

@media (max-width: 600px) {
    .pvp-leaderboard { width: 140px; top: 44px; right: 6px; padding: 6px 8px; }
    .pvp-lb-entry { font-size: 0.62rem; }
    .pvp-hud-top { gap: 8px; }
    .pvp-hp-bar-bg { width: 140px; height: 16px; }
    .pvp-score-value { font-size: 1rem; }
}

/* ─── Mod Sidebar ─── */
.mod-sidebar {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    width: 210px;
    max-height: 85vh;
    overflow-y: auto;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(74,222,128,0.2);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 9999;
    pointer-events: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(74,222,128,0.3) transparent;
    transition: width 0.3s ease, padding 0.3s ease;
}
.mod-sidebar::-webkit-scrollbar { width: 4px; }
.mod-sidebar::-webkit-scrollbar-thumb { background: rgba(74,222,128,0.3); border-radius: 2px; }
.mod-sidebar.hidden {
    display: none;
}
.mod-sidebar.collapsed {
    width: auto;
    overflow: hidden;
    padding: 10px 14px;
}
.mod-sidebar.collapsed .mod-body {
    display: none;
}
.mod-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}
.mod-header h3 {
    margin: 0;
    font-size: 14px;
    color: #4ade80;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(74,222,128,0.3);
}
.mod-collapse-btn {
    background: none;
    border: 1px solid rgba(74,222,128,0.3);
    color: #4ade80;
    font-size: 12px;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}
.mod-sidebar.collapsed .mod-collapse-btn {
    transform: rotate(-90deg);
}
.mod-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.mod-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mod-section:last-child {
    border-bottom: none;
}
.mod-section label {
    font-size: 11px;
    color: #888;
    letter-spacing: 0.5px;
}
.mod-row {
    display: flex;
    gap: 4px;
    align-items: center;
}
.mod-input {
    flex: 1;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    color: #e0e0e0;
    padding: 5px 6px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s;
}
.mod-input:focus {
    border-color: rgba(74,222,128,0.4);
}
.mod-sidebar .btn-small {
    font-size: 11px;
    padding: 5px 10px;
    background: rgba(74,222,128,0.15);
    border: 1px solid rgba(74,222,128,0.25);
    color: #4ade80;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.mod-sidebar .btn-small:hover {
    background: rgba(74,222,128,0.25);
    border-color: rgba(74,222,128,0.4);
}
.mod-toggle {
    width: 100%;
    text-align: center;
}

/* ─── Premium Button ─── */
.btn-premium {
    background: linear-gradient(135deg, rgba(250,204,21,0.2), rgba(251,146,60,0.2));
    border: 1px solid rgba(250,204,21,0.4);
    color: #facc15;
    text-shadow: 0 0 8px rgba(250,204,21,0.3);
}
.btn-premium:hover {
    background: linear-gradient(135deg, rgba(250,204,21,0.3), rgba(251,146,60,0.3));
    border-color: rgba(250,204,21,0.6);
}

/* ─── Premium Overlay ─── */
.premium-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}
.premium-overlay.hidden { display: none; }
.premium-card {
    background: linear-gradient(145deg, rgba(20,15,40,0.95), rgba(30,20,50,0.95));
    border: 1px solid rgba(250,204,21,0.3);
    border-radius: 16px;
    padding: 40px 36px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 0 60px rgba(250,204,21,0.1);
}
.premium-close {
    position: absolute;
    top: 12px; right: 14px;
    background: none; border: none;
    color: #888; font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}
.premium-close:hover { color: #fff; }
.premium-crown { font-size: 48px; margin-bottom: 8px; }
.premium-title {
    color: #facc15;
    font-size: 1.4rem;
    letter-spacing: 2px;
    margin-bottom: 6px;
    text-shadow: 0 0 20px rgba(250,204,21,0.3);
}
.premium-price {
    font-size: 2rem;
    color: #fff;
    font-weight: 900;
    margin: 10px 0 4px;
}
.premium-price span {
    font-size: 0.9rem;
    color: #888;
    font-weight: 400;
}
.premium-perks {
    list-style: none;
    padding: 0;
    margin: 18px 0;
    text-align: left;
}
.premium-perks li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: #ccc;
    font-size: 0.95rem;
}
.premium-perks li:last-child { border-bottom: none; }
.btn-premium-buy {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #facc15, #fb923c);
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
}
.btn-premium-buy:hover {
    transform: scale(1.03);
    box-shadow: 0 0 25px rgba(250,204,21,0.4);
}
.premium-fine {
    color: #555; font-size: 0.7rem; margin-top: 12px;
}

/* ─── Death Upsell Popup ─── */
.upsell-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.4s ease;
}
.upsell-overlay.hidden { display: none; }
.upsell-card {
    background: linear-gradient(145deg, rgba(20,10,30,0.95), rgba(40,15,15,0.95));
    border: 1px solid rgba(255,100,50,0.3);
    border-radius: 16px;
    padding: 32px 30px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    position: relative;
    box-shadow: 0 0 60px rgba(255,100,50,0.1);
}
.upsell-close {
    position: absolute;
    top: 12px; right: 14px;
    background: none; border: none;
    color: #888; font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}
.upsell-close:hover { color: #fff; }
.upsell-icon { font-size: 42px; margin-bottom: 6px; }
.upsell-title {
    color: #ff6633;
    font-size: 1.3rem;
    letter-spacing: 2px;
    margin-bottom: 4px;
    text-shadow: 0 0 15px rgba(255,100,50,0.3);
}
.upsell-slogan {
    color: #aaa;
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.upsell-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.upsell-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px 14px;
    text-align: left;
}
.upsell-item-icon { font-size: 22px; }
.upsell-item-desc {
    flex: 1;
    color: #777;
    font-size: 0.75rem;
    text-align: right;
}
.upsell-price {
    color: #ccc;
    font-size: 1rem;
    margin-bottom: 12px;
}
.upsell-price strong {
    color: #ff6633;
    font-size: 1.3rem;
}
.btn-upsell-buy {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #ff6633, #ff4444);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
}
.btn-upsell-buy:hover {
    transform: scale(1.03);
    box-shadow: 0 0 25px rgba(255,100,50,0.4);
}
.upsell-skip {
    color: #555;
    font-size: 0.75rem;
    margin-top: 12px;
    cursor: pointer;
    transition: color 0.2s;
}
.upsell-skip:hover { color: #aaa; }
.upsell-browse {
    color: #666;
    font-size: 0.75rem;
    margin-top: 8px;
}
.upsell-browse-link {
    color: #60a5fa;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: underline;
}
.upsell-browse-link:hover { color: #93c5fd; }

/* ─── Petal Shop ─── */
.shop-subtitle {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 16px;
}
.petal-shop-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}
.petal-shop-tab {
    padding: 8px 20px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    color: #888;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}
.petal-shop-tab:hover {
    background: rgba(255,255,255,0.06);
    color: #ccc;
}
.petal-shop-tab.active {
    background: rgba(250,204,21,0.1);
    border-color: rgba(250,204,21,0.3);
    color: #facc15;
}
.petal-shop-tab.active[data-tab="eternal"] {
    background: rgba(0,255,204,0.1);
    border-color: rgba(0,255,204,0.3);
    color: #00ffcc;
}
.petal-shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    max-height: 55vh;
    overflow-y: auto;
    padding: 4px;
}
.petal-shop-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.petal-shop-card:hover {
    background: rgba(255,255,255,0.06);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.petal-shop-card.owned {
    opacity: 0.5;
    cursor: default;
}
.petal-shop-card.owned:hover {
    transform: none;
    box-shadow: none;
}
.petal-shop-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 6px;
}
.petal-shop-name {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 2px;
}
.petal-shop-rarity {
    font-size: 0.65rem;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.petal-shop-desc {
    font-size: 0.7rem;
    color: #777;
    margin-bottom: 8px;
    line-height: 1.3;
}
.petal-shop-price-tag {
    display: inline-block;
    padding: 4px 14px;
    background: linear-gradient(135deg, #ff6633, #ff4444);
    border-radius: 20px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 900;
}
.petal-shop-card.owned .petal-shop-price-tag {
    background: rgba(74,222,128,0.2);
    color: #4ade80;
}
.petal-shop-stats {
    font-size: 0.65rem;
    color: #999;
    margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════ */
/* MOBILE TOUCH CONTROLS                                 */
/* ═══════════════════════════════════════════════════════ */

.mobile-controls {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 500;
    touch-action: none;
}
.mobile-controls.hidden {
    display: none !important;
}

/* Joystick Zone — left half of screen */
.joystick-zone {
    position: absolute;
    left: 0; bottom: 0;
    width: 50%;
    height: 55%;
    pointer-events: auto;
    touch-action: none;
}

/* Joystick Base — appears where you touch */
.joystick-base {
    position: fixed;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.08);
    border: 2px solid rgba(0, 240, 255, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transform: translate(-50%, -50%);
    display: none;
    pointer-events: none;
    transition: opacity 0.15s;
}
.joystick-base.active {
    display: block;
}

/* Joystick Thumb */
.joystick-thumb {
    position: absolute;
    top: 50%; left: 50%;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.5), rgba(0, 180, 255, 0.3));
    border: 2px solid rgba(0, 240, 255, 0.6);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.3), inset 0 0 6px rgba(0, 240, 255, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Action Button Container — right side */
.mobile-btn-container {
    position: absolute;
    right: 12px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: auto;
    touch-action: none;
}

/* Individual Action Button */
.mobile-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 40, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.1s, background 0.1s, box-shadow 0.1s;
}
.mobile-btn:active,
.mobile-btn.pressed {
    transform: scale(0.9);
    background: rgba(0, 240, 255, 0.25);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
}

.mobile-btn-icon {
    font-size: 20px;
    line-height: 1;
}
.mobile-btn-label {
    font-size: 7px;
    letter-spacing: 1px;
    opacity: 0.7;
    margin-top: 1px;
    font-family: 'Segoe UI', sans-serif;
    text-transform: uppercase;
}

/* Button colors */
.mobile-btn-extend {
    border-color: rgba(0, 255, 100, 0.35);
    box-shadow: 0 0 8px rgba(0, 255, 100, 0.15);
}
.mobile-btn-extend.pressed {
    background: rgba(0, 255, 100, 0.25);
    box-shadow: 0 0 16px rgba(0, 255, 100, 0.4);
}

.mobile-btn-retract {
    border-color: rgba(255, 180, 0, 0.35);
    box-shadow: 0 0 8px rgba(255, 180, 0, 0.15);
}
.mobile-btn-retract.pressed {
    background: rgba(255, 180, 0, 0.25);
    box-shadow: 0 0 16px rgba(255, 180, 0, 0.4);
}

.mobile-btn-dash {
    border-color: rgba(0, 200, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 200, 255, 0.2);
}
.mobile-btn-dash.pressed {
    background: rgba(0, 200, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.5);
}

.mobile-btn-equip {
    border-color: rgba(192, 132, 252, 0.35);
    box-shadow: 0 0 8px rgba(192, 132, 252, 0.15);
}
.mobile-btn-equip.pressed {
    background: rgba(192, 132, 252, 0.25);
    box-shadow: 0 0 16px rgba(192, 132, 252, 0.4);
}

.mobile-btn-store {
    border-color: rgba(255, 107, 0, 0.35);
    box-shadow: 0 0 8px rgba(255, 107, 0, 0.15);
}
.mobile-btn-store.pressed {
    background: rgba(255, 107, 0, 0.25);
    box-shadow: 0 0 16px rgba(255, 107, 0, 0.4);
}

/* Mobile-specific responsive tweaks */
@media (max-width: 768px) {
    .menu-layout { flex-direction: column !important; }
    .menu-panel { max-width: 100% !important; width: 100% !important; margin: 0 !important; }
    .menu-center { order: -1; }
    .controls-desktop { display: none !important; }
    .controls-mobile { display: block !important; }
    .game-title { font-size: 28px !important; }
    .subtitle { font-size: 12px !important; }
    .menu-container { padding: 12px !important; }
    .btn { font-size: 12px !important; padding: 8px 16px !important; }
    .menu-stats { font-size: 11px !important; }
    .secret-code-row { flex-wrap: wrap; }

    /* Stack panels for mobile */
    .menu-panel-left, .menu-panel-right {
        max-height: 200px !important;
        overflow-y: auto;
    }

    /* Smaller HUD on mobile */
    .hud-bar { height: 14px !important; }
    #statsPanel { font-size: 10px !important; }

    /* Inventory at top on mobile */
    #inventoryPanel {
        top: auto !important;
        bottom: 140px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: 90vw !important;
    }

    /* Hide PVP on mobile (needs 2 players on same device) */
    #btnPVP { display: none !important; }
}

/* Desktop hides mobile controls hint */
.controls-mobile { display: none; }

/* Touch device hides desktop controls hint via JS class */
body.is-mobile .controls-desktop { display: none !important; }
body.is-mobile .controls-mobile { display: block !important; }

/* ═══════════════════════════════════════════════════════ */
/* GOOGLE ACCOUNT BAR                                    */
/* ═══════════════════════════════════════════════════════ */

.google-account-bar {
    margin: 8px 0 12px;
    display: flex;
    justify-content: center;
}

.btn-google {
    display: inline-flex;
    align-items: center;
    background: rgba(66, 133, 244, 0.15);
    border: 1px solid rgba(66, 133, 244, 0.35);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.btn-google:hover {
    background: rgba(66, 133, 244, 0.3);
    box-shadow: 0 0 12px rgba(66, 133, 244, 0.3);
}

.google-signed-in {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px 4px 4px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.google-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(0, 240, 255, 0.3);
}

.google-name {
    color: #ccc;
    font-size: 12px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-google-out {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #999 !important;
    font-size: 10px !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    cursor: pointer;
}
.btn-google-out:hover {
    background: rgba(255, 80, 80, 0.15) !important;
    border-color: rgba(255, 80, 80, 0.3) !important;
    color: #ff8888 !important;
}
