/* Calibrated — FunSlop.com
   A confidence-betting trivia eval. Pick an answer, then bet how sure you are.
   Scored with a proper scoring rule. Neon-on-near-black house style. */

: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;
    right: -80px;
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, var(--cyan) 0%, transparent 70%);
    opacity: 0.13;
    z-index: -1;
    filter: blur(60px);
    pointer-events: none;
    animation: float 14s infinite alternate;
}

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

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

.content {
    text-align: center;
    padding: 2.5rem 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(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Control hints (idle only) */
.controls-inline {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.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); }

/* Live HUD */
.hud {
    display: none;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.hud-item.progress { color: var(--text-muted); }

.hud-item.score-now {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--cyan);
}

.hud-item.score-now.positive { color: var(--neon-green); }
.hud-item.score-now.negative { color: var(--pink); }

.progress-bar {
    display: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--neon-green));
    border-radius: 999px;
    transition: width 0.35s ease;
}

.state-answering .hud,
.state-confidence .hud,
.state-feedback .hud,
.state-answering .progress-bar,
.state-confidence .progress-bar,
.state-feedback .progress-bar {
    display: flex;
}

.state-answering .progress-bar,
.state-confidence .progress-bar,
.state-feedback .progress-bar {
    display: block;
}

.instruction {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    min-height: 1.4em;
    line-height: 1.4;
}

/* Question card */
.question-card {
    display: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem 1.25rem;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
}

.question-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(var(--cyan), var(--neon-purple));
}

.state-answering .question-card,
.state-confidence .question-card,
.state-feedback .question-card {
    display: block;
    animation: card-in 0.3s ease-out;
}

@keyframes card-in {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.q-tag {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--bg-dark);
    background: var(--cyan);
    border-radius: 6px;
    padding: 0.2rem 0.55rem;
    margin-bottom: 0.85rem;
}

.q-tag.tag-ai { background: var(--neon-purple); color: var(--text-primary); }
.q-tag.tag-tf { background: var(--gold); }

.q-text {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-primary);
}

/* Answer buttons */
.answers {
    display: none;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.state-answering .answers,
.state-confidence .answers,
.state-feedback .answers {
    display: flex;
}

.answer-btn {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 500;
    text-align: left;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    transition: transform 0.08s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.answer-btn .ans-key {
    flex: 0 0 auto;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    width: 1.6rem;
    height: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.answer-btn:hover:not(:disabled) {
    border-color: var(--cyan);
    background: rgba(5, 217, 232, 0.08);
}

.answer-btn:active:not(:disabled) { transform: scale(0.98); }

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

/* selected answer (during confidence stage) */
.answer-btn.selected {
    border-color: var(--cyan);
    background: rgba(5, 217, 232, 0.14);
    box-shadow: 0 0 18px rgba(5, 217, 232, 0.25);
}

.answer-btn.selected .ans-key {
    color: var(--bg-dark);
    background: var(--cyan);
}

/* reveal states (during feedback) */
.answer-btn.reveal-correct {
    border-color: var(--neon-green);
    background: rgba(57, 255, 20, 0.14);
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.3);
}

.answer-btn.reveal-wrong {
    border-color: var(--pink);
    background: rgba(255, 42, 109, 0.14);
}

.answer-btn:disabled { cursor: default; }
.answers.locked .answer-btn:not(.reveal-correct):not(.reveal-wrong) { opacity: 0.5; }

/* Confidence betting stage */
.confidence-stage {
    display: none;
    margin-bottom: 1rem;
    animation: card-in 0.25s ease-out;
}

.state-confidence .confidence-stage {
    display: block;
}

.confidence-prompt {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.85rem;
}

.confidence-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
}

.conf-btn {
    font-family: var(--font-body);
    cursor: pointer;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.7rem 0.4rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    transition: transform 0.08s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.conf-btn .conf-pct {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1;
}

.conf-btn .conf-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.1;
}

.conf-btn:active { transform: scale(0.96); }
.conf-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* The four confidence tiers get hotter as they get bolder */
.conf-btn[data-conf="55"]:hover { border-color: var(--cyan); box-shadow: 0 0 16px rgba(5,217,232,0.3); }
.conf-btn[data-conf="55"] .conf-pct { color: var(--cyan); }
.conf-btn[data-conf="70"]:hover { border-color: var(--neon-green); box-shadow: 0 0 16px rgba(57,255,20,0.3); }
.conf-btn[data-conf="70"] .conf-pct { color: var(--neon-green); }
.conf-btn[data-conf="85"]:hover { border-color: var(--gold); box-shadow: 0 0 16px rgba(255,213,74,0.3); }
.conf-btn[data-conf="85"] .conf-pct { color: var(--gold); }
.conf-btn[data-conf="99"]:hover { border-color: var(--pink); box-shadow: 0 0 18px rgba(255,42,109,0.4); }
.conf-btn[data-conf="99"] .conf-pct { color: var(--pink); }

.confidence-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.8rem;
}

/* Per-question feedback */
.feedback {
    display: none;
    min-height: 1.4em;
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.45;
    color: var(--text-primary);
    animation: card-in 0.2s ease-out;
}

.state-feedback .feedback { display: block; }

.feedback .fb-points {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.6rem;
    display: block;
    margin-bottom: 0.3rem;
}

.feedback.good .fb-points { color: var(--neon-green); }
.feedback.bad .fb-points { color: var(--pink); }
.feedback.meh .fb-points { color: var(--gold); }

.feedback .fb-verdict { color: var(--text-muted); font-size: 0.95rem; }

/* Start / restart button */
.start-btn {
    display: none;
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--bg-dark);
    background: linear-gradient(45deg, var(--cyan), var(--neon-green));
    border: none;
    border-radius: 14px;
    padding: 1rem 2.2rem;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
    box-shadow: 0 0 22px rgba(5, 217, 232, 0.35);
    margin: 0.5rem auto 0;
}

.state-idle .start-btn,
.state-gameover .start-btn,
.state-feedback .start-btn {
    display: inline-block;
}

.start-btn:hover { filter: brightness(1.08); box-shadow: 0 0 30px rgba(5, 217, 232, 0.5); }
.start-btn:active { transform: scale(0.96); }
.start-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* During feedback the start button becomes a "Next" affordance */
.state-feedback .start-btn {
    background: linear-gradient(45deg, var(--neon-purple), var(--cyan));
    box-shadow: 0 0 22px rgba(189, 0, 255, 0.35);
}

/* Results / game-over readout */
.results {
    display: none;
    margin: 0.5rem 0 1rem;
}

.state-gameover .results { display: block; animation: card-in 0.35s ease-out; }

.results .final-score {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.3rem;
    color: var(--cyan);
    text-shadow: 0 0 18px rgba(5, 217, 232, 0.4);
}

.results .final-score.negative { color: var(--pink); text-shadow: 0 0 18px rgba(255, 42, 109, 0.4); }

.results .final-label {
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1.1rem;
}

.results .verdict {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.4rem;
    color: var(--gold);
}

.results .verdict-sub {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 460px;
    margin: 0 auto 1.25rem;
}

/* Confidence-vs-accuracy calibration readout */
.calib-readout {
    text-align: left;
    max-width: 420px;
    margin: 0 auto 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 1rem 1.1rem;
}

.calib-readout .calib-title {
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.calib-row {
    display: grid;
    grid-template-columns: 3.2rem 1fr 3.4rem;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.55rem;
    font-size: 0.85rem;
}

.calib-row:last-child { margin-bottom: 0; }

.calib-row .calib-band { color: var(--text-muted); font-variant-numeric: tabular-nums; }

.calib-row .calib-track {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

/* the bar = actual accuracy in this band */
.calib-row .calib-acc {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: var(--cyan);
    border-radius: 999px;
}

/* the marker = where stated confidence sat (the target) */
.calib-row .calib-target {
    position: absolute;
    top: -2px; bottom: -2px;
    width: 2px;
    background: var(--gold);
    box-shadow: 0 0 6px var(--gold);
}

.calib-row .calib-num {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.calib-row.empty .calib-track { opacity: 0.4; }
.calib-row.empty .calib-num { color: var(--text-muted); }

.calib-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.8rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.calib-legend .swatch {
    display: inline-block;
    width: 0.8rem;
    height: 0.5rem;
    border-radius: 2px;
    margin-right: 0.3rem;
    vertical-align: middle;
}
.calib-legend .swatch.acc { background: var(--cyan); }
.calib-legend .swatch.tgt { background: var(--gold); width: 2px; height: 0.8rem; }

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

.state-gameover.new-best .results .final-score {
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 213, 74, 0.55);
    animation: score-pop 0.45s ease-out;
}

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

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

/* Hide control hints once a run begins/ends */
.state-answering .controls-inline,
.state-confidence .controls-inline,
.state-feedback .controls-inline,
.state-gameover .controls-inline {
    display: none;
}

/* 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 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; }
    .q-text { font-size: 1.2rem; }
    .instruction { font-size: 1rem; }
    .answer-btn { font-size: 1rem; padding: 0.8rem 0.95rem; }
    .conf-btn { padding: 0.6rem 0.25rem; }
    .conf-btn .conf-pct { font-size: 1.1rem; }
    .conf-btn .conf-label { font-size: 0.62rem; }
    .results .final-score { font-size: 2.5rem; }
    .results .verdict { font-size: 1.15rem; }
    .calib-row { grid-template-columns: 2.8rem 1fr 3rem; gap: 0.45rem; font-size: 0.8rem; }
}

@media (max-width: 360px) {
    .confidence-buttons { gap: 0.4rem; }
    .conf-btn .conf-pct { font-size: 1rem; }
}
