/* Perplexed — FunSlop.com
   Be the language model: predict the next token, score the probability mass.
   Self-contained neon-on-near-black aesthetic, no shared theme stylesheet. */

: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);
    --panel: rgba(255, 255, 255, 0.03);
    --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, 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.13;
    z-index: -1;
    filter: blur(60px);
    pointer-events: none;
    animation: float 13s infinite alternate;
}

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

.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.1rem 6rem;
    max-width: 660px;
    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(--neon-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Control hint pills */
.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: var(--panel);
    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(--neon-green); }

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

/* HUD: round / score / best */
.hud {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
    min-height: 1.6rem;
}

.hud-item {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text-muted);
    background: var(--panel);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
}
.hud-item:empty { display: none; }
.hud-score { color: var(--cyan); }
.hud-best { color: var(--gold); }

/* The prompt card with the sentence prefix */
.prompt-card {
    background: var(--panel);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 1.5rem 1.35rem;
    margin: 0.25rem 0 1.25rem;
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 40px rgba(5, 217, 232, 0.04);
}

.state-idle .prompt-card,
.state-gameover .prompt-card { display: none; }

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

.blank {
    display: inline-block;
    min-width: 1.6em;
    color: var(--neon-purple);
    border-bottom: 3px solid var(--neon-purple);
    text-shadow: 0 0 14px rgba(189, 0, 255, 0.6);
    animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* Guess zone */
.guess-zone { margin-bottom: 0.5rem; }

.state-idle .guess-zone,
.state-gameover .guess-zone { display: none; }

.state-reveal .input-row,
.state-reveal .suggestions,
.state-reveal .options,
.state-reveal .easy-toggle { display: none; }

.input-row {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
}

.guess-input {
    flex: 1 1 240px;
    min-width: 0;
    max-width: 360px;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid var(--glass-border);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    text-align: center;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.guess-input::placeholder { color: var(--text-muted); opacity: 0.7; }

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

.guess-input.shake {
    animation: shake 0.22s ease-in-out;
    border-color: var(--pink);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* Buttons */
.game-btn {
    font-family: var(--font-body);
    font-size: 1.1rem;
    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);
}
.game-btn:active { transform: scale(0.96); }
.game-btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

.submit-btn {
    flex: 0 0 auto;
    padding: 0.85rem 1.5rem;
    background: var(--cyan);
    box-shadow: 0 0 18px rgba(5, 217, 232, 0.35);
}
.submit-btn:hover { filter: brightness(1.1); box-shadow: 0 0 26px rgba(5, 217, 232, 0.5); }

/* Autocomplete suggestions */
.suggestions {
    display: flex;
    gap: 0.45rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    min-height: 0;
}

.suggestion {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: rgba(189, 0, 255, 0.1);
    border: 1px solid rgba(189, 0, 255, 0.35);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.suggestion:hover { background: rgba(189, 0, 255, 0.22); border-color: var(--neon-purple); }
.suggestion:active { transform: scale(0.95); }

/* Easy-mode options grid */
.options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
    margin-top: 0.75rem;
}
.options:empty { display: none; }

.option {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.85rem 0.6rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s, color 0.15s;
}
.option:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(5, 217, 232, 0.08); }
.option:active { transform: scale(0.96); }
.option:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* Easy-mode toggle */
.easy-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    cursor: pointer;
}
.easy-toggle input { width: 1.05rem; height: 1.05rem; accent-color: var(--neon-green); cursor: pointer; }

/* Reveal block */
.reveal { margin-top: 0.5rem; }
.reveal:empty { display: none; }

.verdict {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}
.verdict.top  { color: var(--neon-green); text-shadow: 0 0 16px rgba(57, 255, 20, 0.5); }
.verdict.good { color: var(--cyan); text-shadow: 0 0 16px rgba(5, 217, 232, 0.45); }
.verdict.weak { color: var(--gold); text-shadow: 0 0 16px rgba(255, 213, 74, 0.4); }
.verdict.zero { color: var(--pink); text-shadow: 0 0 16px rgba(255, 42, 109, 0.45); }

.reveal-line {
    font-size: 1.02rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.reveal-line .guess-word { color: var(--text-primary); }

/* Distribution bars */
.dist-bars {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: 460px;
    margin: 0 auto 1rem;
    text-align: left;
}

.bar-row {
    display: grid;
    grid-template-columns: 6.5rem 1fr 3rem;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.bar-word {
    font-family: var(--font-display);
    color: var(--text-muted);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    height: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--neon-purple), var(--cyan));
    animation: grow 0.4s ease-out;
}

@keyframes grow {
    from { transform: scaleX(0); transform-origin: left; }
    to { transform: scaleX(1); transform-origin: left; }
}

.bar-pct { color: var(--text-muted); font-variant-numeric: tabular-nums; }

.bar-row.is-guess .bar-word { color: var(--neon-green); font-weight: 700; }
.bar-row.is-guess .bar-fill { background: linear-gradient(90deg, var(--neon-green), var(--gold)); }
.bar-row.is-guess .bar-pct { color: var(--neon-green); }

.reveal-note {
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto 1.25rem;
}
.reveal-note .model-line { color: var(--cyan); font-style: italic; }

.next-btn {
    background: var(--neon-green);
    padding: 0.8rem 1.8rem;
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.35);
}
.next-btn:hover { filter: brightness(1.1); box-shadow: 0 0 26px rgba(57, 255, 20, 0.5); }

/* Start zone */
.start-zone {
    display: none;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.state-idle .start-zone { display: flex; }

.start-btn {
    background: var(--cyan);
    padding: 0.95rem 1.9rem;
    box-shadow: 0 0 18px rgba(5, 217, 232, 0.35);
}
.start-btn:hover { filter: brightness(1.1); box-shadow: 0 0 26px rgba(5, 217, 232, 0.5); }

.daily-btn {
    background: var(--gold);
    padding: 0.95rem 1.9rem;
    box-shadow: 0 0 18px rgba(255, 213, 74, 0.3);
}
.daily-btn:hover { filter: brightness(1.08); box-shadow: 0 0 26px rgba(255, 213, 74, 0.45); }

/* Final card */
.final-card {
    background: var(--panel);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 1.75rem 1.35rem;
    margin-top: 0.5rem;
}

.final-score {
    font-family: var(--font-display);
    font-size: 3.25rem;
    font-weight: 700;
    color: var(--cyan);
    text-shadow: 0 0 22px rgba(5, 217, 232, 0.4);
    line-height: 1;
}
.final-score span { font-size: 1.2rem; color: var(--text-muted); }

.state-gameover.new-best .final-score {
    color: var(--gold);
    text-shadow: 0 0 24px 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.12); }
    100% { transform: scale(1); opacity: 1; }
}

.final-verdict {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin: 1rem auto 1.25rem;
    max-width: 460px;
    line-height: 1.5;
}

.final-stats {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    color: var(--text-muted);
}
.final-stats span {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
}
.final-stats strong { color: var(--text-primary); }

.again-btn { background: var(--neon-green); }

/* Hint line */
.hint {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-top: 1.25rem;
    min-height: 1.2em;
    line-height: 1.5;
}

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

/* SEO / how-to */
.how-to-play {
    text-align: left;
    margin: 3rem auto 0;
    max-width: 580px;
    background: var(--panel);
    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: 580px;
    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; }
    .instruction { font-size: 0.98rem; }
    .prefix { font-size: 1.2rem; }
    .prompt-card { padding: 1.25rem 1rem; }
    .guess-input { font-size: 1.05rem; padding: 0.75rem 0.85rem; }
    .submit-btn { padding: 0.75rem 1.2rem; font-size: 1rem; }
    .final-score { font-size: 2.6rem; }
    .bar-row { grid-template-columns: 5rem 1fr 2.6rem; font-size: 0.82rem; }
    .bar-word { font-size: 0.82rem; }
}

@media (max-width: 360px) {
    .input-row { flex-direction: column; align-items: stretch; }
    .guess-input { max-width: none; }
}
