@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;700;900&family=Cinzel+Decorative:wght@400;700;900&display=swap');

@font-face {
    font-family: 'Spira';
    src: url('https://dl.dropboxusercontent.com/scl/fi/bta6goew001eivm77hnf2/FFXSpiran.ttf?rlkey=moy3tarfyc7eir128q3gikzod&raw=1') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'AlBhed';
    src: url('https://dl.dropboxusercontent.com/scl/fi/g6f0mtdiel386f0jsuvup/FFXAlBhed.ttf?rlkey=1cx6d1stzm39qzt4m0voapl2g&raw=1') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Yevon';
    src: url('https://dl.dropboxusercontent.com/scl/fi/63tiyv4v13q7jven3gx2e/FFXYevon.ttf?rlkey=6zipk52uezuh1cj3hnylvp8uj&raw=1') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    /* --- THE SPIRAN PALETTE --- */
    --ffx-blue-deep: #010205;       /* Void */
    --ffx-blue-dark: #081226;       /* Midnight Depth */
    --ffx-blue-mid: #16325B;        /* Zanarkand Sea */
    --ffx-blue-light: #3b75ba;      /* Sphere Water */
    
    --ffx-cyan: #00f2ff;            /* Spirit Energy */
    --ffx-cyan-glow: #a2f9ff;       /* Pyrefly Core */
    --ffx-cyan-dim: #005f73;        /* Deep Magic */

    --ffx-gold: #c5a059;            /* Yevon Script */
    --ffx-gold-light: #fceeb5;      /* Holy Aura */
    --ffx-gold-dark: #7a5c22;       /* Aged Relic */
    
    --ffx-glass-bg: rgba(6, 12, 24, 0.85);
    --ffx-glass-border: rgba(0, 242, 255, 0.25);
    
    /* Typography */
    --font-title: 'Cinzel', 'Garamond', serif;
    --font-data: 'Impact', 'Arial Narrow', sans-serif;
    --font-ui: 'Courier New', monospace;
    --font-spira: 'Spira', 'Cinzel Decorative', sans-serif;
    --font-albhed: 'AlBhed', 'Impact', sans-serif;
    --font-yevon: 'Yevon', 'Cinzel', serif;
}
html, body {
    margin: 0;
    padding: 0;
    background-color: #000;
    overflow: hidden;
    width: 100vw;
    height: 100%;
    position: fixed; 
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-family: var(--font-data);
    color: white;
    user-select: none;
    -webkit-user-select: none;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
    touch-action: none;
}

* {
    box-sizing: border-box;
}
/* --- SPIRAN UTILITIES --- */

/* Global Keyframes */
@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 5px var(--ffx-cyan-dim); }
    50% { box-shadow: 0 0 20px var(--ffx-cyan), 0 0 10px var(--ffx-blue-light); }
    100% { box-shadow: 0 0 5px var(--ffx-cyan-dim); }
}

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

@keyframes holographic-flicker {
    0% { opacity: 0.95; }
    5% { opacity: 0.8; }
    10% { opacity: 0.95; }
    100% { opacity: 0.95; }
}

/* Glass Panel Utility - The Foundation of the UI */
.glass-panel {
    background: linear-gradient(160deg, rgba(6, 12, 24, 0.9) 0%, rgba(10, 25, 50, 0.8) 100%);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-top: 1px solid rgba(0, 242, 255, 0.3);
    border-bottom: 1px solid rgba(0, 242, 255, 0.05);
    
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.6),
        inset 0 0 30px rgba(0, 242, 255, 0.05);
        
    position: relative;
    overflow: hidden;
    
    /* Asymmetric Cut - FFX Style */
    clip-path: polygon(
        0 0, 
        100% 0, 
        100% 85%, 
        95% 100%, 
        0 100%
    );
}

/* Shimmer Effect for Glass Panels */
.glass-panel::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(
        105deg, 
        transparent 20%, 
        rgba(255, 255, 255, 0.05) 40%, 
        rgba(0, 242, 255, 0.1) 45%, 
        rgba(255, 255, 255, 0.05) 50%, 
        transparent 70%
    );
    background-size: 200% 100%;
    animation: shimmer 8s infinite linear;
    pointer-events: none;
    mix-blend-mode: overlay;
}

/* Decorative Corner Accent */
.glass-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--ffx-cyan), transparent);
    opacity: 0.7;
    box-shadow: 0 0 10px var(--ffx-cyan);
}
/* --- MAIN GAME CONTAINER --- */
#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    background: #000510;
    box-shadow: none;
    overflow: hidden;
    transition: filter 0.05s;
    z-index: 1;
    contain: strict;
}

/* --- IMPACT FX --- */
/* --- IMPACT FX (JUICED) --- */
#game-container.impact-fx {
    animation: impactShake 0.15s cubic-bezier(.36,.07,.19,.97) both;
    filter: contrast(1.3) brightness(1.2) saturate(1.2);
    will-change: transform, filter;
}

#game-container.impact-heavy {
    animation: impactHeavy 0.25s cubic-bezier(.36,.07,.19,.97) both;
    filter: contrast(1.5) brightness(1.3) saturate(1.5) sepia(0.2);
    will-change: transform, filter;
}

#game-container.impact-shatter {
    animation: impactShatter 0.5s cubic-bezier(.36,.07,.19,.97) both;
    filter: contrast(2.0) brightness(1.5) saturate(2.0) invert(0.05);
    will-change: transform, filter;
}

@keyframes impactShake {
    0% { transform: translate3d(0, 0, 0); }
    25% { transform: translate3d(-3px, 2px, 0) scale(1.01); }
    50% { transform: translate3d(3px, -2px, 0) scale(1.01); }
    75% { transform: translate3d(-3px, -2px, 0) scale(1.01); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes impactHeavy {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    10% { transform: translate3d(-6px, 4px, 0) scale(1.02); }
    30% { transform: translate3d(6px, -4px, 0) scale(1.02); }
    50% { transform: translate3d(-4px, -2px, 0) scale(1.04); filter: contrast(1.8) brightness(1.5); }
    70% { transform: translate3d(4px, 2px, 0) scale(1.02); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes impactShatter {
    0% { transform: translate3d(0, 0, 0) scale(1); filter: hue-rotate(0deg); }
    10% { transform: translate3d(-10px, 5px, 0) scale(1.05) skewX(2deg); filter: hue-rotate(45deg) contrast(2.5); }
    20% { transform: translate3d(10px, -5px, 0) scale(1.05) skewX(-2deg); filter: hue-rotate(-45deg); }
    40% { transform: translate3d(0, 0, 0) scale(1.1); filter: invert(0.2); }
    60% { transform: translate3d(-5px, 0, 0) scale(1.05); }
    100% { transform: translate3d(0, 0, 0) scale(1); filter: hue-rotate(0deg); }
}

/* --- CANVAS & RENDER --- */
canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated; 
    z-index: 0;
}

/* --- GIF OVERLAY --- */
#screen-overlay-gif {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    mix-blend-mode: overlay;
    opacity: 1.0;
    pointer-events: none;
    z-index: 950;
    image-rendering: pixelated;
}

#ui-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1000;
    contain: strict;
}

/* --- CINEMATIC BARS --- */
#cinematic-bars .bar {
    position: absolute;
    left: 0; width: 100%; height: 0;
    background: black;
    transition: height 0.5s ease;
    z-index: 800;
}
#cinematic-bars .bar.top { top: 0; }
#cinematic-bars .bar.bottom { bottom: 0; }

/* --- TECH FLASH OVERLAY --- */
/* --- TECH FLASH OVERLAY (LIMIT BREAK STYLE) --- */
#tech-flash-overlay {
    position: absolute;
    top: 25%; left: 0; width: 100%; height: 150px;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Limit Break Gradient */
    background: linear-gradient(90deg, 
        rgba(0,0,0,0) 0%, 
        rgba(50, 0, 0, 0.8) 20%, 
        rgba(100, 20, 0, 0.9) 50%, 
        rgba(50, 0, 0, 0.8) 80%, 
        rgba(0,0,0,0) 100%
    );
    z-index: 2200;
    backdrop-filter: blur(4px);
    border-top: 2px solid rgba(255, 100, 0, 0.5);
    border-bottom: 2px solid rgba(255, 100, 0, 0.5);
    transform: skewX(-15deg);
    box-shadow: 0 0 50px rgba(255, 50, 0, 0.3);
    animation: limitBreakEnter 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes limitBreakEnter {
    0% { transform: skewX(-15deg) scaleY(0); opacity: 0; }
    100% { transform: skewX(-15deg) scaleY(1); opacity: 1; }
}

/* Shatter Lines (Pseudo-elements) */
#tech-flash-overlay::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(
        45deg,
        transparent 0,
        transparent 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
    pointer-events: none;
    mix-blend-mode: overlay;
}

.tech-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: skewX(15deg); /* Counter-skew text */
    position: relative;
    z-index: 2;
}

.tech-text {
    font-family: var(--font-title); /* Cinzel */
    font-weight: 900;
    font-size: clamp(40px, 12vw, 64px);
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 5px;
    line-height: 1.0;
    
    /* Limit Break Gold/White Gradient */
    background: linear-gradient(to bottom, #ffffff 0%, #ffffaa 40%, #ffaa00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    
    filter: drop-shadow(0 0 10px rgba(255, 100, 0, 0.8)) drop-shadow(0 0 20px rgba(255, 0, 0, 0.4));
    
    animation: limitTextPulse 0.1s infinite alternate;
    text-align: center;
    margin-bottom: 5px;
}

@keyframes limitTextPulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(255, 100, 0, 0.8)); }
    100% { transform: scale(1.05); filter: drop-shadow(0 0 20px rgba(255, 200, 0, 1.0)); }
}

.tech-sub-text {
    font-family: var(--font-data);
    font-size: 16px;
    color: #00ffff;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #00ffff;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 10px;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.tech-timer-track {
    width: 300px;
    height: 12px;
    background: rgba(20, 0, 0, 0.8);
    border: 1px solid #ff4400;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(255, 68, 0, 0.4);
    position: relative;
}

.tech-timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffaa00, #ffff00, #ffffff);
    width: 100%;
    transform-origin: left;
    box-shadow: 0 0 20px #ffaa00;
    position: relative;
}

/* Shimmer on bar */
.tech-timer-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: shimmer 0.5s infinite linear;
}

/* --- HUD TOP (HERCULEAN SCOREBOARD) --- */
/* --- HUD TOP (HERCULEAN SCOREBOARD) --- */
#hud-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 160px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 50px;
    pointer-events: none;
    z-index: 1100;
    font-family: var(--font-data);
    perspective: 1000px;
}

/* --- WINGS (Team Panels) --- */
.sb-wing {
    position: relative;
    width: 420px;
    height: 100px;
    display: flex;
    align-items: center;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}

.sb-wing.home {
    justify-content: flex-start;
    transform-origin: left top;
}

.sb-wing.away {
    justify-content: flex-end;
    transform-origin: right top;
}

/* Background Shape - Glass Shard */
.sb-wing-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
    z-index: 0;
    overflow: hidden;
}

/* Inner Shine for Glass */
.sb-wing-bg::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 200%; height: 100%;
    background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,0.05) 40%, rgba(255,255,255,0.1) 45%, transparent 50%);
    animation: shimmer 8s infinite linear;
}

.sb-wing.home .sb-wing-bg {
    transform: skewX(-30deg);
    border-left: 8px solid var(--ffx-cyan);
    border-top: 2px solid rgba(0, 242, 255, 0.4);
    border-bottom: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 0 0 30px 0;
    background: linear-gradient(120deg, rgba(0, 30, 60, 0.95) 0%, rgba(0, 10, 20, 0.9) 60%, rgba(0, 0, 0, 0.7) 100%);
}

.sb-wing.away .sb-wing-bg {
    transform: skewX(30deg);
    border-right: 8px solid #ff4444; /* Enemy Red */
    border-top: 2px solid rgba(255, 68, 68, 0.4);
    border-bottom: 1px solid rgba(255, 68, 68, 0.1);
    border-radius: 0 0 0 30px;
    background: linear-gradient(240deg, rgba(60, 10, 10, 0.95) 0%, rgba(20, 5, 5, 0.9) 60%, rgba(0, 0, 0, 0.7) 100%);
}

/* Content Container (Counter-skew) */
/* Content Container (Counter-skew) */
.sb-content-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    /* Padding handles logo space */
}

.sb-wing.home .sb-content-container {
    transform: skewX(30deg); /* Counter skew */
    justify-content: flex-start;
    padding-left: 120px; /* Space for absolute logo */
    padding-right: 20px;
}

.sb-wing.away .sb-content-container {
    transform: skewX(-30deg); /* Counter skew */
    justify-content: flex-end;
    padding-right: 120px; /* Space for absolute logo */
    padding-left: 20px;
}

/* Team Info */
.sb-team-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    z-index: 2;
}

.sb-wing.home .sb-team-info {
    align-items: flex-start;
    text-align: left;
}

.sb-wing.away .sb-team-info {
    align-items: flex-end;
    text-align: right;
}

.sb-team-name {
    font-family: var(--font-title);
    font-size: 36px;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    line-height: 0.85;
    text-shadow: 0 2px 0 #000, 0 0 20px rgba(255,255,255,0.3);
    letter-spacing: 2px;
}

.sb-team-sub {
    font-family: var(--font-yevon);
    font-size: 14px; /* Increased for visibility */
    color: var(--ffx-gold);
    letter-spacing: 4px;
    margin-top: 8px;
    text-transform: uppercase;
    opacity: 0.9;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.sb-team-logo {
    position: absolute;
    top: 50%;
width: 320px;
    height: 320px;
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.4));
    z-index: 1;
    transition: transform 0.3s;
}

.sb-wing.home .sb-team-logo {
    left: -20px;
    transform: translateY(-50%) scale(1.1);
}

.sb-wing.away .sb-team-logo {
    right: -20px;
    transform: translateY(-50%) scale(1.1);
}

.sb-wing:hover .sb-team-logo {
    transform: translateY(-50%) scale(1.2);
}

/* Score Wrapper */
.sb-score-wrapper {
    position: relative;
    width: 100px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.sb-score {
    font-size: 80px;
    font-weight: 900;
    color: #fff;
    line-height: 1.0;
    z-index: 2;
    font-style: italic;
    /* Metallic Gradient Text */
    background: linear-gradient(180deg, #ffffff 0%, #eeeeee 40%, #aaaaaa 50%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 5px 0 rgba(0,0,0,0.8));
    transform: skewX(-10deg);
    margin-top: -5px;
}

.sb-wing.home .sb-score {
    filter: drop-shadow(0 5px 0 rgba(0,0,0,0.8)) drop-shadow(0 0 20px var(--ffx-cyan));
}

.sb-wing.away .sb-score {
    filter: drop-shadow(0 5px 0 rgba(0,0,0,0.8)) drop-shadow(0 0 20px #ff4444);
}
/* Crystal Deco */
.sb-crystal-deco {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    z-index: 3;
    opacity: 0.5;
opacity: 0.5;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

/* --- POSSESSION INDICATOR --- */
/* --- POSSESSION INDICATOR --- */
.possession-marker {
    position: absolute;
    bottom: -22px; /* Moved slightly lower to clear new border glow */
    font-family: var(--font-spira);
    font-size: 10px;
    color: #ffd700; /* Default Gold */
    letter-spacing: 2px;
    text-shadow: 0 0 8px #ffaa00;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.8);
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    white-space: nowrap;
}

.sb-wing.home .possession-marker { left: 20px; }
.sb-wing.away .possession-marker { right: 20px; }

.sb-energy-conduit {
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 3px;
    background: transparent;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Generic Active State */
.sb-wing.has-possession .possession-marker {
    opacity: 1;
    transform: translateY(0);
    animation: pulse-text 1.5s infinite alternate;
}

/* HOME POSSESSION (GREEN) */
.sb-wing.home.has-possession .sb-wing-bg {
    box-shadow: inset 0 0 40px rgba(0, 255, 0, 0.3);
    border-color: #00ff00;
    border-top-width: 2px;
    background: linear-gradient(120deg, rgba(0, 60, 20, 0.95) 0%, rgba(0, 30, 10, 0.9) 60%, rgba(0, 0, 0, 0.8) 100%);
}
.sb-wing.home.has-possession .possession-marker {
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
    border-color: #00ff00;
}
.sb-wing.home.has-possession .sb-energy-conduit {
    background: linear-gradient(90deg, transparent, #00ff00, transparent);
    box-shadow: 0 0 20px #00ff00;
    opacity: 1;
}

/* AWAY POSSESSION (RED) */
.sb-wing.away.has-possession .sb-wing-bg {
    box-shadow: inset 0 0 40px rgba(255, 0, 0, 0.3);
    border-color: #ff0000;
    border-top-width: 2px;
    background: linear-gradient(240deg, rgba(80, 0, 0, 0.95) 0%, rgba(40, 0, 0, 0.9) 60%, rgba(0, 0, 0, 0.8) 100%);
}
.sb-wing.away.has-possession .possession-marker {
    color: #ff0000;
    text-shadow: 0 0 10px #ff0000;
    border-color: #ff0000;
}
.sb-wing.away.has-possession .sb-energy-conduit {
    background: linear-gradient(90deg, transparent, #ff0000, transparent);
    box-shadow: 0 0 20px #ff0000;
    opacity: 1;
}

@keyframes pulse-text {
    from { text-shadow: 0 0 5px #ffaa00; border-color: rgba(255, 215, 0, 0.3); }
    to { text-shadow: 0 0 15px #ffff00; border-color: rgba(255, 215, 0, 0.8); }
}

/* Mobile Adjustments for Possession */
@media screen and (max-width: 768px) {
    .possession-marker {
        bottom: -12px;
        font-size: 8px;
        padding: 1px 4px;
    }
    .sb-wing.home .possession-marker { left: 5px; }
    .sb-wing.away .possession-marker { right: 5px; }
}
/* --- CHRONOSPHERE (Center Timer) --- */
.sb-chronosphere {
    position: relative;
    width: 180px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-top: -15px;
    perspective: 500px;
}

.chrono-core {
    position: relative;
    width: 150px;
    height: 70px;
    background: radial-gradient(circle at center, rgba(10, 30, 50, 0.95) 0%, rgba(0, 0, 0, 0.9) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-top: 4px solid var(--ffx-gold);
    border-radius: 0 0 75px 75px; /* Semicircle down */
    box-shadow: 
        0 15px 50px rgba(0, 0, 0, 0.9), 
        inset 0 10px 30px rgba(0,0,0,0.8),
        0 0 20px rgba(255, 215, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(15px);
}

/* Decorative wings for timer */
.sb-chronosphere::before {
    content: '';
    position: absolute;
    top: 0; left: -30px; width: 240px; height: 2px;
    background: linear-gradient(90deg, transparent, var(--ffx-gold), transparent);
    z-index: 5;
    box-shadow: 0 0 10px var(--ffx-gold);
}

#half-indicator {
font-family: var(--font-yevon);
    font-size: 14px;
    color: var(--ffx-gold);
    letter-spacing: 6px;
    margin-bottom: 4px;
    text-shadow: 0 0 10px var(--ffx-gold);
    text-transform: uppercase;
}

#timer-display {
    font-family: var(--font-data);
    font-size: 48px;
    color: #fff;
    letter-spacing: 4px;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
    font-weight: 700;
}

/* Rings */
.chrono-ring {
    position: absolute;
    top: -20px;
    border-radius: 50%;
    border: 1px solid rgba(255, 215, 0, 0.15);
    pointer-events: none;
    z-index: 1;
    transform-style: preserve-3d;
}

.chrono-ring.outer {
    width: 180px; height: 180px;
    border-top: 2px solid var(--ffx-gold);
    border-bottom: 2px solid rgba(255, 215, 0, 0.1);
    animation: spinSlow 40s linear infinite;
    opacity: 0.5;
}

.chrono-ring.mid {
    width: 160px; height: 160px;
    border-left: 2px solid var(--ffx-cyan);
    border-right: 2px solid var(--ffx-cyan);
    animation: spinSlow 25s linear infinite reverse;
    opacity: 0.4;
}

.chrono-ring.inner {
    width: 130px; height: 130px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    animation: spinSlow 15s linear infinite;
    opacity: 0.3;
}

/* Mobile Adjustments */
@media screen and (max-width: 768px) {
    #hud-top {
        height: 100px;
        padding: 5px 10px;
    }
    .sb-wing { width: 140px; height: 60px; }
    .sb-wing.home .sb-wing-bg { transform: skewX(-20deg); border-left-width: 4px; }
    .sb-wing.away .sb-wing-bg { transform: skewX(20deg); border-right-width: 4px; }
    
    /* Reset padding for mobile */
    .sb-wing.home .sb-content-container { transform: skewX(20deg); padding-left: 40px; padding-right: 5px; }
    .sb-wing.away .sb-content-container { transform: skewX(-20deg); padding-right: 40px; padding-left: 5px; }
    
    .sb-team-name { font-size: 16px; }
    .sb-team-sub { display: none; }
    .sb-score { font-size: 42px; }
    .sb-score-wrapper { width: 40px; }
    
    /* Mobile Logo: Smaller, absolute but tighter */
.sb-team-logo { 
        width: 120px; 
        height: 120px; 
    }
    .sb-wing.home .sb-team-logo { left: -10px; }
    .sb-wing.away .sb-team-logo { right: -10px; }
    .sb-chronosphere { width: 100px; margin-top: -5px; }
    .chrono-core { width: 90px; height: 45px; border-radius: 0 0 45px 45px; }
    #timer-display { font-size: 24px; }
    #half-indicator { font-size: 10px; letter-spacing: 2px; }
    
    .chrono-ring { display: none; } /* Hide rings on mobile for clarity */
}
/* --- PLAYER STATUS PANEL (LIQUID LIGHT) --- */
/* --- PLAYER STATUS PANEL (HERCULEAN DIVINITY) --- */
#player-status-panel {
    position: absolute;
    bottom: max(160px, env(safe-area-inset-bottom) + 40px);
    left: max(20px, env(safe-area-inset-left));
    width: 280px; /* Wider for immense stats */
    padding: 20px;
    
    /* Fade to Transparent (Goal Distance Style) */
    background: linear-gradient(90deg, rgba(0, 5, 15, 0.9) 0%, transparent 100%);
    
    /* Left Accent Only */
    border: none;
    border-left: 6px solid var(--ffx-gold);
    
    border-radius: 0;
    
    /* No box shadow on right side */
    box-shadow: none;
        
    transform: skewX(-10deg);
    pointer-events: none;
    display: none; /* Managed by JS */
    overflow: visible;
    z-index: 1200;
}

/* Ornate Corner Decoration */
#player-status-panel::after {
    content: '';
    position: absolute;
    top: -1px; right: -1px;
    width: 30px; height: 30px;
    border-top: 3px solid var(--ffx-cyan);
    border-right: 3px solid var(--ffx-cyan);
    box-shadow: 2px -2px 15px var(--ffx-cyan);
    z-index: 2;
}

/* Gold Accent Line */
#player-status-panel::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, var(--ffx-gold), transparent);
    opacity: 0.7;
}

.char-name {
    font-family: var(--font-title);
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    margin-bottom: 15px;
    transform: skewX(10deg); /* Counter skew */
    /* Fixed: Use filter for drop shadow on clipped text to prevent shadow rendering on top */
    filter: drop-shadow(0 2px 0 #000) drop-shadow(0 0 10px rgba(0, 255, 255, 0.6));
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
    letter-spacing: 2px;
    background: linear-gradient(180deg, #fff 0%, #aaddff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hp-gauge-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    transform: skewX(10deg);
    position: relative;
}

.hp-label { 
    font-family: var(--font-spira);
    font-size: 14px; 
    color: var(--ffx-cyan); 
    width: 35px; 
    text-shadow: 0 0 8px var(--ffx-cyan);
    letter-spacing: 1px;
    font-weight: bold;
}

.hp-bar-track {
    flex-grow: 1;
    height: 14px; /* Thicker */
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #334455;
    margin: 0 12px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0,0,0,1);
    position: relative;
}

/* Grid overlay on bar */
.hp-bar-track::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(90deg, rgba(0,0,0,0.8) 1px, transparent 1px);
    background-size: 10% 100%;
    pointer-events: none;
    z-index: 2;
}

.hp-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #008833, #44ff88, #88ffaa, #00ff66);
    background-size: 200% 100%;
    animation: liquidFlow 1.5s linear infinite; /* Faster flow */
    box-shadow: 0 0 20px #00ff44;
    transition: width 0.2s cubic-bezier(0.2, 0.8, 0.2, 1.0);
    position: relative;
    z-index: 1;
}

.hp-value { 
    font-family: var(--font-data);
    font-size: 18px; 
    color: #fff; 
    width: 80px; 
    text-align: right; 
    letter-spacing: 1px;
    text-shadow: 0 2px 0 #000;
    font-weight: bold;
}

.en-gauge-container {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    transform: skewX(10deg);
}

.en-label { 
    font-family: var(--font-spira);
    font-size: 12px; 
    color: #ffff00; 
    width: 35px; 
    text-shadow: 0 0 8px #ffff00;
    letter-spacing: 1px;
    font-weight: bold;
}

.en-bar-track {
    flex-grow: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #665500;
    margin: 0 12px;
    border-radius: 2px;
    overflow: hidden;
}

.en-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #aa8800, #ffff00, #ffaa00);
    width: 100%;
    box-shadow: 0 0 10px #ffff00;
    transition: width 0.1s linear;
}

.tech-gauge-container {
    display: flex;
    align-items: center;
    transform: skewX(10deg);
}

.tech-label { 
    font-family: var(--font-spira);
    font-size: 12px; 
    color: var(--ffx-cyan); 
    width: 35px; 
    text-shadow: 0 0 8px var(--ffx-cyan);
    letter-spacing: 1px;
}

.tech-bar-track {
    flex-grow: 1;
    height: 4px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #004466;
    margin: 0 12px;
    border-radius: 1px;
    overflow: hidden;
}

.tech-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #004488, #00aaff, #00ffff);
    width: 0%;
    box-shadow: 0 0 5px #00ffff;
}
@keyframes liquidFlow {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
100% { background-position: -100% 0; }
}

/* --- ADRENALINE PULSE HUD (Critical Health) --- */
@keyframes hud-critical-pulse {
    0% { 
        box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.2); 
        border-left-color: rgba(255, 0, 0, 0.5);
    }
    50% { 
        box-shadow: inset 0 0 50px rgba(255, 0, 0, 0.5); 
        border-left-color: rgba(255, 0, 0, 1.0);
    }
    100% { 
        box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.2); 
        border-left-color: rgba(255, 0, 0, 0.5);
    }
}

#player-status-panel.critical-health {
    animation: hud-critical-pulse 0.5s infinite alternate;
    background: linear-gradient(90deg, rgba(50, 0, 0, 0.8) 0%, transparent 100%);
}

#player-status-panel.critical-health .hp-bar-fill {
    background: linear-gradient(90deg, #ff0000, #ff4444, #ff0000) !important;
    background-size: 200% 100%;
    box-shadow: 0 0 15px #ff0000 !important;
    animation: liquidFlow 0.2s linear infinite !important; /* Hyper fast flow */
}

#player-status-panel.critical-health .hp-value {
    color: #ff4444;
    text-shadow: 0 0 10px #ff0000;
    animation: blink 0.2s infinite;
}
/* --- MINIMAP --- */
#minimap-container {
    position: absolute;
    top: max(80px, env(safe-area-inset-top) + 60px);
    right: max(20px, env(safe-area-inset-right));
    width: 110px;
    height: 110px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.radar-rim {
    position: absolute;
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 2px solid var(--ffx-blue-light);
    box-shadow: 0 0 15px var(--ffx-blue-mid), inset 0 0 20px rgba(0,0,0,0.8);
    background: radial-gradient(circle, rgba(0, 20, 60, 0.4) 0%, rgba(0, 5, 10, 0.8) 100%);
    z-index: 5;
}

#minimap {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    z-index: 6;
    overflow: hidden;
}

.radar-label {
    position: absolute;
    bottom: -15px;
    width: 140%;
    left: -20%;
    text-align: center;
    font-family: var(--font-spira);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 5px var(--ffx-cyan);
}

.map-dot {
    position: absolute;
    width: 6px; height: 6px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px currentColor;
}
.map-dot.home { background: var(--ffx-cyan); color: var(--ffx-cyan); }
.map-dot.away { background: #00ffaa; color: #00ffaa; }
.map-dot.ball { 
    background: #ff00cc;
    color: #ff00cc; 
    width: 12px; height: 12px;
    border: 2px solid #ffffff;
    z-index: 20;
    animation: blinkBall 0.3s infinite alternate;
    box-shadow: 0 0 6px #ff00cc;
}
.map-dot.nap { background: #333; color: #000; border: 1px solid #555; }
.map-dot.active-player { 
    background: #00ff00 !important; 
    color: #00ff00 !important; 
    box-shadow: 0 0 8px #00ff00;
    z-index: 15;
    transform: translate(-50%, -50%) scale(1.2);
}
.map-dot.ball-carrier {
    box-shadow: 0 0 15px #fff, 0 0 30px #ffaa00;
    border: 2px solid #ffffff;
    background-color: #ffaa00 !important;
    z-index: 100;
    width: 10px; height: 10px;
    animation: carrierPulse 0.8s infinite alternate;
}
@keyframes carrierPulse {
    from { transform: translate(-50%, -50%) scale(1.2); box-shadow: 0 0 10px #fff; opacity: 0.8; }
    to { transform: translate(-50%, -50%) scale(1.8); box-shadow: 0 0 25px #ffcc00; opacity: 1.0; }
}
@keyframes blinkBall { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0.5; transform: translate(-50%, -50%) scale(1.3); } }

/* --- ANNOUNCEMENTS --- */
#announcement {
    position: absolute;
    top: 40%; 
    left: 5%; 
    width: 90%;
    text-align: center;
    font-family: var(--font-data);
    font-size: clamp(40px, 12vw, 72px);
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.0;
    white-space: normal;
    background: linear-gradient(to bottom, #fff 0%, #ffd700 40%, #b8860b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255, 100, 0, 0.5)) drop-shadow(3px 3px 0 #000);
    display: none;
    z-index: 2000;
    animation: announceSlide 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    will-change: transform, opacity;
}

@keyframes announceSlide {
    from { transform: scale(0) rotate(-5deg); opacity: 0; }
    to { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* --- JOYSTICK (ETHEREAL INTERFACE) --- */
#joystick-hit-zone {
    position: absolute;
    bottom: 0; left: 0;
    width: 50%; height: 50%;
    z-index: 1000;
    background: rgba(0,0,0,0); 
    touch-action: none;
    pointer-events: auto;
}

#joystick-visual-container {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    overflow: visible;
    pointer-events: none;
    display: none;
    z-index: 1100;
}

#joystick-base {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 140px; height: 140px;
    border-radius: 50%;
    /* Ethereal Ring */
    border: 1px dashed rgba(0, 242, 255, 0.3);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.1), inset 0 0 20px rgba(0, 242, 255, 0.05);
    background: radial-gradient(circle, rgba(0,0,0,0) 60%, rgba(0, 242, 255, 0.05) 100%);
    animation: etherealSpin 10s linear infinite;
}

#joystick-base::after {
    content: '';
    position: absolute;
    top: 10%; left: 10%; width: 80%; height: 80%;
    border-radius: 50%;
    border: 1px solid rgba(0, 242, 255, 0.1);
    animation: etherealSpin 5s linear infinite reverse;
}

@keyframes etherealSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

#joystick-knob {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; height: 40px;
    border-radius: 50%;
    /* Pyrefly Light */
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #a2f9ff 40%, #00f2ff 100%);
    box-shadow: 0 0 15px #00f2ff, 0 0 30px #00f2ff;
    transition: transform 0.05s linear;
    will-change: transform;
    opacity: 0.8;
}

#joystick-knob::after {
    content: "";
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
    opacity: 0.5;
    animation: pulse-glow 2s infinite;
}

.touch-ripple {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(0, 242, 255, 0.5);
    background: transparent;
    transform: translate(-50%, -50%) scale(0);
    animation: rippleAnim 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 9000;
    box-shadow: 0 0 10px var(--ffx-cyan);
    will-change: transform, opacity;
}

@keyframes rippleAnim {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; border-width: 5px; }
    100% { transform: translate(-50%, -50%) scale(2.0); opacity: 0; border-width: 0px; }
}

#camera-zone {
    position: absolute;
    top: 0; right: 0; width: 50%; height: 100%;
    pointer-events: auto;
    touch-action: none;
    z-index: 50;
}

/* --- ACTION BUTTON (SPHERE GRID NODE) --- */
#action-container {
position: absolute;
    bottom: max(40px, env(safe-area-inset-bottom)); 
    right: max(10px, env(safe-area-inset-right));
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
z-index: 1500;
}
.command-menu-bg {
    position: absolute;
    width: 220px; height: 100px;
    bottom: 20px;
    background: radial-gradient(ellipse at center, rgba(0, 20, 60, 0.8) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

.command-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 140px; height: 140px;
    border-radius: 50%;
    border: 1px dashed rgba(0, 242, 255, 0.3);
    border-top: 2px solid var(--ffx-cyan);
    border-bottom: 2px solid var(--ffx-cyan);
    animation: spinReverse 20s linear infinite;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.1);
}
.command-ring::before {
    content: '';
    position: absolute;
    top: -10px; left: -10px; right: -10px; bottom: -10px;
    border-radius: 50%;
    border: 1px dotted rgba(255, 255, 255, 0.2);
    animation: spinReverse 10s linear infinite reverse;
}

@keyframes spinReverse { from { transform: translate(-50%, -50%) rotate(360deg); } to { transform: translate(-50%, -50%) rotate(0deg); } }

#action-label {
    font-family: var(--font-spira);
    font-size: 14px;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 16px;
    border: 1px solid var(--ffx-cyan);
    border-radius: 12px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 3px;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
    text-shadow: 0 0 5px var(--ffx-cyan);
    transition: all 0.3s;
    z-index: 20;
}

/* --- ACTION BUTTON (HERCULEAN SPHERE GRID NODE) --- */
/* --- ACTION BUTTON (HERCULEAN SPHERE GRID NODE) --- */
#action-button {
    position: absolute;
    top: 0; left: 0;
    width: 140px; height: 140px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Deep Shadow & 3D Context */
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.9),
        0 0 0 2px rgba(0, 0, 0, 1.0);
    background: none;
    border: none;
    perspective: 1000px;
    transform-style: preserve-3d;
}

#action-button:active {
    transform: scale(0.95);
}

/* Keyframes for Living UI */
@keyframes ring-gyro-z {
    0% { transform: rotateZ(0deg); }
    100% { transform: rotateZ(360deg); }
}

@keyframes ring-wobble {
    0% { transform: rotateX(0deg) rotateY(0deg); }
    25% { transform: rotateX(10deg) rotateY(5deg); }
    50% { transform: rotateX(0deg) rotateY(10deg); }
    75% { transform: rotateX(-10deg) rotateY(5deg); }
    100% { transform: rotateX(0deg) rotateY(0deg); }
}

@keyframes rune-spin-glow {
    0% { transform: rotate(0deg) scale(1); filter: drop-shadow(0 0 2px var(--ffx-cyan)); opacity: 0.8; }
    50% { transform: rotate(180deg) scale(1.05); filter: drop-shadow(0 0 8px var(--ffx-cyan-glow)); opacity: 1.0; }
    100% { transform: rotate(360deg) scale(1); filter: drop-shadow(0 0 2px var(--ffx-cyan)); opacity: 0.8; }
}

@keyframes liquid-surge-complex {
    0% { transform: scale(0.98); background-position: 0% 50%; border-radius: 50%; box-shadow: 0 0 30px #00aaff, inset 0 0 20px rgba(255, 255, 255, 0.5); }
    50% { transform: scale(1.02); background-position: 100% 50%; border-radius: 49%; box-shadow: 0 0 50px #00ffff, inset 0 0 40px rgba(255, 255, 255, 0.8); }
    100% { transform: scale(0.98); background-position: 0% 50%; border-radius: 50%; box-shadow: 0 0 30px #00aaff, inset 0 0 20px rgba(255, 255, 255, 0.5); }
}

@keyframes crystal-breathe {
    0%, 100% { border-color: rgba(0, 200, 255, 0.3); box-shadow: inset 0 0 20px #000000; }
    50% { border-color: rgba(0, 255, 255, 0.6); box-shadow: inset 0 0 30px #001133, 0 0 15px rgba(0, 255, 255, 0.2); }
}

/* Layer 1: Outer Ornate Ring (Metal/Gold) - The Gyro */
.ab-outer-ring {
    position: absolute;
    top: -8px; left: -8px; right: -8px; bottom: -8px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #b8860b, #ffd700, #fffacd, #ffd700, #b8860b, #8b4500, #b8860b
    );
    box-shadow: 
        inset 0 0 10px rgba(0,0,0,0.8),
        0 0 25px rgba(255, 215, 0, 0.3);
    z-index: 1;
    border: 1px solid #553300;
    /* Complex rotation */
    animation: ring-gyro-z 20s linear infinite;
}

/* Pseudo-element for 3D depth/wobble effect on the ring */
.ab-outer-ring::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 215, 0, 0.5);
    animation: ring-wobble 8s ease-in-out infinite;
    pointer-events: none;
}

/* Layer 2: Rune Ring (Spinning) */
.ab-rune-ring {
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 50%;
    border: 2px dashed rgba(0, 255, 255, 0.6);
    /* box-shadow handled by animation */
    z-index: 2;
    animation: rune-spin-glow 15s linear infinite;
    pointer-events: none;
}

/* Layer 3: Inner Crystal Housing (Dark Glass) */
.ab-inner-crystal {
    position: absolute;
    top: 6px; left: 6px; right: 6px; bottom: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.1) 0%, rgba(0, 10, 30, 0.95) 60%, #000000 100%);
    border: 2px solid rgba(0, 200, 255, 0.3);
    z-index: 3;
    overflow: hidden;
    pointer-events: none;
    animation: crystal-breathe 4s ease-in-out infinite;
}

/* Layer 4: Liquid Core (Animated Surface) */
.ab-liquid-core {
    position: absolute;
    top: 12px; left: 12px; right: 12px; bottom: 12px;
    border-radius: 50%;
    /* Complex Gradient for liquid motion */
    background: radial-gradient(circle at 40% 40%, #00ffff 0%, #0088ff 40%, #002266 100%);
    background-size: 150% 150%;
    z-index: 4;
    animation: liquid-surge-complex 3s ease-in-out infinite;
    pointer-events: none;
}

/* Liquid movement effect (Internal reflection) */
.ab-liquid-core::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.5) 0%, transparent 25%);
    animation: liquidMove 5s infinite ease-in-out;
    mix-blend-mode: overlay;
}

/* Layer 5: Limit Break Ring (Hidden by default) */
.limit-ring {
    position: absolute;
    top: -22px; left: -22px; right: -22px; bottom: -22px;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: #ff4400;
    border-bottom-color: #ffaa00;
    border-left-color: transparent;
    border-right-color: transparent;
    box-shadow: 0 0 40px #ff4400;
    z-index: 0;
    opacity: 0;
    animation: limitSpin 1.5s linear infinite;
    transition: opacity 0.5s;
    pointer-events: none;
}

@keyframes limitSpin {
    0% { transform: rotate(0deg) scale(1); filter: hue-rotate(0deg); }
    50% { transform: rotate(180deg) scale(1.1); filter: hue-rotate(15deg); }
    100% { transform: rotate(360deg) scale(1); filter: hue-rotate(0deg); }
}

/* Layer 6: Text Label */
#action-button .btn-text {
    font-family: var(--font-title);
    font-size: 28px;
    font-weight: 900;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 
        0 2px 0 #000,
        0 0 15px rgba(0, 255, 255, 1.0),
        0 0 30px #0088ff;
    z-index: 6;
    pointer-events: none;
    position: relative;
    top: 1px;
    animation: textFloat 3s ease-in-out infinite;
}

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

/* Layer 7: Glare */
#action-button .btn-glare {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.6) 0%, transparent 45%, transparent 100%);
    z-index: 7;
    pointer-events: none;
    mix-blend-mode: soft-light;
}

/* STATE: SHOOT MODE (Orange/Red) */
#action-button.shoot-mode .ab-outer-ring {
    background: conic-gradient(
        from 0deg,
        #8b0000, #ff4400, #ffaa00, #ff4400, #8b0000, #440000, #8b0000
    );
    box-shadow: 0 0 50px rgba(255, 68, 0, 0.9);
    animation: ring-gyro-z 5s linear infinite; /* Faster spin */
}

#action-button.shoot-mode .ab-liquid-core {
    background: radial-gradient(circle at 40% 40%, #ffff00 0%, #ff4400 50%, #660000 100%);
    animation: corePulseRed 0.4s ease-in-out infinite alternate;
}

@keyframes corePulseRed {
    0% { transform: scale(0.95); box-shadow: 0 0 40px #ff4400; filter: brightness(1); }
    100% { transform: scale(1.08); box-shadow: 0 0 80px #ffaa00, 0 0 20px #fff; filter: brightness(1.3); }
}

#action-button.shoot-mode .btn-text {
    text-shadow: 0 2px 0 #000, 0 0 20px #ff4400;
}

/* STATE: LIMIT READY (Herculean Gold) */
#action-button.limit-ready .limit-ring {
    opacity: 1;
    border-width: 6px;
    border-top-color: #fff;
    border-bottom-color: #ffd700;
    box-shadow: 0 0 60px #ffaa00, inset 0 0 20px #ff4400;
    animation: limitSpin 0.8s linear infinite, limitPulse 0.3s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 10px #ffffff);
}

@keyframes limitPulse {
    from { opacity: 0.8; box-shadow: 0 0 40px #ff4400, inset 0 0 20px #ffaa00; }
    to { opacity: 1.0; box-shadow: 0 0 80px #ffaa00, inset 0 0 40px #ffff00; }
}

#action-button.limit-ready .ab-outer-ring {
    background: conic-gradient(
        from 0deg,
        #ffd700, #ffffff, #ffaa00, #ffffff, #ffd700, #b8860b, #ffd700
    );
    box-shadow: 0 0 80px rgba(255, 215, 0, 0.8);
    animation: ring-gyro-z 2s linear infinite;
    border: 2px solid #ffffff;
}

#action-button.limit-ready .ab-rune-ring {
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 40px #00ffff;
    animation: rune-spin-glow 3s linear infinite reverse;
}

#action-button.limit-ready .ab-liquid-core {
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #ffff00 20%, #ff8800 60%, #ff0000 100%);
    animation: liquid-surge-complex 0.5s ease-in-out infinite;
    filter: brightness(1.2);
}

#action-button.limit-ready .btn-text {
    color: #ffffff;
    text-shadow: 0 0 10px #ff0000, 0 0 20px #ffff00, 0 0 40px #ffffff;
    animation: textFloat 0.2s ease-in-out infinite alternate;
}

/* STATE: ACTIVE (Charging/Pressed) */
#action-button.active {
    transform: scale(0.95);
}

#action-button.active .ab-liquid-core {
    background: radial-gradient(circle at 50% 50%, #ffffff 40%, #ffffaa 70%, #ffaa00 100%);
    box-shadow: 0 0 80px #ffffff, inset 0 0 50px #ffffff;
    filter: brightness(2.0) contrast(1.2);
    animation: none; /* Solid intense light */
}

#action-button.active .ab-outer-ring {
    animation: ring-gyro-z 0.2s linear infinite; /* Hyper spin */
    filter: brightness(1.5);
    box-shadow: 0 0 100px #ffffff;
}

#action-button.active .limit-ring {
    border-color: #ffffff;
    box-shadow: 0 0 100px #ffffff;
    animation: limitSpin 0.1s linear infinite;
    opacity: 1;
}
/* --- KINETIC CHARGE FEEDBACK --- */
#action-button .ab-liquid-core {
    transition: background 0.2s ease-out, box-shadow 0.2s ease-out;
}

#action-button.charge-level-0 .ab-liquid-core {
    /* Level 1: Cyan (Start) */
    background: radial-gradient(circle at 40% 40%, #00ffff 0%, #0088ff 50%, #002266 100%);
    box-shadow: 0 0 30px #00aaff, inset 0 0 20px rgba(255, 255, 255, 0.5);
}
#action-button.charge-level-0 .ab-outer-ring {
    box-shadow: 0 0 25px rgba(0, 242, 255, 0.3);
}

#action-button.charge-level-1 .ab-liquid-core {
    /* Level 2: Gold (Mid) */
    background: radial-gradient(circle at 40% 40%, #ffffaa 0%, #ffd700 50%, #b8860b 100%);
    box-shadow: 0 0 50px #ffd700, inset 0 0 30px rgba(255, 255, 255, 0.7);
}
#action-button.charge-level-1 .ab-outer-ring {
    border-color: #ffd700;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
    animation: ring-gyro-z 2s linear infinite;
}

#action-button.charge-level-2 .ab-liquid-core {
    /* Level 3: Red (Max) */
    background: radial-gradient(circle at 40% 40%, #ffffff 0%, #ff4400 40%, #880000 100%);
    box-shadow: 0 0 80px #ff0000, inset 0 0 50px rgba(255, 255, 255, 0.9);
    animation: corePulseRed 0.15s ease-in-out infinite alternate;
}
#action-button.charge-level-2 .ab-outer-ring {
    border-color: #ff4444;
    box-shadow: 0 0 60px rgba(255, 68, 68, 0.9);
    animation: ring-gyro-z 0.5s linear infinite;
}
/* --- SATELLITE BUTTON (DASH/TACKLE) --- */
#sub-action-button {
    position: absolute;
    top: 40px; 
    left: -80px; /* To the left of main button */
    width: 90px; 
    height: 90px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    transition: transform 0.1s;
}

#sub-action-button:active {
    transform: scale(0.95);
}

#sub-action-button .ab-outer-ring {
    position: absolute;
    top: -4px; left: -4px; right: -4px; bottom: -4px;
    border-radius: 50%;
    border: 1px solid #550000;
    background: conic-gradient(from 0deg, #8b0000, #ff4400, #ff8800, #ff4400, #8b0000);
    animation: ring-gyro-z 8s linear infinite reverse;
    box-shadow: 0 0 15px rgba(255, 68, 0, 0.4);
}

#sub-action-button .ab-liquid-core {
    position: absolute;
    top: 6px; left: 6px; right: 6px; bottom: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #ffaa00 0%, #ff4400 60%, #550000 100%);
    box-shadow: inset 0 0 15px rgba(255, 200, 0, 0.5);
}

#sub-action-button .btn-text {
    font-family: var(--font-title);
    font-size: 16px;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    text-shadow: 0 2px 0 #000, 0 0 10px #ff4400;
    z-index: 6;
    pointer-events: none;
    letter-spacing: 1px;
}

#sub-action-button .btn-glare {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 50%);
    pointer-events: none;
    z-index: 7;
    mix-blend-mode: soft-light;
}

/* Mobile Landscape Adjustment */
@media screen and (max-height: 600px) and (orientation: landscape) {
    #sub-action-button {
        width: 70px; height: 70px;
        left: -60px; top: 30px;
    }
    #sub-action-button .btn-text { font-size: 12px; }
#sub-action-button .btn-text { font-size: 12px; }
}

/* --- LOB BUTTON (Satellite) --- */
#lob-action-button {
    position: absolute;
    top: -50px; 
    left: -60px; /* Above and slightly inward from Dash */
    width: 70px; 
    height: 70px;
    border-radius: 50%;
    cursor: pointer;
    display: none; /* Hidden by default, shown when holding ball */
    justify-content: center;
    align-items: center;
    z-index: 8;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.8);
    transition: transform 0.1s, opacity 0.2s;
}

#lob-action-button:active {
    transform: scale(0.95);
}

#lob-action-button .ab-outer-ring {
    position: absolute;
    top: -3px; left: -3px; right: -3px; bottom: -3px;
    border-radius: 50%;
    border: 1px solid #0055aa;
    background: conic-gradient(from 0deg, #004488, #0088ff, #00aaff, #0088ff, #004488);
    animation: ring-gyro-z 10s linear infinite;
    box-shadow: 0 0 10px rgba(0, 150, 255, 0.4);
}

#lob-action-button .ab-liquid-core {
    position: absolute;
    top: 4px; left: 4px; right: 4px; bottom: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #aaddff 0%, #0088ff 60%, #002244 100%);
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.5);
}

#lob-action-button .btn-text {
    font-family: var(--font-title);
    font-size: 12px;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    text-shadow: 0 2px 0 #000, 0 0 8px #00aaff;
    z-index: 6;
    pointer-events: none;
    letter-spacing: 1px;
}

#lob-action-button .btn-glare {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, transparent 50%);
    pointer-events: none;
    z-index: 7;
    mix-blend-mode: soft-light;
}

/* Mobile Landscape Adjustment for Lob */
@media screen and (max-height: 600px) and (orientation: landscape) {
    #lob-action-button {
        width: 60px; height: 60px;
        left: -50px; top: -40px;
    }
    #lob-action-button .btn-text { font-size: 10px; }
}

#auto-toggle {
    position: absolute;
    top: max(300px, env(safe-area-inset-top) + 120px); 
    right: max(20px, env(safe-area-inset-right));
    width: 110px;
    padding: 10px 0;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: var(--ffx-cyan);
    background: linear-gradient(135deg, rgba(0, 20, 40, 0.8) 0%, rgba(0, 5, 10, 0.9) 100%);
    border: 1px solid var(--ffx-blue-light);
    border-top: 1px solid var(--ffx-cyan);
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(4px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    pointer-events: auto;
    transition: all 0.2s;
    z-index: 100;
z-index: 1500;
}
#auto-toggle:hover {
    background: rgba(0, 40, 80, 0.9);
    box-shadow: 0 0 15px var(--ffx-cyan);
    color: white;
}
#auto-toggle.active {
    background: linear-gradient(135deg, rgba(100, 20, 0, 0.8) 0%, rgba(40, 0, 0, 0.9) 100%);
    border-color: #ff4400;
    color: #ffaa00;
    animation: pulseRed 2s infinite;
}
@keyframes pulseRed { 0% { box-shadow: 0 0 5px #ff0000; } 50% { box-shadow: 0 0 20px #ff4400; } 100% { box-shadow: 0 0 5px #ff0000; } }

/* --- FLOATING TEXT --- */
/* --- FLOATING TEXT --- */
.floating-text-wrapper {
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 2000;
    will-change: transform;
    contain: layout style;
}

.floating-text-inner {
    display: block;
    font-family: var(--font-data);
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
    font-size: 12px; /* Smaller base size */
    text-shadow: 0 1px 2px rgba(0,0,0,0.8); /* Cleaner shadow */
    opacity: 1.0;
    letter-spacing: 1px;
    color: white; /* Ensure white default */
    background: transparent; /* Allow subclasses to override */
}
.floating-text-inner.damage {
    font-family: var(--font-data);
    font-size: 20px; /* Reduced from 24 */
    font-style: italic;
    background: linear-gradient(to bottom, #ffffff 0%, #ffcc00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
-webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.8));
    animation: popDamage 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.floating-text-inner.heal {
    font-size: 16px; /* Reduced from 18 */
    color: #44ff44;
    text-shadow: 0 0 3px #00ff00;
    animation: floatUp 0.8s ease-out forwards;
}

.floating-text-inner.venom {
    font-size: 16px; /* Reduced from 20 */
    color: #aaff00;
    text-shadow: 0 0 3px #448800;
    animation: dripStatus 2s infinite;
}

.floating-text-inner.sleep {
    font-size: 16px; /* Reduced from 20 */
    color: #ffffff;
    text-shadow: 0 0 5px #0044ff;
    animation: driftStatus 3s ease-in-out infinite;
}

.floating-text-inner.wither {
    font-size: 14px; /* Reduced from 18 */
    color: #cccccc;
    text-shadow: 0 0 3px #444444;
    animation: witherStatus 1.5s forwards;
}

.floating-text-inner.tech {
    font-family: var(--font-data);
    font-size: 14px; /* Reduced from 16 */
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
    animation: shakeTech 0.6s ease-in-out;
    letter-spacing: 1px;
}

.floating-text-inner.save, .floating-text-inner.block {
    font-family: var(--font-data);
    font-size: 24px; /* Reduced from 32 */
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 5px #0088ff;
    animation: popDamage 0.5s ease-out forwards;
}

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

@keyframes dripStatus {
    0% { transform: scaleY(1); filter: blur(0px); }
    50% { transform: scaleY(1.1) translateY(2px); filter: blur(0.5px); }
    100% { transform: scaleY(1); filter: blur(0px); }
}

@keyframes driftStatus {
    0% { transform: translateX(0) rotate(0deg); opacity: 0; }
    20% { opacity: 1; }
    50% { transform: translateX(10px) translateY(-10px) rotate(5deg); }
    100% { transform: translateX(-10px) translateY(-30px) rotate(-5deg); opacity: 0; }
}

@keyframes witherStatus {
    0% { transform: scale(1); filter: grayscale(0%); opacity: 1; }
    100% { transform: scale(0.8); filter: grayscale(100%); opacity: 0; }
}

@keyframes shakeTech {
    0% { transform: scale(0.8); }
    10%, 30%, 50%, 70%, 90% { transform: scale(1.1) translate(-1px, 1px); }
    20%, 40%, 60%, 80% { transform: scale(1.1) translate(1px, -1px); }
    100% { transform: scale(1.0); }
}

@keyframes flashTech {
    0% { color: #fff; text-shadow: 0 0 10px #fff; }
    100% { color: #00ffff; text-shadow: 0 0 5px #00ffff; }
}

#loading {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: var(--ffx-cyan);
    text-transform: uppercase;
    letter-spacing: 5px;
    animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0.5; } }

#controls-hint {
    position: absolute;
    top: 130px; width: 100%;
    text-align: center;
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    pointer-events: none;
}

.floating-text-inner.comic-impact {
    font-family: var(--font-data);
    font-size: 28px; /* Reduced from 32 */
    color: #ffff00; 
    text-shadow: 2px 2px 0 #ff0000; /* Hard shadow instead of glow for cleaner look */
    font-style: italic;
    transform-origin: center;
    white-space: nowrap;
    animation: comicPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    z-index: 2500;
}

.floating-text-inner.comic-action {
    font-family: var(--font-data);
    font-size: 16px; /* Reduced from 20 */
    color: #00ffff; 
    text-shadow: 0 0 5px #0044aa;
    font-style: normal;
    white-space: nowrap;
    animation: comicSlide 0.4s ease-out forwards;
    z-index: 2500;
}
@keyframes comicPop {
    0% { transform: scale(0) rotate(-20deg); opacity: 0; }
    40% { transform: scale(1.2) rotate(5deg); opacity: 1; }
    60% { transform: scale(1.0) rotate(-5deg); opacity: 1; }
    100% { transform: scale(1.1) rotate(0deg); opacity: 0; }
}

@keyframes comicSlide {
    0% { transform: translate(-20px, 20px) scale(0.5); opacity: 0; }
    100% { transform: translate(20px, -20px) scale(1.2); opacity: 0; }
}

/* --- MAIN MENU --- */
/* --- MAIN MENU & END GAME (FFX STYLE) --- */
/* --- MAIN MENU (FAYTH INTERFACE) --- */
#main-menu {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end; /* Asymmetric Right Align */
    padding-right: 10%;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1.0);
    
    /* Deep Void Background */
    background: radial-gradient(circle at 30% 50%, #051020 0%, #000000 100%);
    overflow: hidden;
}

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

/* Scanlines & Vignette */
.menu-bg-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 2px,
            rgba(0, 255, 255, 0.02) 3px,
            rgba(0, 255, 255, 0.02) 4px
        );
    pointer-events: none;
}
.menu-bg-overlay::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, transparent 40%, rgba(0,0,0,0.8) 100%);
}

/* LOGO STYLING */
.ffx-logo-container {
    margin-bottom: 60px;
    text-align: right;
    transform: skewX(-10deg);
    position: relative;
    margin-right: 20px;
}

.ffx-logo-main {
    font-family: var(--font-title);
    font-size: clamp(60px, 12vw, 100px);
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 10px;
    line-height: 0.9;
    
    /* Crystal Gradient */
    background: linear-gradient(180deg, #ffffff 0%, #aaccff 45%, #0088ff 55%, #002266 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    
    filter: drop-shadow(0 0 20px rgba(0, 150, 255, 0.6));
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 20px rgba(0, 150, 255, 0.6)); }
    50% { transform: translateY(-10px); filter: drop-shadow(0 0 30px rgba(0, 200, 255, 0.8)); }
}

.ffx-logo-sub {
    font-family: var(--font-spira);
    font-size: clamp(24px, 5vw, 42px); /* Larger */
    color: var(--ffx-gold);
    letter-spacing: 8px;
    margin-top: 5px;
    text-shadow: 0 0 10px #ffaa00;
    opacity: 1.0;
    text-align: right;
}

/* MENU OPTIONS (Asymmetric List) */
.menu-options {
    display: flex;
    flex-direction: column;
/* MENU OPTIONS (Asymmetric List) */
    width: 400px;
    align-items: flex-end; /* Align items to right */
}

.menu-item {
    position: relative;
    width: 100%;
    padding: 15px 40px 15px 20px;
    
    /* Glass Shard Look */
    background: linear-gradient(270deg, rgba(0, 40, 80, 0.8) 0%, rgba(0, 10, 20, 0.0) 100%);
    border-right: 3px solid rgba(100, 200, 255, 0.3);
    
    cursor: pointer;
/* Glass Shard Look */
    transform: skewX(-15deg);
    
    display: flex;
    justify-content: flex-end;
    align-items: center;
    overflow: visible;
}

.menu-item:hover {
    background: linear-gradient(270deg, rgba(0, 100, 200, 0.9) 0%, rgba(0, 20, 40, 0.2) 100%);
    border-right-color: #00ffff;
    padding-right: 60px; /* Slide left effect */
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.2);
}

.menu-item .label {
    font-family: var(--font-title);
    font-size: 24px;
    color: #aaaaaa;
    letter-spacing: 4px;
    text-transform: uppercase;
    transform: skewX(15deg); /* Counter skew text */
    transition: color 0.2s, text-shadow 0.2s;
}

.menu-item:hover .label {
    color: #ffffff;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #0088ff;
}

/* PYREFLY CURSOR */
.menu-item .cursor {
    position: absolute;
    right: 15px;
    width: 12px; height: 12px;
    background: #ffd700;
    border-radius: 50%;
    opacity: 0;
    transform: skewX(15deg) scale(0);
    transition: all 0.3s;
    box-shadow: 
        0 0 10px #ffd700,
        0 0 20px #ffaa00,
        0 0 40px #ff4400;
    pointer-events: none;
}

.menu-item:hover .cursor {
    opacity: 1;
    right: 30px;
    transform: skewX(15deg) scale(1);
    animation: pyreflyWiggle 1s infinite ease-in-out;
}

@keyframes pyreflyWiggle {
    0%, 100% { transform: skewX(15deg) scale(1) translate(0, 0); }
    50% { transform: skewX(15deg) scale(1.2) translate(-2px, -2px); }
}

/* Particle trail for cursor (Pseudo element) */
.menu-item:hover .cursor::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    background: inherit;
    opacity: 0.5;
    animation: pyreflyTrail 1s infinite;
}

@keyframes pyreflyTrail {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(2.5); opacity: 0; }
}

.menu-footer {
    position: absolute;
    bottom: 30px;
    right: 40px;
    font-family: var(--font-ui);
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    letter-spacing: 4px;
    text-transform: uppercase;
    text-align: right;
}
/* END GAME SPECIFIC */
#end-game-menu {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    background: rgba(0, 5, 15, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

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

.result-header {
    text-align: center;
    margin-bottom: 40px;
    transform: skewX(-10deg);
}

.result-title {
    font-family: var(--font-title);
    font-size: 72px;
    color: #fff;
    text-shadow: 0 0 20px #00aaff, 0 0 40px #0044aa;
    letter-spacing: 5px;
    line-height: 1.0;
}

.result-subtitle {
    font-family: var(--font-spira);
    font-size: 18px;
    color: var(--ffx-gold);
    letter-spacing: 8px;
    margin-top: 5px;
}

.final-score-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin-bottom: 50px;
    background: linear-gradient(90deg, transparent, rgba(0, 20, 50, 0.8), transparent);
    padding: 20px 0;
    width: 100%;
}

.final-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 120px;
}

.final-score-digit {
    font-family: var(--font-data);
    font-size: 80px;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    line-height: 1.0;
}

.final-team.home .final-score-digit { color: #00ffff; text-shadow: 0 0 20px #00ffff; }
.final-team.away .final-score-digit { color: #00ffaa; text-shadow: 0 0 20px #00ffaa; }

.final-team-name {
    font-family: var(--font-title);
    font-size: 14px;
    color: #aaa;
    letter-spacing: 2px;
    margin-top: 5px;
}

.final-vs {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.6;
}

.final-vs span {
    font-family: var(--font-spira);
    font-size: 24px;
    color: var(--ffx-gold);
    margin: 5px 0;
}

.vs-line {
    width: 2px; height: 30px;
    background: linear-gradient(to bottom, transparent, var(--ffx-gold), transparent);
}
/* --- PRACTICE OVERLAY --- */
/* --- PRACTICE OVERLAY (SPHERE POOL TERMINAL) --- */
#practice-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 5, 10, 0.4);
    backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2500;
    pointer-events: none;
}

#practice-overlay.active {
    display: flex;
}

.practice-panel {
    position: absolute;
    top: max(60px, env(safe-area-inset-top) + 40px); 
    right: max(20px, env(safe-area-inset-right));
    width: 300px;
    
    /* Holographic Glass */
    background: linear-gradient(160deg, rgba(0, 20, 40, 0.9) 0%, rgba(0, 10, 20, 0.95) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    
    /* Tech Shape */
    clip-path: polygon(
        20px 0, 100% 0, 
        100% calc(100% - 20px), calc(100% - 20px) 100%, 
        0 100%, 0 20px
    );
    
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-left: 2px solid var(--ffx-cyan);
    
    box-shadow: 
        0 0 30px rgba(0, 100, 255, 0.2),
        inset 0 0 50px rgba(0, 20, 60, 0.5);
        
    padding: 20px;
    pointer-events: auto;
    
    /* Grid Pattern Overlay */
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    
    animation: panelFloat 4s ease-in-out infinite;
}

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

.panel-header {
    margin-bottom: 20px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

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

.panel-title {
    font-family: var(--font-title);
    font-size: 22px;
    color: #ffffff;
    text-shadow: 0 0 10px #00ffff;
    letter-spacing: 2px;
}

.panel-subtitle {
font-family: var(--font-yevon);
    font-size: 10px;
    color: var(--ffx-cyan);
    letter-spacing: 2px;
    opacity: 0.8;
}

.panel-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-label {
    font-family: var(--font-spira);
    font-size: 12px;
    color: var(--ffx-gold);
    margin-bottom: 8px;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 5px rgba(255, 200, 0, 0.5);
}

.drill-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.drill-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 5px;
    background: rgba(0, 20, 40, 0.6);
    border: 1px solid rgba(0, 255, 255, 0.1);
    cursor: pointer;
    font-family: var(--font-data);
    font-size: 11px;
    color: #88aacc;
    transition: all 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.drill-btn:hover {
    background: rgba(0, 40, 80, 0.8);
    border-color: var(--ffx-cyan);
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.drill-btn.active {
    background: linear-gradient(135deg, rgba(0, 100, 200, 0.8) 0%, rgba(0, 40, 80, 0.8) 100%);
    border-color: #00ffff;
    color: #fff;
    text-shadow: 0 0 5px #00ffff;
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.3);
}

.drill-btn .icon {
    display: none; /* Hide icons for cleaner grid */
}

.option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-toggle {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 12px;
    color: #aaa;
    transition: all 0.2s;
}

.option-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.option-toggle.active {
    border-color: #00ff00;
    color: #fff;
    background: rgba(0, 50, 0, 0.3);
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.2);
}

.option-toggle .checkbox {
    margin-right: 10px;
    color: inherit;
    font-family: monospace;
}

.action-btn {
    text-align: center;
    background: linear-gradient(90deg, rgba(50, 0, 0, 0.6), rgba(20, 0, 0, 0.8));
    border: 1px solid #ff4444;
    padding: 8px;
    font-size: 12px;
    color: #ffaaaa;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: var(--font-title);
}

.action-btn:hover {
    background: #ff4444;
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
}

#p-reset-ball {
    background: linear-gradient(90deg, rgba(0, 50, 100, 0.6), rgba(0, 20, 40, 0.8));
    border-color: #00ffff;
    color: #00ffff;
}
#p-reset-ball:hover {
    background: #00ffff;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.panel-footer {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

#offscreen-indicator {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    display: none;
    z-index: 1000;
    pointer-events: none;
}
#offscreen-indicator .arrow {
    width: 0; 
    height: 0; 
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 15px solid #00ffff;
    filter: drop-shadow(0 0 5px #00ffff);
}

#drill-instruction {
    font-size: 11px;
    color: #88aacc;
    margin-bottom: 8px;
    font-style: italic;
    font-family: var(--font-ui);
}

#drill-score {
    font-family: var(--font-data);
    font-size: 32px;
    color: var(--ffx-gold);
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    letter-spacing: 2px;
}

.panel-minimize-btn {
    width: 24px; height: 24px;
    border: 1px solid var(--ffx-cyan);
    color: var(--ffx-cyan);
    text-align: center;
    line-height: 22px;
    cursor: pointer;
    font-size: 16px;
    background: rgba(0,0,0,0.5);
    transition: all 0.2s;
}
.panel-minimize-btn:hover { 
    background: var(--ffx-cyan); 
    color: #000; 
    box-shadow: 0 0 10px var(--ffx-cyan);
}
.panel-minimize-btn {
    position: absolute;
    top: 10px; right: 10px;
    width: 20px; height: 20px;
    border: 1px solid var(--ffx-cyan);
    color: var(--ffx-cyan);
    text-align: center;
    line-height: 18px;
    cursor: pointer;
    font-size: 14px;
    background: rgba(0,0,0,0.5);
    transition: all 0.2s;
}
.panel-minimize-btn:hover { 
    background: var(--ffx-cyan); 
    color: #000; 
    box-shadow: 0 0 5px var(--ffx-cyan);
}

#practice-restore-btn {
    position: absolute;
    top: max(60px, env(safe-area-inset-top) + 40px); 
    right: max(20px, env(safe-area-inset-right));
    padding: 8px 15px;
    background: linear-gradient(90deg, rgba(0, 20, 50, 0.9) 0%, rgba(0, 10, 20, 0.9) 100%);
    border: 1px solid var(--ffx-cyan);
    border-left: 3px solid var(--ffx-cyan);
    color: var(--ffx-cyan);
    font-family: var(--font-data);
    font-size: 12px;
    letter-spacing: 1px;
    cursor: pointer;
    z-index: 2400;
    display: none;
    pointer-events: auto;
    transform: skewX(-10deg);
    box-shadow: 0 0 10px rgba(0, 100, 255, 0.2);
    text-transform: uppercase;
}
#practice-restore-btn:hover {
    background: rgba(0, 40, 80, 0.9);
    color: #fff;
    text-shadow: 0 0 5px #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

/* --- AIM JOYSTICK --- */
#aim-joystick-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 50%;
    height: 100%;
    z-index: 1000;
    background: rgba(0,0,0,0);
    touch-action: none;
    pointer-events: auto;
}

#aim-joystick-visual {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    overflow: visible;
    pointer-events: none;
    display: none;
    z-index: 1100;
}

#aim-joystick-base {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100px; height: 100px;
    border-radius: 50%;
    /* Ethereal Orange Ring */
    border: 1px dashed rgba(255, 150, 50, 0.4);
    box-shadow: 0 0 15px rgba(255, 100, 0, 0.2), inset 0 0 20px rgba(255, 50, 0, 0.1);
    background: radial-gradient(circle, rgba(0,0,0,0) 60%, rgba(255, 100, 0, 0.05) 100%);
    animation: etherealSpin 12s linear infinite reverse;
}

#aim-joystick-knob {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 30px; height: 30px;
    border-radius: 50%;
    /* Firefly Light */
    background: radial-gradient(circle at 30% 30%, #fff 0%, #ffaa00 40%, #ff4400 100%);
    box-shadow: 0 0 15px #ff6600;
    transition: transform 0.05s linear;
    will-change: transform;
}

#aim-joystick-knob::after {
    content: "AIM";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8px;
    color: white;
    font-family: var(--font-data);
    text-shadow: 0 0 3px #000;
    opacity: 0.8;
}
/* --- TACKLE BUTTON --- */
/* --- TACKLE BUTTON REMOVED --- */
/* --- CHARGE POWER METER --- */
#charge-meter-container {
    position: absolute;
    bottom: max(250px, env(safe-area-inset-bottom) + 100px);
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    display: none;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 2000;
    background: rgba(0, 10, 30, 0.8);
    padding: 10px 15px;
    border: 1px solid var(--ffx-cyan);
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0, 100, 255, 0.3);
}

.charge-label {
    font-family: var(--font-spira);
    font-size: 12px;
    color: var(--ffx-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.charge-meter-track {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
    border-radius: 6px;
    overflow: hidden;
}

#charge-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0af, #0f0);
    box-shadow: 0 0 10px #0f0;
    transition: width 0.05s linear, background 0.1s;
    border-radius: 5px;
}

.charge-hint {
    font-family: var(--font-ui);
    font-size: 10px;
    color: var(--ffx-gold);
    margin-top: 5px;
    opacity: 0.8;
    animation: blink 0.5s infinite;
}

/* --- GOAL DISTANCE INDICATOR --- */
#goal-distance-container {
    position: absolute;
    top: max(75px, env(safe-area-inset-top) + 55px);
    left: max(20px, env(safe-area-inset-left));
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 100;
    background: linear-gradient(90deg, rgba(0, 10, 30, 0.7) 0%, transparent 100%);
    padding: 5px 15px 5px 10px;
    border-left: 2px solid var(--ffx-gold);
}

.distance-label {
    font-family: var(--font-spira);
    font-size: 8px;
    color: var(--ffx-gold);
    letter-spacing: 2px;
    text-transform: uppercase;
}

#goal-distance {
    font-family: var(--font-data);
    font-size: 24px;
    color: white;
    text-shadow: 0 0 5px var(--ffx-gold);
}

/* --- SETTINGS BUTTON --- */
/* --- SETTINGS BUTTON --- */
#settings-button {
    position: absolute;
    top: max(350px, env(safe-area-inset-top) + 170px);
    right: max(20px, env(safe-area-inset-right));
    width: 110px;
    padding: 8px 0;
    text-align: center;
    font-size: 10px;
    font-weight: bold;
    color: #888;
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.8) 0%, rgba(10, 10, 10, 0.9) 100%);
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: auto;
    transition: all 0.2s;
    z-index: 100;
z-index: 1500;
}
#settings-button:hover {
    background: rgba(40, 40, 40, 0.9);
    border-color: #888;
    color: #fff;
}

/* --- SETTINGS PANEL --- */
/* --- SETTINGS PANEL --- */
#settings-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    max-width: 90%; /* Ensure it fits on narrow screens */
    background: linear-gradient(160deg, rgba(0, 20, 50, 0.98) 0%, rgba(0, 10, 20, 0.99) 100%);
    border: 2px solid var(--ffx-cyan);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 100, 255, 0.4);
    z-index: 3500;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(100, 200, 255, 0.3);
    background: rgba(0, 30, 60, 0.5);
}

.settings-header span {
    font-family: var(--font-title);
    font-size: 20px;
    color: white;
    text-shadow: 0 0 5px var(--ffx-cyan);
    letter-spacing: 3px;
}

#settings-close {
    width: 30px;
    height: 30px;
    border: 1px solid #ff4444;
    background: rgba(50, 0, 0, 0.5);
    color: #ff4444;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
}

#settings-close:hover {
    background: #ff4444;
    color: white;
}

.settings-content {
    padding: 20px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.setting-row label {
    font-family: var(--font-data);
    font-size: 14px;
    color: #ccc;
}

.setting-row input[type="range"] {
    width: 100px;
    accent-color: var(--ffx-cyan);
}

.setting-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--ffx-cyan);
    cursor: pointer;
}

/* --- GLARE ANIMATION --- */
@keyframes glarePass {
    0% { transform: translateX(-100%) rotate(45deg); }
    30% { transform: translateX(100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

/* --- STATUS TYPE FLOATING TEXT --- */
.floating-text-inner.status {
    font-size: 14px; /* Reduced from 18 */
    color: #ff00ff;
    text-shadow: 0 0 3px #ff00ff;
    animation: statusPop 1.2s ease-out forwards;
}

@keyframes statusPop {
    0% { transform: scale(0.5) translateY(0); opacity: 0; }
    20% { transform: scale(1.1) translateY(-5px); opacity: 1; }
    100% { transform: scale(1.0) translateY(-20px); opacity: 0; }
}

.floating-text-inner.blind {
    font-size: 16px;
    color: #888;
    text-shadow: 0 0 3px #000;
    animation: witherStatus 2s forwards;
}

.floating-text-inner.silence {
    font-size: 16px;
    color: #ff00ff;
    text-shadow: 0 0 3px #ff00ff;
    animation: shakeTech 0.5s ease-in-out;
}

.floating-text-inner.shield {
    font-size: 20px;
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
    animation: popDamage 0.5s ease-out forwards;
}

.floating-text-inner.haste {
    font-size: 20px;
    font-style: italic;
    color: #ffff00;
    text-shadow: 0 0 3px #ff8800;
    animation: floatUp 0.5s ease-out forwards;
}

.floating-text-inner.slow {
    font-size: 20px;
    font-weight: bold;
    color: #885522;
    text-shadow: 0 0 3px #000;
    animation: witherStatus 1.5s forwards;
}

.floating-text-inner.burn {
    font-size: 20px;
    font-style: italic;
    color: #ff4400;
    text-shadow: 0 0 5px #ff0000;
    animation: burnStatus 1.5s infinite;
}

.floating-text-inner.freeze {
    font-size: 20px;
    color: #aaddff;
    text-shadow: 0 0 5px #00ffff;
    animation: freezeStatus 2.0s forwards;
}

.floating-text-inner.shock {
    font-size: 20px;
    font-weight: bold;
    color: #ffff00;
    text-shadow: 0 0 5px #ffff00;
    animation: shockStatus 0.1s infinite alternate;
}

@keyframes burnStatus {
    0% { transform: scale(1) skewX(0deg); filter: brightness(1); }
    50% { transform: scale(1.05) skewX(-2deg); filter: brightness(1.2); }
    100% { transform: scale(1) skewX(0deg); filter: brightness(1); }
}

@keyframes freezeStatus {
    0% { transform: scale(0.8); opacity: 0; }
    20% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1.0); opacity: 0; filter: brightness(1.5); }
}

@keyframes shockStatus {
    0% { transform: translate(1px, 0); }
    100% { transform: translate(-1px, 0); }
}

/* --- LEVEL UP TYPE FLOATING TEXT --- */
.floating-text-inner.levelup {
    font-family: var(--font-title);
    font-size: 48px; /* Reduced from 60 */
    font-weight: 900;
    font-style: italic;
    letter-spacing: 2px;
    background: linear-gradient(180deg, #ffffff 0%, #ffd700 40%, #ffaa00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
-webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.6));
    animation: levelUpRise 3.0s cubic-bezier(0.2, 0.8, 0.2, 1.0) forwards;
    z-index: 3000;
}
/* --- LEVEL UP TYPE FLOATING TEXT --- */
.floating-text-inner.levelup {
    font-family: var(--font-title);
    font-size: 60px;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 2px;
    background: linear-gradient(180deg, #ffffff 0%, #ffd700 40%, #ffaa00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
    animation: levelUpRise 3.0s cubic-bezier(0.2, 0.8, 0.2, 1.0) forwards;
    z-index: 3000;
}

@keyframes levelUpRise {
    0% { transform: scale(0.5) translateY(50px); opacity: 0; }
    10% { transform: scale(1.2) translateY(0); opacity: 1; }
    20% { transform: scale(1.0); }
    80% { transform: scale(1.0) translateY(-50px); opacity: 1; }
    100% { transform: scale(1.5) translateY(-80px); opacity: 0; filter: blur(5px); }
}

/* --- GOAL TYPE FLOATING TEXT --- */
.floating-text-inner.goal {
    font-family: var(--font-data);
    font-size: 40px;
    font-weight: 900;
    background: linear-gradient(to bottom, #fff 0%, #ffd700 50%, #ff8800 100%);
    -webkit-background-clip: text;
-webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.9));
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.9));
    animation: goalPop 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes goalPop {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(5deg); opacity: 1; }
    100% { transform: scale(1.0) rotate(0deg); opacity: 0; }
}

/* --- DEFAULT TYPE FLOATING TEXT --- */
.floating-text-inner.default {
    font-family: var(--font-data);
    font-size: 16px;
    color: white;
    text-shadow: 0 0 4px rgba(0,0,0,0.8);
    animation: floatUp 0.8s ease-out forwards;
}

/* --- MOBILE PORTRAIT OPTIMIZATIONS --- */
/* --- MOBILE & RESPONSIVE OPTIMIZATIONS --- */

/* 1. Compact Landscape (Mobile Horizontal) */
@media screen and (max-height: 600px) and (orientation: landscape) {
    #hud-top {
        height: 100px;
        padding: 5px 40px; /* More side padding to clear notches */
    }

    .sb-wing {
        width: 220px;
        height: 70px;
    }

    .sb-wing.home .sb-wing-bg { transform: skewX(-15deg); }
    .sb-wing.away .sb-wing-bg { transform: skewX(15deg); }

    .sb-team-name { font-size: 18px; }
    .sb-team-sub { font-size: 8px; letter-spacing: 2px; }
    .sb-score { font-size: 48px; }
    
    .sb-chronosphere {
        width: 100px; height: 100px;
    }
    .chrono-core { width: 70px; height: 70px; }
    .chrono-ring.outer { width: 90px; height: 90px; }
    .chrono-ring.mid { width: 80px; height: 80px; }
    .chrono-ring.inner { width: 60px; height: 60px; }
    
    #timer-display { font-size: 24px; }
    
    /* Adjust controls for landscape */
#action-container { bottom: 20px; right: 5px; transform: scale(0.8); transform-origin: bottom right; }
    #joystick-hit-zone { width: 40%; }
    
    #player-status-panel {
        bottom: 20px; left: 20px;
        transform: scale(0.8) skewX(-10deg); transform-origin: bottom left;
    }
}

/* 2. Portrait Mode (Mobile Vertical) */
@media screen and (orientation: portrait) {
    #hud-top {
        height: 140px;
        padding: max(10px, env(safe-area-inset-top)) 10px 0 10px;
        align-items: flex-start;
        gap: 5px;
    }

    /* Wings become top bars */
    .sb-wing {
        width: auto;
        flex: 1;
        height: 80px;
        margin: 0;
        background: none; /* Remove default bg container */
    }

    /* Custom BG for Portrait Wings */
    .sb-wing-bg {
        transform: skewX(0deg) !important; /* Remove skew */
        border-radius: 0 0 10px 10px;
        border-top: none;
        background: linear-gradient(180deg, rgba(0, 20, 40, 0.95) 0%, rgba(0, 10, 20, 0.8) 100%);
    }
    .sb-wing.home .sb-wing-bg { 
        border-left: none; 
        border-bottom: 2px solid var(--ffx-cyan);
        clip-path: polygon(0 0, 100% 0, 100% 80%, 85% 100%, 0 100%);
    }
    .sb-wing.away .sb-wing-bg { 
        border-right: none; 
border-bottom: 2px solid #00ffaa;
        clip-path: polygon(0 0, 100% 0, 100% 100%, 15% 100%, 0 80%);
    }

.sb-content-container {
        transform: skewX(0deg) !important;
        padding: 5px;
        flex-direction: row; /* Keep row for portrait top bar */
        justify-content: space-between;
        align-items: center;
    }
    
    .sb-wing.home .sb-content-container { padding-left: 60px; padding-right: 10px; }
.sb-wing.away .sb-content-container { padding-right: 60px; padding-left: 10px; flex-direction: row; }

    /* Portrait Logo: Absolute, anchored to corners */
.sb-team-logo {
        width: 120px;
        height: 120px;
        top: 50%;
        transform: translateY(-50%) !important;
    }
    .sb-wing.home .sb-team-logo { left: 5px; }
    .sb-wing.away .sb-team-logo { right: 5px; }

    .sb-team-info {
        order: unset;
        text-align: left;
        flex-grow: 1;
    }
    .sb-wing.away .sb-team-info { text-align: right; }

    .sb-team-name { font-size: 14px; letter-spacing: 1px; }
    .sb-team-sub { display: none; }

    .sb-score-wrapper {
        order: unset;
        width: auto;
        height: 40px;
        justify-content: center;
        padding: 0 10px;
    }
    .sb-score {
        font-size: 48px;
        margin: 0 !important;
        line-height: 0.8;
    }

    .sb-crystal-deco { display: none; }
    .sb-energy-conduit { display: none; }

    /* Chronosphere Compact */
    .sb-chronosphere {
        width: 90px; height: 90px;
        margin-top: 5px;
        z-index: 1200;
    }
    .chrono-core { width: 70px; height: 70px; background: rgba(0, 10, 20, 0.95); }
    .chrono-ring.outer { width: 85px; height: 85px; opacity: 0.4; }
    .chrono-ring.mid { display: none; } /* Simplify */
    .chrono-ring.inner { width: 60px; height: 60px; }
    
    #timer-display { font-size: 20px; }
    #half-indicator { font-size: 10px; margin-bottom: 0; }

    /* UI Repositioning for Portrait */
    #minimap-container {
        top: max(160px, env(safe-area-inset-top) + 140px);
        right: 10px;
        transform: scale(0.8); transform-origin: top right;
    }
    
    #goal-distance-container {
        top: max(160px, env(safe-area-inset-top) + 140px);
        left: 10px;
    }

#player-status-panel {
        bottom: max(180px, env(safe-area-inset-bottom) + 100px);
        left: 10px;
        width: 190px; /* Slightly wider for new layout */
        padding: 10px;
        transform: skewX(0deg); /* Remove skew for readability on narrow screens */
        border-left-width: 4px;
    }
    .char-name { font-size: 16px; margin-bottom: 5px; transform: skewX(0deg); }
    .hp-gauge-container { margin-bottom: 5px; transform: skewX(0deg); }
    .tech-gauge-container { transform: skewX(0deg); }
    .hp-value { font-size: 12px; width: 50px; }
    .hp-label, .tech-label { font-size: 10px; width: 25px; }
    .hp-bar-track { margin: 0 5px; height: 8px; }
    .tech-bar-track { margin: 0 5px; }
    /* Controls */
    #action-container {
#action-container {
        bottom: max(40px, env(safe-area-inset-bottom));
        right: max(5px, env(safe-area-inset-right));
    }
    
    /* Hide redundant label in portrait to save space */
    #action-label { display: none; }
    #tackle-button {
        bottom: max(60px, env(safe-area-inset-bottom));
        right: max(140px, env(safe-area-inset-right));
    }

    #joystick-hit-zone {
        height: 40%;
        bottom: 0;
    }
    
/* Settings & Auto Buttons - Moved higher to avoid clutter */
    #auto-toggle {
        top: max(160px, env(safe-area-inset-top) + 140px);
        right: 10px;
        width: 80px;
        font-size: 10px;
        padding: 6px 0;
    }
    #settings-button {
        top: max(200px, env(safe-area-inset-top) + 180px);
        right: 10px;
        width: 80px;
        font-size: 10px;
        padding: 6px 0;
    }
    #practice-restore-btn {
        top: max(240px, env(safe-area-inset-top) + 220px);
        right: 10px;
        width: 80px;
        font-size: 10px;
        padding: 6px 0;
    }

    /* Adjust Sub-Button to prevent overlap in Portrait */
    #sub-action-button {
        left: -95px; /* Push further left */
        top: 50px;   /* Push slightly down */
    }
    /* Menus */
    .menu-options { width: 100%; padding-right: 20px; }
    .ffx-logo-main { font-size: 60px; }
    
    /* Settings */
    #settings-panel { width: 90%; }
    
    /* Practice */
    .practice-panel { width: 95%; right: 2.5%; top: 120px; }
    
    /* Announcements */
    #announcement {
        font-size: 48px;
        top: 35%;
    }
    .announcement-slam {
        font-size: 64px !important;
    }
.announcement-slam {
        font-size: 64px !important;
    }
}

/* --- INITIAL VISIBILITY STATE (Fix for UI Clutter) --- */
/* Hide all gameplay UI elements by default so they don't overlap loading/menu */
#hud-top,
#goal-distance-container,
#minimap-container,
#player-status-panel,
#charge-meter-container,
#announcement,
#joystick-hit-zone,
#joystick-visual-container,
#aim-joystick-zone,
#aim-joystick-visual,
#camera-zone,
#action-container,
#tackle-button,
#auto-toggle,
#settings-button,
#practice-restore-btn,
#controls-hint,
#gesture-hint,
#offscreen-indicator,
#tech-flash-overlay {
display: none;
}

/* --- STAT ALLOCATION UI --- */
#stat-allocation-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 5, 15, 0.95);
    backdrop-filter: blur(10px);
    display: none; /* Managed by JS */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 4000; /* Above End Game Menu */
}

#stat-allocation-overlay.active {
    display: flex;
}

.stat-panel {
    width: 400px;
    max-width: 90%;
    background: linear-gradient(160deg, rgba(0, 20, 40, 0.95) 0%, rgba(0, 10, 20, 0.98) 100%);
    border: 1px solid var(--ffx-cyan);
    box-shadow: 0 0 30px rgba(0, 100, 255, 0.2);
    padding: 20px;
    clip-path: polygon(
        20px 0, 100% 0, 
        100% calc(100% - 20px), calc(100% - 20px) 100%, 
        0 100%, 0 20px
    );
    color: white;
    font-family: var(--font-data);
    animation: panelFloat 4s ease-in-out infinite;
}

.stat-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 10px;
}

.stat-title {
    font-family: var(--font-title);
    font-size: 32px;
    color: #ffd700;
    text-shadow: 0 0 10px #ffaa00;
    margin-bottom: 5px;
}

.stat-subtitle {
    font-family: var(--font-spira);
    font-size: 14px;
    color: var(--ffx-cyan);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.stat-player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 4px;
}

.stat-player-name {
    font-size: 20px;
    text-transform: uppercase;
    color: white;
    font-weight: bold;
}

.stat-points-remaining {
    font-size: 16px;
    color: #ffaa00;
    font-weight: bold;
    text-shadow: 0 0 5px #ff4400;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 25px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.stat-row:hover {
    border-color: rgba(0, 255, 255, 0.3);
}

.stat-label {
    font-family: var(--font-data);
    width: 50px;
    color: #aaa;
    font-weight: bold;
}

.stat-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-val {
    width: 40px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    color: white;
}

.stat-val.boosted {
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
}

.stat-btn {
    width: 30px; height: 30px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--ffx-cyan);
    color: var(--ffx-cyan);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    user-select: none;
}

.stat-btn:hover {
    background: var(--ffx-cyan);
    color: #000;
    box-shadow: 0 0 10px var(--ffx-cyan);
}

.stat-btn:active {
    transform: scale(0.95);
}

.stat-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
    border-color: #555;
    color: #555;
    background: transparent;
    box-shadow: none;
}

.stat-confirm-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(90deg, rgba(0, 50, 100, 0.8), rgba(0, 20, 40, 0.9));
    border: 1px solid var(--ffx-cyan);
    color: white;
    font-family: var(--font-title);
    font-size: 18px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-confirm-btn:hover {
    background: var(--ffx-cyan);
    color: #000;
    box-shadow: 0 0 20px var(--ffx-cyan);
    text-shadow: none;
}

.stat-confirm-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 3s infinite;
animation: shimmer 3s infinite;
}

/* --- OPTIONS MENU --- */
/* --- OPTIONS MENU --- */
/* --- OPTIONS MENU --- */
#options-menu, #language-menu, #difficulty-menu {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, rgba(10, 20, 40, 0.95) 0%, #000000 100%);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3100;
    padding: 20px; /* Safety padding */
}

#options-menu.active, #language-menu.active, #difficulty-menu.active {
    display: flex;
}

.options-header {
    font-family: var(--font-title);
    font-size: 48px;
    color: #ffffff;
    text-shadow: 0 0 20px #00aaff;
    margin-bottom: 40px;
    letter-spacing: 5px;
    border-bottom: 2px solid var(--ffx-cyan);
    padding-bottom: 10px;
    width: 60%;
    text-align: center;
}

.options-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 60%;
    margin-bottom: 40px;
}

.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 255, 255, 0.05);
    padding: 20px;
    border-left: 4px solid var(--ffx-cyan);
}

.opt-label {
    font-family: var(--font-data);
    font-size: 24px;
    color: #aaa;
    letter-spacing: 2px;
}

.opt-selector {
    display: flex;
    gap: 20px;
}

.opt-val {
    font-family: var(--font-spira);
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 5px 15px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.opt-val:hover {
    color: #fff;
    text-shadow: 0 0 5px #fff;
}

.opt-val.selected {
    color: #ffd700;
    border: 1px solid #ffd700;
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.back-btn {
    width: auto !important;
    padding-left: 40px !important;
    background: transparent !important;
    border: none !important;
}
.back-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* --- MOBILE OPTIONS OPTIMIZATION (9:16) --- */
@media screen and (max-width: 768px) {
@media screen and (max-width: 768px) {
        width: 100%;
        font-size: 28px;
        margin-bottom: 20px;
        text-align: center;
    }
    
    .options-content {
        width: 100%;
        gap: 20px;
        padding: 0 5px;
    }

    .option-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 15px;
        width: 100%;
    }

    .opt-label {
        font-size: 18px;
        margin-bottom: 5px;
        text-align: center;
    }

    .opt-selector {
        width: 100%;
        display: flex;
        flex-direction: column; /* Stack vertically to fit screen */
        gap: 8px;
    }

    .opt-val {
        font-size: 16px;
        padding: 12px;
        width: 100%;
        flex: none;
        text-align: center;
        background: rgba(0,0,0,0.5);
        border: 1px solid rgba(255, 255, 255, 0.1);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Ensure Back button is accessible */
    .back-btn {
        margin-top: 20px;
        padding: 15px !important;
        background: rgba(0, 20, 40, 0.8) !important;
        border: 1px solid var(--ffx-cyan) !important;
        width: 100% !important;
        justify-content: center;
        text-align: center;
    }
}
/* --- LEAGUE UI (HERCULEAN) --- */
#league-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, rgba(10, 20, 40, 0.95) 0%, #000000 100%);
background: radial-gradient(circle at center, rgba(10, 20, 40, 0.95) 0%, #000000 100%);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3200;
    pointer-events: auto; /* Enable interaction */
}
#league-overlay.active { display: flex; }

.league-bg-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
    pointer-events: none;
}

.league-panel {
    width: 900px;
    max-width: 95%;
    height: 80vh;
    background: linear-gradient(160deg, rgba(0, 20, 40, 0.9) 0%, rgba(0, 10, 20, 0.95) 100%);
    border: 1px solid var(--ffx-cyan);
    box-shadow: 0 0 50px rgba(0, 100, 255, 0.2);
    padding: 30px;
    clip-path: polygon(30px 0, 100% 0, 100% calc(100% - 30px), calc(100% - 30px) 100%, 0 100%, 0 30px);
    color: white;
    font-family: var(--font-data);
    display: flex;
    flex-direction: column;
}

.league-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 2px solid var(--ffx-cyan);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.league-title {
    font-family: var(--font-title);
    font-size: 36px;
    color: #ffffff;
    text-shadow: 0 0 15px var(--ffx-cyan);
    letter-spacing: 2px;
}

.league-week {
    font-family: var(--font-spira);
    font-size: 24px;
    color: var(--ffx-gold);
    letter-spacing: 4px;
}

.league-content-split {
    display: flex;
    flex: 1;
    gap: 30px;
    overflow: hidden;
}

/* Left: Standings */
.league-standings-section {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 4px;
}

.league-table-wrapper {
    flex: 1;
    overflow-y: auto;
}

#league-table {
    width: 100%;
    border-collapse: collapse;
}

#league-table th {
    text-align: left;
    padding: 10px;
    background: rgba(0, 255, 255, 0.1);
    color: var(--ffx-cyan);
    font-size: 12px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
}

#league-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 16px;
}

#league-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

#league-table tr.highlight {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    font-weight: bold;
    box-shadow: inset 3px 0 0 #ffd700;
}

/* Right: Match Banner */
.league-match-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 4px;
    position: relative;
}

.match-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.2) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.match-team {
    width: 100%;
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
}

.match-team.home { border-left: 4px solid var(--ffx-cyan); }
.match-team.away { border-right: 4px solid #00ffaa; justify-content: flex-end; }

.team-color-strip {
    width: 10px; height: 40px;
    margin-right: 15px;
}
.match-team.away .team-color-strip { margin-right: 0; margin-left: 15px; order: 2; }

.match-team .team-name {
    font-family: var(--font-title);
    font-size: 28px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.match-vs {
    font-family: var(--font-spira);
    font-size: 24px;
    color: var(--ffx-gold);
    margin: 10px 0;
    position: relative;
}
.match-vs::before, .match-vs::after {
    content: ''; position: absolute; top: 50%; width: 50px; height: 1px; background: var(--ffx-gold);
}
.match-vs::before { right: 100%; margin-right: 15px; }
.match-vs::after { left: 100%; margin-left: 15px; }

.match-info {
    text-align: center;
    font-size: 12px;
    color: #88aacc;
    margin-bottom: 30px;
    letter-spacing: 2px;
}

.league-controls {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

@media screen and (max-width: 768px) {
    .league-content-split { flex-direction: column; }
    .league-standings-section { flex: 1; max-height: 40%; }
    .league-match-section { flex: 1; }
    .match-team .team-name { font-size: 20px; }
    .league-header { flex-direction: column; align-items: center; }
}
#locker-room-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Keep the 3D scene visible behind the locker UI.
       Vignette handled by ::before so the center doesn't become opaque. */
    background: transparent;
    display: none;
    z-index: 3300;
    pointer-events: auto;
}

/* Vignette overlay (doesn't block the 3D view) */
#locker-room-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* Make the center *truly* clear so the 3D scene is visible in the
       big middle "preview" area on mobile. Keep only a subtle edge vignette. */
    background: radial-gradient(
        circle at center,
        rgba(0, 0, 0, 0.0) 0%,
        rgba(0, 0, 0, 0.0) 55%,
        rgba(0, 5, 15, 0.25) 75%,
        rgba(0, 0, 0, 0.45) 100%
    );
}

#locker-room-overlay.active {
    display: block;
}

.locker-ui-layer {
    width: 100%; height: 100%;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 60px;
    pointer-events: none;
    box-sizing: border-box;
}

.locker-panel {
    pointer-events: auto;
    background: #050a10;
    background: linear-gradient(160deg, rgba(2, 5, 12, 0.98) 0%, rgba(0, 0, 0, 1.0) 100%);
    border: 1px solid var(--ffx-cyan);
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(0, 100, 255, 0.1), 
        inset 0 0 100px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 25px;
    position: relative;
    animation: panelFloat 4s ease-in-out infinite;
    z-index: 10;
}

.side-panel {
    width: 380px;
    height: auto;
    min-height: 500px;
    max-height: 85vh;
}

.side-panel.left {
    clip-path: polygon(
        0 0, 100% 0, 
        100% calc(100% - 30px), calc(100% - 30px) 100%, 
        0 100%
    );
    border-right: 4px solid var(--ffx-cyan);
    transform: perspective(1000px) rotateY(2deg);
}

.side-panel.right {
    clip-path: polygon(
        0 0, 100% 0, 
        100% 100%, 
        30px 100%, 0 calc(100% - 30px)
    );
    border-left: 4px solid var(--ffx-gold);
    transform: perspective(1000px) rotateY(-2deg);
}

.locker-header {
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.locker-title {
    font-family: var(--font-title);
    font-size: 24px;
    color: #88aacc;
    letter-spacing: 2px;
}

.locker-subtitle {
    font-family: var(--font-title);
    font-size: 48px;
    color: #ffffff;
    text-shadow: 0 0 15px var(--ffx-cyan);
    letter-spacing: 2px;
    line-height: 1.0;
    margin: 5px 0;
}

.locker-role {
font-family: var(--font-yevon);
    font-size: 20px;
    color: var(--ffx-gold);
    letter-spacing: 4px;
}

.locker-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-box {
    background: rgba(0, 15, 30, 0.85);
    padding: 10px 15px;
    border-left: 3px solid #445566;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    overflow: hidden;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.3);
    transition: background 0.2s;
}
.stat-box:hover {
    background: rgba(0, 30, 60, 0.9);
    border-left-color: var(--ffx-cyan);
}

.stat-name { 
    font-size: 14px; 
    color: #88aacc; 
    font-family: var(--font-data); 
    white-space: nowrap;
    font-weight: bold;
    letter-spacing: 1px;
}
.stat-val { 
    font-size: 20px; 
    color: #fff; 
    font-weight: bold; 
    font-family: var(--font-data); 
    white-space: nowrap;
    text-shadow: 0 0 5px rgba(255,255,255,0.3);
}
.locker-nav {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 20px;
}

.nav-btn {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--ffx-cyan);
    color: var(--ffx-cyan);
    padding: 10px 25px;
    cursor: pointer;
    font-family: var(--font-data);
    font-size: 14px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.nav-btn:hover {
    background: var(--ffx-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--ffx-cyan);
}

/* Tech Slots */
.tech-slots-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tech-slot {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tech-slot:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: var(--ffx-cyan);
    transform: translateX(-5px);
}

.tech-slot.selected {
    background: linear-gradient(90deg, rgba(0, 255, 255, 0.2), transparent);
    border-color: var(--ffx-cyan);
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.2);
    border-left: 4px solid var(--ffx-cyan);
}

.slot-icon {
    font-size: 24px;
    width: 50px;
    text-align: center;
    color: var(--ffx-gold);
}

.slot-info {
    display: flex;
    flex-direction: column;
}

.slot-type {
    font-family: var(--font-spira);
    font-size: 10px;
    color: #888;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.slot-value {
    font-family: var(--font-data);
    font-size: 18px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tech-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 15px;
    max-height: 200px;
}

.tech-list-item {
    padding: 12px;
    margin-bottom: 2px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font-family: var(--font-data);
    font-size: 14px;
    color: #aaa;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tech-list-item:hover {
    background: rgba(0, 255, 255, 0.15);
    color: #fff;
    padding-left: 18px;
}

.tech-list-item.equipped {
    color: var(--ffx-gold);
    border-left: 3px solid var(--ffx-gold);
    background: rgba(255, 215, 0, 0.05);
}

.tech-cost {
    font-size: 12px;
    color: #666;
}

.locker-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

/* Mobile Adjustments for Locker Room */
/* Mobile Adjustments for Locker Room */
@media screen and (max-width: 768px) {
    .locker-ui-layer {
        display: flex;
        flex-direction: column;
        padding: max(env(safe-area-inset-top) + 10px, 20px) 15px max(env(safe-area-inset-bottom) + 10px, 20px) 15px;
        width: 100%;
        height: 100%;
        overflow-y: auto;
        gap: 15px;
        background: rgba(0, 5, 10, 0.8); /* Darker bg for contrast */
    }

    /* Reset Panel Styles */
    .locker-panel, .side-panel.left, .side-panel.right {
        position: relative;
        top: auto; bottom: auto; left: auto; right: auto;
        width: 100%;
        height: auto;
        max-height: none;
        transform: none !important;
        clip-path: none !important;
        border: 1px solid var(--ffx-cyan);
        background: linear-gradient(160deg, rgba(6, 15, 30, 0.95) 0%, rgba(0, 0, 0, 0.9) 100%);
        border-radius: 16px;
        padding: 20px;
        margin: 0;
        animation: none;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }

    /* On mobile we stack panels; the desktop min-height creates a huge
       "dead" void between sections. Remove it so the 3D canvas behind is visible
       and the layout doesn't reserve a giant empty block. */
    .side-panel { min-height: 0 !important; }

    /* Header */
    .locker-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 10px;
        margin-bottom: 15px;
        border-bottom: 1px solid rgba(0, 255, 255, 0.2);
    }
    .locker-title { font-size: 12px; opacity: 0.7; }
    .locker-subtitle { font-size: 28px; }
    .locker-role { font-size: 20px; background: rgba(0,0,0,0.5); padding: 2px 8px; border-radius: 4px; }

    /* Stats: Horizontal Scroll Bubbles */
    .locker-stats {
        display: flex;
        grid-template-columns: none; /* Override grid */
        overflow-x: auto;
        gap: 12px;
        padding: 5px 5px 15px 5px;
        margin-bottom: 0;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .locker-stats::-webkit-scrollbar { display: none; }

    .stat-box {
        flex: 0 0 75px;
        height: 70px;
        flex-direction: column;
        justify-content: center;
        background: linear-gradient(135deg, rgba(0, 40, 80, 0.6), rgba(0, 10, 20, 0.8));
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-left: 1px solid rgba(255, 255, 255, 0.1); /* Reset desktop border */
        border-radius: 12px;
        padding: 5px;
        gap: 4px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    }
    .stat-name { font-size: 10px; color: var(--ffx-cyan); letter-spacing: 1px; margin-bottom: 0; }
    .stat-val { font-size: 20px; text-shadow: 0 0 10px rgba(255,255,255,0.2); }

    /* Nav Buttons */
/* Nav Buttons - Floating Side Overlays */
    .locker-nav {
        position: fixed;
        top: 50%;
        left: 0;
        right: 0;
        height: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 10px;
        margin: 0;
        pointer-events: none;
        z-index: 5000;
        transform: translateY(-50%);
    }

    .nav-btn {
        pointer-events: auto;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: rgba(0, 15, 30, 0.9);
        border: 2px solid var(--ffx-cyan);
        color: var(--ffx-cyan);
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 0; /* Hide text */
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
        backdrop-filter: blur(5px);
        flex: none;
        transition: transform 0.1s, background 0.2s;
    }

    .nav-btn:active {
        transform: scale(0.9);
        background: var(--ffx-cyan);
        color: #000;
    }

    .nav-btn::after {
        font-size: 24px;
        font-weight: bold;
        font-family: monospace;
    }

    #locker-btn-prev::after { content: '❮'; }
    #locker-btn-next::after { content: '❯'; }

    /* Tech Slots: Horizontal Scroll Circles */
    .tech-slots-container {
        display: flex;
        grid-template-columns: none; /* Override grid */
        overflow-x: auto;
        gap: 15px;
        padding: 10px 5px 20px 5px;
        margin-bottom: 10px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .tech-slots-container::-webkit-scrollbar { display: none; }

    .tech-slot {
        flex: 0 0 85px;
        height: 85px;
        flex-direction: column;
        border-radius: 50%;
        background: radial-gradient(circle at 30% 30%, rgba(20, 60, 100, 0.9), #000);
        border: 2px solid rgba(255, 255, 255, 0.15);
        border-left: 2px solid rgba(255, 255, 255, 0.15); /* Reset desktop */
        box-shadow: 0 5px 15px rgba(0,0,0,0.4);
        padding: 0;
        position: relative;
        overflow: hidden;
        transition: transform 0.2s, border-color 0.2s;
        justify-content: flex-start;
    }
    .tech-slot.selected {
        border-color: var(--ffx-cyan);
        box-shadow: 0 0 20px var(--ffx-cyan);
        transform: scale(1.05);
        background: radial-gradient(circle at 30% 30%, rgba(0, 100, 200, 0.9), #000);
    }

    .slot-icon {
        font-size: 24px;
        margin-top: 15px;
        margin-bottom: 0;
        width: 100%;
        text-shadow: 0 0 10px currentColor;
    }
    
    .slot-info {
        position: absolute;
        bottom: 12px;
        width: 100%;
        text-align: center;
        align-items: center;
    }
    
    .slot-type { display: none; } /* Hide label to save space */
    
    .slot-value {
        font-size: 9px;
        width: 90%;
        margin: 0 auto;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        background: rgba(0,0,0,0.6);
        border-radius: 4px;
        padding: 1px 2px;
    }

    /* Available Tech List */
    .tech-list {
        max-height: 250px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 0;
        background: rgba(0,0,0,0.2);
        border-radius: 8px;
    }
    .tech-list-item {
        padding: 15px;
        font-size: 14px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .locker-footer {
        margin-top: 15px;
        border-top: none;
        padding-top: 0;
    }
    .locker-footer .menu-item {
        width: 100%;
        justify-content: center;
        background: rgba(255, 68, 68, 0.2);
        border: 1px solid #ff4444;
        border-radius: 8px;
        transform: none;
        padding: 15px;
    }
}
/* Locker Tooltip */
.locker-tooltip {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background: rgba(0, 10, 30, 0.95);
    border: 1px solid var(--ffx-cyan);
    padding: 15px;
    color: #fff;
    font-family: var(--font-data);
    font-size: 14px;
    display: none;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    text-align: center;
    border-left: 4px solid var(--ffx-gold);
}
.locker-tooltip.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}
.locker-tooltip .tt-title {
    color: var(--ffx-gold);
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
    display: block;
    font-size: 16px;
    letter-spacing: 1px;
}
.locker-tooltip .tt-desc {
    color: #ccc;
    font-style: italic;
/* --- RADIAL MENU (SPHERE GRID STYLE) --- */
/* --- RADIAL MENU (SPHERE GRID STYLE) --- */
@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.radial-menu, .radial-menu-container {
    position: absolute;
    width: 0; height: 0;
    z-index: 2500; /* Above HUD */
    display: none;
    pointer-events: none; /* Allow clicks to pass through empty space */
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 10px rgba(0, 242, 255, 0.3));
}

.radial-menu.active, .radial-menu-container.active {
    display: block;
    animation: radialExpand 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes radialExpand {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(-45deg); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

/* Central Hub */
.radial-hub {
    position: absolute;
    top: 0; left: 0;
    transform: translate(-50%, -50%);
    width: 60px; height: 60px;
    background: radial-gradient(circle, #001133 0%, #000000 100%);
    border: 2px solid var(--ffx-cyan);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--ffx-cyan), inset 0 0 10px var(--ffx-cyan);
    pointer-events: auto;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
}

.radial-hub::after {
    content: '';
    position: absolute;
    width: 140%; height: 140%;
    border: 1px dashed rgba(0, 242, 255, 0.3);
    border-radius: 50%;
    animation: spinSlow 10s linear infinite;
}

.radial-hub .hub-core {
    width: 20px; height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px #fff, 0 0 30px var(--ffx-cyan);
    animation: pulse-glow 2s infinite;
}

/* Connections (SVG Layer) */
.radial-connections {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}

.radial-connections line {
    stroke: var(--ffx-cyan);
    stroke-width: 2;
    stroke-dasharray: 4 4;
    opacity: 0.6;
    animation: dashFlow 1s linear infinite;
}

@keyframes dashFlow {
    to { stroke-dashoffset: -8; }
}

/* Nodes */
.radial-node {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    pointer-events: none;
    z-index: 3;
}

.node-inner {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 50px; height: 50px;
    background: rgba(0, 10, 20, 0.9);
    border: 1px solid var(--ffx-gold);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 15px rgba(0,0,0,0.8);
}

/* Hover State - Zoom & Glow */
.node-inner:hover, .node-inner:active {
    transform: translate(-50%, -50%) scale(1.3);
    background: rgba(0, 40, 80, 0.95);
    border-color: #fff;
    box-shadow: 0 0 25px var(--ffx-cyan), inset 0 0 10px var(--ffx-cyan);
    z-index: 10;
}

.node-icon, .radial-icon {
    font-size: 20px;
    color: #fff;
    text-shadow: 0 0 5px var(--ffx-cyan);
    margin-bottom: 2px;
    pointer-events: none;
}

.node-label {
    position: absolute;
    bottom: -25px;
    font-family: var(--font-spira);
    font-size: 10px;
    color: var(--ffx-gold);
    white-space: nowrap;
    text-shadow: 0 0 2px #000;
    background: rgba(0,0,0,0.8);
    padding: 2px 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    transform: translateY(-5px);
}

.node-inner:hover .node-label {
    opacity: 1;
    transform: translateY(0);
}

/* Sphere Grid Node Glow Ring */
.node-glow {
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    opacity: 0;
    animation: spinSlow 4s linear infinite;
    pointer-events: none;
}

.node-inner:hover .node-glow {
    opacity: 1;
    border-color: var(--ffx-cyan);
/* --- AL BHED OVERRIDES --- */
/* --- AL BHED OVERRIDES --- */
body.lang-albhed .menu-item .label,
body.lang-albhed .sb-team-name,
body.lang-albhed .result-title,
body.lang-albhed .stat-title,
body.lang-albhed .league-title,
body.lang-albhed .panel-title,
body.lang-albhed .ffx-logo-main, /* Applied to main logo too */
body.lang-albhed .tech-text,
body.lang-albhed .announcement-slam {
    font-family: 'AlBhed', var(--font-albhed) !important;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* Ensure Spira font is used for specific elements regardless of language */
.ffx-logo-sub, .sb-team-sub, .radar-label, .distance-label, .charge-label, .hp-label, .en-label, .tech-label {
    font-family: 'Spira', var(--font-spira) !important;
/* Ensure Spira font is used for specific elements regardless of language */
.ffx-logo-sub, .sb-team-sub, .radar-label, .distance-label, .charge-label, .hp-label, .en-label, .tech-label {
    font-family: 'Spira', var(--font-spira) !important;
}

#fps-counter {
    position: fixed;
    top: 10px;
    left: 10px;
    font-family: var(--font-ui);
    font-size: 14px;
    color: #00ff00;
    pointer-events: none;
    z-index: 100000; /* Maximum Z-Index */
    text-shadow: 1px 1px 0 #000;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 255, 0, 0.3);
}

@media screen and (orientation: portrait) {
    #fps-counter {
        /* Keep at top-left in portrait to avoid bottom nav clutter */
        top: max(10px, env(safe-area-inset-top));
        left: max(10px, env(safe-area-inset-left));
        bottom: auto;
    }
}