:root {
    --primary: #4a90e2;
    --secondary: #50e3c2;
    --accent: #f5a623;
    --bg: #f0f4f8;
    --surface: #ffffff;
    --text: #333333;
    --danger: #e74c3c;
    --success: #2ecc71;
    
    --rarity-common: #b0b0b0;
    --rarity-uncommon: #2ecc71;
    --rarity-rare: #3498db;
    --rarity-epic: #9b59b6;
    --rarity-legendary: #f1c40f;
    --rarity-mythical: #e74c3c; /* For 0.5% or lower */
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--surface);
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Header */
.top-bar {
    padding: 15px;
    background: var(--surface);
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 10;
}

.stat-box {
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Main Content */
#main-view {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}

/* Navigation */
.bottom-nav {
    display: flex;
    background: var(--surface);
    border-top: 1px solid #eee;
    padding: 10px;
}

.nav-btn {
    flex: 1;
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-btn span {
    font-size: 1.5rem;
}

/* Common Components */
.hidden { display: none !important; }

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s;
}
.btn:active { transform: scale(0.95); }

/* Home View */
.section-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.pet-card {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    position: relative;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.pet-card.equipped {
    border-color: var(--success);
    background: #e8f8f5;
}

.pet-card.selected {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.pet-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
    display: block;
}

.pet-name {
    font-size: 0.8rem;
    font-weight: bold;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pet-stats {
    font-size: 0.7rem;
    color: #666;
}

/* Shop View */
.shop-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.egg-card {
    background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%);
    border: 1px solid #e1e4e8;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.egg-card.limited {
    border: 2px solid var(--accent);
}

.egg-icon {
    font-size: 3rem;
    background: white;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.egg-info h3 { margin: 0 0 5px 0; }
.egg-price { color: var(--success); font-weight: bold; }
.egg-timer { font-size: 0.8rem; color: var(--danger); font-weight: bold; margin-top: 5px; }

/* Minigames View */
.game-card {
    background: var(--surface);
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-canvas-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #333;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

canvas {
    background: white;
    max-width: 100%;
    max-height: 80vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.game-ui {
    color: white;
    margin-bottom: 10px;
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: space-between;
}

/* Modal / Slot Machine */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.slot-machine {
    width: 100px;
    height: 100px;
    background: #f0f0f0;
    margin: 20px auto;
    border-radius: 10px;
    border: 5px solid #333;
    overflow: hidden;
    position: relative;
}

.slot-reel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slot-item {
    width: 90px;
    height: 90px;
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Rarity Colors */
.rarity-common { color: var(--rarity-common); }
.rarity-uncommon { color: var(--rarity-uncommon); }
.rarity-rare { color: var(--rarity-rare); }
.rarity-epic { color: var(--rarity-epic); }
.rarity-legendary { color: var(--rarity-legendary); }
.rarity-mythical { color: var(--rarity-mythical); text-shadow: 0 0 5px rgba(231, 76, 60, 0.5); }
