/* CA Governor 2026 Simulator - "TWINS" Theme */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,800;0,900;1,700;1,800;1,900&family=Anton&display=swap');

:root {
    --dem-blue: #2166ac;
    --dem-light: #4393c3;
    --rep-red: #b2182b;
    --rep-light: #d6604d;
    --purple: #7b3294;
    --bg: #dce9f2;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-muted: #5a6578;
    --border: #c2d1de;
    --accent: #1a1a2e;
    --gold: #d4a017;
    --gold-light: #f0d060;
    --sky-top: #5ba3d9;
    --sky-bottom: #a8d4f0;
    --tan: #c8a96e;
    --font-title: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Consolas', 'Courier New', monospace;
}

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

body {
    font-family: var(--font-sans);
    background: linear-gradient(180deg, var(--sky-bottom) 0%, var(--bg) 300px);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header - Twins poster style */
header {
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
    color: white;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 40px;
}

.header-content {
    position: relative;
    z-index: 2;
    padding: 14px 0;
    flex-shrink: 0;
}

.header-above {
    font-family: 'Anton', Impact, 'Arial Black', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    margin-bottom: 2px;
}

header h1 {
    font-family: 'Anton', Impact, 'Arial Black', sans-serif;
    font-size: 6.5rem;
    font-weight: 400;
    font-style: normal;
    letter-spacing: 8px;
    text-transform: uppercase;
    color: var(--gold-light);
    text-shadow:
        3px 3px 0px #b8860b,
        5px 5px 0px rgba(0,0,0,0.25);
    line-height: 0.9;
    margin-bottom: 4px;
}

.header-below {
    font-family: var(--font-title);
    font-size: 1.15rem;
    font-style: italic;
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    margin-top: 2px;
}

.header-url {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--gold);
    letter-spacing: 1px;
    margin-top: 4px;
    opacity: 0.85;
}

/* Hero image area - movie film frame */
.hero-image-container {
    position: relative;
    max-width: 550px;
    flex-shrink: 1;
    padding: 8px 0;
}

.film-frame {
    display: flex;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.sprocket-strip {
    width: 22px;
    flex-shrink: 0;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    padding: 6px 0;
}

.sprocket-strip::before,
.sprocket-strip::after {
    content: '';
    display: block;
}

/* Generate sprocket holes with repeating gradient */
.sprocket-strip {
    background: repeating-linear-gradient(
        to bottom,
        #1a1a1a 0px,
        #1a1a1a 6px,
        transparent 6px,
        transparent 7px,
        #1a1a1a 7px,
        #1a1a1a 9px,
        #444 9px,
        #444 19px,
        #1a1a1a 19px,
        #1a1a1a 21px,
        transparent 21px,
        transparent 22px,
        #1a1a1a 22px,
        #1a1a1a 28px
    );
}

.film-window {
    flex: 1;
    position: relative;
    background: #000;
    margin: 4px 0;
}

.film-window img {
    width: 100%;
    height: auto;
    max-height: 234px;
    object-fit: cover;
    display: block;
    transition: opacity 0.6s ease-in-out;
}

.hero-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    color: var(--gold-light);
    font-family: var(--font-title);
    font-style: italic;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 24px 12px 8px;
    text-align: center;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
}

/* Main layout */
main {
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
}

.panel-left {
    flex: 0 0 38%;
    min-width: 0;
    overflow: visible;
}

.panel-right {
    flex: 1;
    min-width: 0;
}

/* Section cards */
.section-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.section-card h2 {
    font-family: var(--font-title);
    font-size: 1.05rem;
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 12px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 6px;
}

.section-card.collapsed h2 {
    margin-bottom: 0;
    border-bottom-color: transparent;
    padding-bottom: 0;
}

.section-card h2 .hint {
    font-family: var(--font-sans);
    font-weight: 400;
    font-size: 0.8rem;
    font-style: normal;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

/* Collapsible sections */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.collapsible-header:hover {
    color: var(--gold);
}

.chevron {
    display: inline-block;
    font-size: 0.65rem;
    transition: transform 0.2s;
    margin-left: 8px;
    flex-shrink: 0;
}

.chevron::after {
    content: '\25BC';
}

.collapsed > .collapsible-header .chevron::after {
    content: '\25B6';
}

.collapsible > .section-body {
    transition: max-height 0.25s ease, opacity 0.2s ease;
    overflow: hidden;
}

.collapsed > .section-body {
    max-height: 0 !important;
    opacity: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Loading */
.loading {
    color: var(--text-muted);
    font-style: italic;
    padding: 12px 0;
}

/* Poll list */
.poll-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #e8edf2;
}

.poll-item:last-child {
    border-bottom: none;
}

.poll-item input[type="checkbox"] {
    margin-top: 3px;
    transform: scale(1.2);
    accent-color: var(--gold);
}

.poll-meta {
    flex: 1;
}

.poll-pollster {
    font-weight: 600;
    font-size: 0.95rem;
}

.poll-details {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.poll-rating {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.rating-a { background: #2d7d46; }
.rating-b { background: #6b8e23; }
.rating-c { background: #b8860b; }
.rating-d { background: #b22222; }

/* Tab bar */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.tab {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 4px 4px 0 0;
    transition: background 0.2s;
}

.tab.active {
    background: var(--card-bg);
    border-bottom-color: var(--card-bg);
}

.tab.has-data {
    color: var(--gold);
}

/* Custom poll form */
.custom-poll-form {
    display: none;
}

.custom-poll-form.active {
    display: block;
}

.candidate-entry {
    display: grid;
    grid-template-columns: 1fr 70px 80px;
    gap: 6px;
    align-items: center;
    padding: 4px 0;
    font-size: 0.85rem;
}

.candidate-entry .name {
    font-weight: 500;
}

.candidate-entry .name.dem { color: var(--dem-blue); }
.candidate-entry .name.rep { color: var(--rep-red); }

.candidate-entry input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.85rem;
    text-align: right;
}

.candidate-entry .moe {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

.poll-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e8edf2;
}

.poll-settings label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.poll-settings select,
.poll-settings input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.85rem;
}

.poll-overall-moe {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-align: right;
    padding-top: 4px;
}

/* Finance section */
.finance-section {
    margin: 8px 0;
    padding: 8px;
    background: #f4f7fa;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.finance-table th {
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

.finance-table td {
    padding: 3px 4px;
    border-bottom: 1px solid #e8edf2;
}

.finance-table input[type="number"] {
    border: 1px solid var(--border);
    border-radius: 3px;
}

.finance-table input[type="number"]:focus {
    border-color: var(--gold);
    outline: none;
}

/* Sliders */
.slider-group {
    margin-bottom: 12px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.share-display {
    font-weight: 700;
    font-size: 0.9rem;
}

.share-display.dem { color: var(--dem-blue); }
.share-display.rep { color: var(--rep-red); }

input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
}

#dem-slider {
    background: linear-gradient(to right, #ccc, var(--dem-blue));
}

#dem-slider::-webkit-slider-thumb {
    background: var(--dem-blue);
}

#rep-slider {
    background: linear-gradient(to right, #ccc, var(--rep-red));
}

#rep-slider::-webkit-slider-thumb {
    background: var(--rep-red);
}

#betting-weight {
    background: linear-gradient(to right, #ccc, var(--gold));
}

#betting-weight::-webkit-slider-thumb {
    background: var(--gold);
}

/* Toggles and selects */
.toggle-row, .select-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.select-row select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.85rem;
}

/* Run button - Twins gold theme */
.run-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
    color: var(--accent);
    border: none;
    border-radius: 8px;
    font-family: var(--font-title);
    font-size: 1.15rem;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    margin-top: 8px;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 3px 10px rgba(180, 140, 20, 0.3);
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

.run-button:hover {
    box-shadow: 0 5px 15px rgba(180, 140, 20, 0.45);
    transform: translateY(-1px);
}

.run-button:active {
    transform: scale(0.98) translateY(0);
}

.run-button:disabled {
    background: linear-gradient(180deg, #bbb 0%, #999 100%);
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}

.run-button-top {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1rem;
    padding: 14px 16px;
    line-height: 1.4;
}

/* Right panel */
.results-placeholder {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 30px 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.hidden {
    display: none !important;
}

/* Counter */
.sim-counter {
    background: linear-gradient(135deg, var(--accent) 0%, #2d2d4e 100%);
    color: var(--gold-light);
    padding: 8px 16px;
    border-radius: 8px;
    text-align: center;
    font-family: var(--font-title);
    font-size: 1rem;
    font-style: italic;
    margin-bottom: 12px;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sim-counter strong {
    font-size: 1.3rem;
    color: #fff;
}

.mobile-hint {
    display: none;
    font-family: var(--font-sans);
    font-style: italic;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
}

/* (twins image display now in header film frame) */

/* Charts row - side by side */
.charts-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}

.charts-row .chart-pie {
    flex: 1;
    min-width: 0;
}

.charts-row .chart-bar {
    flex: 1;
    min-width: 0;
}

.chart-container h3 {
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 8px;
}

.chart-small {
    max-width: 350px;
}

/* Cascade */
.cascade-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cascade-container > .section-body {
    max-height: 300px;
    overflow-y: auto;
}

.cascade-container h3 {
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 8px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 4px;
}

.cascade-container.collapsed h3 {
    margin-bottom: 0;
    border-bottom-color: transparent;
    padding-bottom: 0;
}

.cascade-list {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    overflow: hidden;
}

.cascade-item {
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cascade-item .sim-num {
    color: var(--text-muted);
    margin-right: 8px;
}

.cascade-item .dem-name { color: var(--dem-blue); font-weight: 600; }
.cascade-item .rep-name { color: var(--rep-red); font-weight: 600; }

.cascade-summary {
    display: flex;
    align-items: center;
    gap: 4px;
}

.detail-toggle {
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 6px;
    opacity: 0.6;
    transition: opacity 0.15s;
    user-select: none;
}
.detail-toggle:hover { opacity: 1.0; }

.draw-detail {
    background: #f4f7fa;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin: 6px 0 8px 0;
    padding: 8px 10px;
    font-family: var(--font-sans);
    font-size: 0.78rem;
}

.draw-detail .detail-header {
    font-family: var(--font-title);
    font-weight: 700;
    font-style: italic;
    font-size: 0.82rem;
    margin-bottom: 4px;
    color: var(--accent);
}

.detail-party-totals {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 6px;
    padding: 3px 6px;
    background: #eaeef3;
    border-radius: 3px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th {
    text-align: left;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    padding: 2px 6px;
}

.detail-table td {
    padding: 2px 6px;
    border-bottom: 1px solid #e8edf2;
}

.detail-table .pct { text-align: right; font-family: var(--font-mono); font-weight: 600; }
.detail-table .votes { text-align: right; font-family: var(--font-mono); color: var(--text-muted); }
.detail-table .check { text-align: center; color: #2a9d2a; font-weight: 700; }

.detail-row.advance {
    background: #edf5ed;
    font-weight: 600;
}

/* Final results tables */
#final-results {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

#final-results h3 {
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 800;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin: 0 0 8px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 2px solid var(--gold);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

td {
    padding: 6px 10px;
    border-bottom: 1px solid #e8edf2;
}

tr:last-child td {
    border-bottom: none;
}

td.dem { color: var(--dem-blue); font-weight: 600; }
td.rep { color: var(--rep-red); font-weight: 600; }

td.prob-bar {
    position: relative;
}

.prob-fill {
    display: inline-block;
    height: 16px;
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: middle;
}

.prob-fill.dem { background: var(--dem-light); }
.prob-fill.rep { background: var(--rep-light); }
.prob-fill.purple { background: var(--purple); }

/* Footer */
footer {
    text-align: center;
    padding: 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
}

.header-links {
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-link-sep {
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
}

/* How This Works / Get Updates links */
.how-link {
    display: inline-block;
    color: rgba(255,255,255,0.9);
    font-size: 0.8rem;
    font-style: italic;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.15s;
}

.how-link:hover {
    color: var(--gold-light);
}

/* Methodology Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 10px;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px 36px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-close {
    position: sticky;
    top: 0;
    float: right;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0 4px;
    z-index: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--rep-red);
}

.methodology-body h2 {
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 900;
    font-style: italic;
    color: var(--accent);
    margin-bottom: 8px;
}

.methodology-body h3 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 800;
    font-style: italic;
    color: var(--accent);
    margin: 20px 0 8px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 4px;
}

.methodology-body h4 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--accent);
    margin: 14px 0 6px;
}

.methodology-body p {
    font-size: 0.88rem;
    line-height: 1.65;
    margin-bottom: 10px;
    color: var(--text);
}

.methodology-body ul, .methodology-body ol {
    font-size: 0.88rem;
    line-height: 1.65;
    margin: 6px 0 12px 20px;
    color: var(--text);
}

.methodology-body li {
    margin-bottom: 4px;
}

.methodology-body ul ul {
    margin-top: 4px;
    margin-bottom: 4px;
}

.methodology-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin: 10px 0 16px;
}

.methodology-body th {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 2px solid var(--gold);
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.methodology-body td {
    padding: 5px 10px;
    border-bottom: 1px solid #e8edf2;
}

.methodology-body hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}

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

/* Welcome modal */
.welcome-modal-content {
    max-width: 560px;
    text-align: center;
    padding: 36px 40px 28px;
}

.welcome-title {
    font-family: 'Anton', Impact, 'Arial Black', sans-serif;
    font-size: 2.4rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 2px;
    border: none;
}

.welcome-subtitle {
    font-family: var(--font-title);
    font-size: 1rem;
    font-style: italic;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.welcome-body p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text);
    margin-bottom: 12px;
    text-align: left;
}

.welcome-disclaimer {
    font-style: italic;
    color: var(--text-muted) !important;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 16px !important;
    font-size: 0.84rem !important;
}

.welcome-go-button {
    margin-top: 16px;
    width: auto;
    padding: 12px 48px;
    font-size: 1.1rem;
    display: inline-block;
}

/* Responsive */
@media (max-width: 900px) {
    main {
        flex-direction: column;
        padding: 8px 10px;
        gap: 10px;
    }

    .panel-left, .panel-right {
        flex: 1;
        min-width: unset;
    }

    /* When simulation is running/complete, flip panel order:
       results on top, controls below */
    main.simulation-active .panel-right {
        order: -1;
    }

    /* Mobile run button: keep it visible and compact */
    .run-button-top {
        font-size: 0.9rem;
        padding: 12px 14px;
    }

    /* Charts: stack vertically, reduce size */
    .charts-row {
        flex-direction: column;
        gap: 8px;
    }

    /* Pie chart: use full width on mobile, no constraint */
    .charts-row .chart-pie {
        width: 100%;
    }

    .chart-container {
        padding: 8px 10px 10px;
    }

    .chart-container h3 {
        font-size: 0.78rem;
        margin-bottom: 4px;
    }

    /* Counter: compact */
    .sim-counter {
        padding: 6px 12px;
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .sim-counter strong {
        font-size: 1.1rem;
    }

    /* Mobile scroll hint */
    .mobile-hint.visible {
        display: block !important;
    }

    /* Section cards: tighter padding */
    .section-card {
        padding: 12px 14px;
        margin-bottom: 8px;
    }

    .section-card h2 {
        font-size: 0.92rem;
        margin-bottom: 8px;
    }

    /* Cascade: shorter */
    .cascade-container > .section-body {
        max-height: 180px;
    }

    .cascade-list {
        font-size: 0.72rem;
    }

    /* Final results: compact */
    #final-results {
        padding: 10px 12px;
    }

    table {
        font-size: 0.78rem;
    }

    th, td {
        padding: 4px 6px;
    }

    /* Header */
    .header-row {
        flex-direction: column;
        text-align: center;
    }

    .header-content {
        padding: 10px 0 4px;
    }

    .hero-image-container {
        max-width: 280px;
        margin: 0 auto;
    }

    header h1 {
        font-size: 2.5rem;
    }

    .header-above {
        font-size: 0.9rem;
        letter-spacing: 3px;
    }

    .header-below {
        font-size: 0.9rem;
    }

    /* Results placeholder: compact */
    .results-placeholder {
        padding: 16px;
    }

    .results-placeholder p {
        font-size: 1rem !important;
    }

    /* Welcome modal: fit on phone */
    .modal-content {
        padding: 20px 22px;
        max-height: 90vh;
    }

    .welcome-modal-content {
        padding: 24px 22px 20px;
    }

    .welcome-title {
        font-size: 1.8rem;
    }

    .welcome-body p {
        font-size: 0.84rem;
    }

    .welcome-go-button {
        padding: 10px 36px;
        font-size: 1rem;
    }

    /* Finance & betting tables: allow horizontal scroll */
    .finance-section {
        overflow-x: auto;
    }

    /* Methodology modal */
    .methodology-body h2 {
        font-size: 1.3rem;
    }
}
