/* Turing Booth — FunSlop.com
   Convince a scripted judge you're human. A live needle judges your typos. */

:root {
    --bg-dark: #090b10;
    --neon-green: #39ff14;
    --neon-purple: #bd00ff;
    --cyan: #05d9e8;
    --pink: #ff2a6d;
    --gold: #ffd54a;
    --text-primary: #f0f4f8;
    --text-muted: #8b9bb4;
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-body: 'Outfit', system-ui, -apple-system, sans-serif;
    --font-display: 'Space Grotesk', 'Outfit', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    min-height: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Ambient neon glow, matching FunSlop's house style */
.glow-bg {
    position: fixed;
    top: -80px;
    left: -80px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, var(--cyan) 0%, transparent 70%);
    opacity: 0.14;
    z-index: -1;
    filter: blur(60px);
    pointer-events: none;
    animation: float 12s infinite alternate;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(120px, 60px); }
}

.game-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.content {
    text-align: center;
    padding: 2.25rem 1.25rem 6rem;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}

.title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.75rem;
    background: linear-gradient(45deg, var(--cyan), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Control hints */
.controls-inline {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.control-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
}

.control-pill .key {
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 0.1rem 0.45rem;
    font-size: 0.8rem;
}

.control-pill.action .key { color: var(--cyan); }
.control-pill.special .key { color: var(--gold); }

/* Hide control hints during a run */
.state-playing .controls-inline,
.state-gameover .controls-inline {
    display: none;
}

/* Mode toggle */
.mode-toggle {
    display: inline-flex;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.3rem;
    margin-bottom: 1.25rem;
}

.mode-btn {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.mode-btn:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 2px;
}

.mode-btn.active {
    color: var(--bg-dark);
    background: var(--cyan);
    font-weight: 700;
    box-shadow: 0 0 16px rgba(5, 217, 232, 0.4);
}

#mode-bot.active {
    background: var(--pink);
    box-shadow: 0 0 16px rgba(255, 42, 109, 0.4);
}

/* Disable mode-switching once a run is underway */
.state-playing .mode-toggle {
    opacity: 0.4;
    pointer-events: none;
}

/* The verdict meter */
.meter-wrap {
    margin: 0.5rem auto 1.25rem;
    max-width: 420px;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 0.4rem;
}

.meter-label.human { color: var(--neon-green); }
.meter-label.bot { color: var(--pink); }

.meter-track {
    position: relative;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--neon-green), #6b7a90 50%, var(--pink));
    overflow: hidden;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.6);
}

/* Subtle scrim so the needle is always visible */
.meter-fill {
    position: absolute;
    inset: 0;
    background: rgba(9, 11, 16, 0.0);
}

.meter-needle {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    border-radius: 3px;
    box-shadow: 0 0 10px var(--text-primary), 0 0 4px #000;
    transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.meter-readout {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.55rem;
    min-height: 1.3em;
}

.progress {
    font-size: 0.95rem;
    color: var(--text-muted);
    min-height: 1.2em;
    margin-bottom: 0.15rem;
}

.timer {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--cyan);
    min-height: 1.2em;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}

.timer.danger {
    color: var(--pink);
    animation: pulse-danger 0.6s infinite alternate;
}

@keyframes pulse-danger {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* The judge's question card */
.question-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--cyan);
    border-radius: 0 14px 14px 0;
    padding: 1.1rem 1.25rem;
    margin: 0 auto 1.25rem;
    max-width: 520px;
    text-align: left;
    min-height: 5.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.judge-tag {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--cyan);
    margin-bottom: 0.4rem;
}

.question {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Answer input area */
.answer-area {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
    max-width: 520px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.answer-input {
    flex: 1 1 220px;
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.75rem 0.95rem;
    resize: none;
    line-height: 1.4;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.answer-input::placeholder { color: var(--text-muted); }

.answer-input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(5, 217, 232, 0.18);
}

.answer-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Buttons */
.game-btn {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s, opacity 0.15s;
    color: var(--bg-dark);
}

.game-btn:active { transform: scale(0.96); }

.game-btn:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 2px;
}

.game-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-submit {
    flex: 0 0 auto;
    padding: 0.75rem 1.5rem;
    background: var(--neon-green);
    box-shadow: 0 0 16px rgba(57, 255, 20, 0.3);
}

.btn-submit:not(:disabled):hover {
    filter: brightness(1.1);
    box-shadow: 0 0 24px rgba(57, 255, 20, 0.5);
}

.btn-start {
    padding: 0.9rem 2rem;
    margin-top: 1.25rem;
    background: var(--cyan);
    box-shadow: 0 0 18px rgba(5, 217, 232, 0.35);
}

.btn-start:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 26px rgba(5, 217, 232, 0.55);
}

/* Show/hide play vs idle elements via state */
.answer-area { display: none; }
.state-playing .answer-area { display: flex; }

.btn-start { display: inline-block; }
.state-playing .btn-start,
.state-playing .best-score { display: none; }
.state-gameover .btn-start { display: inline-block; }

.state-idle .question-card,
.state-idle .meter-wrap { display: block; }

/* Feedback line after each answer */
.feedback {
    font-size: 1rem;
    font-weight: 500;
    min-height: 1.5em;
    margin-top: 1rem;
    color: var(--gold);
    line-height: 1.4;
}

.feedback.tell-human { color: var(--neon-green); }
.feedback.tell-bot { color: var(--pink); }

.instruction {
    font-size: 1.05rem;
    color: var(--text-primary);
    min-height: 1.4em;
    margin-top: 0.75rem;
    line-height: 1.45;
}

.best-score {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    min-height: 1.2em;
}

.hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    min-height: 1.2em;
}

/* Game-over verdict colouring */
.state-gameover.verdict-pass .instruction {
    color: var(--neon-green);
    font-weight: 700;
    text-shadow: 0 0 14px rgba(57, 255, 20, 0.4);
    animation: score-pop 0.4s ease-out;
}

.state-gameover.verdict-fail .instruction {
    color: var(--pink);
    font-weight: 700;
    text-shadow: 0 0 14px rgba(255, 42, 109, 0.4);
    animation: score-pop 0.4s ease-out;
}

.state-gameover.new-best .best-score {
    color: var(--gold);
    font-weight: 700;
    text-shadow: 0 0 12px rgba(255, 213, 74, 0.4);
}

@keyframes score-pop {
    0% { transform: scale(0.85); opacity: 0; }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

/* SEO / how-to content */
.how-to-play {
    text-align: left;
    margin: 3rem auto 0;
    max-width: 560px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.75rem;
}

.how-to-play h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.how-to-play h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin: 1.25rem 0 0.5rem;
    color: var(--cyan);
}

.how-to-play p {
    font-weight: 300;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.how-to-play strong { color: var(--text-primary); font-weight: 500; }
.how-to-play em { color: var(--text-primary); font-style: italic; }

.how-to-play ol {
    margin: 0.5rem 0 0.75rem 1.25rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.fun-fact {
    margin-top: 1.25rem;
    padding: 1rem;
    border-left: 3px solid var(--neon-purple);
    background: rgba(189, 0, 255, 0.06);
    border-radius: 0 10px 10px 0;
}

.fun-fact p { margin: 0; }

.related-games {
    margin: 2rem auto 0;
    max-width: 560px;
    text-align: center;
}

.related-games h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.related-games-list {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
}

.related-game-link {
    text-decoration: none;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-size: 0.9rem;
    transition: border-color 0.2s, color 0.2s;
}

.related-game-link:hover {
    border-color: var(--neon-green);
    color: var(--neon-green);
}

/* Home link */
.home-link {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    transition: border-color 0.2s, color 0.2s;
    z-index: 10;
}

.home-link:hover {
    border-color: var(--neon-purple);
    color: var(--neon-purple);
}

.home-link:active {
    transform: translateX(-50%) scale(0.95);
}

.home-link:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 600px) {
    .title { font-size: 1.85rem; }
    .question { font-size: 1.05rem; }
    .mode-btn { font-size: 0.82rem; padding: 0.45rem 0.7rem; }
    .answer-input { font-size: 1rem; }
    .btn-submit { padding: 0.7rem 1.1rem; }
    .instruction { font-size: 0.98rem; }
}
