/* ==========================================
   Global & Layout Styling
   ========================================== */
body {
    background-color: #090d16;
    color: #f8fafc;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

.container {
    text-align: center;
    background-color: #1e293b;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    width: 340px;
    max-width: 90vw;
    box-sizing: border-box;
    transition: width 0.2s ease;
}

/* PC Mode expansion for the outer container */
.container.pc-mode-active {
    width: 500px;
}

header {
    margin-bottom: 12px;
}

h1 {
    margin: 0 0 5px 0;
    color: #38bdf8;
    font-size: 1.5rem;
}

.subtitle {
    color: #94a3b8;
    font-size: 0.85rem;
    margin: 0 0 10px 0;
}

.nav-bar {
    text-align: left;
    margin-bottom: 10px;
}

.home-link {
    color: #38bdf8;
    text-decoration: none;
    font-size: 0.85rem;
}

.home-link:hover {
    text-decoration: underline;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-btn {
    display: block;
    color: white;
    text-decoration: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    transition: transform 0.1s, filter 0.2s;
}

.menu-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-green {
    background-color: #16a34a;
    border: 1px solid #22c55e;
}

.btn-orange {
    background-color: #ea580c;
    border: 1px solid #f97316;
}

/* Device Mode Toggle Buttons on Index Page */
.global-device-toggle {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.toggle-btn {
    background-color: #334155;
    color: #94a3b8;
    border: 1px solid #475569;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.toggle-btn.active {
    background-color: #0284c7;
    color: white;
    border-color: #38bdf8;
}

/* ==========================================
   Universal Game Dashboards & Scoreboards
   ========================================== */
.game-dashboard {
    position: relative;
}

.score-board {
    display: flex;
    justify-content: space-around;
    background: #0f172a;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    border: 1px solid #334155;
}

#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

#start-btn, .ctrl-btn {
    background-color: #0284c7;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#start-btn:hover, .ctrl-btn:hover {
    background-color: #0369a1;
}

/* ==========================================
   Target Practice Game Styling
   ========================================== */
#game-container {
    position: relative;
    width: 100%;
    max-width: 280px;
    height: 350px;
    background-color: #0f172a;
    margin: 0 auto;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid #334155;
    background-image: radial-gradient(circle, #1e293b 10%, #0f172a 90%);
}

.target, .decoy {
    position: absolute;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    transition: transform 0.1s ease;
}

.target.small { width: 45px; height: 45px; }
.target.medium { width: 60px; height: 60px; }
.target.large { width: 75px; height: 75px; }

.decoy.small { width: 45px; height: 45px; }
.decoy.medium { width: 60px; height: 60px; }
.decoy.large { width: 75px; height: 75px; }

.ring-outer {
    width: 100%;
    height: 100%;
    background-color: #ef4444;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}

.ring-mid {
    width: 65%;
    height: 65%;
    background-color: #ffffff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ring-inner {
    width: 35%;
    height: 35%;
    background-color: #3b82f6;
    border-radius: 50%;
}

.decoy {
    background-color: #7c3aed;
    border: 2px solid #a78bfa;
}

.decoy-inner {
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

/* ==========================================
   Speed Racing Game Styling (Full Width Road)
   ========================================== */
#racing-container {
    position: relative;
    width: 100%;
    max-width: 280px;
    height: 350px;
    background-color: #334155;
    margin: 0 auto;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid #334155;
}

.road {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #334155;
    margin: 0 auto;
    border-left: none;
    border-right: none;
}

.car, .obstacle-car {
    position: absolute;
    width: 36px;
    height: 60px;
    background-color: #0284c7;
    border-radius: 6px;
    bottom: 30px;
    transition: left 0.1s ease-out;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.obstacle-car {
    background-color: #dc2626;
    bottom: auto;
}

.car .windshield, .obstacle-car .windshield {
    position: absolute;
    width: 26px;
    height: 16px;
    background-color: #cbd5e1;
    top: 8px;
    left: 5px;
    border-radius: 2px;
}

.headlights {
    position: absolute;
    width: 28px;
    height: 4px;
    background-color: #fde047;
    top: 2px;
    left: 4px;
    border-radius: 2px;
}

.tailights {
    position: absolute;
    width: 28px;
    height: 4px;
    background-color: #f87171;
    bottom: 2px;
    left: 4px;
    border-radius: 2px;
}

.racing-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    gap: 6px;
}

/* ==========================================
   Soccer Challenge Game Styling
   ========================================== */
#soccer-container {
    position: relative;
    width: 100%;
    max-width: 280px;
    height: 350px;
    background-color: #0f172a;
    margin: 0 auto;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid #334155;
    background-image: linear-gradient(to bottom, #1e293b 0%, #0f172a 100%);
}

.goal-frame {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 110px;
    border: 4px solid #f8fafc;
    border-bottom: none;
    background-color: rgba(51, 65, 85, 0.4);
}

#goalie {
    position: absolute;
    top: 0;
    width: 65px;
    height: 25px;
    background-color: #ef4444;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#ball {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 34px;
    height: 34px;
    background-color: #ffffff;
    border-radius: 50%;
    cursor: pointer;
}

.soccer-instructions {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* ==========================================
   Memory Match Game Styling
   ========================================== */
#memory-container {
    position: relative;
    width: 100%;
    max-width: 280px;
    height: 350px;
    background-color: #0f172a;
    margin: 0 auto;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid #334155;
    display: flex;
    justify-content: center;
    align-items: center;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    box-sizing: border-box;
}

.memory-card {
    aspect-ratio: 1;
    cursor: pointer;
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.4s;
    transform-style: preserve-3d;
}

.memory-card.flipped .card-inner,
.memory-card.matched .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.card-front {
    background-color: #0284c7;
    color: white;
    font-weight: bold;
}

.card-back {
    background-color: #334155;
    color: white;
    transform: rotateY(180deg);
}

/* ==========================================
   Platform Jump Specific Styling
   ========================================== */
#footstep-container {
    position: relative;
    width: 100%;
    max-width: 280px;
    height: 350px;
    background-color: #0f172a;
    margin: 0 auto;
    box-sizing: border-box;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid #334155;
    background-image: radial-gradient(circle, #1e293b 10%, #0f172a 90%);
}

.circular-platform {
    position: absolute;
    width: 48px;
    height: 48px;
    background: radial-gradient(circle, #22c55e 40%, #16a34a 100%);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.3);
    border: 2px solid #86efac;
    z-index: 5;
    transition: top 0.15s ease-out, left 0.1s ease-out, transform 0.15s ease, opacity 0.15s ease;
}

.footstep-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    gap: 6px;
}

.ctrl-btn {
    flex: 1;
    font-size: 0.8rem;
    padding: 10px 4px;
}

.jump-up-btn {
    background-color: #16a34a !important;
}

/* --- Interactive Stats Card Styling --- */
.interactive-stats {
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.interactive-stats:hover {
    transform: translateY(-2px);
    border-color: #4CAF50;
}

.click-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #4CAF50;
    font-weight: bold;
}

/* --- Modal Overlay & Content Styling --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #1a1a1a;
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

.modal-content h2 {
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.chart-container {
    position: relative;
    width: 100%;
    max-height: 260px;
    margin: 15px 0;
}

.modal-close-btn {
    padding: 10px 24px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.modal-close-btn:hover {
    background: #ff6b81;
}