* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a12;
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    display: block;
    image-rendering: pixelated;
    box-shadow: 0 0 60px rgba(100, 60, 255, 0.15);
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#ui-layer > * {
    pointer-events: auto;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a12 0%, #1a0a2e 50%, #0d1b2a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.8s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-content h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: 28px;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 0 40px rgba(255, 100, 50, 0.3);
    margin: 24px 0 8px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 18px;
    color: #a78bfa;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 40px;
}

.loading-bar {
    width: 300px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    margin: 0 auto 16px;
    overflow: hidden;
}

.loading-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ff6b35, #a78bfa);
    border-radius: 3px;
    animation: loadFill 2s ease-in-out forwards;
}

@keyframes loadFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

.loading-tip {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    font-style: italic;
}

/* Sandwich Loader Animation */
.sandwich-loader {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    animation: float 2s ease-in-out infinite;
}

.sandwich-loader .bread {
    width: 80px;
    height: 18px;
    background: linear-gradient(180deg, #d4a574, #b8956a);
    border-radius: 10px 10px 4px 4px;
    border: 2px solid #8b6914;
}

.sandwich-loader .bread.bottom {
    border-radius: 4px 4px 10px 10px;
}

.sandwich-loader .filling {
    width: 72px;
    height: 8px;
    border-radius: 4px;
    animation: rainbow 1.5s linear infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes rainbow {
    0% { background: #ff6b6b; }
    20% { background: #4ecdc4; }
    40% { background: #45b7d1; }
    60% { background: #96ceb4; }
    80% { background: #ffeaa7; }
    100% { background: #ff6b6b; }
}

/* Menu Screens */
.menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 18, 0.92);
    z-index: 20;
    transition: opacity 0.4s ease;
}

.menu-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.menu-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 32px;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    margin-bottom: 8px;
    text-align: center;
}

.menu-subtitle {
    font-size: 16px;
    color: #a78bfa;
    letter-spacing: 3px;
    margin-bottom: 40px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 240px;
}

.menu-btn {
    padding: 14px 32px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, rgba(100, 60, 255, 0.2), rgba(255, 100, 50, 0.2));
    color: #fff;
    border-color: rgba(167, 139, 250, 0.4);
}

.menu-btn:hover {
    background: linear-gradient(135deg, rgba(100, 60, 255, 0.4), rgba(255, 100, 50, 0.4));
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.2);
}

.menu-btn.primary {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    border-color: #ff8c42;
    color: #fff;
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, #ff8c42, #ffd700);
    border-color: #ffd700;
}

/* HUD */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 15;
    pointer-events: none;
}

.hud-panel {
    background: rgba(10, 10, 18, 0.8);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 8px;
    padding: 8px 14px;
    pointer-events: auto;
}

.hud-score {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #ffd700;
}

.hud-label {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-value {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

/* Ingredient Tray */
.ingredient-tray {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(10, 10, 18, 0.9);
    border-top: 1px solid rgba(167, 139, 250, 0.2);
    z-index: 15;
}

.ingredient-slot {
    width: 56px;
    height: 56px;
    border: 2px solid rgba(167, 139, 250, 0.3);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    background: rgba(20, 20, 35, 0.8);
    position: relative;
}

.ingredient-slot:hover {
    border-color: #ffd700;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.ingredient-slot.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.ingredient-slot .icon {
    font-size: 24px;
}

.ingredient-slot .name {
    font-size: 9px;
    color: rgba(255,255,255,0.6);
    margin-top: 2px;
    text-align: center;
    line-height: 1;
}

.ingredient-slot .hotkey {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 9px;
    color: rgba(255,255,255,0.3);
    font-family: 'Press Start 2P', monospace;
}

/* Dimension Indicator */
.dimension-indicator {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 18, 0.85);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 20px;
    padding: 6px 20px;
    z-index: 15;
    text-align: center;
}

.dimension-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #a78bfa;
}

.dimension-effect {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
}

/* Floating Text */
.floating-text {
    position: absolute;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    pointer-events: none;
    animation: floatUp 1.2s ease-out forwards;
    z-index: 25;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(1.3); }
}

/* Combo Display */
.combo-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
    pointer-events: none;
}

.combo-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 24px;
    color: #ff6b35;
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
    animation: comboPulse 0.5s ease-out;
}

@keyframes comboPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}

/* Pause Overlay */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 30;
}

.pause-overlay h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 24px;
    color: #fff;
    margin-bottom: 30px;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: #fff;
    z-index: 50;
    max-width: 200px;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.tooltip .title {
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 4px;
}

.tooltip .desc {
    color: rgba(255,255,255,0.7);
    line-height: 1.4;
}

.tooltip .rarity {
    margin-top: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rarity-common { color: #a0a0a0; }
.rarity-rare { color: #4ecdc4; }
.rarity-epic { color: #a78bfa; }
.rarity-legendary { color: #ffd700; }
.rarity-quantum { color: #ff6b35; }

/* Progress Bar */
.progress-bar-container {
    width: 200px;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* Notifications */
.notification {
    position: absolute;
    top: 80px;
    right: 20px;
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 8px;
    padding: 12px 16px;
    max-width: 280px;
    z-index: 40;
    animation: slideIn 0.3s ease-out;
}

.notification.exit {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* Scrollbar for menus */
.scroll-container {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
}

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

.scroll-container::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}

.scroll-container::-webkit-scrollbar-thumb {
    background: rgba(167, 139, 250, 0.4);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-title { font-size: 20px; }
    .menu-subtitle { font-size: 12px; }
    .ingredient-slot { width: 48px; height: 48px; }
    .ingredient-slot .icon { font-size: 20px; }
}
