:root {
    --frame: #f4c95d;
    --page-bg: #0c0a10;
    
    /* Frontend Design Tokens */
    --brand-primary: #FF9933; /* Saffron/Chai */
    --brand-hover: #E68A2E;
    --brand-accent: #f4c95d;
    
    --bg-surface: rgba(12, 10, 16, 0.45);
    --bg-card: rgba(255, 255, 255, 0.04);
    --border-card: rgba(255, 255, 255, 0.1);
    
    --text-primary: #FFFFFF;
    --text-secondary: #E0E7FF;
    --text-muted: #94A3B8;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    background-color: var(--page-bg);
    font-family: 'Inter', sans-serif;
}

/* Layout Containers */
#app {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, #1a1424 0%, var(--page-bg) 62%);
}

#game-container {
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: min(100vw - 16px, 1280px);
    height: min(100vh - 16px, 880px);
    max-width: 100%;
    max-height: 100%;
    padding: 10px;
    border-radius: 8px;
    background: linear-gradient(145deg, #2a2438, #0f0c14);
    box-shadow:
        0 0 0 3px var(--frame),
        0 18px 48px rgba(0, 0, 0, 0.65),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#game-canvas-host {
    position: relative;
    flex: 1 1 0; /* Changed to flex-basis 0 to ensure it grows correctly without initial size bias */
    min-height: 0; /* Important for flex-shrink/grow in some browsers */
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
    background: #0a080c;
}

#game-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    vertical-align: top;
    image-rendering: auto;
}

/* Menu Overlay System - Now lives inside game-canvas-host */
#menu-overlay {
    position: absolute;
    inset: 0; /* Fill the host exactly */
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, transparent 0%, rgba(12, 10, 16, 0.45) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

#menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.menu-card {
    width: min(90%, 480px);
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-card);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

#menu-overlay.active .menu-card {
    transform: translateY(0);
}

.menu-title {
    font-family: 'Clash Display', sans-serif;
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--brand-accent);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.menu-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 40px;
}

.menu-save-info {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 32px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.save-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.save-stats {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary);
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-primary {
    background: var(--brand-primary);
    color: #000;
    font-family: 'Clash Display', sans-serif;
    font-weight: 600;
    font-size: 18px;
    padding: 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-out;
    box-shadow: 0 4px 0px #b36b24;
}

.btn-primary:hover {
    background: var(--brand-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 0px #b36b24;
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 0px 0px #b36b24;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 15px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border-card);
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.menu-footer {
    margin-top: 32px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}
