/* Be Average — FunSlop.com
   Poll game. Hit the mode. Maximize alignment with the crowd. */

: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, FunSlop 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 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;
    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(--neon-green));
    -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(--neon-green); }

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

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

.hud-item {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
}

.hud-item:empty { display: none; }

.hud-score { color: var(--cyan); }

.hud-combo {
    color: var(--gold);
    font-weight: 700;
}

.hud-combo.hot {
    animation: combo-pop 0.3s ease-out;
    text-shadow: 0 0 12px rgba(255, 213, 74, 0.6);
}

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

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

/* The poll question card */
.prompt-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 1.5rem 1.25rem;
    margin: 0.5rem auto 0;
    max-width: 520px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.state-playing .prompt-card {
    border-color: rgba(5, 217, 232, 0.35);
    box-shadow: 0 0 28px rgba(5, 217, 232, 0.12);
}

.question {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 1.1rem;
    min-height: 1.4em;
}

/* Hide the answer form when not actively playing */
.answer-form { display: none; }
.state-playing .answer-form { display: block; }

.answer-input {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-weight: 500;
    text-align: center;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

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

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

.answer-input.nudge {
    animation: shake 0.3s ease-in-out;
    border-color: var(--pink);
}

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

/* Quick-pick chips */
.quick-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin: 0.9rem 0 0.2rem;
}

.pick-chip {
    font-family: var(--font-body);
    font-size: 0.9rem;
    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.45rem 0.95rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, transform 0.1s, background 0.15s;
}

.pick-chip:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(5, 217, 232, 0.08);
}

.pick-chip:active { transform: scale(0.94); }

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

.game-btn {
    font-family: var(--font-body);
    margin-top: 1rem;
    padding: 0.9rem 2rem;
    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;
    min-width: 160px;
    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.5;
    cursor: default;
}

.btn-submit {
    background: var(--neon-green);
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.32);
}

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

/* Reveal / distribution chart */
.reveal {
    margin: 1.25rem auto 0;
    max-width: 520px;
    text-align: left;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.25s ease;
}

.reveal.show {
    opacity: 1;
    max-height: none;
    animation: reveal-in 0.3s ease-out;
}

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

.reveal-head {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.9rem;
    line-height: 1.4;
}

.reveal-head.jackpot {
    color: var(--gold);
    text-shadow: 0 0 14px rgba(255, 213, 74, 0.45);
}

.reveal-head.partial { color: var(--cyan); }
.reveal-head.off-dist { color: var(--pink); }
.reveal-head strong { color: var(--neon-green); }

.dist-chart {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 0.9rem 1rem;
}

.dist-row {
    display: grid;
    grid-template-columns: 1fr 36%;
    align-items: center;
    gap: 0.6rem;
    padding: 0.32rem 0;
    position: relative;
}

.dist-label {
    font-size: 0.92rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.dist-row.mode .dist-label { color: var(--text-primary); }
.dist-row.matched .dist-label { color: var(--cyan); font-weight: 700; }
.dist-row.mode.matched .dist-label { color: var(--gold); }

.dist-bar-track {
    grid-column: 1 / -1;
    height: 7px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
}

/* Reflow: label + pop on one row, bar full-width beneath */
.dist-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "label pop"
        "bar bar";
}
.dist-label { grid-area: label; }
.dist-pop { grid-area: pop; }
.dist-bar-track { grid-area: bar; margin-top: 0.2rem; }

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

.dist-row.mode .dist-bar-fill {
    background: linear-gradient(90deg, var(--gold), var(--neon-green));
}

.dist-row.matched .dist-bar-fill {
    background: linear-gradient(90deg, var(--cyan), var(--neon-green));
}

@keyframes bar-grow {
    0% { transform: scaleX(0); transform-origin: left; }
    100% { transform: scaleX(1); transform-origin: left; }
}

.dist-pop {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    text-align: right;
}

.dist-row.mode .dist-pop { color: var(--gold); }
.dist-row.matched .dist-pop { color: var(--cyan); }

.mode-tag, .you-tag {
    font-family: var(--font-display);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0.1rem 0.35rem;
    border-radius: 5px;
    line-height: 1;
}

.mode-tag {
    color: var(--bg-dark);
    background: var(--gold);
}

.you-tag {
    color: var(--bg-dark);
    background: var(--cyan);
}

/* Game-over summary */
.summary { text-align: center; }

.summary-score {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    color: var(--neon-green);
    text-shadow: 0 0 18px rgba(57, 255, 20, 0.35);
    margin-bottom: 0.3rem;
}

.summary-unit {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    display: block;
    margin-top: 0.3rem;
}

.summary-line {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
}

.summary-verdict {
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.5;
    max-width: 440px;
    margin: 0 auto;
}

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

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

@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: 1.5rem;
    min-height: 1.2em;
}

/* Hide control hints / prompt card per state */
.state-playing .controls-inline,
.state-reveal .controls-inline,
.state-gameover .controls-inline {
    display: none;
}

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

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

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

.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(--cyan);
    background: rgba(5, 217, 232, 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;
    cursor: auto;
}

.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(--cyan);
    color: var(--cyan);
}

.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: 1rem; }
    .question { font-size: 1.25rem; }
    .answer-input { font-size: 1.05rem; }
    .game-btn {
        padding: 0.8rem 1.6rem;
        font-size: 1rem;
        min-width: 140px;
    }
    .summary-score { font-size: 2.4rem; }
    .content { padding-top: 2rem; }
}
