/* Venetian Masquerade Baroque Snake Game Stylesheet (2026-08-08) */

:root {
    --bg-dark: #090514;
    --card-bg: #140d28;
    --paper-light: #f8f2e2;
    --gold-primary: #e5c158;
    --gold-light: #f7e49e;
    --gold-dark: #9e7a27;
    --gold-glow: rgba(229, 193, 88, 0.4);
    --purple-royal: #7a1f82;
    --purple-glow: rgba(122, 31, 130, 0.5);
    --crimson-red: #961634;
    --text-primary: #f8f2e2;
    --text-muted: #bdae93;
    
    --font-heading: 'Cinzel Decorative', 'Noto Serif SC', serif;
    --font-body: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* --- Venetian Ambient Background --- */
.water-waves-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 50% 30%, #1e133a 0%, #090514 80%);
    pointer-events: none;
    z-index: 1;
}

.masquerade-glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 2;
    opacity: 0.25;
}

.orb-gold {
    top: 10%; left: 20%;
    width: 350px; height: 350px;
    background: var(--gold-primary);
}

.orb-purple {
    bottom: 10%; right: 20%;
    width: 400px; height: 400px;
    background: var(--purple-royal);
}

/* --- Container --- */
.app-container {
    width: 100%;
    max-width: 820px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 10;
}

/* --- Header Section --- */
.header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(20, 13, 40, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid var(--gold-primary);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 15px var(--gold-glow);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 16px;
}

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

.back-home-btn:hover {
    background: var(--gold-primary);
    color: var(--bg-dark);
    transform: translateX(-3px);
}

.title-wrapper {
    text-align: center;
}

.main-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--gold-primary);
    text-shadow: 0 0 10px var(--gold-glow);
    letter-spacing: 1px;
}

.sub-highlight {
    display: block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--gold-primary);
    color: var(--gold-primary);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--gold-primary);
    color: var(--bg-dark);
    transform: scale(1.08);
}

/* --- Dashboard Section --- */
.dashboard {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: rgba(20, 13, 40, 0.85);
    border: 1px solid var(--gold-dark);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--gold-primary);
    text-shadow: 0 0 8px var(--gold-glow);
}

.energy-card {
    grid-column: span 1;
}

.energy-bar-track {
    width: 100%;
    height: 14px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--gold-primary);
    border-radius: 6px;
    margin-top: 6px;
    overflow: hidden;
}

.energy-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #7a1f82 0%, #e5c158 100%);
    transition: width 0.25s ease;
    box-shadow: 0 0 10px var(--gold-primary);
}

/* --- Canvas Outer Frame --- */
.canvas-outer-frame {
    position: relative;
    background: #0d0818;
    padding: 14px;
    border: 3px solid var(--gold-primary);
    border-radius: 14px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.8), 0 0 25px var(--purple-glow);
    display: flex;
    justify-content: center;
}

.baroque-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid var(--gold-primary);
    pointer-events: none;
}

.top-left { top: 4px; left: 4px; border-right: none; border-bottom: none; }
.top-right { top: 4px; right: 4px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 4px; left: 4px; border-right: none; border-top: none; }
.bottom-right { bottom: 4px; right: 4px; border-left: none; border-top: none; }

.canvas-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1;
    border: 2px solid var(--gold-dark);
    border-radius: 6px;
    overflow: hidden;
    background: #090514;
}

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

/* --- Skill Overlay --- */
.mirage-overlay {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    pointer-events: none;
}

.mirage-badge {
    background: rgba(122, 31, 130, 0.9);
    border: 2px solid var(--gold-primary);
    color: var(--gold-light);
    padding: 8px 20px;
    border-radius: 25px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 15px var(--gold-glow);
    animation: mirageGlow 0.6s infinite alternate;
}

@keyframes mirageGlow {
    from { transform: scale(1); box-shadow: 0 0 10px var(--gold-glow); }
    to { transform: scale(1.06); box-shadow: 0 0 22px var(--gold-primary); }
}

/* --- Overlays & Cards --- */
.overlay-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(9, 5, 20, 0.88);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 20;
}

.masquerade-card {
    background: linear-gradient(135deg, #180e30 0%, #0d071d 100%);
    border: 2px solid var(--gold-primary);
    border-radius: 12px;
    padding: 6px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px var(--gold-glow);
}

.card-inner-border {
    border: 1px dashed var(--gold-primary);
    border-radius: 8px;
    padding: 24px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.card-heading {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--gold-primary);
    text-shadow: 0 0 8px var(--gold-glow);
}

.text-danger { color: #ff5577; }

.gold-divider {
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
    margin: 4px 0;
}

.card-desc {
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-primary);
}

.card-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--gold-dark);
}

.gold-btn {
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
    color: #000;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 10px 26px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px var(--gold-glow);
}

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

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

@keyframes btnPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

.final-stats {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px;
    border: 1px solid var(--gold-dark);
    border-radius: 6px;
}

.final-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

/* --- Skill Bar --- */
.skill-bar {
    width: 100%;
    margin-top: 14px;
    display: flex;
    justify-content: center;
}

.skill-btn {
    width: 100%;
    max-width: 400px;
    background: rgba(20, 13, 40, 0.85);
    border: 2px solid var(--gold-primary);
    border-radius: 10px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.skill-btn:not(:disabled):hover {
    background: var(--purple-royal);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--gold-primary);
}

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

.skill-icon {
    font-size: 1.8rem;
}

.skill-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.skill-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--gold-primary);
}

.skill-shortcut {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Mobile D-Pad Controls --- */
.mobile-controls {
    display: none;
    margin-top: 14px;
    width: 100%;
    justify-content: center;
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(3, 56px);
    gap: 6px;
    background: rgba(20, 13, 40, 0.85);
    padding: 8px;
    border: 2px solid var(--gold-primary);
    border-radius: 12px;
}

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

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

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-center { grid-column: 2; grid-row: 2; opacity: 0.3; pointer-events: none; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

/* --- Help Modal --- */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(5, 3, 12, 0.88);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 100;
}

.modal-content {
    max-width: 500px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px; right: 14px;
    background: transparent;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--gold-primary);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--gold-primary);
}

.help-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    margin: 10px 0;
}

.help-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 12px;
    border: 1px solid var(--gold-dark);
    border-radius: 6px;
}

.help-icon {
    font-size: 1.6rem;
}

.help-info strong {
    font-size: 0.95rem;
    color: var(--gold-primary);
}

.help-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.highlight-box {
    background: rgba(122, 31, 130, 0.3);
    border: 1px solid var(--gold-primary);
}

.modal-confirm-btn {
    width: 100%;
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

/* --- Responsive Adaptations --- */
@media (max-width: 768px) {
    .header {
        padding: 8px 12px;
    }

    .main-title {
        font-size: 1.2rem;
    }

    .subtitle {
        display: none;
    }

    .dashboard {
        grid-template-columns: repeat(2, 1fr);
    }

    .energy-card {
        grid-column: span 2;
    }

    .canvas-outer-frame {
        padding: 10px;
    }

    .mobile-controls {
        display: flex;
    }
}
