/* Olive palette — mirrors the E101H/Apps Carolina-blue scheme with
   dark olive green in place of UNC navy + olivedrab in place of
   Carolina blue. */
:root {
    --olive-dark:   #3D421A;   /* was --unc-navy   #13294B */
    --olive-bright: #6B8E23;   /* was --carolina-blue #4B9CD3 (olivedrab) */
    --olive-soft:   #F4F5EE;   /* was #f9f9f9 accordion bg */
    --olive-info:   #f4f4f4;   /* instructor-info / muted card */
}

body {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

h1 { color: var(--olive-dark); }
h2 { color: var(--olive-bright); }

/* ---- brand header ---- */
.page-head { margin-bottom: 1.25rem; }
.brand-title {
    font-family: "Spectral", Georgia, "Times New Roman", serif;
    font-weight: 600;
    font-size: 2.6rem;
    letter-spacing: -0.01em;
    color: var(--olive-dark);
    margin-bottom: 0.35rem;
}
.paper-sub { margin: 0; line-height: 1.35; }
.paper-title {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--olive-bright);
}
.paper-by {
    display: block;
    font-family: "Spectral", Georgia, serif;
    font-style: italic;
    font-size: 0.95rem;
    color: #6a6a5a;
    margin-top: 0.15rem;
}

/* signature: comb-teeth divider — encodes the interleaving atom comb
   y₁ ≤ x₁ ≤ y₂ ≤ x₂ … that the march assembles. Tall dark teeth + short
   olive teeth alternate on a spine, the way y- and x-atoms interleave. */
.comb-rule {
    height: 22px;
    margin-top: 0.9rem;
    border-bottom: 1.5px solid var(--olive-dark);
    background:
        repeating-linear-gradient(90deg,
            var(--olive-dark) 0 2.5px, transparent 2.5px 34px)
            left bottom / 100% 20px no-repeat,
        repeating-linear-gradient(90deg,
            transparent 0 17px, var(--olive-bright) 17px 19px, transparent 19px 34px)
            left bottom / 100% 9px no-repeat;
}

@media (max-width: 575px) {
    .brand-title { font-size: 2rem; }
    .paper-title { font-size: 0.66rem; letter-spacing: 0.1em; }
}

.accordion-button {
    background-color: var(--olive-soft);
    color: var(--olive-dark);
    font-weight: 600;
    font-size: 1.05rem;
}
.accordion-button:not(.collapsed) {
    background-color: var(--olive-bright);
    color: white;
}
.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(107, 142, 35, 0.25);
}
.accordion-item {
    border-left: 4px solid var(--olive-bright);
    margin-bottom: 0.5rem;
}

.btn-olive {
    background-color: var(--olive-bright);
    color: white;
    border: none;
}
.btn-olive:hover, .btn-olive:focus {
    background-color: var(--olive-dark);
    color: white;
}

.back-link { color: var(--olive-bright); text-decoration: none; }
.back-link:hover { text-decoration: underline; color: var(--olive-dark); }

.instructor-info {
    background-color: var(--olive-info);
    border-radius: 0.5rem;
}

footer { color: #666; }

/* ---- input card ---- */
.input-card {
    background: white;
    border: 1px solid #e1e3d7;
    border-left: 4px solid var(--olive-bright);
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0 1.5rem 0;
}
.input-card label { font-weight: 600; color: var(--olive-dark); }

.preset-chip {
    display: inline-block;
    background: var(--olive-soft);
    border: 1px solid #c9d39a;
    color: var(--olive-dark);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
    margin: 0.15rem 0.25rem 0.15rem 0;
    user-select: none;
}
.preset-chip:hover {
    background: var(--olive-bright);
    color: white;
    border-color: var(--olive-bright);
}

#costPreview {
    background: var(--olive-soft);
    border-radius: 0.3rem;
    padding: 0.5rem 0.75rem;
    min-height: 2.4rem;
    font-size: 1.05rem;
    color: var(--olive-dark);
}

/* ---- results ---- */
.regime-col {
    background: var(--olive-soft);
    border-radius: 0.4rem;
    padding: 0.9rem;
    height: 100%;
}
.regime-col h5 {
    color: var(--olive-dark);
    border-bottom: 1px solid #d4d8b6;
    padding-bottom: 0.3rem;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.verdict-yes { color: #5c7a1f; font-weight: 700; }
.verdict-no  { color: #8b3a3a; font-weight: 600; }

.reason-pill {
    display: inline-block;
    background: #fff3cd;
    color: #6b5a00;
    border-radius: 0.25rem;
    padding: 0.05rem 0.4rem;
    font-size: 0.78rem;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    margin-right: 0.25rem;
}
.reason-pill.error { background: #f5c6cb; color: #842029; }

.atom-table {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.88rem;
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
}
.atom-table td { padding: 0.05rem 0.5rem; }
.atom-table .label { color: #666; }

.alert-cost {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
    border-radius: 0.4rem;
    padding: 0.7rem 1rem;
    margin: 1rem 0;
}

.busy {
    color: var(--olive-bright);
    font-style: italic;
}

/* ---- Newton GUI: case list ---- */
.regime-group { margin-bottom: 1.75rem; }
.regime-group > h3 {
    color: var(--olive-dark);
    font-size: 1.05rem;
    border-bottom: 1px solid #d4d8b6;
    padding-bottom: 0.3rem;
    margin-bottom: 0.6rem;
}
.case-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: var(--olive-soft);
    border: 1px solid #e1e3d7;
    border-left: 4px solid var(--olive-bright);
    border-radius: 0.4rem;
    padding: 0.55rem 0.9rem;
    margin-bottom: 0.45rem;
    text-decoration: none;
    color: var(--olive-dark);
    transition: background 0.12s;
}
.case-row:hover { background: #eaecdc; color: var(--olive-dark); }
.case-row .case-name { font-weight: 700; min-width: 4.5rem; }
.case-row .case-arrow { margin-left: auto; color: var(--olive-bright); font-weight: 700; }
/* Slack player's rent, shown only on rows that ARE equilibria.  The fixed min-width is
   what keeps the verdict badges in a single column: rows without a rent still reserve
   the slot, so a "negative mass" badge does not slide left of the "solution" ones.
   tabular-nums stops the digits from jittering the badge edge row to row. */
.case-row .case-u {
    min-width: 9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* verdict badges (case list + detail) */
.verdict-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 0.12rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}
.v-solution     { background: #dcead0; color: #3f5d1e; }
.v-no_converge  { background: #e2e3e5; color: #41464b; }
.v-illegal      { background: #fff3cd; color: #6b5a00; }
.v-deviable     { background: #ffe2c7; color: #8a4b00; }
.v-wrong_regime { background: #f5d2e0; color: #7a2a4f; }

/* ---- Newton GUI: detail page ---- */
.detail-grid {
    display: flex;
    flex-wrap: nowrap;          /* never let the table wrap BELOW the comb */
    gap: 1.5rem;
    align-items: flex-start;
    margin-top: 1.25rem;
}
/* keep both panels at content width on one row: comb left, table always to its right */
.detail-grid > div { flex: 0 0 auto; }
.comb-host {
    border: 1px solid #e1e3d7;
    border-radius: 0.5rem;
    background: white;
    overflow: hidden;
}
.comb-host iframe { border: 0; display: block; }
.atom-grid {
    border-collapse: collapse;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.9rem;
}
.atom-grid th, .atom-grid td {
    border: 1px solid #d4d8b6;
    padding: 0.3rem 0.7rem;
    text-align: right;
}
.atom-grid thead th { background: var(--olive-soft); color: var(--olive-dark); }
/* Corner cell: holds "u_A = <value>" rather than a column index, so it is left-aligned
   (it reads as a label, not a number in the k-column) and never wraps — a wrapped
   corner would push the header row taller than the atom columns. */
.atom-grid thead th.corner {
    text-align: left;
    white-space: nowrap;
    font-style: normal;
    padding-right: 1rem;
}
.atom-grid tbody th {
    background: var(--olive-soft);
    color: var(--olive-dark);
    text-align: center;
    font-style: italic;
}
/* Owner tag on a row label — "x (A)".  Upright and smaller so it reads as an
   annotation rather than part of the symbol, which is italic maths. */
.atom-grid tbody th .who {
    font-style: normal;
    font-size: 0.78em;
    opacity: 0.75;
    margin-left: 0.25em;
}
.atom-grid td.empty { background: #fafbf6; color: #bcbcae; }
/* Change-of-vars legend: a bottom caption sits flush under the table. Kept on ONE line
   (white-space:nowrap) — the table widens to fit it rather than wrapping the formula. */
.table-legend {
    caption-side: bottom;
    text-align: left;
    white-space: nowrap;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.35;
    padding-top: 0.5rem;
}
.detail-note { color: #555; font-size: 0.9rem; margin-top: 0.6rem; }

/* ---- collapsible solver-diagnostics panel (case page) ---- */
.diag-details { margin: 0.4rem 0 0.2rem; font-size: 0.85rem; }
.diag-details > summary {
    cursor: pointer;
    width: max-content;
    color: var(--olive-bright);
    font-weight: 600;
}
.diag-details[open] > summary { margin-bottom: 0.45rem; }
.diag-line {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: #444;
    background: var(--olive-soft);
    border-left: 3px solid var(--olive-bright);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    overflow-x: auto;
}
.diag-legend { margin: 0.55rem 0 0; color: #555; line-height: 1.4; }
.diag-legend dt {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
    color: var(--olive-dark);
    margin-top: 0.4rem;
}
.diag-legend dd { margin: 0.1rem 0 0; padding-left: 0.9rem; }
