/* ============================================================
   MAZE RUNNER QUIZ — Styles (maze.css)
   Futuristic neon-cyan maze with grass-green paths
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800;900&family=Orbitron:wght@400;700;900&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
    --maze-bg: #020617;
    --maze-wall: #00e5ff;
    --maze-wall-glow: rgba(0, 229, 255, 0.6);
    --maze-floor-light: #1b4332;
    --maze-floor-dark: #0d2818;
    --maze-border-outer: #00e5ff;
    --maze-border-inner: #7c3aed;
    --boys-color: #3b82f6;
    --boys-glow: rgba(59, 130, 255, 0.7);
    --girls-color: #ec4899;
    --girls-glow: rgba(236, 72, 153, 0.7);
    --boys-start: rgba(59, 130, 246, 0.15);
    --girls-start: rgba(236, 72, 153, 0.15);
}

/* ── Reset / Base ──────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Dashboard Body ────────────────────────────────────── */
body.dashboard-maze {
    font-family: 'Outfit', sans-serif;
    background: #020617;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(0, 229, 255, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.12) 0%, transparent 45%),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 24px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 24px);
    color: #f8fafc;
    min-height: 100vh;
}

/* ── Game Page Body ────────────────────────────────────── */
body.game-maze {
    font-family: 'Outfit', sans-serif;
    background: #020617;
    overflow: hidden;
    margin: 0; padding: 0;
    width: 100vw; height: 100vh;
    display: flex; flex-direction: column;
}

/* ── HUD (Top Progress Area) ───────────────────────────── */
.maze-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: rgba(2, 6, 23, 0.92);
    border-bottom: 2px solid rgba(0, 229, 255, 0.3);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
    gap: 14px;
    min-height: 72px;
}

.hud-team {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.hud-team.girls { flex-direction: row-reverse; }

.hud-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid var(--boys-color);
    box-shadow: 0 0 14px var(--boys-glow);
    background: #0f172a;
}

.hud-team.girls .hud-avatar {
    border-color: var(--girls-color);
    box-shadow: 0 0 14px var(--girls-glow);
}

.hud-avatar img {
    width: 100%; height: 100%; object-fit: cover;
    border-radius: 50%;
}

.hud-avatar-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem;
}

.hud-info { flex: 1; }

.hud-team.girls .hud-info { text-align: right; }

.hud-team-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--boys-color);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.hud-team.girls .hud-team-name { color: var(--girls-color); }

.hud-credit {
    font-size: 2rem;
    font-weight: 800;
    color: #10b981;
    margin-bottom: 5px;
}

.hud-progress-bar-wrap {
    position: relative;
    height: 10px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.hud-progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, #3b82f6, #00e5ff);
    box-shadow: 0 0 8px rgba(59,130,246,0.8);
    position: relative;
}

.hud-team.girls .hud-progress-fill {
    background: linear-gradient(90deg, #ec4899, #f472b6);
    box-shadow: 0 0 8px rgba(236,72,153,0.8);
}

.hud-progress-fill::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 6px;
    background: rgba(255,255,255,0.6);
    border-radius: 0 10px 10px 0;
    animation: progressPulse 1s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.hud-progress-pct {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
    font-size: 0.55rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 4px #000;
}

.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.hud-turn-badge {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 2px;
    padding: 5px 14px;
    border-radius: 50px;
    text-transform: uppercase;
    animation: hudPulse 2s ease-in-out infinite;
}

.hud-turn-badge.boys {
    background: rgba(59, 130, 246, 0.2);
    border: 2px solid var(--boys-color);
    color: var(--boys-color);
    box-shadow: 0 0 15px var(--boys-glow);
}

.hud-turn-badge.girls {
    background: rgba(236, 72, 153, 0.2);
    border: 2px solid var(--girls-color);
    color: var(--girls-color);
    box-shadow: 0 0 15px var(--girls-glow);
}

@keyframes hudPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.85; }
}

.hud-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* ── Maze Stage (Canvas Area) ──────────────────────────── */
.maze-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 10px;
}

.maze-canvas-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.maze-canvas-wrap canvas {
    display: block;
    border-radius: 8px;
    /* Futuristic neon border */
    box-shadow:
        0 0 0 2px #00e5ff,
        0 0 15px rgba(0,229,255,0.6),
        0 0 40px rgba(0,229,255,0.2),
        inset 0 0 20px rgba(0,229,255,0.05);
    border: 2px solid rgba(0,229,255,0.8);
}

/* Turn fade transitions */
.maze-canvas-wrap.fade-out {
    animation: mazeFadeOut 0.4s ease-out forwards;
}
.maze-canvas-wrap.fade-in {
    animation: mazeFadeIn 0.4s ease-out forwards;
}

@keyframes mazeFadeOut {
    to { opacity: 0; transform: scale(0.96); }
}
@keyframes mazeFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

/* ── No Maze Placeholder ───────────────────────────────── */
.maze-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: rgba(0,229,255,0.4);
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.maze-placeholder .maze-placeholder-icon {
    font-size: 4rem;
    filter: grayscale(1) opacity(0.4);
}

.maze-placeholder p { font-size: 0.75rem; }

/* ── Credit Particle Animation ─────────────────────────── */
.credit-particle {
    position: fixed;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    pointer-events: none;
    z-index: 3000;
    animation: creditFloat 2s ease-out forwards;
    text-shadow: 0 0 20px currentColor;
}

@keyframes creditFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    80% { opacity: 1; transform: translateY(-80px) scale(1.2); }
    100% { opacity: 0; transform: translateY(-120px) scale(0.8); }
}

/* ── Quiz Overlay (matches monopoly style) ─────────────── */
.maze-quiz-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background: rgba(2, 6, 23, 0.88);
    backdrop-filter: blur(18px);
}

.maze-quiz-overlay.active {
    display: flex;
    animation: mazeQuizIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mazeQuizIn {
    from { opacity: 0; transform: scale(0.82) translateY(40px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.maze-quiz-card {
    padding: 50px 60px;
    max-width: 820px;
    width: 92%;
    border-radius: 28px;
    background: rgba(10, 15, 35, 0.98);
    border: 2px solid rgba(0, 229, 255, 0.5);
    box-shadow:
        0 0 60px rgba(0, 229, 255, 0.2),
        0 0 120px rgba(124, 58, 237, 0.15),
        inset 0 0 30px rgba(0, 229, 255, 0.03);
}

.maze-quiz-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.maze-quiz-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: #00e5ff;
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(0,229,255,0.5);
}

.maze-quiz-team-badge {
    display: inline-block;
    padding: 8px 28px;
    border-radius: 50px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.maze-quiz-team-badge.boys {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #fff;
    box-shadow: 0 0 20px rgba(59,130,246,0.4);
}

.maze-quiz-team-badge.girls {
    background: linear-gradient(135deg, #831843, #ec4899);
    color: #fff;
    box-shadow: 0 0 20px rgba(236,72,153,0.4);
}

.maze-quiz-question {
    font-size: clamp(1.1rem, 2.8vw, 1.7rem);
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 28px;
    line-height: 1.55;
    font-family: 'Hind Siliguri', 'Outfit', sans-serif;
    text-align: center;
}

.maze-quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    text-align: left;
}

.maze-quiz-option {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(0, 229, 255, 0.15);
    border-radius: 14px;
    font-size: clamp(0.9rem, 2.2vw, 1.2rem);
    color: #cbd5e1;
    font-weight: 600;
    transition: all 0.3s;
    font-family: 'Hind Siliguri', 'Outfit', sans-serif;
}

.maze-quiz-option:hover {
    border-color: rgba(0, 229, 255, 0.4);
    background: rgba(0, 229, 255, 0.06);
}

.maze-quiz-opt-label {
    color: #00e5ff;
    font-weight: 900;
    margin-right: 10px;
}

.maze-quiz-result-badge {
    margin-top: 24px;
    padding: 16px 28px;
    border-radius: 14px;
    font-size: 1.4rem;
    font-weight: 900;
    display: none;
    text-align: center;
    animation: resultPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes resultPop {
    from { transform: scale(0.4); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.maze-quiz-result-badge.correct {
    background: rgba(16, 185, 129, 0.18);
    border: 2px solid #10b981;
    color: #10b981;
}

.maze-quiz-result-badge.wrong {
    background: rgba(239, 68, 68, 0.18);
    border: 2px solid #ef4444;
    color: #ef4444;
}

/* ── Winner Overlay ────────────────────────────────────── */
.maze-winner-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background: rgba(2, 6, 23, 0.96);
    backdrop-filter: blur(24px);
}

.maze-winner-overlay.active {
    display: flex;
    animation: winnerFadeIn 0.5s ease-out;
}

@keyframes winnerFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.maze-winner-content {
    padding: 60px;
    border: 4px solid #00e5ff;
    box-shadow: 0 0 60px rgba(0,229,255,0.4), 0 0 120px rgba(124,58,237,0.2);
    max-width: 900px;
    width: 90%;
    border-radius: 28px;
    background: rgba(10, 15, 35, 0.98);
    text-align: center;
}

.maze-winner-confetti {
    font-size: 3rem;
    animation: confettiSpin 0.8s linear infinite;
}

@keyframes confettiSpin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

/* ── Runner Glow on Canvas ─────────────────────────────── */
.runner-glow-boys { filter: drop-shadow(0 0 8px #3b82f6); }
.runner-glow-girls { filter: drop-shadow(0 0 8px #ec4899); }

/* ── Maze start/end markers ────────────────────────────── */
.maze-marker {
    position: absolute;
    font-size: 1rem;
    pointer-events: none;
    z-index: 10;
}

/* ─── Dashboard Controls ───────────────────────────────── */
.maze-control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1500px;
    margin: 0 auto;
}

.maze-team-card {
    padding: 26px;
    text-align: center;
    border-radius: 24px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.maze-team-card.boys { border-top: 8px solid var(--boys-color); }
.maze-team-card.girls { border-top: 8px solid var(--girls-color); }
.maze-team-card.control { border-top: 8px solid #7c3aed; }

.maze-stat-label {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 5px;
}

.maze-stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
}

/* D-pad controller */
.dpad {
    display: grid;
    grid-template-areas:
        ". up ."
        "left center right"
        ". down .";
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    width: 160px;
    margin: 12px auto;
}

.dpad-btn {
    width: 48px; height: 48px;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    user-select: none;
}

.dpad-btn:hover { transform: scale(1.12); filter: brightness(1.25); }
.dpad-btn:active { transform: scale(0.94); }

.dpad-btn.up    { grid-area: up;     background: linear-gradient(135deg, #1e40af, #3b82f6); }
.dpad-btn.down  { grid-area: down;   background: linear-gradient(135deg, #1e40af, #3b82f6); }
.dpad-btn.left  { grid-area: left;   background: linear-gradient(135deg, #1e40af, #3b82f6); }
.dpad-btn.right { grid-area: right;  background: linear-gradient(135deg, #1e40af, #3b82f6); }
.dpad-btn.center{ grid-area: center; background: rgba(255,255,255,0.06); cursor: default; font-size: 0.55rem; color: #64748b; letter-spacing: 1px; }

.dpad-girls .dpad-btn.up,
.dpad-girls .dpad-btn.down,
.dpad-girls .dpad-btn.left,
.dpad-girls .dpad-btn.right {
    background: linear-gradient(135deg, #9d174d, #ec4899);
}

.dpad-cost-note {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* Maze generator size buttons */
.maze-size-btns {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 10px 0;
}

.maze-size-btn {
    padding: 8px 16px;
    border-radius: 10px;
    border: 2px solid rgba(0, 229, 255, 0.3);
    background: rgba(0, 229, 255, 0.06);
    color: #00e5ff;
    font-weight: 800;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Orbitron', sans-serif;
}

.maze-size-btn:hover,
.maze-size-btn.active {
    background: rgba(0, 229, 255, 0.18);
    border-color: #00e5ff;
    box-shadow: 0 0 12px rgba(0,229,255,0.3);
    transform: scale(1.05);
}

/* Turn control buttons */
.turn-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.turn-btn {
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-weight: 900;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
}

.turn-btn.boys-turn {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.turn-btn.girls-turn {
    background: linear-gradient(135deg, #831843, #ec4899);
    box-shadow: 0 4px 12px rgba(236,72,153,0.3);
}

.turn-btn:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.15); }
.turn-btn.active-turn { animation: turnGlow 1.5s ease-in-out infinite; }

@keyframes turnGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
    50% { box-shadow: 0 0 25px rgba(59,130,246,0.8); }
}

/* Quiz section dashboard */
.maze-quiz-section {
    padding: 20px;
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 16px;
}

.maze-quiz-question-box {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: none;
}

.maze-quiz-question-box .q-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 10px;
}

.maze-quiz-question-box .q-option {
    padding: 5px 8px;
    margin: 3px 0;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.maze-quiz-question-box .q-answer {
    margin-top: 10px;
    padding: 8px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid #10b981;
    border-radius: 8px;
    color: #10b981;
    font-weight: 800;
    text-align: center;
    font-size: 0.85rem;
}

/* Winner section dashboard */
.maze-winner-section {
    padding: 20px;
    margin-top: 20px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
}

.maze-winner-section input[type="text"] {
    width: 100%;
    margin: 5px 0;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
}

/* Session management */
.maze-session-section {
    padding: 20px;
    margin-top: 20px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-radius: 16px;
}

.maze-session-section select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.4);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
}

/* Progress mini-bar in dashboard */
.mini-progress-wrap {
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    margin-top: 6px;
    overflow: hidden;
}

.mini-progress-fill-boys {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #3b82f6, #00e5ff);
    transition: width 0.4s ease;
}

.mini-progress-fill-girls {
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(90deg, #ec4899, #f472b6);
    transition: width 0.4s ease;
}

/* Toast */
.maze-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 26px;
    border-radius: 12px;
    background: rgba(10,15,35,0.96);
    border: 1px solid rgba(0,229,255,0.4);
    color: #00e5ff;
    font-weight: 700;
    font-size: 0.85rem;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 0.3s;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 900px) {
    .maze-control-grid { grid-template-columns: 1fr; }
    .maze-quiz-card { padding: 30px 20px; }
    .maze-quiz-options { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .maze-hud { padding: 6px 10px; gap: 8px; }
    .hud-avatar { width: 40px; height: 40px; }
    .hud-turn-badge { font-size: 0.55rem; padding: 4px 10px; }
}

/* Solved path highlight on canvas is drawn via JS */

/* Scan-line overlay for game page */
body.game-maze::after {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.08) 50%),
                linear-gradient(90deg, rgba(0,255,255,0.02), rgba(100,0,255,0.01), rgba(0,255,255,0.02));
    z-index: 5000;
    pointer-events: none;
    background-size: 100% 3px, 3px 100%;
    opacity: 0.25;
}
