* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green: #22c55e;
    --orange: #f97316;
    --yellow: #eab308;
    --purple: #a855f7;
    --blue: #3b82f6;
    --gray: #6b7280;
    --bg: #111827;
    --surface: #1f2937;
    --surface2: #374151;
    --text: #f9fafb;
    --text-dim: #9ca3af;
    --accent: #60a5fa;
    --border: #4b5563;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
}

header {
    text-align: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.5rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

main {
    max-width: 600px;
    margin: 0 auto;
    padding: 0.75rem;
}

/* Puzzle Nav */
.puzzle-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 1rem;
}

.nav-btn:active {
    background: var(--surface2);
}

.nav-btn.nav-disabled {
    opacity: 0.25;
    pointer-events: none;
}

.nav-center {
    text-align: center;
}

.nav-puzzle-num {
    font-size: 0.9rem;
    font-weight: 600;
}

.nav-daily-badge {
    display: inline-block;
    background: var(--accent);
    color: var(--bg);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
    margin-left: 0.375rem;
}

.nav-completed {
    display: block;
    font-size: 0.7rem;
    color: var(--green);
    min-height: 1em;
}

.puzzle-info {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

/* Box Scores */
.box-scores {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.box-score-line {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
}

.bs-away, .bs-home {
    font-weight: 600;
    min-width: 2rem;
    text-align: center;
}

.bs-score {
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

/* Rules */
.rules {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.rules summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
}

.rules p {
    margin: 0.5rem 0;
    color: var(--text-dim);
}

.hint-legend {
    list-style: none;
    margin: 0.375rem 0 0;
}

.hint-legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
    color: var(--text-dim);
}

.hint-swatch {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Slots */
#slots {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.slot {
    flex: 1;
    min-width: 75px;
    max-width: 110px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.25rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s;
}

.slot.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.slot.filled {
    background: var(--surface2);
}

.slot-rank {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
}

.slot-player {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.25rem;
}

.score-display {
    text-align: center;
    min-width: 3.5rem;
}

.score-display .score-value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.score-target .score-value {
    color: var(--green);
}

.score-best .score-value {
    color: var(--accent);
}

.score-display .score-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.slot-controls {
    display: flex;
    gap: 0.375rem;
    justify-content: center;
}

.slot-controls button {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    cursor: pointer;
}

.slot-controls button:active {
    background: var(--surface2);
}

/* Submit */
#guess-form {
    text-align: center;
    margin-bottom: 0.75rem;
}

#submit-btn {
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    padding: 0.625rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

#submit-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Results */
#results {
    margin-bottom: 0.75rem;
}

.guess-row {
    display: flex;
    gap: 0.25rem;
    align-items: stretch;
    margin-bottom: 0.5rem;
}

.guess-label {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    min-width: 1.5rem;
}

.guess-tile {
    flex: 1;
    border-radius: 6px;
    padding: 0.375rem 0.25rem;
    text-align: center;
    min-width: 0;
}

.tile-icon {
    display: block;
    font-size: 1.1rem;
}

.tile-name {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tile-hint {
    display: none;
}

.guess-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
    min-width: 2.5rem;
    font-variant-numeric: tabular-nums;
}

.guess-pct {
    display: block;
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-dim);
    opacity: 0.7;
}

.hint-green { background: var(--green); color: #fff; }
.hint-orange { background: var(--orange); color: #fff; }
.hint-yellow { background: var(--yellow); color: #1a1a1a; }
.hint-purple { background: var(--purple); color: #fff; }
.hint-blue-left, .hint-blue-right { background: var(--blue); color: #fff; }
.hint-gray { background: var(--gray); color: #fff; }

.solved-banner, .game-over-banner {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.solved-banner {
    background: var(--green);
    color: #fff;
}

.game-over-banner {
    background: var(--surface2);
    color: var(--text);
}

/* Filters */
#filters {
    margin-bottom: 0.5rem;
}

#filter-name {
    width: 100%;
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 0.375rem;
}

#filter-name::placeholder {
    color: var(--text-dim);
}

.filter-row {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: contents;
}

.filter-sep {
    width: 1px;
    height: 1.4rem;
    background: var(--border);
    margin: 0 0.25rem;
}

.filter-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.filter-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.filter-btn.locked {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    cursor: default;
}

.filter-btn.disabled {
    opacity: 0.25;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Player Pool */
#pool {
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.pool-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.pool-player:last-child {
    border-bottom: none;
}

.pool-player:active {
    background: var(--surface2);
}

.pool-player.picked {
    opacity: 0.3;
    pointer-events: none;
}

.pool-player.hidden {
    display: none;
}

.player-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.player-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
}

@media (hover: hover) {
    .pool-player:hover {
        background: var(--surface);
    }
    .slot:hover {
        border-color: var(--text-dim);
    }
}

/* Answer Reveal */
.answer-reveal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.answer-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
    text-align: center;
}

.answer-player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
}

.answer-player:last-child {
    border-bottom: none;
}

.answer-rank {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    min-width: 1.5rem;
}

.answer-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
}

.answer-meta {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.answer-pts {
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--green);
}
