/* ── Fonts ───────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Body / CRT background ───────────────────────────────────────────────── */
body {
    font-family: 'Press Start 2P', monospace;
    background-color: #000;
    color: #00ff41;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem 3rem;
    /* subtle scanline overlay */
    background-image: repeating-linear-gradient(
        0deg,
        rgba(0,0,0,0.18) 0px,
        rgba(0,0,0,0.18) 1px,
        transparent 1px,
        transparent 4px
    );
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
    background: #000;
    border: 3px solid #00ff41;
    box-shadow:
        0 0 12px rgba(0,255,65,0.5),
        0 0 40px rgba(0,255,65,0.15),
        inset 0 0 30px rgba(0,255,65,0.04);
    padding: 2rem;
    width: 100%;
    max-width: 700px;
    position: relative;
    /* pixel corner accent lines */
    outline: 1px solid rgba(0,255,65,0.25);
    outline-offset: 5px;
}

/* ── Logo ────────────────────────────────────────────────────────────────── */
.logo {
    font-size: 1.6rem;
    color: #ffff00;
    text-shadow: 0 0 12px #ffff00, 0 0 30px rgba(255,255,0,0.4);
    text-align: center;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

/* ── Alien decorations ───────────────────────────────────────────────────── */
.aliens-row {
    text-align: center;
    font-size: 1.4rem;
    letter-spacing: 0.5rem;
    margin-bottom: 1.25rem;
    animation: alien-shift 3s infinite alternate ease-in-out;
}
@keyframes alien-shift {
    from { letter-spacing: 0.5rem; }
    to   { letter-spacing: 0.9rem; }
}

.blink {
    text-align: center;
    font-size: 0.65rem;
    color: #fff;
    letter-spacing: 0.1em;
    margin-bottom: 1.75rem;
    animation: blink 1.1s step-start infinite;
}
@keyframes blink {
    50% { opacity: 0; }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.65rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: transform 0.08s, box-shadow 0.08s;
}

.btn-primary {
    background: #00ff41;
    color: #000;
    width: 100%;
    padding: 1rem;
    margin-top: 1.5rem;
    text-align: center;
    box-shadow: 4px 4px 0 #007a1f;
    font-size: 0.7rem;
}
.btn-primary:hover:not(:disabled) {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #007a1f;
}
.btn-primary:active:not(:disabled) {
    transform: translate(4px, 4px);
    box-shadow: none;
}
.btn-primary:disabled {
    background: #004d15;
    color: #007a1f;
    box-shadow: 4px 4px 0 #002a0b;
    cursor: not-allowed;
}

.back-link {
    display: inline-block;
    background: #000;
    color: #00ff41;
    border: 2px solid #00ff41;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55rem;
    padding: 0.5rem 0.9rem;
    text-decoration: none;
    margin-bottom: 1.5rem;
    box-shadow: 3px 3px 0 #007a1f;
    transition: transform 0.08s, box-shadow 0.08s;
}
.back-link:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 #007a1f;
}

/* ── Home mode cards ─────────────────────────────────────────────────────── */
.mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.mode-card {
    background: #000;
    border: 2px solid #00ff41;
    padding: 1.75rem 1rem;
    text-align: center;
    text-decoration: none;
    color: #00ff41;
    box-shadow: 4px 4px 0 #007a1f;
    transition: transform 0.08s, box-shadow 0.08s, background 0.1s;
}
.mode-card:hover {
    background: #001a08;
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #007a1f;
}
.mode-card-icon  { font-size: 2.25rem; display: block; margin-bottom: 1rem; }
.mode-card-title { font-size: 0.7rem; color: #ffff00; margin-bottom: 0.6rem; }
.mode-card-desc  { font-size: 0.5rem; color: #00aa30; line-height: 1.8; }

/* ── Section labels & headings ───────────────────────────────────────────── */
h2 { font-size: 0.9rem; color: #ffff00; text-shadow: 0 0 8px rgba(255,255,0,0.4); }
h3 { font-size: 0.7rem; color: #00ff41; }

.section-label {
    font-size: 0.55rem;
    color: #00aa30;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

/* ── Category grid ───────────────────────────────────────────────────────── */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}

.category-card {
    background: #000;
    border: 2px solid #00aa30;
    padding: 1.1rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
    user-select: none;
}
.category-card:hover, .category-card.selected {
    border-color: #00ff41;
    background: #001a08;
    box-shadow: 0 0 8px rgba(0,255,65,0.4);
}
.category-icon { font-size: 1.6rem; display: block; margin-bottom: 0.5rem; }
.category-card div { font-size: 0.5rem; color: #00ff41; line-height: 1.6; }

/* ── Form elements ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-size: 0.55rem;
    color: #00aa30;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

input[type="text"], select {
    width: 100%;
    background: #000;
    border: 2px solid #00aa30;
    color: #00ff41;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.65rem;
    padding: 0.75rem;
    outline: none;
    appearance: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus, select:focus {
    border-color: #00ff41;
    box-shadow: 0 0 8px rgba(0,255,65,0.4);
}
input[type="text"]::placeholder { color: #005918; }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-bar {
    background: #001a08;
    border: 1px solid #00aa30;
    height: 12px;
    margin: 0.5rem 0 1.75rem;
    position: relative;
}
.progress-fill {
    background: #00ff41;
    box-shadow: 0 0 6px rgba(0,255,65,0.7);
    height: 100%;
    transition: width 0.4s ease;
}

/* ── Answer options ──────────────────────────────────────────────────────── */
.options-grid { display: grid; gap: 0.6rem; margin-bottom: 0.5rem; }

.option-btn {
    background: #000;
    border: 2px solid #00aa30;
    color: #00ff41;
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.45rem, 1.2vw, 0.62rem);
    padding: 0.9rem 1rem;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    line-height: 1.7;
    transition: background 0.08s, border-color 0.08s;
}
.option-btn:hover, .option-btn.selected {
    background: #001a08;
    border-color: #00ff41;
    box-shadow: 0 0 8px rgba(0,255,65,0.35);
}

.option-letter {
    background: #00ff41;
    color: #000;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: bold;
    flex-shrink: 0;
}
.option-btn.selected .option-letter {
    background: #ffff00;
    color: #000;
}

/* ── Feedback ────────────────────────────────────────────────────────────── */
.feedback-icon { font-size: 3.5rem; text-align: center; margin: 1.25rem 0; }
.correct   { color: #00ff41; text-shadow: 0 0 10px rgba(0,255,65,0.6); }
.incorrect { color: #ff2222; text-shadow: 0 0 10px rgba(255,34,34,0.6); }

/* ── Results & leaderboard ───────────────────────────────────────────────── */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 2px solid #00aa30;
    margin-bottom: 0.6rem;
    background: #000;
}
.leaderboard-item:first-child { border-color: #ffff00; box-shadow: 0 0 8px rgba(255,255,0,0.3); }

.rank        { font-size: 1.2rem; width: 36px; text-align: center; flex-shrink: 0; }
.rank.gold   { color: #ffff00; }
.rank.silver { color: #aaaaaa; }
.rank.bronze { color: #ff8c00; }

.review-item {
    border: 1px solid #003a10;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.5rem;
    line-height: 1.9;
}
.review-item .q-text    { color: #00aa30; margin-bottom: 0.35rem; }
.review-item .your-answer { font-size: 0.55rem; }

/* ── Multiplayer / lobby ─────────────────────────────────────────────────── */
.room-code {
    font-size: 2rem;
    color: #00ffff;
    text-shadow: 0 0 14px rgba(0,255,255,0.7), 0 0 30px rgba(0,255,255,0.3);
    text-align: center;
    letter-spacing: 0.3em;
    padding: 1rem;
    border: 2px solid #00ffff;
    margin: 0.75rem 0 1.5rem;
}

.player-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #00aa30;
    padding: 0.4rem 0.75rem;
    margin: 0.25rem;
    font-size: 0.5rem;
    color: #00ff41;
}

/* ── Waiting animation ───────────────────────────────────────────────────── */
@keyframes pixel-bounce {
    0%, 80%, 100% { transform: scaleY(0);   opacity: 0.3; }
    40%           { transform: scaleY(1.4); opacity: 1; }
}
.dot {
    width: 10px; height: 10px;
    background: #00ff41;
    box-shadow: 0 0 6px #00ff41;
    display: inline-block;
    margin: 0 5px;
    animation: pixel-bounce 1.4s infinite ease-in-out both;
}
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

/* ── Score display ───────────────────────────────────────────────────────── */
.score-display {
    color: #ffff00;
    text-shadow: 0 0 8px rgba(255,255,0,0.5);
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
    border: 2px solid #ff2222;
    color: #ff6666;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.55rem;
    line-height: 1.8;
    box-shadow: 0 0 8px rgba(255,34,34,0.3);
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: #00aa30; font-size: 0.6rem; line-height: 1.8; }
.mt-1        { margin-top: 0.5rem; }
.mt-2        { margin-top: 1rem; }
.mt-3        { margin-top: 1.5rem; }
.divider     { border: none; border-top: 1px solid #003a10; margin: 1.5rem 0; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    body           { padding: 1rem 0.5rem 2rem; }
    .card          { padding: 1.25rem; }
    .mode-cards    { grid-template-columns: 1fr; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .logo          { font-size: 1.1rem; }
    .room-code     { font-size: 1.4rem; letter-spacing: 0.2em; }
}
