:root {
    --bg:            #0c0c0e;
    --surface:       #141418;
    --surface-alt:   #1e1e24;
    --border:        #2a2a32;
    --border-light:  #3a3a45;
    --text:          #e2e2e8;
    --text-muted:    #72727e;
    --accent:        #7c5cfc;
    --accent-dim:    #3d2d8a;
    --confirmed-bg:  #0d2e1a;
    --confirmed-border: #22c55e;
    --confirmed-text:   #4ade80;
    --ruledout-bg:   #2e0d0d;
    --ruledout-border:  #ef4444;
    --ruledout-text:    #f87171;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    min-height: 100vh;
    line-height: 1.5;
}

/* ── Header ── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

header p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    border: 1px solid;
    vertical-align: middle;
}

.confirmed-pill {
    background: var(--confirmed-bg);
    border-color: var(--confirmed-border);
    color: var(--confirmed-text);
}

.ruledout-pill {
    background: var(--ruledout-bg);
    border-color: var(--ruledout-border);
    color: var(--ruledout-text);
}

/* ── Layout ── */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ── Evidence Section ── */
.evidence-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 0.875rem;
}

.evidence-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.evidence-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--surface-alt);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    user-select: none;
    white-space: nowrap;
}

.evidence-btn:hover {
    border-color: #555;
    color: var(--text);
    background: #28282f;
}

.evidence-btn.confirmed {
    background: var(--confirmed-bg);
    border-color: var(--confirmed-border);
    color: var(--confirmed-text);
}

.evidence-btn.ruled-out {
    background: var(--ruledout-bg);
    border-color: var(--ruledout-border);
    color: var(--ruledout-text);
    text-decoration: line-through;
    text-decoration-color: var(--ruledout-text);
}

/* ── Reset Button ── */
.reset-btn {
    padding: 0.5rem 1.1rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}

.reset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Ghost Count ── */
.ghost-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.ghost-count #possible-count {
    color: var(--accent);
    font-weight: 700;
    font-size: 1rem;
}

/* ── Ghost Grid ── */
.ghost-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 0.875rem;
    overflow: visible;
}

/* ── Ghost Card ── */
.ghost-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ghost-card.possible {
    border-color: var(--border);
}

.ghost-card.possible:hover {
    border-color: var(--border-light);
}

.ghost-card.eliminated {
    display: none;
}

.ghost-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.hunt-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: fit-content;
}

/* ── Evidence Badges ── */
.evidence-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.evidence-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border-light);
    background: var(--surface-alt);
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    white-space: nowrap;
}

.ghost-grid.has-confirmed .evidence-badge {
    border-color: var(--accent);
}

.evidence-badge.confirmed {
    display: none;
}

.evidence-badge.ruled-out {
    background: var(--ruledout-bg);
    border-color: var(--ruledout-border);
    color: var(--ruledout-text);
    text-decoration: line-through;
    text-decoration-color: var(--ruledout-text);
}

/* ── Tooltip Details ── */
.ghost-card {
    position: relative;
}

.detail-content {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 50;

    background: #1d1b30;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);

    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* Caret pointing down toward the card */
.detail-content::after,
.detail-content::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: solid transparent;
    border-right: solid transparent;
    border-top: solid;
}

.detail-content::after {
    border-left-width: 8px;
    border-right-width: 8px;
    border-top-width: 8px;
    border-top-color: var(--accent);
}

.detail-content::before {
    border-left-width: 7px;
    border-right-width: 7px;
    border-top-width: 7px;
    border-top-color: #1d1b30;
    margin-top: -1px;
    z-index: 1;
}

.ghost-card:hover .detail-content {
    opacity: 1;
}

.detail-row .detail-label {
    font-weight: 700;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text);
    display: block;
    margin-bottom: 0.15rem;
}

/* ── Footer ── */
footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
}

footer a:hover {
    color: var(--accent);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    header { padding: 1rem; }
    .container { padding: 1rem; }
    .ghost-grid { grid-template-columns: 1fr; }
    header h1 { font-size: 1.1rem; }
    header p { display: none; }
}
