/* ── Variables (matching bot_arena) ───────────────────────────── */
:root {
    --bg: #0f1923;
    --bg-card: #1a2332;
    --bg-row: rgba(255,255,255,0.02);
    --bg-row-alt: rgba(255,255,255,0.04);
    --accent: #6e8eff;
    --accent-bg: rgba(110,142,255,0.1);
    --green: #66bb6a;
    --green-bg: rgba(102,187,106,0.12);
    --red: #ef5350;
    --red-bg: rgba(239,83,80,0.12);
    --gold: #ffd54f;
    --text: #e0e0e0;
    --text-dim: #8899a6;
    --panel: rgba(15,25,35,0.95);
    --border: rgba(255,255,255,0.08);
    --radius: 10px;
    --radius-sm: 6px;
}

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

/* ── Site Nav ─────────────────────────────────────────────────── */
.site-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 44px;
    background: rgba(10,18,26,0.95); border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky; top: 0; z-index: 100; backdrop-filter: blur(8px);
    flex-shrink: 0;
}
.nav-brand {
    font-size: 0.95em; font-weight: 700; color: #fff; text-decoration: none;
    letter-spacing: 0.5px;
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
    padding: 6px 14px; border-radius: 6px; font-size: 0.82em; font-weight: 600;
    color: #8899a6; text-decoration: none; transition: all 0.15s;
}
.nav-link:hover { color: #e0e0e0; background: rgba(255,255,255,0.06); }
.nav-link.active { color: #fff; background: rgba(27,110,46,0.35); }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 12px;
}

.header-left h1 { font-size: 1.3em; font-weight: 700; }
.header-left .subtitle { font-size: 0.85em; color: var(--text-dim); margin-top: 2px; }

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.bot-label {
    font-size: 0.8em;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#botSelect {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-size: 0.9em;
    min-width: 200px;
    cursor: pointer;
}

/* ── Body Grid ───────────────────────────────────────────────── */
.body-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 900px) {
    .body-grid { grid-template-columns: 1fr; }
}

/* ── Panel ───────────────────────────────────────────────────── */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-header h2 { font-size: 1em; font-weight: 700; }

.toggle-btn {
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text-dim);
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.toggle-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.toggle-btn.active { background: var(--accent-bg); color: var(--accent); border-color: rgba(110,142,255,0.3); }

/* ── Format Guide ────────────────────────────────────────────── */
.format-guide {
    display: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.2);
    max-height: 360px;
    overflow-y: auto;
}
.format-guide.open { display: block; }

.guide-content {
    padding: 14px;
    font-size: 0.85em;
    line-height: 1.5;
}
.guide-content h3 {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin: 12px 0 6px;
}
.guide-content h3:first-child { margin-top: 0; }
.guide-content p { color: var(--text-dim); margin-bottom: 6px; }
.guide-content code {
    background: rgba(255,255,255,0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

.guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    margin: 6px 0;
}
.guide-table th {
    text-align: left;
    padding: 4px 8px;
    color: var(--text-dim);
    font-size: 0.8em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
.guide-table td {
    padding: 3px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.guide-table td:first-child { white-space: nowrap; }

/* ── Textarea ────────────────────────────────────────────────── */
#scenarioInput {
    width: 100%;
    min-height: 240px;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.3);
    color: var(--text);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.88em;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}
#scenarioInput:focus {
    outline: none;
    border-color: var(--accent);
}
#scenarioInput::placeholder {
    color: rgba(255,255,255,0.2);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.input-actions {
    display: flex;
    gap: 10px;
}

.btn-analyze {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent), #5070dd);
    color: #fff;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}
.btn-analyze:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(110,142,255,0.3);
}
.btn-analyze:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-analyze.loading { opacity: 0.7; }

.btn-clear {
    padding: 12px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text-dim);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-clear:hover { background: rgba(255,255,255,0.12); color: var(--text); }

/* ── Error Display ───────────────────────────────────────────── */
.error-display {
    display: none;
    background: var(--red-bg);
    border: 1px solid rgba(239,83,80,0.3);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 0.85em;
}
.error-display.visible { display: block; }
.error-display ul { margin: 0; padding-left: 18px; }
.error-display li { color: var(--red); margin: 2px 0; }

/* ── Results ─────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-style: italic;
}

.results-content { display: none; flex-direction: column; gap: 14px; }
.results-content.visible { display: flex; }

.result-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    background: rgba(0,0,0,0.15);
}
.result-card h3 {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.summary-item {
    padding: 6px 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 4px;
}
.summary-label {
    font-size: 0.7em;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.3px;
}
.summary-value {
    font-size: 0.95em;
    font-weight: 600;
    margin-top: 2px;
}

/* Recommendation */
.rec-top-action {
    font-size: 2em;
    font-weight: 800;
    text-align: center;
    padding: 16px;
    background: var(--accent-bg);
    border-radius: var(--radius-sm);
    color: #fff;
    margin-bottom: 10px;
}

.rec-confidence {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.confidence-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
}
.confidence-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--accent), var(--green));
}
.confidence-label {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--text);
    min-width: 48px;
    text-align: right;
}

.rec-advisor {
    font-size: 0.8em;
    color: var(--text-dim);
    margin-bottom: 10px;
    text-align: center;
}

.rec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
}
.rec-table th {
    text-align: left;
    padding: 5px 8px;
    font-size: 0.75em;
    text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}
.rec-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.rec-table tr:first-child td { font-weight: 700; }
.rec-table .prob-bar-cell { width: 40%; }
.prob-bar-wrap {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.prob-bar-inner {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
}

/* Action Chips */
.action-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.action-chip {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
}
.action-chip.card-action { color: var(--text); }
.action-chip.bid-action { color: var(--accent); border-color: rgba(110,142,255,0.3); }

/* ── Prompt Footer ───────────────────────────────────────────── */
.prompt-footer {
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    background: var(--panel);
    flex-shrink: 0;
}

.prompt-section {
    max-width: 1400px;
    margin: 0 auto;
}

.prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.prompt-header h3 {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    font-weight: 700;
}

.copy-btn {
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text-dim);
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.copy-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.copy-btn.copied { background: var(--green-bg); color: var(--green); border-color: rgba(102,187,106,0.3); }

.prompt-text {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78em;
    line-height: 1.5;
    color: var(--text-dim);
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Monte Carlo Button & Options ────────────────────────────── */
.btn-mc {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--green), #4a9e4e);
    color: #fff;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}
.btn-mc:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102,187,106,0.3);
}
.btn-mc:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-mc.loading { opacity: 0.7; }

.mc-options {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mc-label {
    font-size: 0.8em;
    color: var(--text-dim);
    font-weight: 600;
}
.mc-options select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-size: 0.85em;
    cursor: pointer;
}

/* ── Monte Carlo Results ─────────────────────────────────────── */
.mc-card { }

.mc-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
    color: var(--text-dim);
    margin-bottom: 10px;
}
.mc-sep { color: rgba(255,255,255,0.2); }

.mc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}
.mc-table thead th {
    text-align: left;
    padding: 5px 8px;
    font-size: 0.75em;
    text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}
.mc-table tbody td {
    padding: 7px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.mc-table tbody tr:nth-child(even) { background: var(--bg-row-alt); }

.mc-action { font-weight: 600; white-space: nowrap; }
.mc-wr { font-weight: 700; white-space: nowrap; }
.mc-march { color: var(--gold); font-size: 0.9em; }
.mc-euchre { color: var(--red); font-size: 0.9em; }

.mc-best td { background: var(--green-bg) !important; }
.mc-best .mc-action { color: var(--green); }
.mc-best .mc-wr { color: var(--green); }

.mc-best-tag {
    display: inline-block;
    font-size: 0.65em;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--green);
    color: #0f1923;
    font-weight: 800;
    vertical-align: middle;
    margin-left: 4px;
    letter-spacing: 0.5px;
}

.mc-bar-cell { width: 30%; }
.mc-bar-wrap {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.mc-bar-inner {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.mc-bar-inner.best { background: var(--green); }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    .header { padding: 10px 16px; }
    .body-grid { padding: 12px 16px; }
    .prompt-footer { padding: 12px 16px; }
    #botSelect { min-width: 150px; }
    .rec-top-action { font-size: 1.5em; padding: 12px; }
    .summary-grid { grid-template-columns: 1fr 1fr; }
}
