/* MFT Q-Ball Lepton Spectrum Solver — styling (v2) */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #222;
    background: #fff;
    line-height: 1.55;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */

.site-header {
    border-bottom: 1px solid #e5e5e5;
    padding: 14px 0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-weight: 600;
    font-size: 18px;
    text-decoration: none;
    color: #111;
}

.site-nav {
    display: flex;
    gap: 24px;
}

.site-nav a {
    text-decoration: none;
    color: #555;
    font-size: 14px;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.site-nav a:hover, .site-nav a.active {
    color: #111;
    border-bottom-color: #2c5aa0;
}

/* Page content */

main {
    padding: 40px 24px 80px;
}

h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 12px;
    color: #111;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 32px 0 12px;
    color: #111;
}

h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 24px 0 8px;
    color: #333;
}

.lede {
    color: #444;
    margin: 0 0 32px;
    max-width: 820px;
}

/* Status / loading */

.status {
    background: #f8f9fc;
    border: 1px solid #e5e5e5;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 32px;
}

.status p {
    margin: 0 0 12px;
    color: #555;
}

.progress-bar {
    height: 4px;
    background: #e5e5e5;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #2c5aa0;
    transition: width 0.3s ease;
}

/* Solver layout */

.solver-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 32px;
    margin: 24px 0;
}

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

/* Controls */

.controls {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 20px;
    background: #fafbfd;
    align-self: start;
    position: sticky;
    top: 80px;
}

@media (max-width: 800px) {
    .controls { position: static; }
}

.controls h2 {
    margin-top: 0;
    font-size: 16px;
    font-weight: 600;
}

.control {
    margin: 14px 0;
}

.control label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #444;
    margin-bottom: 4px;
}

.hint-inline {
    color: #888;
    font-weight: 400;
    font-size: 12px;
}

.control input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 14px;
    background: #fff;
}

.control input:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.15);
}

hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 18px 0;
}

.presets {
    margin-bottom: 8px;
}

.preset-label {
    font-size: 13px;
    font-weight: 500;
    color: #444;
    margin: 0 0 6px;
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.preset {
    padding: 8px 6px;
    border: 1px solid #2c5aa0;
    background: #fff;
    color: #2c5aa0;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.preset:hover {
    background: #2c5aa0;
    color: #fff;
}

.preset.active {
    background: #2c5aa0;
    color: #fff;
}

.preset-description {
    font-size: 12px;
    color: #555;
    margin: 8px 0 0;
    line-height: 1.5;
}

.solve-button {
    width: 100%;
    padding: 12px;
    background: #2c5aa0;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 16px;
    transition: background 0.15s;
}

.solve-button:hover:not(:disabled) {
    background: #234a85;
}

.solve-button:disabled {
    background: #888;
    cursor: not-allowed;
}

.solve-time-note {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin: 4px 0 0;
}

.silver-ratio-note {
    margin-top: 18px;
    padding: 10px 12px;
    background: #f0f4fa;
    border-left: 3px solid #2c5aa0;
    border-radius: 0 4px 4px 0;
    font-size: 12px;
}

.silver-ratio-note p {
    margin: 0;
    color: #444;
    line-height: 1.5;
}

/* Results */

.results {
    min-width: 0;
}

.results h2 {
    margin-top: 0;
}

.results-summary {
    background: #f8f9fc;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #444;
}

.results-summary p {
    margin: 0 0 6px;
}

.results-summary p:last-child {
    margin-bottom: 0;
}

.results-summary .placeholder {
    color: #888;
    font-style: italic;
}

.results-summary .error {
    color: #c0392b;
}

.results-summary .hint, .hint {
    margin-top: 6px;
    font-size: 12px;
    color: #777;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

.badge.ok {
    background: #d5f5e3;
    color: #1e7e34;
}

.badge.warn {
    background: #fdebd0;
    color: #b9770e;
}

/* Lepton triple table */

.lepton-triple-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 18px;
    font-size: 13px;
}

.lepton-triple-table th {
    text-align: left;
    padding: 8px 10px;
    background: #2c5aa0;
    color: #fff;
    font-weight: 600;
}

.lepton-triple-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #eee;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.lepton-triple-table .lepton-row td:first-child {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
}

.lepton-triple-table .lepton-row.electron {
    background: rgba(39, 174, 96, 0.05);
}
.lepton-triple-table .lepton-row.muon {
    background: rgba(44, 90, 160, 0.05);
}
.lepton-triple-table .lepton-row.tau {
    background: rgba(192, 57, 43, 0.05);
}

.lepton-ratios-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 18px;
    font-size: 13px;
    max-width: 480px;
}

.lepton-ratios-table th {
    text-align: left;
    padding: 6px 10px;
    background: #f0f4fa;
    color: #234a85;
    font-weight: 600;
}

.lepton-ratios-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.lepton-ratios-table td:first-child {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 500;
}

/* Color dots */

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.lepton-tag {
    display: inline-block;
    padding: 1px 6px;
    margin-left: 6px;
    border-radius: 8px;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    vertical-align: middle;
    text-transform: lowercase;
}

.stab-tag {
    display: inline-block;
    padding: 1px 6px;
    margin-left: 4px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    vertical-align: middle;
}

.stab-stable {
    background: #d5f5e3;
    color: #1e7e34;
}

.stab-metastable {
    background: #fdebd0;
    color: #b9770e;
}

.stab-unstable {
    background: #f5b7b1;
    color: #922b21;
}

.muted {
    color: #ccc;
}

/* Plots */

.plots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

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

.plot-container {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 12px;
    background: #fff;
}

.plot-container h3 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    text-align: center;
}

.plot-container canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* Spectrum table */

.spectrum-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    margin-top: 8px;
}

.spectrum-table-wrapper::-webkit-scrollbar {
    width: 10px;
}
.spectrum-table-wrapper::-webkit-scrollbar-track {
    background: #f0f0f0;
}
.spectrum-table-wrapper::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 5px;
}
.spectrum-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.spectrum-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.spectrum-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.spectrum-table th {
    text-align: left;
    padding: 7px 10px;
    background: #f0f4fa;
    border-bottom: 2px solid #2c5aa0;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    color: #234a85;
}

.spectrum-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
}

.spectrum-table tr:hover td {
    background: #fafbfd;
}

.spectrum-table .lepton-row.electron {
    background: rgba(39, 174, 96, 0.08);
    font-weight: 600;
}
.spectrum-table .lepton-row.muon {
    background: rgba(44, 90, 160, 0.08);
    font-weight: 600;
}
.spectrum-table .lepton-row.tau {
    background: rgba(192, 57, 43, 0.08);
    font-weight: 600;
}

/* Explanatory section */

.explanatory {
    margin-top: 60px;
    padding-top: 32px;
    border-top: 1px solid #e5e5e5;
    max-width: 820px;
}

.explanatory p {
    color: #444;
    margin: 0 0 14px;
}

.explanatory strong {
    color: #111;
}

/* Footer */

.page-footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
    color: #888;
    font-size: 13px;
}

.page-footer a {
    color: #2c5aa0;
    text-decoration: none;
}

.page-footer a:hover {
    text-decoration: underline;
}

/* ─── Galactic-solver-specific styles ─── */

.galaxy-selector {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.galaxy-selector:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.15);
}

.beta-display {
    text-align: center;
    margin: 4px 0 8px;
    font-size: 13px;
    color: #555;
}

.beta-display .beta-value {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 16px;
    font-weight: 700;
    color: #234a85;
}

.fit-results-block {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-left: 4px solid #2c5aa0;
    border-radius: 0 4px 4px 0;
    padding: 14px 16px;
    margin-top: 14px;
}

.fit-results-block h4 {
    margin: 0 0 10px;
    font-size: 12px;
    color: #234a85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fit-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.fit-row:last-child {
    border-bottom: none;
}

.fit-row .fit-name {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    color: #444;
    font-weight: 600;
    font-size: 12.5px;
}

.fit-row .fit-val {
    color: #234a85;
    font-weight: 600;
}

.chi2-headline {
    font-size: 28px;
    text-align: center;
    margin: 8px 0;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-weight: 700;
    color: #234a85;
}

.chi2-label {
    text-align: center;
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.chi2-quality-tag {
    display: block;
    text-align: center;
    margin: 6px auto;
    padding: 3px 10px;
    width: fit-content;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chi2-tag-excellent { background: #d5f5e3; color: #1e7e34; }
.chi2-tag-good      { background: #e8f0e9; color: #386641; }
.chi2-tag-marginal  { background: #fdebd0; color: #b9770e; }
.chi2-tag-poor      { background: #f5b7b1; color: #922b21; }

.galaxy-info-block {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 12px 14px;
    margin-top: 12px;
    font-size: 12px;
    color: #555;
    line-height: 1.6;
}

.galaxy-info-block strong {
    color: #234a85;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.galaxy-info-block .info-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.residuals-bar-container {
    display: flex;
    align-items: flex-end;
    height: 80px;
    gap: 4px;
    padding: 8px 4px;
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    margin: 12px 0;
    position: relative;
}

.residuals-bar-container::before {
    content: '';
    position: absolute;
    left: 8px;
    right: 8px;
    top: 50%;
    height: 1px;
    background: #888;
    z-index: 1;
}

.residual-bar {
    flex: 1;
    min-width: 16px;
    position: relative;
    transition: all 0.2s;
}

.residual-bar .bar-fill {
    position: absolute;
    left: 0;
    right: 0;
}

.residual-bar.positive .bar-fill {
    bottom: 50%;
    background: linear-gradient(to top, rgba(39, 174, 96, 0.3), rgba(39, 174, 96, 0.7));
    border-radius: 2px 2px 0 0;
}

.residual-bar.negative .bar-fill {
    top: 50%;
    background: linear-gradient(to bottom, rgba(192, 57, 43, 0.3), rgba(192, 57, 43, 0.7));
    border-radius: 0 0 2px 2px;
}

.residual-bar .bar-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9.5px;
    color: #888;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

