/* ============================================
   THEME PARK TYCOON - Core Styles
   Colors: Golden, Rainbow, Blue
   Style: Pixel Art / Retro Game
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    /* Primary palette */
    --gold: #FFD700;
    --gold-dark: #B8960F;
    --gold-light: #FFF3B0;
    --blue: #1a1a2e;
    --blue-mid: #16213e;
    --blue-light: #0f3460;
    --blue-bright: #4FC3F7;
    --blue-sky: #87CEEB;

    /* Rainbow palette */
    --rainbow-red: #FF6B6B;
    --rainbow-orange: #FFA500;
    --rainbow-yellow: #FFD700;
    --rainbow-green: #4ECB71;
    --rainbow-blue: #4FC3F7;
    --rainbow-purple: #BB86FC;
    --rainbow-pink: #FF6EB4;

    /* UI colors */
    --bg-primary: #0a0a1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1a2744;
    --text-primary: #FFFFFF;
    --text-secondary: #B0BEC5;
    --text-muted: #607D8B;
    --border-color: #2a3a5e;
    --border-gold: #FFD70080;

    /* Status colors */
    --success: #4ECB71;
    --danger: #FF6B6B;
    --warning: #FFA500;
    --info: #4FC3F7;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Pixel border style */
    --pixel-border: 3px solid;
    --pixel-radius: 2px;
    --pixel-shadow: 4px 4px 0px rgba(0,0,0,0.5);

    /* Font */
    --font-game: 'Courier New', 'Courier', monospace;
    --font-size-sm: 12px;
    --font-size-md: 14px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-title: 36px;

    /* Player colors */
    --player-1: #FF6B6B;
    --player-2: #4FC3F7;
    --player-3: #4ECB71;
    --player-4: #FFD700;
    --player-5: #BB86FC;
    --player-6: #FF6EB4;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    overflow: hidden;
    height: 100%;
    height: -webkit-fill-available;
}

body {
    font-family: var(--font-game);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    height: -webkit-fill-available;
    width: 100vw;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* ---------- Scrollbar styling ---------- */
.scroll-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-dark) var(--bg-secondary);
}

.scroll-container::-webkit-scrollbar {
    width: 6px;
}

.scroll-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.scroll-container::-webkit-scrollbar-thumb {
    background: var(--gold-dark);
    border-radius: var(--pixel-radius);
}

/* ---------- Typography ---------- */
h1 { font-size: var(--font-size-title); letter-spacing: 2px; }
h2 { font-size: var(--font-size-xl); letter-spacing: 1px; }
h3 { font-size: var(--font-size-lg); letter-spacing: 1px; color: var(--gold); }
p { font-size: var(--font-size-md); color: var(--text-secondary); }

/* ---------- Buttons ---------- */
.btn {
    font-family: var(--font-game);
    font-size: var(--font-size-md);
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: var(--pixel-border) var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all 0.1s ease;
    position: relative;
    white-space: nowrap;
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: none !important;
}

.pixel-btn {
    box-shadow: var(--pixel-shadow);
    image-rendering: pixelated;
}

.btn-primary {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--blue);
    border-color: var(--gold-dark);
}

.btn-primary:active {
    background: var(--gold-dark);
}

.btn-secondary {
    background: linear-gradient(180deg, var(--blue-light) 0%, var(--blue-mid) 100%);
    border-color: var(--blue-bright);
    color: var(--blue-bright);
}

.btn-ghost {
    background: transparent;
    border-color: var(--text-muted);
    color: var(--text-secondary);
    box-shadow: none;
}

.btn-danger {
    background: linear-gradient(180deg, var(--danger) 0%, #c0392b 100%);
    border-color: #c0392b;
    color: white;
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-lg);
    min-height: 56px;
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: var(--space-xs);
    font-size: 20px;
}

.btn-back {
    font-size: var(--font-size-sm);
    padding: var(--space-xs) var(--space-sm);
}

.btn-close {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 18px;
    background: transparent;
    border-color: var(--text-muted);
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn .btn-icon {
    width: auto;
    height: auto;
    padding: 0;
}

/* ---------- Screen Base ---------- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background: var(--bg-primary);
}

.screen.active {
    display: flex;
}

.screen-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 3px solid var(--border-gold);
    min-height: 56px;
    z-index: 10;
}

.screen-header h2 {
    flex: 1;
    text-align: center;
    color: var(--gold);
    font-size: var(--font-size-lg);
    margin-right: 60px; /* Balance the back button */
}

.screen-body {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

/* ---------- Modals ---------- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    padding: 0;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-top: 3px solid var(--gold);
    border-radius: 16px 16px 0 0;
    animation: slideUp 0.25s ease-out;
}

.modal-content-sm {
    max-height: 70vh;
    padding: var(--space-xl);
    align-items: center;
    text-align: center;
    gap: var(--space-md);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    color: var(--gold);
    font-size: var(--font-size-lg);
}

.modal-body {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    top: var(--space-md);
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: var(--bg-card);
    border: 2px solid var(--gold);
    padding: var(--space-sm) var(--space-md);
    text-align: center;
    font-size: var(--font-size-md);
    font-weight: bold;
    box-shadow: var(--pixel-shadow);
    animation: toastIn 0.3s ease-out;
    pointer-events: auto;
}

.toast.toast-success { border-color: var(--success); color: var(--success); }
.toast.toast-danger { border-color: var(--danger); color: var(--danger); }
.toast.toast-warning { border-color: var(--warning); color: var(--warning); }
.toast.toast-info { border-color: var(--info); color: var(--info); }

.toast.hiding {
    animation: toastOut 0.3s ease-in forwards;
}

/* ---------- Utility Classes ---------- */
.hidden { display: none !important; }
.text-gold { color: var(--gold); }
.text-center { text-align: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }
