:root {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --primary: #00bfff; /* Neon Blue */
    --secondary: #32cd32; /* Neon Green */
    --accent: #ff4500; /* Orange Red */
    --text-color: #ffffff;
    --font-family: 'Fredoka One', 'Verdana', sans-serif; /* Playful font */
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: var(--card-bg);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.logo {
    font-size: 1.5rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.stats-bar {
    display: flex;
    gap: 1rem;
}

.stat {
    background: #444;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,191,255,0.2);
    border-color: var(--primary);
}

.card h2 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.card p {
    color: #ccc;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: #000;
}

.btn-primary:hover {
    background: #009acd;
    transform: scale(1.05);
}

.btn-secondary {
    background: var(--secondary);
    color: #000;
}

/* Game Interface */
.game-container {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.question-box {
    font-size: 3rem;
    margin: 2rem 0;
    color: var(--primary);
}

.options-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.options-grid > * {
    flex: 1 1 45%; /* roughly half width minus gap, allows wrapping */
    min-width: 200px;
}

.option-btn {
    background: #444;
    color: #fff;
    font-size: 1.5rem;
    padding: 1.5rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.option-btn:hover {
    background: #555;
}

.feedback {
    margin-top: 1rem;
    font-size: 1.5rem;
    height: 2rem;
}

.feedback.correct { color: var(--secondary); }
.feedback.wrong { color: var(--accent); }

/* Form Elements */
input[type="text"], input[type="password"], textarea {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid #444;
    background: #333;
    color: #fff;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-weight: bold;
}

/* Admin */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.admin-table th, .admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #444;
}
.admin-table th {
    color: var(--primary);
}

/* Math Visualization */
.visual-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    max-height: 40vh; /* Keep it above the fold */
    overflow-y: auto; /* Scroll if it's a huge number */
    padding: 5px;
}

.group-box {
    border: 2px dashed var(--secondary);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    align-content: center;
    background: rgba(50, 205, 50, 0.1);
    min-width: 30px;
    min-height: 30px;
}

.unit-dot {
    width: 8px;
    height: 8px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(255,255,255,0.5);
}
