:root {
    --background: #0e1420;
    --panel: #151e2c;
    --panel-light: #192434;
    --border: #2d3d50;
    --text: #e8eef5;
    --muted: #a3b2c4;
    --accent: #77c8c5;
    --blue: #a3d9ff;
    --input: #263b4e;
    --green: #8be2b2;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.65;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 50px 22px 70px;
}

/* HEADER */

.eyebrow {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
}

h1 {
    font-size: clamp(26px, 4vw, 39px);
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -0.025em;
    margin: 12px 0;
}

.intro {
    max-width: 760px;
    color: var(--muted);
    margin-bottom: 22px;
}

.research-note {
    max-width: 850px;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 22px;
}

.research-note strong {
    color: var(--text);
}

/* EXCEL SPREADSHEET */

.spreadsheet {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

.sheet-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
    background: var(--panel-light);
    border-bottom: 1px solid var(--border);
}

.file-name {
    font-size: 13px;
    font-weight: 650;
}

.excel-badge {
    display: inline-block;
    background: #1d5a44;
    border: 1px solid #448a69;
    color: #d8ffeb;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 10px;
    margin-right: 8px;
}

.sheet-tab {
    color: var(--muted);
    font-size: 12px;
}

.sheet-tab span {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 4px;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 690px;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    border: 1px solid var(--border);
    padding: 11px 15px;
    vertical-align: middle;
}

.column-letters th {
    background: #182333;
    color: var(--muted);
    text-align: center;
    font-size: 11px;
    font-weight: 550;
    padding: 6px;
}

.row-number {
    background: #182333;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    padding: 8px 5px;
}

.section-row td {
    background: #192738;
    color: var(--accent);
    font-size: 11px;
    letter-spacing: 0.13em;
    font-weight: 700;
    padding: 9px 15px;
}

.cell-label {
    font-size: 13px;
    font-weight: 550;
}

.cell-note {
    font-size: 12px;
    color: var(--muted);
}

/* EDITABLE CELLS */

.editable-cell {
    background: var(--input);
    padding: 5px 10px;
}

.editable-cell:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.editable-cell input {
    width: 100%;
    min-width: 0;
    padding: 5px;
    border: none;
    outline: none;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 17px;
    font-weight: 650;
}

.input-suffix {
    color: var(--blue);
    font-size: 12px;
    flex-shrink: 0;
}

.editable-cell input[aria-invalid="true"] {
    color: #ffb1a9;
}

/* CALCULATED RESULTS */

.result-primary {
    background: #1a302e;
    color: var(--green);
    font-size: 24px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.result-secondary {
    background: #1c2b38;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.formula-cell {
    font-family: Consolas, Monaco, monospace;
    color: var(--blue);
    font-size: 12px;
    overflow-wrap: anywhere;
}

/* PROBABILITY CHART */

.chart-area {
    padding: 20px 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--panel-light);
}

.chart-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.chart-header strong {
    font-size: 13px;
}

.chart-header span {
    color: var(--muted);
    font-size: 12px;
}

.probability-meter {
    height: 18px;
    width: 100%;
    overflow: hidden;
    border-radius: 3px;
    background: #344657;
}

.probability-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,
            #478c8b,
            var(--accent));
    transition: width 0.28s ease;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 11px;
    margin-top: 6px;
}

/* BUTTONS */

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

button {
    cursor: pointer;
    background: var(--panel-light);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 10px 15px;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    transition: border-color 0.2s ease;
}

button:hover {
    border-color: var(--accent);
}

button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.copy-button {
    color: var(--accent);
}

/* METHODOLOGY */

.methodology {
    max-width: 850px;
    margin-top: 36px;
    color: var(--muted);
    font-size: 13px;
}

.methodology h2 {
    margin-top: 32px;
    margin-bottom: 10px;
    color: var(--text);
    font-size: 17px;
    font-weight: 650;
}

.equation {
    padding: 14px 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    color: var(--blue);
    overflow-wrap: anywhere;
    margin: 16px 0;
}

.methodology a {
    color: var(--accent);
}

.disclaimer {
    font-style: italic;
}

footer {
    color: var(--muted);
    margin-top: 42px;
    font-size: 12px;
}

/* MOBILE */

@media (max-width: 650px) {
    .page {
        padding: 32px 14px 55px;
    }

    .sheet-toolbar {
        align-items: flex-start;
    }

    h1 {
        font-size: 27px;
    }

    .chart-area {
        padding: 16px 14px;
    }

    .actions {
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .probability-fill {
        transition: none;
    }
}