/* Hallucination Detector — FunSlop.com
   Tap the confidently-wrong cards before they ship. Self-contained. */

: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(--pink) 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, 70px); }
}

.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: 2rem 1rem 6rem;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
}

.title {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.75rem;
    background: linear-gradient(45deg, var(--pink), var(--cyan));
    -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(--pink); }
.control-pill.special .key { color: var(--neon-green); }

.state-playing .controls-inline,
.state-gameover .controls-inline {
    display: none;
}

/* HUD: lives, score, combo */
.hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    max-width: 420px;
    margin: 0 auto 0.4rem;
    padding: 0 0.25rem;
    min-height: 2rem;
}

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

.hud-item.lives {
    color: var(--pink);
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 42, 109, 0.4);
    min-width: 4.2rem;
    text-align: left;
}

.hud-item.lives .spent {
    opacity: 0.18;
    text-shadow: none;
}

.hud-item.lives.life-lost {
    animation: life-flash 0.4s ease-out;
}

@keyframes life-flash {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.3); filter: brightness(1.6); }
}

.hud-item.score {
    color: var(--text-primary);
    font-size: 1.5rem;
    flex: 1;
    text-align: center;
}

.hud-item.combo {
    color: var(--cyan);
    min-width: 4.2rem;
    text-align: right;
    text-shadow: 0 0 10px rgba(5, 217, 232, 0.4);
    transition: transform 0.12s ease-out;
}

.hud-item.combo.bump {
    animation: combo-bump 0.25s ease-out;
}

.hud-item.combo.hot {
    color: var(--gold);
    text-shadow: 0 0 14px rgba(255, 213, 74, 0.6);
}

@keyframes combo-bump {
    0% { transform: scale(1); }
    45% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.best-score {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    min-height: 1.2em;
}

/* The playfield where cards drift */
.playfield {
    position: relative;
    width: 100%;
    max-width: 640px;
    height: 60vh;
    min-height: 360px;
    max-height: 560px;
    margin: 0 auto;
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    background:
        radial-gradient(circle at 20% 0%, rgba(189, 0, 255, 0.08), transparent 55%),
        radial-gradient(circle at 80% 100%, rgba(5, 217, 232, 0.07), transparent 55%),
        rgba(255, 255, 255, 0.015);
    overflow: hidden;
    touch-action: manipulation;
    cursor: crosshair;
}

.state-idle .playfield,
.state-gameover .playfield {
    cursor: default;
}

/* Faint scanline texture for that "monitoring dashboard" feel */
.playfield::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.02) 0px,
        rgba(255, 255, 255, 0.02) 1px,
        transparent 1px,
        transparent 4px
    );
    pointer-events: none;
    opacity: 0.5;
}

/* A drifting fact card */
.card {
    position: absolute;
    left: 0;
    top: 0;
    max-width: 78%;
    padding: 0.7rem 0.95rem;
    background: rgba(20, 24, 36, 0.92);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--cyan);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    will-change: transform;
    /* generous tap target on mobile */
    min-height: 44px;
    display: flex;
    align-items: center;
    backdrop-filter: blur(2px);
}

.card .tag {
    display: block;
    font-family: var(--font-display);
    font-size: 0.62rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.card-inner {
    pointer-events: none;
}

.card.caught {
    border-color: var(--neon-green);
    border-left-color: var(--neon-green);
    background: rgba(57, 255, 20, 0.14);
    color: var(--neon-green);
    box-shadow: 0 0 22px rgba(57, 255, 20, 0.5);
    animation: card-pop 0.32s ease-out forwards;
}

.card.misflag {
    border-color: var(--pink);
    border-left-color: var(--pink);
    background: rgba(255, 42, 109, 0.16);
    color: var(--pink);
    box-shadow: 0 0 22px rgba(255, 42, 109, 0.5);
    animation: card-shake 0.32s ease-out forwards;
}

.card.escaped {
    border-color: var(--gold);
    border-left-color: var(--gold);
    background: rgba(255, 213, 74, 0.14);
    color: var(--gold);
    box-shadow: 0 0 22px rgba(255, 213, 74, 0.5);
    animation: card-pop 0.32s ease-out forwards;
}

@keyframes card-pop {
    0% { transform: var(--pos) scale(1); }
    40% { transform: var(--pos) scale(1.1); }
    100% { transform: var(--pos) scale(0.6); opacity: 0; }
}

@keyframes card-shake {
    0% { transform: var(--pos) translateX(0); }
    25% { transform: var(--pos) translateX(-8px); }
    60% { transform: var(--pos) translateX(8px); }
    100% { transform: var(--pos) scale(0.6); opacity: 0; }
}

/* floating "+N" score popups */
.popup {
    position: absolute;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 5;
    animation: popup-rise 0.7s ease-out forwards;
    text-shadow: 0 0 8px currentColor;
}

@keyframes popup-rise {
    0% { transform: translate(-50%, 0) scale(0.8); opacity: 0; }
    25% { transform: translate(-50%, -8px) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -42px) scale(1); opacity: 0; }
}

/* Overlay for idle + gameover */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    background: rgba(9, 11, 16, 0.78);
    backdrop-filter: blur(6px);
    z-index: 20;
}

.state-playing .overlay {
    display: none;
}

.overlay-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.state-gameover.new-best .overlay-title {
    color: var(--gold);
    text-shadow: 0 0 16px rgba(255, 213, 74, 0.5);
    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; }
}

.overlay-body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 30rem;
}

.overlay-body strong { color: var(--text-primary); font-weight: 500; }

.overlay-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-height: 1.2em;
}

.btn-start {
    margin-top: 0.25rem;
}

.game-btn {
    font-family: var(--font-body);
    padding: 0.9rem 2.2rem;
    font-size: 1.15rem;
    font-weight: 700;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
    color: var(--bg-dark);
    background: var(--neon-green);
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.35);
}

.game-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 26px rgba(57, 255, 20, 0.5);
}

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

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

/* Live feedback line under the field */
.feedback {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 0.9rem;
    min-height: 1.4em;
    transition: color 0.2s;
}

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

/* 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: 30;
}

.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.7rem; }
    .playfield {
        height: 64vh;
        min-height: 340px;
    }
    .card {
        font-size: 0.92rem;
        max-width: 84%;
        padding: 0.65rem 0.85rem;
    }
    .hud-item.score { font-size: 1.3rem; }
    .hud-item { font-size: 1.1rem; }
    .overlay-title { font-size: 1.3rem; }
    .overlay-body { font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
    .glow-bg { animation: none; }
}
