@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600&display=swap");

:root {
    --bg: #0f172a;
    --panel: #0b1222;
    --accent: #4ade80;
    --accent-strong: #22c55e;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.4);
    --shadow: 0 25px 60px rgba(15, 23, 42, 0.45);
    --radius: 20px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at 20% 20%, rgba(74, 222, 128, 0.08), transparent 35%),
                radial-gradient(circle at 80% 30%, rgba(56, 189, 248, 0.08), transparent 30%),
                linear-gradient(135deg, #0b1222 0%, #111827 100%);
    color: var(--text);
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page {
    width: min(1100px, 100%);
    display: grid;
    gap: 24px;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.eyebrow {
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0 0 6px 0;
}

h1 {
    margin: 0 0 10px 0;
    font-size: clamp(32px, 4vw, 44px);
    line-height: 1.1;
}

.lede {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 60ch;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.4);
    color: var(--accent);
    font-weight: 600;
}

.pill-title {
    margin: 0;
    color: var(--text);
}

.pill-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 20px;
    background: var(--panel);
    border-radius: calc(var(--radius) + 4px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.meta {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    background: linear-gradient(120deg, rgba(74, 222, 128, 0.08), rgba(59, 130, 246, 0.12));
}

.meta-item,
.meta-label {
    margin: 0;
}

.meta-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.meta-item.timer {
    color: var(--accent);
}

.meta-item.high-score {
    color: var(--muted);
}

.timer-block {
    display: grid;
    gap: 6px;
    min-width: 220px;
}

.timer-display {
    display: grid;
    gap: 8px;
}

.timer-value {
    font-weight: 700;
    font-size: clamp(24px, 4vw, 32px);
    color: var(--accent);
}

.timer-bar {
    position: relative;
    height: 10px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    overflow: hidden;
}

.timer-bar span {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(90deg, var(--accent), #38bdf8);
    transition: width 0.25s linear;
}

.high-score-block {
    text-align: right;
}

.high-score {
    font-weight: 700;
    color: var(--text);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 190px;
}

.controls label {
    color: var(--muted);
    font-size: 0.9rem;
}

.slider-control {
    min-width: 240px;
}

.slider-control input[type="range"] {
    accent-color: var(--accent);
    width: 100%;
}

.next-block {
    display: grid;
    gap: 6px;
    min-width: 180px;
}

.next-block button {
    width: 100%;
}

.game-switch {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.game-link {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all 0.15s ease;
    background: rgba(255, 255, 255, 0.03);
}

.game-link:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.5);
}

.game-link.active {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(74, 222, 128, 0.12);
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.25);
}

.image-frame {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.12), rgba(59, 130, 246, 0.12));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 280px;
    min-height: 360px;
    align-self: stretch;
}

.image-frame img {
    width: 100%;
    height: 100%;
    max-width: none;
    min-height: 320px;
    aspect-ratio: 3 / 4;
    border-radius: calc(var(--radius) - 6px);
    background: #0f172a;
    object-fit: cover;
}

.question {
    display: grid;
    gap: 12px;
    width: 100%;
}

.prompt {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
}

.options {
    display: grid;
    gap: 12px;
}

button {
    font: inherit;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button:hover,
button:focus-visible {
    border-color: var(--accent);
    transform: translateY(-2px);
    outline: none;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.option.correct {
    border-color: var(--accent);
    background: rgba(74, 222, 128, 0.1);
}

.option.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.status {
    min-height: 24px;
    margin: 6px 0 4px 0;
    color: var(--muted);
}

.streak {
    margin: 4px 0 8px 0;
    color: var(--text);
    font-weight: 700;
    background: linear-gradient(120deg, rgba(74, 222, 128, 0.16), rgba(59, 130, 246, 0.16));
    border: 1px solid rgba(74, 222, 128, 0.4);
    padding: 10px 14px;
    border-radius: 12px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.question-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    align-items: start;
    justify-content: center;
    justify-items: stretch;
    grid-column: 1 / -1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.attempts {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    min-height: 100%;
}

.attempts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.attempts-list {
    list-style: none;
    margin: 10px 0 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
    font-size: 0.95rem;
    color: var(--text);
}

.attempts-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.attempts-list .tag {
    font-size: 0.85rem;
    color: var(--muted);
}

.attempts-list .result {
    font-weight: 700;
}

.attempts-list .result.correct {
    color: var(--accent);
}

.attempts-list .result.wrong {
    color: #f87171;
}

/* Hide legacy question-type tags if they ever appear */
.attempts-list .tag {
    display: none;
}

.ghost.small {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.ghost.strong {
    font-weight: 700;
    border-color: var(--accent);
    color: var(--text);
}

@media (max-width: 1100px) {
    .question-row {
        grid-template-columns: 1fr 1fr;
    }
    .attempts {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .question-row {
        grid-template-columns: 1fr;
    }
    .attempts {
        grid-column: 1 / -1;
    }
}

.status.positive {
    color: var(--accent);
}

.status.negative {
    color: #f87171;
}

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.16);
}

.leaderboard {
    grid-column: 1 / -1;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: rgba(255, 255, 255, 0.03);
    display: grid;
    gap: 12px;
}

.leaderboard-title {
    margin: 0;
    font-weight: 700;
    color: var(--text);
}

.leaderboard-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.leaderboard-col {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    display: grid;
    gap: 6px;
}

.leaderboard-col-title {
    margin: 0;
    font-weight: 700;
    color: var(--text);
    font-size: 0.95rem;
}

.leaderboard-list {
    list-style: decimal;
    margin: 0;
    padding-left: 0;
    display: grid;
    gap: 4px;
    color: var(--muted);
    list-style-position: inside;
}

.leaderboard-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    color: var(--text);
    font-weight: 600;
}

.leaderboard-list span {
    color: var(--muted);
    font-weight: 500;
}

@media (max-width: 720px) {
    body {
        padding: 18px;
    }

    .hero {
        flex-direction: column;
    }

    .card {
        grid-template-columns: 1fr;
    }
}
