/* Import fonts */
@font-face {
    font-family: 'NeuzeitGrotesk';
    src: url('../fonts/NeuzeitGro-Bol.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

:root {
    --primary-bg: #1B1464; /* Brand Navy */
    --secondary-bg: #0D0A35; /* Darker shade for contrast */
    --accent-blue: #00EDFF; /* Brand Cyan */
    --accent-red: #E95044; /* Experience Red (from PDF palette) */
    --accent-purple: #B26FAB; /* Innovation Purple (from PDF palette) */
    --text-light: #FFFFFF;
    --text-dark: #A0A0A0;
    --border-color: #00EDFF; /* Cyan borders */
    --header-font: 'NeuzeitGrotesk', 'Montserrat', sans-serif; /* Use Neuzeit Grotesk */
    --body-font: 'Montserrat', sans-serif; /* Substitute for Aktiv Grotesk */
}

body {
    font-family: var(--body-font);
    background-color: var(--primary-bg);
    background: radial-gradient(circle at 50% 50%, #1B1464 0%, #000000 100%);
    /* User requested specific parameters for the gradient: 15% 10% center, -5% cyan, 50% navy */
    background: radial-gradient(circle at 15% 10%, #00EDFF -5%, #1B1464 50%);
    color: var(--text-light);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative; 
}

/* --- ISECI Circles Motif REMOVED --- */
/* body::before, body::after removed */


/* Additional decorative circle container to hold more rings if needed */
.screen {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    box-sizing: border-box;
    justify-content: center;
    text-align: center;
    padding: 0 20px 20px 20px; /* Removed top padding */
    z-index: 1; /* Ensure content is above background */
}

.hidden {
    display: none !important;
}

/* --- General Elements --- */
.logo {
    font-family: var(--header-font);
    font-size: 2em;
    font-weight: 800;
    color: var(--text-light);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.1;
}

.modern-button {
    background-color: transparent;
    border: 2px solid #FFFFFF;
    border-radius: 30px;
    color: #FFFFFF;
    padding: 15px 30px;
    font-size: 1.1em;
    font-family: var(--header-font);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none; /* Removed glow */
    width: 90%;
    max-width: 350px;
    margin: 5px 0;
    -webkit-tap-highlight-color: transparent; /* Remove mobile tap highlight */
    outline: none;
}

/* Hover (Desktop) & Active (Press) get effect */
.modern-button:hover, .modern-button:active {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    transform: scale(1.02);
    color: #FFFFFF;
    border-color: #FFFFFF;
}

/* Focus & Visited reset to normal */
.modern-button:focus, .modern-button:visited {
    background-color: transparent;
    transform: scale(1);
    color: #FFFFFF;
    border-color: #FFFFFF;
    outline: none;
}

.modern-button:active {
    transform: scale(0.98);
}

.modern-button:disabled {
    background-color: #444;
    color: #888;
    box-shadow: none;
    cursor: not-allowed;
}

.utility-button {
    margin-top: -10px !important; /* Move closer to the button above */
}
.utility-button:hover {
    background: rgba(0, 237, 255, 0.1);
    color: var(--text-light);
}

.player-gamertag {
    font-weight: 700;
    letter-spacing: 0.05em;
    font-size: 1.2em;
    color: var(--accent-blue) !important; /* Force Cyan for names */
}


/* --- Screen Specific --- */

/* Specific override for start screen to visually lift content */
#start-screen {
    padding-bottom: 15vh; /* Pushes content up from the center */
}

/* Hide the status text (Connected, Disconnected, etc.) on start screen */
#hud {
    display: none;
}

#start-screen .screen-main, #queue-screen .screen-main, #game-over-screen .screen-main, #countdown-screen .screen-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

#countdown-display {
    font-family: var(--header-font);
    font-size: 12vw; /* Reduced size */
    font-weight: 800;
    color: var(--text-light);
    text-shadow: 0 0 20px var(--accent-blue);
    white-space: nowrap;
    overflow: visible;
    width: 100%;
    text-align: center;
    line-height: 1.2;
}

#countdown-display .player-gamertag {
    font-size: 0.6em; /* Relative to countdown text */
    display: block;
    margin-top: 10px;
    color: var(--accent-blue);
}

#queue-display {
    font-size: 1.5em;
    line-height: 1.5em;
}

/* --- Active Controller Screen --- */
#controller-screen {
    justify-content: space-between;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Grid Layout for Header - Handles alignment properly */
#controller-screen .screen-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* Left, Center, Right */
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    box-sizing: border-box;
    background: rgba(27, 20, 100, 0.9);
    border-bottom: 2px solid var(--border-color);
    position: relative;
    transition: border-color 0.3s ease;
    z-index: 10;
}

#controller-header-title {
    font-family: var(--header-font);
    font-weight: 700;
    font-size: 1.2em;
    text-transform: uppercase;
    color: inherit;
    justify-self: start; /* Align Left */
    margin: 0;
}

.hud-display {
    display: flex;
    flex-direction: row; /* Always row */
    gap: 30px;
    font-size: 1.2em;
    font-weight: 700;
    justify-content: center;
    justify-self: center; /* Align Center */
    width: auto;
}

.hud-display div {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stats colors */
#hud-lives {
    order: 1;
    color: var(--accent-red);
}
#hud-score {
    order: 2;
    color: var(--accent-blue);
}

#hud-lives .lucide { stroke: var(--accent-red); }
#hud-score .lucide { stroke: var(--accent-blue); }

/* Toggle Button - Align Right */
#motion-toggle {
    justify-self: end;
    position: relative;
    margin: 0;
}

/* Portrait Override */
@media (orientation: portrait) {
    #controller-screen .screen-header {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding-top: 25px;
    }
    
    /* In portrait flex, resetting alignments */
    #motion-toggle {
        align-self: center; 
    }
}

/* Icons */
.icon-button {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--accent-blue);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    padding: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.icon-button .motion-icon {
    width: 32px;
    height: 32px;
    stroke-width: 1.5;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.icon-button .motion-active {
    display: none;
}
.icon-button .motion-inactive {
    display: block;
    stroke: var(--accent-blue);
}
.icon-button.active .motion-active {
    display: block;
    stroke: var(--primary-bg); /* Contrast on active background */
}
.icon-button.active .motion-inactive {
    display: none;
}

/* Portrait Hint */
.portrait-hint {
    display: none;
    font-family: var(--body-font);
    font-size: 1.2em;
    color: var(--accent-blue);
    margin-top: 10px;
    animation: blink 2s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@media (orientation: portrait) {
    #motion-toggle { display: none; }
    .portrait-hint { display: block; }
}

.icon-button .lucide {
    stroke: var(--accent-blue);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.icon-button.active {
    background: var(--accent-blue);
}
.icon-button.active .motion-icon, .icon-button.active .smartphone-overlay, .icon-button.active .lucide {
    stroke: var(--primary-bg); /* Invert on active */
}


#controller-screen .screen-main {
    flex-grow: 1;
    padding: 0;
    width: 100%;
    position: relative;
    display: flex;
}

#control-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    flex-grow: 1;
    width: 100%;
    height: 100%;
}

#joystick-zone, #action-zone {
    position: relative;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
}

/* Circular decorative elements for ISECI theme */
#joystick-zone::before, #action-zone::before {
    content: '';
    position: absolute;
    width: 70%;
    padding-bottom: 70%;
    border: 1px solid rgba(0, 237, 255, 0.1);
    border-radius: 50%;
    pointer-events: none;
}
#joystick-zone::after, #action-zone::after {
    content: '';
    position: absolute;
    width: 50%;
    padding-bottom: 50%;
    border: 1px solid rgba(0, 237, 255, 0.2);
    border-radius: 50%;
    pointer-events: none;
}

.background-icon {
    position: absolute;
    width: 40%;
    height: 40%;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
    pointer-events: none;
}

#joystick-zone {
    border-right: 1px solid rgba(0, 237, 255, 0.2);
}

#action-zone {
    cursor: pointer;
    background: radial-gradient(circle, rgba(0, 237, 255, 0.1) 0%, rgba(27, 20, 100, 0) 70%);
}

#action-zone:active {
    background: radial-gradient(circle, rgba(0, 237, 255, 0.3) 0%, rgba(27, 20, 100, 0) 70%);
}

/* --- Action Zone Animations (Fire Ripple) --- */
.fire-ripple {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%) scale(0.5);
    pointer-events: none;
    animation: ripple-effect 0.4s linear forwards;
}

@keyframes ripple-effect {
    to {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
        border-width: 0;
    }
}

/* --- NippleJS Custom Rings --- */
.nipple.back {
    background: transparent !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50%;
}
.nipple.front {
    background: transparent !important;
    border: 2px solid rgba(255, 255, 255, 0.8) !important;
    box-shadow: none !important;
    opacity: 1 !important;
}