/* ═══════════════════════════════════════════════════════════════════
   Odds-O-Matic — Tool-Specific Styles
   Extends shared/css/main.css — keep overrides minimal
   Redesigned: 3-act guided narrative, 2×2 table leads, 2 ratio cards
   ═══════════════════════════════════════════════════════════════════ */

/* ── Segment Colors ──────────────────────────────────────────────── */
:root {
    --seg-a: #2a7de1;
    --seg-a-light: #e0f0ff;
    --seg-b: #f59e0b;
    --seg-b-light: #fef3c7;
}

/* ═══════════════════════════════════════════════════════════════════
   ACT HEADINGS + NARRATIVE BRIDGES
   (matches Threshold Lab pattern)
   ═══════════════════════════════════════════════════════════════════ */

.act-section {
    margin-top: 0.5rem;
}

.act-heading {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 0.85rem;
}

.act-heading h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #374151;
    text-transform: uppercase;
}

.act-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.act-narrative {
    font-size: 0.94rem;
    color: #4b5563;
    line-height: 1.65;
    margin: 0 0 1rem;
    max-width: 760px;
}

.act-bridge {
    text-align: center;
    font-size: 0.92rem;
    font-style: italic;
    color: #6b7280;
    margin: 1.5rem 0 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(to right, transparent, #f1f5f9, transparent);
    border-radius: 8px;
}

/* ── Name Input Fields ───────────────────────────────────────────── */
.name-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 1rem 0;
}

.name-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--app-muted);
}

.name-field input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    font-size: 0.95rem;
}

.name-field--wide {
    grid-column: 1 / -1;
}

/* ── Entry Mode Panels ───────────────────────────────────────────── */
.entry-mode-panel {
    margin-top: 1rem;
}

.entry-mode-panel.hidden {
    display: none;
}

/* ── Probability Mode (collapsed details) ────────────────────────── */
.prob-mode-details {
    margin-top: 1.25rem;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #f8fafc;
}

.prob-mode-details summary {
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--app-muted);
    user-select: none;
}

.prob-mode-details summary:hover {
    color: var(--seg-a);
}

.prob-mode-details[open] summary {
    border-bottom: 1px solid var(--app-border);
}

.prob-mode-details .entry-mode-panel {
    padding: 0 1rem 1rem;
    margin-top: 0;
}

/* ── Probability Slider + Number Row ─────────────────────────────── */
.prob-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.prob-input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.slider-row input[type="range"] {
    flex: 1;
    accent-color: var(--seg-a);
}

.prob-input-group:last-child .slider-row input[type="range"] {
    accent-color: var(--seg-b);
}

.slider-row input[type="number"] {
    width: 70px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    font-size: 0.95rem;
    text-align: center;
}

/* ── 2×2 Contingency Table ───────────────────────────────────────── */
.contingency-table-wrapper {
    overflow-x: auto;
}

.contingency-table {
    width: 100%;
    max-width: 500px;
    border-collapse: collapse;
    margin: 0 auto;
}

.contingency-table th,
.contingency-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--app-border);
    text-align: center;
    font-size: 0.95rem;
}

.contingency-table thead th {
    background: #f1f5f9;
    font-weight: 600;
    font-size: 0.85rem;
}

.contingency-table tbody th {
    background: #f8fafc;
    font-weight: 600;
    text-align: left;
    font-size: 0.85rem;
    min-width: 100px;
}

.ct-cell {
    width: 80px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--app-border);
    border-radius: 4px;
    font-size: 0.95rem;
    text-align: center;
}

.ct-total-col {
    color: var(--app-muted);
    font-weight: 500;
}

.ct-total {
    color: var(--app-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.table-derived-display {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f0f9ff;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e40af;
}

/* ── Segment Panels (side-by-side results) ───────────────────────── */
.segment-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.segment-panel {
    border-top: 4px solid var(--app-border);
}

.segment-panel--a {
    border-top-color: var(--seg-a);
}

.segment-panel--b {
    border-top-color: var(--seg-b);
}

.segment-panel__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    font-size: 1.15rem;
}

.segment-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.segment-dot--a { background: var(--seg-a); }
.segment-dot--b { background: var(--seg-b); }

/* ── Metric Blocks ───────────────────────────────────────────────── */
.metric-block {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.metric-block:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.metric-block h4 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
    margin: 0 0 0.5rem;
}

.stat-highlight {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--app-text);
    margin: 0.25rem 0;
}

.stat-highlight--muted {
    font-size: 1.15rem;
    color: var(--app-muted);
}

.interpretation-sentence {
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0.4rem 0 0;
}

.interpretation-sentence strong {
    font-weight: 700;
}

.interpretation-sentence .val-a { color: var(--seg-a); font-weight: 700; }
.interpretation-sentence .val-b { color: var(--seg-b); font-weight: 700; }

/* ── Meeple Viz Area ─────────────────────────────────────────────── */
.meeple-viz-area {
    margin: 0.5rem 0;
    min-height: 42px;
}

/* ── Comparison Cards ────────────────────────────────────────────── */
.comparison-card {
    margin-bottom: 1rem;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.comparison-header h3 {
    margin: 0;
}

.comparison-badge-row {
    display: flex;
    gap: 0.5rem;
}

.stat-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 700;
    background: var(--seg-a-light);
    color: var(--seg-a);
}

.stat-pill--muted {
    background: #f1f5f9;
    color: var(--app-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.metric-explainer {
    font-size: 0.9rem;
    color: var(--app-muted);
    margin: 0 0 0.75rem;
    font-style: italic;
}

/* ── Callout Boxes ───────────────────────────────────────────────── */
.callout-box {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border-left: 3px solid;
    font-size: 0.9rem;
}

.callout-box.hidden {
    display: none;
}

.callout-box--info {
    background: #f0f9ff;
    border-left-color: #3b82f6;
}

.callout-box--warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
}

.callout-box--success {
    background: #f0fdf4;
    border-left-color: #22c55e;
}

/* ── Summary Comparison Strip (2 stats) ──────────────────────────── */
.comparison-summary-card {
    margin-bottom: 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.summary-stat {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.summary-stat__label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
    margin-bottom: 0.25rem;
}

.summary-stat__value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--app-text);
}

.summary-stat__sub {
    font-size: 0.8rem;
    color: var(--app-muted);
    margin-top: 0.15rem;
}

.summary-insight {
    font-size: 0.92rem;
    line-height: 1.55;
    padding: 0.75rem 1rem;
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    border-radius: 4px;
}

.summary-insight.neutral {
    background: #f1f5f9;
    border-left-color: var(--app-border);
}

/* ── Dual Math Panels ────────────────────────────────────────────── */
.dual-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.dual-panel h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.dual-panel .eq-block {
    margin-bottom: 1.25rem;
}

.dual-panel .eq-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
    margin-bottom: 0.35rem;
}

/* ── Inline Labels (dynamic segment/outcome names) ───────────────── */
.seg-a-label-inline { color: var(--seg-a); font-weight: 600; }
.seg-b-label-inline { color: var(--seg-b); font-weight: 600; }
.outcome-label-inline { font-weight: 600; }

/* ── Intro Notes (expandable detail blocks) ──────────────────────── */
.intro-notes {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    margin-top: 0.75rem;
    padding: 0;
}

.intro-notes summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: #0369a1;
    -webkit-user-select: none;
    user-select: none;
}

.intro-notes summary:hover {
    background: #e0f2fe;
    border-radius: 8px;
}

.intro-notes[open] summary {
    border-bottom: 1px solid #bae6fd;
    border-radius: 8px 8px 0 0;
}

.intro-notes > *:not(summary) {
    padding: 0 1rem;
}

.intro-notes > *:last-child {
    padding-bottom: 0.75rem;
}

/* ── Report Text ─────────────────────────────────────────────────── */
.report-text {
    line-height: 1.7;
    font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════════════════════
   100-MEEPLE CROWD GRIDS
   ═══════════════════════════════════════════════════════════════════ */

.crowd-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.crowd-panel {
    background: var(--app-bg, #f5f7fb);
    border-radius: 10px;
    padding: 1rem;
    border-top: 3px solid var(--app-border);
}

.crowd-panel--a {
    border-top-color: var(--seg-a);
}

.crowd-panel--b {
    border-top-color: var(--seg-b);
}

.crowd-panel__header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.crowd-panel__name {
    font-weight: 700;
    font-size: 0.95rem;
}

.crowd-panel--a .crowd-panel__name {
    color: var(--seg-a);
}

.crowd-panel--b .crowd-panel__name {
    color: var(--seg-b);
}

.crowd-panel__count {
    font-weight: 800;
    font-size: 1.3rem;
    line-height: 1;
    margin-left: auto;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    min-width: 2ch;
    text-align: center;
}

.crowd-panel--a .crowd-panel__count {
    color: var(--seg-a);
    background: var(--seg-a-light);
}

.crowd-panel--b .crowd-panel__count {
    color: var(--seg-b);
    background: var(--seg-b-light);
}

.crowd-panel__of {
    font-size: 0.82rem;
    color: var(--app-muted);
}

.crowd-grid {
    max-width: 210px;
    margin: 0 auto;
}

.crowd-grid .meeple-probability-bar {
    gap: 2px;
    justify-content: center;
}

.crowd-sentence {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

.crowd-legend {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--app-muted);
}

.crowd-legend__item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.crowd-legend__swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

.crowd-legend__swatch--active {
    background: var(--seg-a);
}

.crowd-legend__swatch--empty {
    background: #d1d8e3;
    opacity: 0.45;
}

/* ═══════════════════════════════════════════════════════════════════
   EMOJI INSIGHT CALLOUTS
   ═══════════════════════════════════════════════════════════════════ */

.emoji-insight {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-top: 0.75rem;
    border-left: 4px solid transparent;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    line-height: 1.5;
    font-size: 0.93rem;
}

.emoji-insight.hidden {
    display: none;
}

.emoji-insight__emoji {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.emoji-insight__body strong {
    font-weight: 700;
}

.emoji-insight--strong {
    background: #ecfdf5;
    border-left-color: #10b981;
    color: #065f46;
}

.emoji-insight--moderate {
    background: #eff6ff;
    border-left-color: #3b82f6;
    color: #1e40af;
}

.emoji-insight--neutral {
    background: #f8fafc;
    border-left-color: #94a3b8;
    color: #475569;
}

.emoji-insight--flipped {
    background: #fefce8;
    border-left-color: #f59e0b;
    color: #92400e;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .name-fields {
        grid-template-columns: 1fr;
    }

    .name-field--wide {
        grid-column: auto;
    }

    .prob-inputs {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .segment-panels {
        grid-template-columns: 1fr;
    }

    .dual-panels {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }

    .crowd-panels {
        grid-template-columns: 1fr;
    }

    .comparison-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .act-bridge {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .slider-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .slider-row input[type="number"] {
        width: 100%;
    }

    .contingency-table {
        font-size: 0.85rem;
    }

    .ct-cell {
        width: 60px;
        font-size: 0.85rem;
    }
}
