/* ==========================================================================
   Gothic Rose Window: Radiant Glass Snake - CSS Design System (2026-08-09)
   ========================================================================== */

:root {
    --bg-dark: #070810;
    --bg-card: rgba(15, 18, 33, 0.85);
    --border-gothic: rgba(217, 119, 6, 0.4);
    --gold-primary: #f59e0b;
    --gold-light: #fbbf24;
    --ruby-red: #ef4444;
    --sapphire-blue: #3b82f6;
    --emerald-green: #10b981;
    --amethyst-purple: #a855f7;
    --text-light: #f3f4f6;
    --text-muted: #9ca3af;
    --font-heading: 'Cinzel', 'Noto Serif SC', serif;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-gothic: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(245, 158, 11, 0.15);
}

* {
    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-light);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
}

/* Cathedral Background Ambient Effects */
.cathedral-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 30%, #151930 0%, #080a14 70%, #030408 100%);
    z-index: -3;
}

.god-rays-overlay {
    position: fixed;
    top: -20%;
    left: 10%;
    width: 80vw;
    height: 140vh;
    background: repeating-linear-gradient(
        75deg,
        rgba(245, 158, 11, 0.03) 0px,
        rgba(245, 158, 11, 0.03) 40px,
        transparent 40px,
        transparent 120px
    );
    pointer-events: none;
    z-index: -2;
    animation: godRaysShift 20s ease-in-out infinite alternate;
}

@keyframes godRaysShift {
    0% { transform: rotate(-3deg) scale(1); opacity: 0.6; }
    100% { transform: rotate(3deg) scale(1.05); opacity: 1; }
}

/* Floating Stained Glass Orbs */
.stained-glass-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: -1;
    opacity: 0.35;
    animation: floatOrb 14s ease-in-out infinite alternate;
}

.orb-red {
    top: 10%;
    left: 15%;
    width: 260px;
    height: 260px;
    background: var(--ruby-red);
}

.orb-blue {
    bottom: 15%;
    right: 15%;
    width: 300px;
    height: 300px;
    background: var(--sapphire-blue);
    animation-delay: -5s;
}

.orb-gold {
    top: 40%;
    right: 25%;
    width: 220px;
    height: 220px;
    background: var(--gold-primary);
    animation-delay: -9s;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 40px) scale(1.15); }
}

/* Main Container Layout */
.app-container {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 auto;
}

/* Header Component */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-gothic);
    border-radius: var(--radius-lg);
    padding: 12px 18px;
    box-shadow: var(--shadow-gothic);
    backdrop-filter: blur(12px);
}

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

.back-home-btn:hover {
    background: rgba(245, 158, 11, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

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

.main-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.sub-highlight {
    color: var(--gold-primary);
    font-size: 0.85rem;
    display: block;
    font-weight: 700;
    letter-spacing: 2px;
}

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

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

.icon-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--gold-primary);
    transform: scale(1.05);
}

/* Dashboard / Stats Cards */
.dashboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gothic);
    border-radius: var(--radius-md);
    padding: 10px 8px;
    text-align: center;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--gold-light);
    margin-top: 2px;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

/* Energy Bar */
.energy-card {
    grid-column: span 1;
}

.energy-bar-track {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    margin-top: 6px;
    overflow: hidden;
    position: relative;
}

.energy-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #3b82f6, #10b981);
    background-size: 200% 100%;
    animation: gradientFlow 3s linear infinite;
    border-radius: 5px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* Canvas Area & Gothic Frame */
.canvas-outer-frame {
    position: relative;
    background: var(--bg-card);
    border: 2px solid var(--gold-primary);
    border-radius: var(--radius-lg);
    padding: 10px;
    box-shadow: var(--shadow-gothic);
    backdrop-filter: blur(14px);
}

.gothic-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--gold-light);
    border-style: solid;
    pointer-events: none;
    z-index: 2;
}

.top-left { top: 4px; left: 4px; border-width: 3px 0 0 3px; }
.top-right { top: 4px; right: 4px; border-width: 3px 3px 0 0; }
.bottom-left { bottom: 4px; left: 4px; border-width: 0 0 3px 3px; }
.bottom-right { bottom: 4px; right: 4px; border-width: 0 3px 3px 0; }

.canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #080912;
}

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

/* Overlay Screens */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 8, 16, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10;
    transition: opacity 0.3s ease;
}

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

.gothic-card {
    background: linear-gradient(135deg, rgba(20, 24, 45, 0.95), rgba(10, 12, 24, 0.95));
    border: 2px solid var(--border-gothic);
    border-radius: var(--radius-lg);
    padding: 6px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
}

.card-inner-border {
    border: 1px dashed rgba(245, 158, 11, 0.4);
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
}

.card-heading {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--gold-light);
    letter-spacing: 1px;
}

.card-heading.text-danger {
    color: #f87171;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

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

.card-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 10px;
}

.card-tip {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    background: rgba(245, 158, 11, 0.08);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

kbd {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    color: var(--gold-light);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.gothic-btn {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
    border: 1px solid var(--gold-light);
    padding: 12px 24px;
    border-radius: 30px;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.4);
}

.gothic-btn:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

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

@keyframes btnPulse {
    0% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
    100% { box-shadow: 0 0 25px rgba(245, 158, 11, 0.8); }
}

/* Game Over Stats */
.final-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.final-stat-row strong {
    color: var(--gold-light);
    font-size: 1rem;
}

/* Active Skill Button */
.skill-bar {
    width: 100%;
}

.skill-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.1));
    border: 1px solid var(--gold-primary);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.skill-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

.skill-btn:not(:disabled):hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.4), rgba(217, 119, 6, 0.3));
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
    transform: translateY(-2px);
}

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

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

.skill-name {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--gold-light);
}

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

/* Radiance Active Overlay Badge */
.radiance-overlay {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.radiance-overlay.hidden {
    opacity: 0;
}

.radiance-badge {
    background: rgba(245, 158, 11, 0.9);
    color: #000;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 0.85rem;
    padding: 6px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.8);
    animation: badgePulse 1s ease-in-out infinite alternate;
}

@keyframes badgePulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    justify-content: center;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
}

.dpad {
    position: relative;
    width: 170px;
    height: 170px;
}

.dpad-btn {
    position: absolute;
    width: 52px;
    height: 52px;
    background: rgba(20, 24, 45, 0.85);
    border: 1px solid var(--border-gothic);
    border-radius: 12px;
    color: var(--gold-light);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: all 0.15s ease;
}

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

.dpad-up { top: 0; left: 59px; }
.dpad-down { bottom: 0; left: 59px; }
.dpad-left { top: 59px; left: 0; }
.dpad-right { top: 59px; right: 0; }
.dpad-center { top: 59px; left: 59px; background: rgba(245, 158, 11, 0.2); border-color: var(--gold-primary); }

/* Help Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
    transition: opacity 0.3s ease;
}

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

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

.modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--gold-light);
}

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

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

.help-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.help-item.highlight-box {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

.help-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.help-info strong {
    font-size: 0.9rem;
    color: var(--gold-light);
    display: block;
    margin-bottom: 2px;
}

.help-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.modal-confirm-btn {
    width: 100%;
}
