/* ==========================================================================
   Egyptian Sun Barque & Solar Flare Snake (2026-08-16)
   Style Design System: Royal Pharaoh Gold, Obsidian Sand & Lapis Lazuli
   ========================================================================== */

:root {
    --bg-dark: #060B19;
    --bg-panel: #0D152D;
    --bg-card: rgba(19, 27, 46, 0.75);
    
    --gold-primary: #FFD700;
    --gold-secondary: #F39C12;
    --gold-glow: rgba(255, 215, 0, 0.4);
    
    --lapis-blue: #00A2FF;
    --turquoise-cyan: #00E5FF;
    --ruby-red: #FF2E63;
    
    --text-light: #F0F4F8;
    --text-muted: #8A99AD;
    --border-gold: rgba(255, 215, 0, 0.25);
    
    --font-heading: 'Cinzel', 'Noto Sans SC', serif;
    --font-body: 'Outfit', 'Noto Sans SC', sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 50% 20%, rgba(0, 162, 255, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 50% 80%, rgba(255, 215, 0, 0.06) 0%, transparent 60%);
    color: var(--text-light);
    font-family: var(--font-body);
    overflow: hidden;
    touch-action: manipulation;
}

.app-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: 12px;
    gap: 12px;
    max-width: 1280px;
    margin: 0 auto;
}

/* Header Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 215, 0, 0.2);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gold-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 6px 12px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.back-link:hover {
    background: rgba(255, 215, 0, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 0 12px var(--gold-glow);
}

.title-group {
    display: flex;
    flex-direction: column;
}

.game-tag {
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    color: var(--lapis-blue);
    text-transform: uppercase;
    font-weight: 700;
}

.game-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #FFF, var(--gold-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.top-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid var(--border-gold);
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 10px var(--gold-glow);
}

.icon {
    width: 22px;
    height: 22px;
}

.hidden {
    display: none !important;
}

/* Main Workspace */
.game-workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
    min-height: 0;
}

/* HUD Bar */
.hud-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr;
    gap: 12px;
}

.hud-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.hud-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1px;
}

.hud-value {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 900;
    color: #FFF;
}

.gold-text {
    color: var(--gold-primary);
    text-shadow: 0 0 8px var(--gold-glow);
}

/* Energy HUD Card */
.energy-hud-card {
    gap: 4px;
}

.hud-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hud-value-small {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--turquoise-cyan);
}

.energy-bar-bg {
    position: relative;
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    border: 1px solid rgba(0, 229, 255, 0.3);
    overflow: hidden;
}

.energy-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lapis-blue), var(--turquoise-cyan), var(--gold-primary));
    box-shadow: 0 0 12px var(--turquoise-cyan);
    transition: width 0.3s ease-out;
    border-radius: 6px;
}

/* Canvas Viewport Container */
.canvas-container {
    position: relative;
    flex: 1;
    background: var(--bg-panel);
    border: 2px solid var(--gold-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.15), inset 0 0 40px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Floating Banner */
.canvas-banner {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(243, 156, 18, 0.95));
    color: #000;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.1rem;
    border-radius: 30px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    pointer-events: none;
    animation: bannerPulse 1.2s infinite alternate;
}

@keyframes bannerPulse {
    0% { transform: translateX(-50%) scale(1); }
    100% { transform: translateX(-50%) scale(1.06); }
}

/* Mobile Skill Button Overlay */
.mobile-skill-wrapper {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: none;
}

.mobile-skill-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-secondary));
    border: 2px solid #FFF;
    border-radius: 30px;
    color: #000;
    font-weight: 900;
    font-size: 0.95rem;
    box-shadow: 0 0 16px var(--gold-glow);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-skill-btn.disabled {
    opacity: 0.4;
    filter: grayscale(80%);
    pointer-events: none;
}

/* Controls Panel */
.controls-panel {
    display: flex;
    gap: 16px;
    align-items: center;
}

.mobile-dpad {
    display: none;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 44px);
    gap: 4px;
    padding: 4px;
    background: rgba(13, 21, 45, 0.8);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
}

.dpad-btn {
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid var(--border-gold);
    color: var(--gold-primary);
    font-size: 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dpad-btn:active {
    background: var(--gold-primary);
    color: #000;
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

.instructions-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    padding: 10px 16px;
}

.instructions-card h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--gold-primary);
    margin-bottom: 6px;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 215, 0, 0.1);
}

.rule-icon {
    font-size: 1.3rem;
}

.rule-desc strong {
    display: block;
    font-size: 0.76rem;
    color: var(--text-light);
}

.rule-desc p {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(6, 11, 25, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.glass-modal {
    background: linear-gradient(145deg, rgba(13, 21, 45, 0.95), rgba(6, 11, 25, 0.95));
    border: 2px solid var(--gold-primary);
    border-radius: var(--radius-lg);
    padding: 30px 40px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
}

.modal-badge {
    font-size: 0.72rem;
    letter-spacing: 2px;
    color: var(--turquoise-cyan);
    font-weight: 700;
    margin-bottom: 6px;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--gold-primary);
    margin-bottom: 12px;
}

.modal-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.4;
}

.score-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.4);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-gold);
    margin-bottom: 24px;
}

.score-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.score-row span:last-child, .score-row strong {
    font-family: var(--font-heading);
    font-weight: 700;
    color: #FFF;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-secondary));
    color: #000;
    box-shadow: 0 0 15px var(--gold-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px var(--gold-primary);
}

.btn-secondary {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid var(--border-gold);
    color: var(--gold-primary);
}

.btn-secondary:hover {
    background: rgba(255, 215, 0, 0.2);
}

.btn-glow {
    animation: btnPulse 1.5s infinite alternate;
}

@keyframes btnPulse {
    0% { box-shadow: 0 0 15px var(--gold-glow); }
    100% { box-shadow: 0 0 30px var(--gold-primary); }
}

/* Responsive Media Queries */
@media (max-width: 820px) {
    .hud-bar {
        grid-template-columns: 1fr 1fr;
    }
    
    .rules-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .mobile-dpad {
        display: grid;
    }
    
    .mobile-skill-wrapper {
        display: block;
    }
    
    .instructions-card {
        display: none;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 6px;
        gap: 6px;
    }
    
    .game-title {
        font-size: 1rem;
    }
    
    .hud-bar {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .hud-card {
        padding: 6px 10px;
    }
    
    .hud-value {
        font-size: 1.1rem;
    }
}
