/* Perplexity Karaoke — FunSlop.com
   Say or type real words the model would never predict. Neon-on-near-black. */

: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 */
.glow-bg {
    position: fixed;
    top: -90px;
    right: -90px;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, var(--cyan) 0%, transparent 70%);
    opacity: 0.13;
    z-index: -1;
    filter: blur(64px);
    pointer-events: none;
    animation: float 13s 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.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), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

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

.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.78rem;
}

.control-pill.action .key { color: var(--cyan); }
.control-pill.special .key { color: var(--neon-green); }
.control-pill.mute .key { color: var(--text-muted); }

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

/* HUD row */
.hud {
    display: flex;
    gap: 0.5rem 1.1rem;
    justify-content: center;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
    min-height: 1.6em;
}

.hud-item { font-size: 1.05rem; }

.timer {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--cyan);
    transition: color 0.2s;
}

.timer.low {
    color: var(--pink);
    animation: pulse-timer 0.7s infinite;
}

@keyframes pulse-timer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.score {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-primary);
}

.combo {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--neon-green);
    transition: transform 0.15s;
}

.combo.hot {
    color: var(--gold);
    text-shadow: 0 0 12px rgba(255, 213, 74, 0.6);
    transform: scale(1.05);
}

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

/* Context prompt card */
.prompt-card {
    position: relative;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.4rem 1.25rem 1.25rem;
    margin: 0.5rem auto 1rem;
    max-width: 560px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.prompt-label {
    position: absolute;
    top: -0.62rem;
    left: 1rem;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--neon-purple);
    background: var(--bg-dark);
    padding: 0 0.5rem;
    font-weight: 700;
}

.prompt-text {
    font-family: var(--font-display);
    font-size: 1.3rem;
    line-height: 1.4;
    color: var(--text-primary);
    min-height: 2.4em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-card.flash-good {
    animation: flash-good 0.4s ease-out;
}

.prompt-card.flash-bad {
    animation: flash-bad 0.4s ease-out;
}

@keyframes flash-good {
    0% { border-color: var(--neon-green); box-shadow: 0 0 26px rgba(57, 255, 20, 0.4); }
    100% { border-color: var(--glass-border); box-shadow: none; }
}

@keyframes flash-bad {
    0% { border-color: var(--pink); box-shadow: 0 0 26px rgba(255, 42, 109, 0.4); }
    100% { border-color: var(--glass-border); box-shadow: none; }
}

/* Verdict on the last committed word */
.verdict {
    min-height: 3.5rem;
    margin: 0 auto 0.9rem;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.verdict.show { opacity: 1; }

.verdict .v-word {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    word-break: break-word;
}

.verdict .v-tier {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.verdict .v-points {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}

.verdict .v-line {
    font-size: 0.92rem;
    color: var(--text-muted);
    font-weight: 300;
}

.verdict.good .v-word { color: var(--neon-green); text-shadow: 0 0 14px rgba(57, 255, 20, 0.45); }
.verdict.good .v-points { color: var(--neon-green); }

.verdict.huge .v-word {
    color: var(--gold);
    text-shadow: 0 0 18px rgba(255, 213, 74, 0.6);
    animation: pop 0.3s ease-out;
}
.verdict.huge .v-points { color: var(--gold); }
.verdict.huge .v-tier { color: var(--gold); }

.verdict.meh .v-word { color: var(--text-muted); }
.verdict.meh .v-points { color: var(--text-muted); }

.verdict.bad .v-word { color: var(--pink); }
.verdict.bad .v-points { color: var(--pink); }

@keyframes pop {
    0% { transform: scale(0.7); }
    60% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

/* Mic row + meter */
.mic-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    margin: 0 auto 0.85rem;
    max-width: 560px;
}

.mic-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
    flex: 0 0 auto;
}

.mic-btn:hover { border-color: var(--cyan); }

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

.mic-btn.on {
    border-color: var(--pink);
    color: var(--pink);
    box-shadow: 0 0 16px rgba(255, 42, 109, 0.35);
}

.mic-icon { font-size: 1.05rem; }

.meter {
    flex: 1 1 auto;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    overflow: hidden;
    min-width: 80px;
}

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

.meter-fill.loud {
    background: linear-gradient(90deg, var(--gold), var(--pink));
}

/* Type fallback form */
.word-form {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin: 0 auto 0.85rem;
    max-width: 560px;
}

.word-input {
    flex: 1 1 auto;
    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.7rem 0.95rem;
    min-width: 0;
}

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

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

.commit-btn {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--bg-dark);
    background: var(--neon-green);
    border: none;
    border-radius: 12px;
    padding: 0.7rem 1.3rem;
    cursor: pointer;
    box-shadow: 0 0 16px rgba(57, 255, 20, 0.3);
    transition: filter 0.15s, transform 0.1s;
    flex: 0 0 auto;
}

.commit-btn:hover { filter: brightness(1.1); }
.commit-btn:active { transform: scale(0.95); }

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

/* Word bank (tap fallback) */
.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin: 0 auto 1rem;
    max-width: 560px;
    min-height: 2.4rem;
}

.bank-word {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s, color 0.15s, box-shadow 0.15s;
}

.bank-word:active { transform: scale(0.94); }

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

/* Tier-tinted chips so tapping is a meaningful choice */
.bank-word.tier-1 { color: var(--text-muted); border-color: rgba(139, 155, 180, 0.25); }
.bank-word.tier-2:hover { border-color: var(--cyan); color: var(--cyan); }
.bank-word.tier-3:hover { border-color: var(--neon-green); color: var(--neon-green); }
.bank-word.tier-4 { border-color: rgba(189, 0, 255, 0.4); }
.bank-word.tier-4:hover { border-color: var(--neon-purple); color: var(--neon-purple); box-shadow: 0 0 14px rgba(189, 0, 255, 0.35); }
.bank-word.tier-5 { border-color: rgba(255, 213, 74, 0.45); color: var(--gold); }
.bank-word.tier-5:hover { box-shadow: 0 0 16px rgba(255, 213, 74, 0.45); }

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

/* Show / hide interactive bits by state */
.state-idle .hud,
.state-gameover .hud,
.state-idle .verdict,
.state-gameover .verdict,
.state-idle .word-bank,
.state-gameover .word-bank {
    /* keep layout stable; content is cleared in JS */
}

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

.state-idle, .state-gameover { cursor: pointer; }

/* New-best celebration */
.state-gameover.new-best .score {
    color: var(--gold);
    text-shadow: 0 0 14px rgba(255, 213, 74, 0.5);
    animation: pop 0.4s ease-out;
}

.state-gameover.new-best .instruction { color: var(--gold); }

/* 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.7rem; }
    .instruction { font-size: 1rem; }
    .prompt-text { font-size: 1.1rem; }
    .verdict .v-word { font-size: 1.3rem; }
    .timer { font-size: 1.25rem; }
    .hud-item { font-size: 0.95rem; }
    .word-input, .commit-btn { font-size: 0.98rem; }
    .content { padding-top: 1.75rem; }
}

@media (max-width: 360px) {
    .commit-btn { padding: 0.7rem 0.9rem; }
    .control-pill { font-size: 0.76rem; }
}
