/* ============================================
   CAPYBARA GO! - Main Styles & CSS Variables
   ============================================ */

:root {
    /* Color Palette - Warm, natural, cute */
    --color-bg-primary: #fef6e4;
    --color-bg-secondary: #f8eed6;
    --color-bg-dark: #2d3436;
    
    /* Capybara colors */
    --color-capybara-body: #c9a66b;
    --color-capybara-dark: #8b6914;
    --color-capybara-nose: #5d4524;
    --color-capybara-belly: #e6d5a8;
    
    /* UI Colors */
    --color-primary: #f582ae;
    --color-primary-dark: #d4608c;
    --color-secondary: #8bd3dd;
    --color-secondary-dark: #5bb8c4;
    --color-tertiary: #b8e994;
    --color-tertiary-dark: #7dc95e;
    
    /* Accent colors */
    --color-gold: #ffd93d;
    --color-gold-dark: #f4c430;
    --color-red: #ff6b6b;
    --color-red-dark: #ee4444;
    --color-purple: #a29bfe;
    --color-orange: #fdcb6e;
    
    /* Rarity colors */
    --rarity-common: #b8c5d6;
    --rarity-uncommon: #7dc95e;
    --rarity-rare: #5b9bd5;
    --rarity-epic: #a855f7;
    --rarity-legendary: #f59e0b;
    
    /* Text colors */
    --color-text: #2d3436;
    --color-text-light: #636e72;
    --color-text-inverse: #fef6e4;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(245, 130, 174, 0.4);
    
    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    --radius-full: 9999px;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Typography */
    --font-display: 'Fredoka One', cursive;
    --font-body: 'Nunito', sans-serif;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: linear-gradient(135deg, var(--color-bg-primary) 0%, var(--color-bg-secondary) 100%);
    -webkit-font-smoothing: antialiased;
}

/* Game Container */
#game-container {
    width: 100%;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    background: var(--color-bg-primary);
    box-shadow: var(--shadow-lg);
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.screen.active {
    display: flex;
    opacity: 1;
}

.screen.fade-out {
    opacity: 0;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: normal;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.25rem;
}

/* Buttons */
.btn {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1rem;
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover::before {
    left: -100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    box-shadow: 0 4px 0 var(--color-primary-dark), var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--color-primary-dark), var(--shadow-lg);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--color-primary-dark);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-dark));
    color: var(--color-text);
    box-shadow: 0 4px 0 var(--color-secondary-dark), var(--shadow-md);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--color-secondary-dark), var(--shadow-lg);
}

.btn-tertiary {
    background: linear-gradient(135deg, var(--color-tertiary), var(--color-tertiary-dark));
    color: var(--color-text);
    box-shadow: 0 4px 0 var(--color-tertiary-dark), var(--shadow-md);
}

.btn-large {
    padding: var(--space-md) var(--space-xl);
    font-size: 1.2rem;
}

.btn-small {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.85rem;
}

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 1.5rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.btn-back {
    background: none;
    border: none;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text);
    cursor: pointer;
    padding: var(--space-sm);
}

.btn-back:hover {
    color: var(--color-primary);
}

/* Cards & Panels */
.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-md);
}

/* Stat Bars */
.stat-bar {
    height: 24px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
    flex: 1;
}

.stat-bar-fill {
    height: 100%;
    transition: width var(--transition-normal);
    border-radius: var(--radius-full);
}

.stat-bar-fill.hp-fill {
    background: linear-gradient(90deg, var(--color-red), var(--color-primary));
}

.stat-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* HP Bar */
.hp-bar {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-red), #ff8888);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.enemy-hp .hp-bar-fill {
    background: linear-gradient(90deg, #8b0000, var(--color-red));
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-red);
    color: white;
    border-radius: var(--radius-full);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Rarity backgrounds */
.rarity-common { border-color: var(--rarity-common); }
.rarity-uncommon { border-color: var(--rarity-uncommon); }
.rarity-rare { border-color: var(--rarity-rare); }
.rarity-epic { border-color: var(--rarity-epic); }
.rarity-legendary { 
    border-color: var(--rarity-legendary);
    animation: legendaryGlow 2s ease-in-out infinite;
}

@keyframes legendaryGlow {
    0%, 100% { box-shadow: 0 0 10px var(--rarity-legendary); }
    50% { box-shadow: 0 0 25px var(--rarity-legendary); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--radius-full);
}

/* Damage numbers */
.damage-numbers {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2000;
}

.damage-number {
    position: absolute;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
    animation: damageFloat 1s ease-out forwards;
    pointer-events: none;
}

.damage-number.damage {
    color: var(--color-red);
}

.damage-number.heal {
    color: var(--color-tertiary);
}

.damage-number.crit {
    color: var(--color-gold);
    font-size: 2.5rem;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.4);
}

.damage-number.miss {
    color: var(--color-text-light);
    font-style: italic;
    font-size: 1.2rem;
}

.damage-number.poison {
    color: #9b59b6;
}

.damage-number.burn {
    color: #e74c3c;
}

.damage-number.buff {
    color: var(--color-secondary);
    font-size: 1.2rem;
}

.damage-number.debuff {
    color: #8e44ad;
    font-size: 1.2rem;
}

.damage-number.companion {
    color: var(--color-primary);
}

@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

/* Message animations */
@keyframes messagePop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* Empty text */
.empty-text {
    color: var(--color-text-light);
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
    padding: var(--space-md);
}

/* Floating inventory button */
.btn-inventory-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(245, 130, 174, 0.4);
    z-index: 500;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-inventory-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(245, 130, 174, 0.6);
}

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

.btn-inventory-float.hidden {
    display: none;
}

/* Responsive adjustments */
@media (min-height: 700px) {
    #game-container {
        height: 100vh;
    }
}

@media (max-width: 480px) {
    #game-container {
        max-width: 100%;
    }
}

