/* Model Zoo — FunSlop.com
   Breed / merge tiny models, auto-battle them up a benchmark ladder. */

: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-bg: 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);
}

.glow-bg {
    position: fixed;
    top: -90px;
    right: -90px;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, var(--neon-purple) 0%, transparent 70%);
    opacity: 0.14;
    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;
    user-select: none;
    -webkit-user-select: none;
}

.content {
    text-align: center;
    padding: 2.25rem 1rem 6rem;
    max-width: 760px;
    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(--neon-purple), var(--cyan), var(--neon-green));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* ---------------- HUD ---------------- */
.hud {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.hud-stat {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.5rem 1.1rem;
    min-width: 92px;
}

.hud-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.hud-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--cyan);
}

.hud-stat:nth-child(2) .hud-value { color: var(--neon-green); }
.hud-stat:nth-child(3) .hud-value { color: var(--gold); }

/* ---------------- start / gameover panels ---------------- */
.start-panel, .gameover-panel { display: none; }
.state-idle .start-panel { display: block; }
.state-gameover .gameover-panel { display: block; }

.pitch {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 520px;
    margin: 0 auto 1.5rem;
}

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

.verdict {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 0.75rem;
    text-shadow: 0 0 16px rgba(255, 213, 74, 0.4);
    animation: score-pop 0.4s ease-out;
}

.final-line {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

@keyframes score-pop {
    0% { transform: scale(0.85); opacity: 0; }
    55% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------------- play area ---------------- */
.play-area { display: none; }
.state-playing .play-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: left;
    margin-bottom: 1rem;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.panel-head {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ---------------- benchmark card ---------------- */
.benchmark-panel { border-color: rgba(5, 217, 232, 0.25); }

.benchmark-card {
    background: rgba(5, 217, 232, 0.05);
    border: 1px solid rgba(5, 217, 232, 0.2);
    border-radius: 12px;
    padding: 0.9rem;
    margin-bottom: 0.85rem;
    flex: 1;
}

.bench-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 0.25rem;
}

.bench-tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.7rem;
}

.bench-demands {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.7rem;
}

.demand-pill {
    font-size: 0.75rem;
    background: rgba(189, 0, 255, 0.12);
    border: 1px solid rgba(189, 0, 255, 0.3);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.demand-w { color: var(--neon-purple); font-weight: 700; }

.bench-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.bench-thresh { color: var(--pink); }
.bench-reward { color: var(--neon-green); }

.bench-preview {
    margin-top: 0.7rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
}

.bench-preview.pass {
    color: var(--neon-green);
    background: rgba(57, 255, 20, 0.08);
    border: 1px solid rgba(57, 255, 20, 0.25);
}

.bench-preview.fail {
    color: var(--pink);
    background: rgba(255, 42, 109, 0.08);
    border: 1px solid rgba(255, 42, 109, 0.25);
}

/* ---------------- roster ---------------- */
.roster-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.roster-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.roster {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    flex: 1;
    align-content: start;
}

.empty-roster {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 1.5rem 0;
}

.model-card {
    position: relative;
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.6rem 0.65rem;
    cursor: pointer;
    font-family: var(--font-body);
    color: var(--text-primary);
    transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s, background 0.15s;
}

.model-card:hover {
    border-color: rgba(5, 217, 232, 0.5);
    transform: translateY(-1px);
}

.model-card:active { transform: scale(0.98); }

.model-card.selected {
    border-color: var(--neon-purple);
    background: rgba(189, 0, 255, 0.1);
    box-shadow: 0 0 16px rgba(189, 0, 255, 0.35);
}

.sel-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--neon-purple);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.7);
}

.model-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.3rem;
    margin-bottom: 0.15rem;
}

.model-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-gen {
    font-size: 0.65rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.model-power {
    font-size: 0.72rem;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.model-stats { display: flex; flex-direction: column; gap: 0.18rem; }

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.62rem;
}

.stat-short {
    width: 26px;
    color: var(--text-muted);
    font-weight: 700;
    flex-shrink: 0;
}

.stat-bar {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.stat-fill {
    display: block;
    height: 100%;
    background: var(--cyan);
    border-radius: 999px;
    transition: width 0.3s;
}

.stat-row.cost .stat-fill { background: var(--pink); }

.stat-num {
    width: 20px;
    text-align: right;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* ---------------- buttons ---------------- */
.action-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.game-btn {
    font-family: var(--font-body);
    font-weight: 700;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s, opacity 0.15s;
    color: var(--bg-dark);
    padding: 0.7rem 1.1rem;
    font-size: 0.95rem;
}

.game-btn:active:not(:disabled) { transform: scale(0.96); }

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

.game-btn:disabled { cursor: default; opacity: 0.45; }

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

.btn-special {
    background: var(--cyan);
    box-shadow: 0 0 16px rgba(5, 217, 232, 0.3);
    width: 100%;
}
.btn-special:hover:not(:disabled) { filter: brightness(1.1); }

.btn-merge {
    background: var(--neon-purple);
    color: #fff;
    box-shadow: 0 0 16px rgba(189, 0, 255, 0.3);
    flex: 1;
    min-width: 110px;
}
.btn-merge:hover:not(:disabled) { filter: brightness(1.15); }

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    flex: 2;
    min-width: 150px;
}
.btn-ghost:hover { border-color: var(--neon-green); color: var(--neon-green); }
.btn-ghost.cant-afford { opacity: 0.55; }

@keyframes flash-no {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.flash-no { animation: flash-no 0.25s ease-in-out; }

/* ---------------- log ---------------- */
.log { display: none; }
.state-playing .log, .state-gameover .log {
    display: block;
    text-align: left;
    max-width: 620px;
    margin: 1rem auto 0;
    max-height: 220px;
    overflow-y: auto;
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
}

.log-line {
    font-size: 0.85rem;
    line-height: 1.45;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    animation: log-in 0.25s ease-out;
}
.log-line:last-child { border-bottom: none; }

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

.log-good { color: var(--neon-green); }
.log-bad { color: var(--pink); }
.log-merge { color: var(--neon-purple); }
.log-system { color: var(--text-muted); font-style: italic; }

/* ---------------- how-to / SEO ---------------- */
.how-to-play {
    text-align: left;
    margin: 3rem auto 0;
    max-width: 620px;
    background: var(--panel-bg);
    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 em { color: var(--cyan); font-style: normal; }

.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: 620px;
    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: 620px) {
    .title { font-size: 1.8rem; }
    .instruction { font-size: 0.95rem; }
    .state-playing .play-area { grid-template-columns: 1fr; }
    .pitch { font-size: 0.98rem; }
    .hud-stat { min-width: 78px; padding: 0.45rem 0.8rem; }
    .hud-value { font-size: 1.2rem; }
}

@media (max-width: 360px) {
    .roster { grid-template-columns: 1fr; }
    .action-row { flex-direction: column; }
    .btn-merge, .btn-ghost { flex: none; width: 100%; }
}
