@font-face {
    font-family: 'BpmfHuninn';
    src: url('../assets/fonts/BpmfHuninn-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-dark: #0f0f1a;
    --bg-panel: rgba(255, 255, 255, 0.05);

    /* Neon Colors */
    --neon-blue: #00f3ff;
    --neon-pink: #ff00ff;
    --neon-green: #00ff9d;
    --neon-yellow: #ffbd00;

    /* Team Colors */
    --team-left: var(--neon-blue);
    --team-right: var(--neon-pink);

    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    /* Prevent browser zooming/scrolling */
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    background-color: #000;
    color: #fff;
    font-family: var(--font-main);
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Prevent bouncy scroll on iOS */
}

#app-container {
    width: 1920px;
    height: 1080px;
    position: absolute;
    top: 50%;
    left: 50%;
    background-color: #000;
    overflow: hidden;
    transform-origin: center center;
}

#game-screen,
#rule-overlay {
    font-family: 'BpmfHuninn', var(--font-main);
}

/* --- Typography --- */
h1,
h2,
h3 {
    margin: 0;
    text-shadow: 0 0 10px currentColor;
}

.text-neon-blue {
    color: var(--neon-blue);
}

.text-neon-pink {
    color: var(--neon-pink);
}

/* --- Components --- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    z-index: 10;
    transition: opacity 0.5s, transform 0.5s;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
    z-index: -1;
}

.btn-primary {
    padding: 15px 40px;
    font-size: 1.5rem;
    border: 2px solid var(--neon-blue);
    background: rgba(0, 243, 255, 0.1);
    color: var(--neon-blue);
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-primary:active {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 0 0 30px var(--neon-blue);
}

.btn-danger {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    background: rgba(255, 0, 255, 0.1);
}

.btn-danger:active {
    background: var(--neon-pink);
    color: #000;
}

/* --- Login Screen --- */
#login-screen {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a2e 0%, #000 100%);
    overflow: hidden;
}

.main-title-container {
    position: relative;
    width: 100%;
    text-align: center;
    margin-bottom: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.center-glow-line {
    position: absolute;
    width: 4px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(to bottom,
            rgba(0, 243, 255, 0) 0%,
            rgba(0, 243, 255, 0.8) 40%,
            rgba(255, 0, 255, 0.8) 60%,
            rgba(255, 0, 255, 0) 100%);
    box-shadow: -1px 0 8px rgba(0, 243, 255, 0.5), 1px 0 8px rgba(255, 0, 255, 0.5);
    z-index: 0;
}

.main-title {
    font-size: 12rem;
    font-weight: 800;
    letter-spacing: 25px;
    z-index: 10;
    line-height: 1;
    position: relative;
}

.title-blue {
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
}

.title-pink {
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
}

.title-split {
    position: relative;
    color: #fff;
    text-shadow: -15px 0 30px var(--neon-blue), 15px 0 30px var(--neon-pink);
}

.title-split::after {
    content: '';
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 140%;
    background: radial-gradient(circle, #fff 0%, transparent 70%);
    filter: blur(10px);
    z-index: -1;
}

.subtitle-row {
    display: flex;
    width: 1250px;
    justify-content: space-between;
    margin-top: 30px;
    z-index: 10;
}

.subtitle-left,
.subtitle-right {
    font-size: 2.5rem;
    letter-spacing: 10px;
    color: #888;
    text-transform: uppercase;
    font-weight: 300;
}

.vs-logo {
    margin-top: 60px;
    font-size: 6rem;
    font-weight: 900;
    font-style: italic;
    font-family: 'Arial Black', sans-serif;
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, #fff 50%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

.login-panel {
    width: 900px;
    padding: 60px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label {
    font-size: 1.5rem;
    color: #888;
    text-transform: uppercase;
}

.team-inputs {
    display: flex;
    gap: 20px;
}

input[type="text"] {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #333;
    padding: 25px;
    color: white;
    font-size: 2rem;
    border-radius: 8px;
    width: 100%;
}

#enter-btn {
    padding: 25px;
    font-size: 3rem;
    letter-spacing: 5px;
    margin-top: 30px !important;
}

input[type="text"]:focus {
    border-color: var(--neon-blue);
    outline: none;
}

.match-settings {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.setting-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #555;
    background: transparent;
    color: #888;
    cursor: pointer;
}

.setting-btn.active {
    border-color: var(--neon-green);
    color: var(--neon-green);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.2);
}

/* --- Dashboard --- */
#dashboard-screen {
    padding: 40px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.score-board {
    display: flex;
    align-items: center;
    gap: 40px;
    font-size: 3rem;
    font-weight: bold;
}

.score-left {
    color: var(--team-left);
    text-shadow: 0 0 20px var(--team-left);
}

.score-right {
    color: var(--team-right);
    text-shadow: 0 0 20px var(--team-right);
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 20px 0;
}

.game-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    height: 350px;
}

.game-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-5px);
    border-color: var(--neon-blue);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.1);
}

.game-card h3 {
    margin-top: 20px;
    font-size: 3rem;
    text-align: center;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.5);
}

.game-card p {
    font-size: 1.6rem !important;
}

.game-icon {
    font-size: 8rem;
    margin-bottom: 20px;
}

/* --- Game Container (Split Screen) --- */
#game-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
}

.player-zone {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    border-right: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 5;
    overflow: hidden;
}

.player-zone:last-child {
    border-right: none;
    box-shadow: none;
    z-index: 1;
}

/* Game Specific Styles */

#game-wrapper[data-game="stroop"] .game-content {
    justify-content: flex-start;
    /* Align to top */
    padding-top: 50px;
    /* Space from top */
    padding-left: 20px;
    padding-right: 20px;
}

#game-wrapper[data-game="path"] svg {
    width: 70% !important;
    height: 70% !important;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

.zone-header {
    position: absolute;
    top: 10px;
    width: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    z-index: 100;
    pointer-events: none;
    /* Allow clicks to pass through to game */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

#zone-left .zone-header {
    left: 0;
}

#zone-right .zone-header {
    right: 0;
}


/* --- Common Game UI --- */
.game-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.timer-float {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    border: 1px solid #333;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 2rem;
    z-index: 100;
}

#rule-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1 !important;
    /* Override inline style */
}

/* --- Victory Screen --- */
#victory-screen {
    justify-content: center;
    align-items: center;
    text-align: center;
    background: rgba(0, 0, 0, 0.95);
}

.winner-announce {
    font-size: 6rem;
    margin-bottom: 20px;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        transform: scale(1);
        text-shadow: 0 0 20px currentColor;
    }

    to {
        transform: scale(1.05);
        text-shadow: 0 0 50px currentColor;
    }
}

/* --- Utilities --- */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 20000;
    opacity: 0.8;
}

.back-btn:hover {
    opacity: 1;
}

/* --- Orientation Lock --- */
#orientation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 100000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

#orientation-overlay .phone-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: rotate-phone 2s infinite ease-in-out;
}

@keyframes rotate-phone {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(90deg);
    }

    100% {
        transform: rotate(90deg);
    }
}

@media screen and (orientation: portrait) {
    #orientation-overlay {
        display: flex;
    }
}

/* --- Block Counter Game --- */
.block-game-area {
    font-family: 'Courier New', monospace;
}

.iso-scene {
    position: relative;
    /* transition: transform 0.5s; Handles rotation smoothly */
}

/* 3D Blocks */
.block {
    position: absolute;
    width: 50px;
    height: 50px;
}

.face {
    position: absolute;
    width: 50px;
    height: 50px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background 0.3s, opacity 0.3s;
}

/* Colors & Shading */
/* Colors & Shading - 2.5D Isometric Optimization */
/* Light Source: Top Left */

/* TOP Face - Lightest */
.face-top {
    transform: rotateX(0deg) translateZ(50px);
    background: var(--team-left);
    /* Dynamic team color potentially, but using base for now */
    filter: brightness(1.3);
    /* Brightest */
    width: 50px;
    height: 50px;
}

/* RIGHT Face - Medium (Side) */
.face-right {
    transform: rotateY(90deg) translateZ(25px) translateX(25px);
    background: var(--team-left);
    filter: brightness(0.9);
    /* Medium Shadow */
    width: 50px;
    height: 50px;
}

/* FRONT Face - Darkest (Front/Side) */
.face-front {
    transform: rotateX(-90deg) translateZ(25px) translateY(25px);
    background: var(--team-left);
    filter: brightness(0.6);
    /* Dark Shadow */
    width: 50px;
    height: 50px;
}

/* Left/Back/Bottom are usually hidden or same as Right/Front reversed */
.face-left {
    transform: rotateY(-90deg) translateZ(25px) translateX(-25px);
    background: var(--team-left);
    filter: brightness(0.9);
    width: 50px;
    height: 50px;
}

.face-back {
    transform: rotateX(90deg) translateZ(25px) translateY(-25px);
    background: var(--team-left);
    filter: brightness(0.6);
    width: 50px;
    height: 50px;
}

.face-bottom {
    transform: rotateX(180deg) translateZ(0px);
    /* At base */
    background: #000;
    width: 50px;
    height: 50px;
}

/* We don't really see bottom/back usually in this angle */


/* X-Ray Mode */
.iso-scene.xray-mode .face {
    opacity: 0.3;
    border: 1px solid rgba(0, 243, 255, 0.8);
    background: rgba(0, 243, 255, 0.1);
}

.iso-scene.xray-mode .face-top {
    background: rgba(0, 243, 255, 0.2);
}

/* Keypad Frozen State */
.input-area.frozen .num-btn {
    background: #555;
    color: #888;
    border-color: #555;
    cursor: not-allowed;
}

/* Input Display */
/* --- Loader Overlay --- */
#loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
}

#loader.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

.loader-content {
    text-align: center;
}

.ready-text,
.go-text,
.round-winner-text {
    font-size: 8rem;
    font-weight: bold;
    color: var(--neon-blue);
    text-shadow: 0 0 20px var(--neon-blue), 0 0 50px var(--neon-blue);
    letter-spacing: 15px;
    animation: pulse-loader 0.8s infinite alternate;
}

.ready-text.hidden,
.go-text.hidden,
.round-winner-text.hidden {
    display: none !important;
}

.go-text {
    color: #2ed573;
    text-shadow: 0 0 20px #2ed573, 0 0 50px #2ed573;
}

@keyframes pulse-loader {
    from {
        transform: scale(0.9);
        opacity: 0.7;
    }

    to {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Symmetry Game Axis Line */
.symmetry-grid {
    position: relative;
}

.symmetry-grid::after {
    content: '';
    position: absolute;
    background: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
}

.symmetry-grid[data-axis="v"]::after {
    opacity: 1;
    width: 4px;
    height: 100%;
    left: calc(50% - 2px);
    top: 0;
}

.symmetry-grid[data-axis="h"]::after {
    opacity: 1;
    width: 100%;
    height: 4px;
    left: 0;
    top: calc(50% - 2px);
}