:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --accent-dark: #0ea5e9;
    --border: #334155;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    border-bottom: 1px solid var(--border);
}

.site-nav {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
}

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    margin-left: 1.5rem;
    transition: color 0.15s ease;
}

.nav-links a:hover {
    color: var(--accent);
}

.site-main {
    flex: 1;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

.hero {
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 32rem;
    margin: 0 auto 2rem;
}

.button {
    display: inline-block;
    background: var(--accent);
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
    padding: 0.7rem 1.4rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s ease;
}

.button:hover {
    background: var(--accent-dark);
}

.button-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.button-secondary:hover {
    background: var(--surface);
}

.games-intro {
    text-align: center;
    margin-bottom: 2.5rem;
}

.games-intro p {
    color: var(--muted);
}

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

.game-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.game-card h2 {
    margin-top: 0;
}

.game-status {
    color: var(--muted);
    min-height: 1.5em;
}

.game-score {
    color: var(--muted);
    font-size: 0.875rem;
}

/* Tic-Tac-Toe */
.ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 4.5rem);
    grid-template-rows: repeat(3, 4.5rem);
    gap: 0.4rem;
    justify-content: center;
    margin: 1.25rem auto;
}

.ttt-cell {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ttt-cell:disabled {
    cursor: default;
}

.ttt-cell:not(:disabled):hover {
    background: var(--border);
}

/* Rock Paper Scissors */
.rps-choices {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin: 1.25rem 0 1rem;
}

/* Math Sprint */
.game-page {
    max-width: 32rem;
    margin: 0 auto;
    text-align: center;
}

.game-page p {
    color: var(--muted);
}

.game-timer {
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    margin: 1rem 0 1.5rem;
}

.mathgame-field {
    margin-bottom: 1.5rem;
    text-align: left;
}

.mathgame-field label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--muted);
}

.mathgame-field input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: 0.4rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
}

.mathgame-questions {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: grid;
    gap: 0.6rem;
}

.mathgame-questions li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.6rem 0.9rem;
}

.mathgame-expr {
    font-size: 1.1rem;
    font-weight: 600;
}

.mathgame-questions input {
    width: 6rem;
    padding: 0.4rem 0.6rem;
    border-radius: 0.4rem;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    text-align: right;
}

.mathgame-result {
    font-size: 1.1rem;
}

.mathgame-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.leaderboard-list {
    list-style: decimal;
    text-align: left;
    max-width: 24rem;
    margin: 0 auto 2rem;
    padding-left: 1.5rem;
}

.leaderboard-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.leaderboard-empty {
    color: var(--muted);
    list-style: none;
}

.leaderboard-name {
    font-weight: 600;
}

.leaderboard-value {
    color: var(--muted);
}
