/* Red theme, compatible with mobile WebViews without @scope. */
/* Shared visual language for prediction, backtest, quant and strategy settings. */
:root[data-theme="red"] {
    --primary: #9f3b47;
    --primary-dark: #88303a;
    --secondary: #9c3d49;
    --accent: #9f3b47;
    --success: #15803d;
    --text: #48272b;
    --text-muted: #866166;
    --border: #e8cd96;
    --bg-card: #fff;
    --dark: #fff6e6;
    --dark-light: #f0e0bf;
}
:where(:root[data-theme="red"]) * { box-sizing: border-box; margin: 0; padding: 0; }
:where(:root[data-theme="red"]) [hidden] { display:none !important; }
:where(:root[data-theme="red"]) .app-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:14px; }
:where(:root[data-theme="red"]) #dataRefreshStatus { flex-basis:100%; margin:0; overflow-wrap:anywhere; }
:where(:root[data-theme="red"]) .mobile-help { margin:auto; max-width:520px; width:calc(100% - 32px); border:1px solid var(--border); border-radius:14px; padding:24px; color:var(--text); background:white; }
:where(:root[data-theme="red"]) .mobile-help p { margin:16px 0; font-size:14px; }
:where(:root[data-theme="red"]) .mobile-help::backdrop { background:#662d3466; }
:where(:root[data-theme="red"]) body {
    font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    color: var(--text);
    background: #fff6e6;
    line-height: 1.65;
    min-height: 100vh;
}
:where(:root[data-theme="red"]) button, :where(:root[data-theme="red"]) input, :where(:root[data-theme="red"]) select { font: inherit; }
:where(:root[data-theme="red"]) button { cursor: pointer; }
:where(:root[data-theme="red"]) button, :where(:root[data-theme="red"]) input, :where(:root[data-theme="red"]) select { -webkit-tap-highlight-color: transparent; }
:where(:root[data-theme="red"]) :focus-visible { outline: 3px solid #d3a040; outline-offset: 3px; }
:where(:root[data-theme="red"]) .bg-glow { display: none; }
:where(:root[data-theme="red"]) .container { max-width: 1280px; margin: auto; padding: 32px; }
:where(:root[data-theme="red"]) header {
    background: radial-gradient(ellipse at 50% 0%, #96354166, transparent 70%), linear-gradient(120deg, #400e14, #741d27 65%, #521119);
    color: #fef9f9;
    border: 1px solid #702a33;
    border-radius: 14px;
    padding: 38px 28px;
    position: relative;
    overflow: hidden;
    text-align: center;
    box-shadow: 0 12px 28px #5c1b231c;
}
:where(:root[data-theme="red"]) .container > header h1 {font-size:clamp(30px,4.2vw,54px);font-weight:900;letter-spacing:.1em;line-height:1.45;text-shadow:0 4px 16px #310a0e66;}
:where(:root[data-theme="red"]) .container > header h1::after {content:'';display:block;width:76px;height:3px;margin:17px auto 0;background:#f4c46a;border-radius:2px;}
:where(:root[data-theme="red"]) header .app-actions {justify-content:center;margin-top:0;}
:where(:root[data-theme="red"]) header .app-actions:has(button:not([hidden])) {margin-top:18px;}
:where(:root[data-theme="red"]) .eyebrow { color: #a76971; font-size: 11px; letter-spacing: .16em; font-weight: 700; margin-bottom: 8px; }
:where(:root[data-theme="red"]) h1 { font-size: 26px; line-height: 1.4; font-weight: 650; letter-spacing: .02em; }
:where(:root[data-theme="red"]) .subtitle { color: #86575d; font-size: 13px; margin-top: 8px; }
:where(:root[data-theme="red"]) .rules-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0 24px; }
:where(:root[data-theme="red"]) .rule-card {
    background: white; border: 1px solid var(--border); border-radius: 14px;
    padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
:where(:root[data-theme="red"]) .rule-card span { color: var(--text-muted); font-size: 13px; }
:where(:root[data-theme="red"]) .rule-card strong { color: var(--primary); font-size: 25px; font-weight: 650; font-variant-numeric: tabular-nums; }
:where(:root[data-theme="red"]) .rule-note { color: var(--text-muted); font-size: 12px; text-align: right; margin: -14px 2px 20px; }
:where(:root[data-theme="red"]) .tabs { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:5px; border-bottom:1px solid var(--border); margin:20px 0 24px; }
:where(:root[data-theme="red"]) .tab-btn {
    background: transparent; color: var(--text-muted); border: 0; border-bottom: 3px solid transparent;
    min-width:0; padding:12px 6px 14px; transition:color .18s,border-color .18s; font-size:14px; white-space:nowrap;
}
:where(:root[data-theme="red"]) .tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
:where(:root[data-theme="red"]) .tab-btn:hover { color: var(--primary); background: #fff0cc; border-radius: 8px 8px 0 0; }
:where(:root[data-theme="red"]) .tab-index { font-size: 11px; margin-right: 8px; opacity: .55; }
:where(:root[data-theme="red"]) .tab-panel { display: none; }
:where(:root[data-theme="red"]) .tab-panel.active { display: block; }
:where(:root[data-theme="red"]) .panel-heading { margin: 0 0 18px; }
:where(:root[data-theme="red"]) .panel-heading h2 { font-size: 21px; margin-bottom: 3px; }
:where(:root[data-theme="red"]) .panel-heading p { color: var(--text-muted); font-size: 13px; }
:where(:root[data-theme="red"]) .control-panel, :where(:root[data-theme="red"]) .card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 24px;
}
:where(:root[data-theme="red"]) .control-panel { margin-bottom: 20px; }
:where(:root[data-theme="red"]) .controls { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
:where(:root[data-theme="red"]) .control-group { display: flex; flex-direction: column; gap: 7px; }
:where(:root[data-theme="red"]) .control-group label { color: var(--text-muted); font-size: 12px; font-weight: 600; }
:where(:root[data-theme="red"]) .input-field {
    background: #fffaf0; border: 1px solid #dec694; border-radius: 8px;
    padding: 10px 14px; color: var(--text); width: 180px; height: 46px;
}
:where(:root[data-theme="red"]) .input-field:focus { border-color: var(--primary); background: white; }
:where(:root[data-theme="red"]) select { color-scheme: light; }
:where(:root[data-theme="red"]) .btn {
    border: 1px solid transparent; border-radius: 8px; padding: 10px 24px;
    color: white; font-size: 14px; font-weight: 600; min-height: 46px;
    transition: background .18s, box-shadow .18s; white-space: nowrap;
}
:where(:root[data-theme="red"]) .btn:disabled { opacity: .55; cursor: wait; }
:where(:root[data-theme="red"]) .btn-predict, :where(:root[data-theme="red"]) .btn-quant { background: var(--primary); }
:where(:root[data-theme="red"]) .btn-predict:hover:not(:disabled), :where(:root[data-theme="red"]) .btn-quant:hover:not(:disabled) { background: var(--primary-dark); }
:where(:root[data-theme="red"]) .btn-backtest { background: var(--secondary); }
:where(:root[data-theme="red"]) .btn-backtest:hover:not(:disabled) { background: #7b2f38; }
:where(:root[data-theme="red"]) .btn-sm { padding: 6px 14px; min-height: 34px; font-size: 12px; }
:where(:root[data-theme="red"]) .btn-outline { background: white; border-color: #e2c17e; color: var(--primary); }
:where(:root[data-theme="red"]) .btn-outline:hover { background: #f9e6b5; }
:where(:root[data-theme="red"]) .custom-bar {
    background: #fff5df; border: 1px solid #ebd5ab; border-radius: 10px;
    padding: 12px 16px; margin-top: 22px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
:where(:root[data-theme="red"]) .custom-bar label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
:where(:root[data-theme="red"]) input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
:where(:root[data-theme="red"]) .custom-summary { color: var(--text-muted); font-size: 12px; flex: 1; min-width: 180px; }
:where(:root[data-theme="red"]) .status-bar { display: flex; align-items: center; gap: 9px; margin-top: 18px; }
:where(:root[data-theme="red"]) .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b89d64; flex-shrink: 0; }
:where(:root[data-theme="red"]) .status-dot.active { background: var(--success); }
:where(:root[data-theme="red"]) .status-dot.error { background: #c2413c; }
:where(:root[data-theme="red"]) .status-text { color: var(--text-muted); font-size: 12px; }
:where(:root[data-theme="red"]) .empty-state {
    padding: 46px 24px; text-align: center; border: 1px dashed #e2c995;
    background: #fffaf0; border-radius: 16px; color: var(--text-muted); font-size: 13px;
}
:where(:root[data-theme="red"]) .empty-state strong { display: block; color: #734c51; font-size: 16px; margin-bottom: 6px; font-weight: 600; }
:where(:root[data-theme="red"]) .empty-icon { margin: 0 auto 16px; width: 48px; height: 48px; background: #fff0cc; border-radius: 14px; color: var(--primary); display: grid; place-items: center; font-size: 22px; }
:where(:root[data-theme="red"]) .results { margin-top: 20px; }
:where(:root[data-theme="red"]) .results > .card, :where(:root[data-theme="red"]) .results-grid { margin-bottom: 20px; }
:where(:root[data-theme="red"]) .results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
:where(:root[data-theme="red"]) .card { min-width: 0; }
:where(:root[data-theme="red"]) .card.span-2 { grid-column: 1 / -1; }
:where(:root[data-theme="red"]) .card-title { font-size: 16px; font-weight: 650; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
:where(:root[data-theme="red"]) .card-title::before { content: ''; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; }
:where(:root[data-theme="red"]) .draw-info { color: var(--text-muted); font-size: 13px; text-align: center; margin-bottom: 20px; }
:where(:root[data-theme="red"]) .draw-numbers { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
:where(:root[data-theme="red"]) .number-ball {
    width: 60px; height: 64px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    background: #f9e6b5; border: 1px solid #e2c17e; color: var(--primary); font: 700 29px 'Consolas', monospace;
}
:where(:root[data-theme="red"]) .number-ball.special { background: #f3e8cd; color: #937478; border-color: var(--border); }
:where(:root[data-theme="red"]) .rec-item { background: #fffaf0; border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid #f0e0bf; }
:where(:root[data-theme="red"]) .rec-item:last-child { margin-bottom: 0; }
:where(:root[data-theme="red"]) .rec-label { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
:where(:root[data-theme="red"]) .rec-value { font-size: 19px; font-weight: 700; color: var(--primary); font-family: 'Consolas', 'Microsoft YaHei', monospace; overflow-wrap: anywhere; }
:where(:root[data-theme="red"]) .rec-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
:where(:root[data-theme="red"]) .budget-table, :where(:root[data-theme="red"]) .data-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
:where(:root[data-theme="red"]) .budget-table th, :where(:root[data-theme="red"]) .budget-table td, :where(:root[data-theme="red"]) .data-table th, :where(:root[data-theme="red"]) .data-table td { padding: 13px 12px; text-align: right; border-bottom: 1px solid #f0e0bf; }
:where(:root[data-theme="red"]) .budget-table th, :where(:root[data-theme="red"]) .data-table th { font-size: 12px; color: var(--text-muted); background: #f8edcf; font-weight: 600; white-space: nowrap; }
:where(:root[data-theme="red"]) .budget-table td:first-child, :where(:root[data-theme="red"]) .budget-table th:first-child, :where(:root[data-theme="red"]) .data-table td:first-child, :where(:root[data-theme="red"]) .data-table th:first-child { text-align: left; }
:where(:root[data-theme="red"]) .budget-table tr:hover td, :where(:root[data-theme="red"]) .data-table tr:hover td { background: #fff0cc; }
:where(:root[data-theme="red"]) .budget-table td { white-space: nowrap; }
:where(:root[data-theme="red"]) .highlight { color: var(--primary); font-weight: 650; }
:where(:root[data-theme="red"]) .success { color: var(--success); }
:where(:root[data-theme="red"]) .dim { color: var(--text-muted); font-size: 12px; }
:where(:root[data-theme="red"]) .score-grid { overflow-x: auto; font: 13px/2 'Consolas', monospace; color: var(--text-muted); white-space: nowrap; }
:where(:root[data-theme="red"]) .score-grid span { display: inline-block; width: 50px; text-align: center; }
:where(:root[data-theme="red"]) .factor-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
:where(:root[data-theme="red"]) .factor-name { width: 130px; font-size: 13px; color: var(--text-muted); }
:where(:root[data-theme="red"]) .factor-bar-inner { flex: 1; height: 9px; background: #f0e0bf; border-radius: 6px; overflow: hidden; }
:where(:root[data-theme="red"]) .factor-bar-fill { height: 100%; background: var(--primary); border-radius: 6px; }
:where(:root[data-theme="red"]) .factor-val { width: 54px; text-align: right; font: 12px 'Consolas', monospace; }
:where(:root[data-theme="red"]) .metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
:where(:root[data-theme="red"]) .metric-tile { border: 1px solid var(--border); border-radius: 10px; background: #fffaf0; padding: 16px; }
:where(:root[data-theme="red"]) .metric-tile span { display: block; color: var(--text-muted); font-size: 12px; margin-bottom: 5px; }
:where(:root[data-theme="red"]) .metric-tile strong { font-size: 20px; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
:where(:root[data-theme="red"]) .modal-overlay { display: none; position: fixed; inset: 0; background: #662d3466; backdrop-filter: blur(3px); z-index: 1000; justify-content: center; align-items: center; padding: 16px; }
:where(:root[data-theme="red"]) .modal-overlay.show { display: flex; }
:where(:root[data-theme="red"]) .modal { background: white; border: 1px solid var(--border); border-radius: 14px; padding: 28px; width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto; box-shadow: 0 16px 56px #662d3420; }
:where(:root[data-theme="red"]) .modal h3 { font-size: 20px; margin-bottom: 22px; }
:where(:root[data-theme="red"]) .modal-section { margin-bottom: 16px; padding: 18px; background: #fffaf0; border: 1px solid var(--border); border-radius: 10px; }
:where(:root[data-theme="red"]) .modal-section h4 { font-size: 13px; color: var(--text); margin-bottom: 14px; }
:where(:root[data-theme="red"]) .modal-section > label { font-size: 12px; color: var(--text-muted); }
:where(:root[data-theme="red"]) .modal-section table { margin-top: 12px; font-size: 13px; }
:where(:root[data-theme="red"]) .modal-section th { font-size: 12px; font-weight: 500; color: var(--text-muted); }
:where(:root[data-theme="red"]) .modal-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
:where(:root[data-theme="red"]) .modal-row label { font-size: 13px; color: var(--text-muted); min-width: 70px; }
:where(:root[data-theme="red"]) .modal-row select, :where(:root[data-theme="red"]) .modal-row input { background: white; border: 1px solid #dec694; border-radius: 6px; padding: 6px 8px; color: var(--text); font-size: 13px; }
:where(:root[data-theme="red"]) .modal-row select { width: 60px; }
:where(:root[data-theme="red"]) .modal-row input { width: 200px; }
:where(:root[data-theme="red"]) .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
:where(:root[data-theme="red"]) .play-checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
:where(:root[data-theme="red"]) .play-checks label { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
:where(:root[data-theme="red"]) .play-options .play-option { padding:14px 12px; align-items:flex-start; border:1px solid #e7d2a4; border-radius:9px; background:#fff; }
:where(:root[data-theme="red"]) .play-options .play-option:has(input:checked) { border-color:#c18b31; background:#f9e7b8; }
:where(:root[data-theme="red"]) .play-option input { margin-top:3px; accent-color:#9f3b47; }
:where(:root[data-theme="red"]) .play-option > span { display:flex; flex-direction:column; gap:6px; }
:where(:root[data-theme="red"]) .play-option strong { color:#6a2b32; }
:where(:root[data-theme="red"]) .play-option small { color:#906469; font-size:11px; line-height:1.6; }
:where(:root[data-theme="red"]) .play-model-summary { padding:10px 12px; margin:12px 0 0; color:#883942; font-size:12px; line-height:1.7; background:#fff2d6; border-radius:7px; }
@media(max-width:640px){:where(:root[data-theme="red"]) .play-checks.play-options{grid-template-columns:1fr;gap:8px}:where(:root[data-theme="red"]) .play-options .play-option{padding:10px 12px}:where(:root[data-theme="red"]) .play-option>span{gap:3px}}
:where(:root[data-theme="red"]) .warning { background: #fff1d2; border: 1px solid #e7d0a0; border-radius: 10px; padding: 16px 20px; margin-top: 20px; display: flex; align-items: flex-start; gap: 10px; }
:where(:root[data-theme="red"]) .warning-icon { flex-shrink: 0; }
:where(:root[data-theme="red"]) .warning-text { font-size: 12px; color: var(--text-muted); }
:where(:root[data-theme="red"]) .section-title { font-size: 15px; font-weight: 700; margin: 24px 0 16px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
:where(:root[data-theme="red"]) footer { padding: 30px 0 6px; color: var(--text-muted); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; }
:where(:root[data-theme="red"]) .simulation-pair { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
:where(:root[data-theme="red"]) .report-scroll { overflow-x:auto; max-width:100%; margin:14px 0; }
:where(:root[data-theme="red"]) .report-scroll table { width:100%; white-space:nowrap; border-collapse:collapse; }
:where(:root[data-theme="red"]) .report-scroll th,:where(:root[data-theme="red"]) .report-scroll td { padding:10px 14px; text-align:left; border-bottom:1px solid var(--border); }
:where(:root[data-theme="red"]) .simulation-model { background:#fff6e6; border:1px solid var(--border); border-radius:10px; padding:18px; min-width:0; }
:where(:root[data-theme="red"]) .simulation-model h3 { font-size:14px; color:var(--primary); margin-bottom:10px; }
:where(:root[data-theme="red"]) .simulation-slots { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:14px 0; }
:where(:root[data-theme="red"]) .simulation-digits { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
:where(:root[data-theme="red"]) .simulation-pair .simulation-slots { grid-template-columns:1fr; }
:where(:root[data-theme="red"]) .simulation-accuracy { margin:12px 0; color:var(--primary); }
:where(:root[data-theme="red"]) .data-table .hit-row td, :where(:root[data-theme="red"]) .data-table .hit-row:hover td { background:#fff0c7; color:#6f1e28; }
:where(:root[data-theme="red"]) .data-table .hit-row td { font-weight:600; }
:where(:root[data-theme="red"]) .combination-text { white-space:nowrap; font-family:Consolas,'Microsoft YaHei',monospace; }
:where(:root[data-theme="red"]) .amount-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
:where(:root[data-theme="red"]) .amount-controls .input-field { width:100%; }
:where(:root[data-theme="red"]) .amount-actions { display:flex; align-items:center; flex-wrap:wrap; gap:14px; margin:16px 0; }
:where(:root[data-theme="red"]) .amount-actions .btn { margin-left:auto; }
:where(:root[data-theme="red"]) .amount-schedule { width:100%; max-width:100%; margin:8px 0; resize:vertical; }
:where(:root[data-theme="red"]) .schedule-label { display:block; font-size:12px; color:var(--text-muted); }
:where(:root[data-theme="red"]) .input-field:disabled { opacity:.65; background:#f2e9d2; cursor:not-allowed; }
:where(:root[data-theme="red"]) .amount-details { max-height:480px; overflow:auto; }
:where(:root[data-theme="red"]) .loss-cost { display:flex; gap:14px; align-items:baseline; flex-wrap:wrap; margin:18px 0 8px; color:var(--primary); }
:where(:root[data-theme="red"]) .loss-cost strong { font-size:24px; }
:where(:root[data-theme="red"]) .amount-preview { background:#f9e7b8; padding:14px 16px; margin:12px 0; border-radius:8px; overflow-wrap:anywhere; }
:where(:root[data-theme="red"]) .amount-preview table { margin-top:12px; }
:where(:root[data-theme="red"]) .automatic-spend { min-width:180px; flex:1; }
:where(:root[data-theme="red"]) .automatic-spend output { display:block; color:var(--primary); font-weight:650; padding:10px 0; overflow-wrap:anywhere; }
:where(:root[data-theme="red"]) .amount-preview-table { max-height:220px; overflow:auto; }
:where(:root[data-theme="red"]) .recommendation-card .simulation-slots { grid-template-columns:repeat(4,minmax(0,1fr)); }
@media(max-width:640px) { :where(:root[data-theme="red"]) .amount-controls { grid-template-columns:repeat(2,minmax(0,1fr)); } :where(:root[data-theme="red"]) .amount-controls .control-group { min-width:0; } :where(:root[data-theme="red"]) .recommendation-card .simulation-slots { grid-template-columns:repeat(2,minmax(0,1fr)); } }
:where(:root[data-theme="red"]) .simulation-accuracy strong { font-size:18px; }
:where(:root[data-theme="red"]) .simulation-accuracy p { font-size:12px; color:var(--text-muted); margin-top:5px; }
:where(:root[data-theme="red"]) .simulation-model { overflow-wrap:anywhere; }
:where(:root[data-theme="red"]) .simulation-digits b { padding:4px 7px; background:#f5d889; color:var(--primary); border-radius:4px; font:700 16px 'Consolas',monospace; }
@media (max-width: 1000px) {
    :where(:root[data-theme="red"]) .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    :where(:root[data-theme="red"]) .rule-card { padding: 14px 16px; }
    :where(:root[data-theme="red"]) .rule-card strong { font-size: 22px; }
}
@media (max-width: 640px) {
    :where(:root[data-theme="red"]) .container { padding-bottom:calc(160px + env(safe-area-inset-bottom)) !important; }
    :where(:root[data-theme="red"]) .tabs { position:sticky; z-index:30; top:env(safe-area-inset-top,0px); margin:0 0 18px !important; background:var(--bg-card); border:1px solid var(--border); padding:4px 6px; box-shadow:0 4px 14px #234e7514; }
    :where(:root[data-theme="red"]) .tabs .tab-btn { font-size:11px; min-width:0; min-height:58px; padding:7px 2px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; white-space:nowrap; }
    :where(:root[data-theme="red"]) .app-actions .btn, :where(:root[data-theme="red"]) .custom-bar .btn { min-height:44px; }
    :where(:root[data-theme="red"]) .custom-bar label { min-height:40px; }
    :where(:root[data-theme="red"]) .input-field { font-size:16px; }
    :where(:root[data-theme="red"]) header h1 { font-size:21px; }
    :where(:root[data-theme="red"]) .simulation-pair { grid-template-columns:1fr; }
    :where(:root[data-theme="red"]) .container { padding: 16px; }
    :where(:root[data-theme="red"]) header { padding: 24px; border-radius: 14px; }
    :where(:root[data-theme="red"]) h1 { font-size: 24px; }
    :where(:root[data-theme="red"]) .rules-strip { gap: 8px; margin-top: 14px; }
    :where(:root[data-theme="red"]) .rule-card { flex-direction: column; align-items: flex-start; padding: 12px 10px; gap: 4px; border-radius: 10px; }
    :where(:root[data-theme="red"]) .rule-card strong { font-size: 19px; }
    :where(:root[data-theme="red"]) .rule-card span { font-size: 11px; }
    :where(:root[data-theme="red"]) .rule-note { text-align: left; font-size: 11px; }
    :where(:root[data-theme="red"]) .tabs { gap: 0; }
    :where(:root[data-theme="red"]) .tab-btn { flex: 1; padding: 10px 8px; font-size: 14px; }
    :where(:root[data-theme="red"]) .tab-index { display:block; margin-right:0; font-size:9px; }
    :where(:root[data-theme="red"]) .control-panel, :where(:root[data-theme="red"]) .card { padding: 18px; border-radius: 12px; }
    :where(:root[data-theme="red"]) .controls { gap: 12px; }
    :where(:root[data-theme="red"]) .control-group { flex: 1; min-width: 120px; }
    :where(:root[data-theme="red"]) .input-field { width: 100%; }
    :where(:root[data-theme="red"]) .controls > .btn { width: 100%; margin-top: 4px; }
    :where(:root[data-theme="red"]) .custom-summary { flex-basis: 100%; }
    :where(:root[data-theme="red"]) .results-grid { grid-template-columns: 1fr; gap: 16px; }
    :where(:root[data-theme="red"]) .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    :where(:root[data-theme="red"]) .metric-tile { padding: 12px; }
    :where(:root[data-theme="red"]) .metric-tile strong { font-size: 18px; }
    :where(:root[data-theme="red"]) .number-ball { width: 46px; height: 50px; font-size: 24px; border-radius: 10px; }
    :where(:root[data-theme="red"]) .draw-numbers { gap: 8px; }
    :where(:root[data-theme="red"]) .modal { padding: 20px 16px; }
    :where(:root[data-theme="red"]) .modal-section { padding: 12px; }
    :where(:root[data-theme="red"]) .play-checks { grid-template-columns: repeat(2, 1fr); }
    :where(:root[data-theme="red"]) .modal-row input { width: 100%; }
    :where(:root[data-theme="red"]) .factor-name { width: 100px; font-size: 12px; }
    :where(:root[data-theme="red"]) footer { flex-direction: column; text-align: center; }
}

:where(:root[data-theme="red"]) #quantWeightMode { width:150px; }
:where(:root[data-theme="red"]) .quant-group-scroll { max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; }
:where(:root[data-theme="red"]) .quant-group-table { min-width:300px; }
:where(:root[data-theme="red"]) .quant-group-table td { white-space:nowrap; }
:where(:root[data-theme="red"]) #quantGroupWeights, :where(:root[data-theme="red"]) #quantFactors { min-width:0; }

:where(:root[data-theme="red"]) #btPlayStats tbody td:nth-child(2), :where(:root[data-theme="red"]) #quantHitSummary tbody td:nth-child(3) { font-weight:800; font-size:18px; color:#8f212e; background:#fae5ae; }
:where(:root[data-theme="red"]) .simulation-accuracy strong { font-weight:800; }
:where(:root[data-theme="red"]) .simulation-miss-streak strong { font-size:inherit; }

/* Compact report hierarchy for review. */
:where(:root[data-theme="red"]) #predictResults .compact-draw { display:flex; align-items:center; flex-wrap:wrap; gap:12px 22px; padding:16px 20px; }
:where(:root[data-theme="red"]) .compact-draw .card-title { font-size:14px; margin:0; }
:where(:root[data-theme="red"]) .compact-draw .draw-info { margin:0; font-size:12px; text-align:left; }
:where(:root[data-theme="red"]) .compact-draw .draw-numbers { margin:0 0 0 auto; gap:6px; }
:where(:root[data-theme="red"]) .compact-draw .number-ball { width:34px; height:36px; font-size:19px; border-radius:7px; }
:where(:root[data-theme="red"]) #recCards { grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); }
:where(:root[data-theme="red"]) .recommendation-card { padding:20px; }
:where(:root[data-theme="red"]) .rec-card-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
:where(:root[data-theme="red"]) .rec-card-heading h2 { font-size:16px; margin:0; }
:where(:root[data-theme="red"]) .rec-card-heading > span { padding:5px 10px; background:#f9e7b8; color:#9f3b47; border-radius:6px; font-size:12px; }
:where(:root[data-theme="red"]) .rec-position-grid { display:grid; grid-template-columns:repeat(var(--positions),minmax(0,1fr)); gap:18px; margin:20px 0; }
:where(:root[data-theme="red"]) .rec-position { background:#fff8e8; padding:14px; border:1px solid #ebd7a7; border-radius:8px; }
:where(:root[data-theme="red"]) .rec-position > span { color:#906469; font-size:12px; }
:where(:root[data-theme="red"]) .rec-position .simulation-digits { margin-top:10px; gap:5px; }
:where(:root[data-theme="red"]) .rec-card-footer { display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; border-top:1px solid #ebdcba; padding-top:12px; font-size:12px; color:#906469; }
:where(:root[data-theme="red"]) .rec-card-footer strong { color:#9f3b47; margin-left:4px; }
:where(:root[data-theme="red"]) .hit-stat { display:inline-flex; flex-direction:column; align-items:flex-start; gap:4px; background:#fff0c7; border:1px solid #e8cf91; border-radius:8px; padding:8px 12px; white-space:nowrap; }
:where(:root[data-theme="red"]) .hit-stat strong { font-size:20px; line-height:1.2; font-weight:800; color:#982b38; }
:where(:root[data-theme="red"]) .hit-stat small { font-size:11px; font-weight:400; color:#936c71; }
:where(:root[data-theme="red"]) .coverage-lift { font-size:17px; font-weight:800; color:#8f212e; white-space:nowrap; }
:where(:root[data-theme="red"]) .coverage-lift-cell { background:#fff0c7; }
:where(:root[data-theme="red"]) .miss-streak { font-weight:800; white-space:nowrap; }
:where(:root[data-theme="red"]) #btPlayStats tbody td:nth-child(2),:where(:root[data-theme="red"]) #quantHitSummary tbody td:nth-child(3) { background:transparent; }
:where(:root[data-theme="red"]) .minimum-hit { display:inline; }
:where(:root[data-theme="red"]) .fixed-training { display:block; color:#883942; font-weight:600; line-height:1.5; background:#f9edcc; }
:where(:root[data-theme="red"]) #quantConfigTrainingFixed { padding:9px 12px; border:1px solid #e7d2a4; border-radius:6px; }
@media(max-width:640px){ :where(:root[data-theme="red"]) #recCards { grid-template-columns:1fr; } :where(:root[data-theme="red"]) .rec-position-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; } :where(:root[data-theme="red"]) .rec-position { padding:10px; } :where(:root[data-theme="red"]) .compact-draw .draw-numbers { margin-left:0; } }

:where(:root[data-theme="red"]) #packageVariants .current-variant td,:where(:root[data-theme="red"]) #packageVariants .current-variant:hover td,
:where(:root[data-theme="red"]) #quantPackageVariants .current-variant td,:where(:root[data-theme="red"]) #quantPackageVariants .current-variant:hover td { background:#edcf83; color:#73202a; font-weight:700; }
:where(:root[data-theme="red"]) #quantPreset,:where(:root[data-theme="red"]) #quantWeightMode { width:160px; max-width:100%; }
:where(:root[data-theme="red"]) .data-table .minimum-column { text-align:left; vertical-align:middle; min-width:190px; }
:where(:root[data-theme="red"]) .data-table .minimum-size-column { text-align:center; vertical-align:middle; white-space:nowrap; min-width:78px; font-family:Consolas,'Microsoft YaHei',monospace; }
:where(:root[data-theme="red"]) #simulationResults .simulation-accuracy strong { color:#781b26; font-weight:800; }
:where(:root[data-theme="red"]) #simulationResults .comparison-hit-rate { color:#7b1e29; font-weight:800; }
:where(:root[data-theme="red"]) #amountResults [data-metric="净利润"] { background:#e6f2ef; border-color:#c7dfd7; }
:where(:root[data-theme="red"]) #amountResults [data-metric="净利润"] strong { color:#125949; font-weight:800; font-size:24px; }
:where(:root[data-theme="red"]) #amountResults [data-metric="最大回撤"] { background:#f8e4bc; border-color:#dfc488; }
:where(:root[data-theme="red"]) #amountResults [data-metric="最大回撤"] strong { color:#923e30; font-weight:800; font-size:24px; }
:where(:root[data-theme="red"]) #amountResults [data-metric="最长连续未中"] { background:#f8f0df; border-color:#e8d7b5; }
:where(:root[data-theme="red"]) #amountResults [data-metric="最长连续未中"] strong { color:#795318; font-weight:800; font-size:24px; }
:where(:root[data-theme="red"]) #amountResults .loss-cost strong { color:#71232c; font-weight:800; }

:where(:root[data-theme="red"]) #configModal .modal { display:flex; flex-direction:column; padding:0; overflow:hidden; height:min(760px,90dvh); max-height:90dvh; }
:where(:root[data-theme="red"]) #configModal .modal > h3 { margin:0; padding:22px 24px 14px; flex-shrink:0; }
:where(:root[data-theme="red"]) .config-tabs { display:flex; gap:6px; padding:0 20px 12px; border-bottom:1px solid #ebd8b0; flex-shrink:0; }
:where(:root[data-theme="red"]) .config-tabs button { flex:1; padding:10px 8px; border:1px solid #e8cd96; border-radius:7px; background:#fff8e8; color:#8b6468; cursor:pointer; font:600 13px 'Microsoft YaHei',sans-serif; }
:where(:root[data-theme="red"]) .config-tabs button[aria-selected="true"] { color:#8d2a36; border-color:#cda753; background:#f7e2aa; }
:where(:root[data-theme="red"]) .config-body { flex:1; min-height:0; overflow-y:auto; padding:18px 22px 4px; overscroll-behavior:contain; }
:where(:root[data-theme="red"]) .config-panel[hidden] { display:none!important; }
:where(:root[data-theme="red"]) #configModal .modal-actions { flex-shrink:0; margin:0; padding:14px 22px; border-top:1px solid #e7d2a4; background:white; box-shadow:0 -5px 14px #72353d08; }
:where(:root[data-theme="red"]) #configModal .modal-actions .btn { min-height:40px; min-width:84px; }
@media(max-width:640px){:where(:root[data-theme="red"]) #configModal .modal {height:92dvh;max-height:92dvh;} :where(:root[data-theme="red"]) .config-tabs {padding:0 12px 10px;gap:5px;} :where(:root[data-theme="red"]) .config-body {padding:14px 12px 2px;} :where(:root[data-theme="red"]) #configModal .modal > h3 {padding:18px 16px 12px;} }

:where(:root[data-theme="red"]) #panel-amount [hidden] { display:none!important; }
:where(:root[data-theme="red"]) #amountPreview { font-weight:700; color:#6f2932; }
:where(:root[data-theme="red"]) .capture-actions {display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:16px 0;}
:where(:root[data-theme="red"]) .capture-row {padding:16px 0;border-top:1px solid var(--border);}
:where(:root[data-theme="red"]) .capture-row-heading {display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:10px;}
:where(:root[data-theme="red"]) .capture-row-heading > strong {color:var(--primary);font-size:14px;}
:where(:root[data-theme="red"]) .capture-data {display:flex;align-items:baseline;flex-wrap:wrap;gap:12px 20px;margin-bottom:6px;}
:where(:root[data-theme="red"]) .capture-data code {font-family:Consolas,'Microsoft YaHei',monospace;font-size:16px;overflow-wrap:anywhere;}
:where(:root[data-theme="red"]) .capture-data > strong {color:#7b1e29;font-size:18px;font-weight:800;}
:where(:root[data-theme="red"]) #captureCopyFallback {width:100%;font-family:Consolas,monospace;}
:where(:root[data-theme="red"]) .capture-parameters {margin-top:10px;}
:where(:root[data-theme="red"]) .capture-parameters summary {cursor:pointer;color:var(--primary);font-weight:600;}
:where(:root[data-theme="red"]) .capture-parameters .quant-group-scroll {margin-top:10px;}
:where(:root[data-theme="red"]) .bao-pos:disabled {background:#f9edcc;color:#883942;opacity:1;}
:where(:root[data-theme="red"]) .budget-recommendation {font-weight:700;color:#8f212e;margin-bottom:16px;line-height:1.7;}
:where(:root[data-theme="red"]) .budget-status {padding:12px;background:#f9edcc;border-radius:8px;line-height:1.8;}
:where(:root[data-theme="red"]) #amountOptimization .data-table {min-width:620px;}
@media(max-width:640px){:where(:root[data-theme="red"]) #amountResults .metric-tile strong {font-size:clamp(14px,4vw,22px);white-space:nowrap;}}


/* Light blue header and shared comparison controls. */
.container > header {background:linear-gradient(125deg,#e5f3ff,#cde7fc 65%,#eaf6ff);color:#235982;border-color:#c2def4;box-shadow:0 10px 28px #36658a12;}
.container > header h1 {text-shadow:none;position:relative;z-index:1;}
.container > header h1::after {display:none;}
header .app-actions {position:relative;z-index:1;}
.capture-selection {border:1px solid var(--border);border-radius:12px;padding:16px;margin-top:18px;background:var(--dark);}
.capture-selection legend {font-weight:700;color:var(--primary);padding:0 8px;}
.capture-filters {display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px;}
#captureChoices {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:12px;}
#captureChoices label {display:flex;align-items:flex-start;gap:8px;background:var(--bg-card);border:1px solid var(--border);padding:12px;border-radius:10px;cursor:pointer;font-size:13px;}
#captureChoices label:has(input:checked) {border-color:var(--primary);box-shadow:inset 0 0 0 1px var(--primary);}
#captureChoices input {margin-top:5px;accent-color:var(--primary);}
#captureChoices small {display:block;color:var(--text-muted);margin-top:4px;}
.festive-art {display:none;}
:root[data-theme=red] {--primary:#b51f32;--primary-dark:#8c1425;--secondary:#a82030;--accent:#bf2539;--text:#512e2a;--text-muted:#8d6258;--border:#efd5bb;--bg-card:#fffdf7;--dark:#fff4e5;--dark-light:#f9e4cd;}
[data-theme=red] body {background:radial-gradient(ellipse at top,#ffe5b7,transparent 650px),#fff5e8;}
[data-theme=red] .container > header {background:radial-gradient(ellipse at top,#df4c42,transparent 80%),linear-gradient(125deg,#971a2b,#c62935 55%,#8e1324);color:#ffe6a7;border:1px solid #e7b95f;box-shadow:0 10px 30px #a5162726;padding-inline:100px;}
[data-theme=red] header h1 {text-shadow:0 3px 0 #8c14254a;}
[data-theme=red] header .btn {border-color:#f6cb77;color:#ffe5a1;background:#8e132455;}
[data-theme=red] .festive-art {display:block;position:absolute;inset:0;pointer-events:none;}
.firecrackers {position:absolute;left:24px;top:18px;font-size:66px;transform:rotate(-12deg);filter:drop-shadow(0 5px 7px #5e07164d);}
.fortune-beast {position:absolute;right:24px;top:14px;font-size:66px;line-height:1.1;filter:drop-shadow(0 5px 7px #5e07164d);}
.fortune-beast small {display:block;font-size:12px;letter-spacing:3px;color:#ffe6a7;border:1px solid #e8b963;border-radius:20px;padding:5px 8px;margin-top:8px;background:#8e1324;}
[data-theme=red] .card,[data-theme=red] .control-panel,[data-theme=red] .custom-bar,[data-theme=red] .modal-content {background:#fffdf7;border-color:var(--border);}
[data-theme=red] .btn-predict,[data-theme=red] .btn-quant,[data-theme=red] .btn-simulate,[data-theme=red] .btn-backtest {background:linear-gradient(120deg,#ba2335,#971528);color:#fff4d6;border-color:#b42336;}
[data-theme=red] .btn-outline {color:var(--primary);border-color:#e6c8ad;background:#fffaf1;}
[data-theme=red] .capture-data > strong {color:#ac1b2d;}
@media(max-width:640px){#captureChoices {grid-template-columns:1fr;}.firecrackers {font-size:35px;left:10px;top:20px;}.fortune-beast {font-size:35px;right:10px;top:20px;}.fortune-beast small {font-size:9px;letter-spacing:1px;padding:3px;}.container > header h1 {letter-spacing:.04em;}[data-theme=red] .container > header {padding:28px 52px;}[data-theme=red] header h1 {font-size:25px;}}

.container > header h1::after {content:none !important;display:none !important;}

/* Theme illustrations frame the title without covering interactive controls. */
.container > header {min-height:236px;display:flex;flex-direction:column;justify-content:center;padding:34px 210px;isolation:isolate;}
.container > header h1 {font-size:clamp(28px,3.8vw,48px);}
.theme-art {position:absolute;inset:0;z-index:-1;pointer-events:none;overflow:hidden;}
.ocean-art,.newyear-art {position:absolute;inset:0;}
.newyear-art {display:none;}
.ocean-friends {position:absolute;right:-12px;bottom:0;width:240px;height:200px;object-fit:contain;filter:drop-shadow(0 8px 12px #387c9f18);}
.ocean-art::before {content:'';position:absolute;left:-30px;bottom:-72px;width:420px;height:175px;border-radius:50%;background:#a8ddf777;box-shadow:20px -18px 0 #b9eafa66,60px -32px 0 #d9f4ff99;transform:rotate(-12deg);}
.ocean-art::after {content:'✧';position:absolute;left:65px;top:35px;font-size:45px;color:#77bedb;}
.sea-bubble {position:absolute;border:2px solid #ffffffaa;background:linear-gradient(135deg,#fff8,#9edcef33);border-radius:50%;}
.bubble-one {width:28px;height:28px;left:100px;bottom:60px;}.bubble-two {width:15px;height:15px;left:145px;bottom:108px;}
[data-theme=red] .ocean-art {display:none;}
[data-theme=red] .newyear-art {display:block;}
[data-theme=red] .container > header {padding:34px 210px;background:radial-gradient(ellipse at 50% 0%,#e65e42,transparent 80%),linear-gradient(120deg,#9c1729,#ca2e35 55%,#94182b);}
.newyear-lion {position:absolute;right:0;bottom:-6px;width:220px;height:220px;object-fit:contain;filter:drop-shadow(0 8px 10px #570a2529);}
.hanging-lantern {position:absolute;left:72px;top:40px;width:76px;height:92px;border:3px solid #f2c96b;border-radius:44%;background:repeating-linear-gradient(90deg,transparent 0 17px,#f9b54155 18px 20px),linear-gradient(90deg,#aa1727,#ee5640,#a91727);box-shadow:0 0 35px #ffd17a22;transform:rotate(-8deg);}
.hanging-lantern::before {content:'';position:absolute;left:33px;top:-44px;width:2px;height:42px;background:#f3c974;}
.hanging-lantern::after {content:'';position:absolute;left:30px;bottom:-47px;width:10px;height:43px;border-radius:0 0 8px 8px;background:repeating-linear-gradient(90deg,#edb455 0 2px,#ffdf91 2px 3px);}
.hanging-lantern i {position:absolute;inset:22px 13px;border:1px solid #ffda80;transform:rotate(45deg);background:#b92230;}
.gold-spark {position:absolute;color:#f9d481;font-size:26px;}.spark-one {left:30px;bottom:32px;}.spark-two {left:170px;top:26px;}
@media(max-width:640px){
 .container > header,[data-theme=red] .container > header {min-height:258px;padding:24px 12px 130px;justify-content:flex-start;}
 .container > header h1,[data-theme=red] header h1 {font-size:clamp(24px,6.7vw,32px);letter-spacing:.035em;white-space:nowrap;}
 header .app-actions:has(button:not([hidden])) {margin-top:12px;}
 .ocean-friends {width:175px;height:138px;right:6px;bottom:-5px;}
 .ocean-art::before {width:260px;bottom:-80px;left:-80px;}
 .ocean-art::after {font-size:25px;left:38px;top:auto;bottom:64px;}
 .bubble-one {left:80px;bottom:26px;width:22px;height:22px;}.bubble-two {left:120px;bottom:65px;}
 .newyear-lion {width:146px;height:146px;right:16px;bottom:-8px;}
 .hanging-lantern {left:45px;top:auto;bottom:45px;width:46px;height:56px;border-width:2px;}
 .hanging-lantern::before {left:20px;top:-15px;height:14px;}.hanging-lantern::after {left:18px;bottom:-30px;height:26px;width:7px;}
 .hanging-lantern i {inset:15px 9px;}.spark-one {left:22px;bottom:16px;font-size:19px;}.spark-two {left:112px;top:auto;bottom:72px;font-size:19px;}
}

@media(max-width:360px){.container > header,[data-theme=red] .container > header {min-height:290px;padding-bottom:154px;}}

.comparison-model-checks {display:flex;flex-wrap:wrap;gap:10px 20px;margin:8px 0 16px;}
.comparison-model-checks label {font-size:13px;cursor:pointer;}
.comparison-model-checks input {accent-color:var(--primary);}
.comparison-model-options {margin:12px 0 20px;}
.overlap-source-selection {border:1px solid var(--border);border-radius:9px;padding:12px;margin:4px 0 16px;background:var(--bg-card);min-width:0;}
.overlap-source-selection legend {font-size:13px;}
.overlap-source-selection .comparison-model-checks {margin-bottom:10px;}
.overlap-source-selection p {margin:0;}
.overlap-history-sources {display:block;max-width:220px;margin-top:6px;white-space:normal;font-size:11px;line-height:1.6;color:var(--text-muted);}
.overlap-source-summary {overflow-wrap:anywhere;}

#captureChoices label[hidden] {display:none!important;}
.capture-filters button[aria-pressed=true] {background:var(--primary);border-color:var(--primary);color:#fff;font-weight:700;}
#overlapHistory {--history-normal:#eef5ff;--history-quant:#edf8f3;--history-overlap:#fff5df;--history-divider:#b3c8d8;}
:root[data-theme=red] #overlapHistory {--history-normal:#fff9eb;--history-quant:#f7ebd3;--history-overlap:#edf4e7;--history-divider:#d5b68c;}
#overlapHistory .history-normal,#overlapHistory [data-history-group=normal] {background:var(--history-normal);}
#overlapHistory .history-quant,#overlapHistory [data-history-group=quant] {background:var(--history-quant);}
#overlapHistory .history-overlap,#overlapHistory [data-history-group=overlap] {background:var(--history-overlap);}
#overlapHistory .history-group-head th {text-align:center;font-size:15px;font-weight:800;padding:14px;}
#overlapHistory tbody td {padding-top:16px;padding-bottom:16px;}
#overlapHistory .history-group-start {border-left:3px solid var(--history-divider);padding-left:22px;}

:root[data-theme=blue] body {background:#eaf6ff;}
:root[data-theme=blue] .container > header {background:#cbeaff;}
:root[data-theme=blue] .container > header::before {content:'';position:absolute;inset:-18% -9%;background:url('/illustrations/ocean-header-reference.png') center/100% 100% no-repeat;z-index:-2;pointer-events:none;}

.festival-firecrackers {display:none;position:fixed;inset:0;pointer-events:none;user-select:none;z-index:0;overflow:hidden;contain:strict;}
:root[data-theme=red] .festival-firecrackers {display:block;}
:root[data-theme=red] .container {position:relative;z-index:1;}
.firecracker-string {position:absolute;width:24px;height:192px;top:22vh;}
.firecracker-left {left:5px;}
.firecracker-right {right:5px;top:48vh;transform:scaleX(-1);}
.firecracker-string::before {content:'';position:absolute;width:1px;left:12px;top:0;bottom:0;background:linear-gradient(#bd573a,#d6a746 80%,transparent);opacity:.7;}
.firecracker {position:absolute;left:7px;top:calc(12px + var(--cracker-index)*29px);width:12px;height:19px;transform:rotate(-24deg);}
.firecracker:nth-of-type(even) {left:12px;transform:rotate(24deg);}
.cracker-barrel {display:block;width:8px;height:18px;border:1px solid #a9242d;border-top:3px solid #f2cd69;border-bottom:3px solid #f2cd69;border-radius:3px;background:linear-gradient(90deg,#b71e31,#ee5548 55%,#ad1c2b);box-shadow:0 1px 3px #84252e22;}
.firecracker-fuse {position:absolute;left:10px;top:0;width:5px;height:5px;border-radius:50%;background:#ffe9a2;box-shadow:0 0 6px 2px #ed9b38;opacity:0;}
.cracker-sparks {position:absolute;left:4px;top:5px;}
.cracker-sparks i {position:absolute;width:2px;height:2px;border-radius:50%;background:#efb347;opacity:0;box-shadow:0 0 3px #f5b438;}
:root[data-theme=red] .firecracker-fuse {animation:cracker-fuse-burn 4s linear infinite;}
:root[data-theme=red] .cracker-barrel {animation:cracker-ignite 4s ease-out infinite;animation-delay:calc(var(--cracker-index)*0.666667s);}
:root[data-theme=red] .cracker-sparks i {animation:cracker-spark 4s ease-out infinite;animation-delay:calc(var(--cracker-index)*0.666667s);}
@keyframes cracker-fuse-burn {0%{opacity:0;transform:translateY(0);}3%{opacity:.9;}95%{opacity:.9;transform:translateY(174px);}100%{opacity:0;transform:translateY(184px);}}
@keyframes cracker-ignite {0%,3%{opacity:1;filter:brightness(1);}4%{filter:brightness(1.6);}7%,84%{opacity:.2;filter:brightness(1);}96%,100%{opacity:1;}}
@keyframes cracker-spark {0%,3%{opacity:0;transform:translate(0,0) scale(.4);}4%{opacity:.8;}10%{opacity:0;transform:translate(var(--spark-x),var(--spark-y)) scale(.2);}100%{opacity:0;transform:translate(var(--spark-x),var(--spark-y)) scale(.2);}}
@media(max-width:640px){.firecracker-string{width:12px;height:168px;top:26vh;}.firecracker-left{left:0;}.firecracker-right{right:0;top:52vh;}.firecracker-string::before{left:6px;}.firecracker{left:2px;width:8px;transform:rotate(-17deg);top:calc(12px + var(--cracker-index)*25px);}.firecracker:nth-of-type(even){left:5px;transform:rotate(17deg);}.cracker-barrel{width:5px;height:14px;border-top-width:2px;border-bottom-width:2px;}.firecracker-fuse{left:4px;width:3px;height:3px;}.cracker-sparks{left:2px;top:4px;}.cracker-sparks i{width:1.5px;height:1.5px;}@keyframes cracker-fuse-burn{0%{opacity:0;transform:translateY(0);}3%{opacity:.8;}95%{opacity:.8;transform:translateY(148px);}100%{opacity:0;transform:translateY(158px);}}}
@media(prefers-reduced-motion:reduce){:root[data-theme=red] .festival-firecrackers{display:none;}.festival-firecrackers *{animation:none!important;}}

@media(max-width:640px){
    .container > .custom-bar {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:stretch;}
    .custom-bar > label {grid-column:1/-1;}
    .custom-bar > .btn {width:100%;min-width:0;height:44px;margin:0;padding:8px 6px;white-space:nowrap;display:flex;align-items:center;justify-content:center;}
    .custom-bar > .custom-summary,.custom-bar > #dataRefreshStatus {grid-column:1/-1;min-width:0;width:100%;margin:0;line-height:1.6;}
}

#simulationResults .simulation-pair {grid-template-columns:repeat(var(--comparison-columns,3),minmax(0,1fr));}
@media(max-width:640px){#simulationResults .simulation-pair{grid-template-columns:minmax(0,1fr);}}

/* Keep the percentage next to its numeric field at every screen width. */
#configModal .weight-input-wrap{display:flex;align-items:center;gap:8px;flex:0 1 224px;min-width:0;max-width:100%}
#configModal .weight-input-wrap input{flex:1 1 0;width:0;min-width:0;box-sizing:border-box}
#configModal .weight-unit{flex:none;font-size:13px;color:var(--text-muted)}
#configModal .modal-row:has(.weight-input-wrap){flex-wrap:nowrap}
#configModal .modal-row:has(.weight-input-wrap)>label{flex:0 0 70px;white-space:nowrap}
@media(max-width:640px){#configModal .weight-input-wrap{flex:1 1 0}}

/* Red-and-gold celebrations live inside the two outer gutters. */
.festival-firecrackers{--edge-width:clamp(24px,calc((100vw - 1230px)/2),240px)}
.firecracker-string{top:32vh;left:calc(var(--edge-width)/2 - 12px);right:auto;transform:scale(2.3);transform-origin:top center}
.firecracker-right{left:auto;right:calc(var(--edge-width)/2 - 12px);top:37vh;transform:scaleX(-1) scale(2.3)}
.cracker-barrel{box-shadow:0 2px 5px #84252e33,inset 0 0 3px #ffe59766}
@keyframes cracker-ignite{0%,3%{opacity:1;filter:brightness(1)}4%{filter:brightness(1.65)}7%,84%{opacity:.55;filter:brightness(1)}96%,100%{opacity:1}}
.celebration-rail{position:absolute;inset:0 auto 0 0;width:var(--edge-width);overflow:hidden;background:radial-gradient(ellipse at 0 40%,#f4c56e24,transparent 70%)}
.celebration-right{left:auto;right:0;background:radial-gradient(ellipse at 100% 60%,#f4c56e24,transparent 70%)}
.edge-lantern{position:absolute;top:9vh;left:50%;width:68px;height:80px;margin-left:-34px;border-radius:44% 44% 42% 42%;border:2px solid #e1ad43;background:repeating-linear-gradient(90deg,transparent 0 13px,#ffd37533 14px 15px),radial-gradient(ellipse at 40% 36%,#ed6045,#bd172e 80%);box-shadow:0 7px 26px #be382532,inset 0 0 14px #f7c36a66;animation:lantern-sway 4s ease-in-out infinite;transform-origin:50% -65px}
.edge-lantern::before{content:'';position:absolute;left:50%;bottom:100%;height:100px;width:1px;background:#cb942f}
.edge-lantern::after{content:'';position:absolute;left:10px;right:10px;top:-6px;height:8px;border-radius:4px;background:linear-gradient(90deg,#c88d28,#ffe09a,#c88d28)}
.edge-lantern>span{display:grid;place-items:center;height:100%;font-size:34px;font-family:serif;color:#ffe4a2;text-shadow:0 2px 2px #8c2033}
.edge-lantern>i{position:absolute;top:100%;left:calc(50% - 9px);width:18px;height:45px;border-top:6px solid #e8b845;background:repeating-linear-gradient(90deg,#df9f33 0 2px,transparent 2px 4px);border-radius:0 0 40% 40%}
.celebration-right .edge-lantern{animation-delay:-2s;top:13vh}
.edge-medallion{position:absolute;left:50%;bottom:8vh;width:46px;height:46px;margin-left:-23px;display:grid;place-items:center;border:1px solid #ce9a3d80;outline:1px solid #ce9a3d40;outline-offset:5px;border-radius:12px;color:#bc6e3399;font:26px serif;background:#ffdf9d20;transform:rotate(-8deg)}
.celebration-right .edge-medallion{transform:rotate(8deg);bottom:11vh}
.gold-confetti{position:absolute;left:var(--x);top:-20px;width:5px;height:11px;background:#dca332;opacity:0;border-radius:1px;animation:celebration-fall calc(7s + var(--i)*.29s) linear infinite;animation-delay:calc(var(--i)*-.9s)}
.gold-confetti:nth-child(3n){background:#cb3440;width:7px;height:4px}.gold-confetti:nth-child(4n){border-radius:50%;width:4px;height:4px;background:#f4c871}
.edge-burst{position:absolute;left:50%;top:27vh;width:2px;height:2px;opacity:0;animation:celebration-burst 4.8s ease-out infinite}
.burst-two{top:78vh;animation-delay:-2.4s}.celebration-right .edge-burst{animation-delay:-1.2s}.celebration-right .burst-two{animation-delay:-3.6s}
.edge-burst i{position:absolute;width:2px;height:16px;border-radius:50%;background:linear-gradient(#e6b34f,transparent);transform:rotate(calc(var(--ray)*36deg)) translateY(-20px);transform-origin:center 0}
@keyframes lantern-sway{0%,100%{transform:rotate(-4deg)}50%{transform:rotate(4deg)}}
@keyframes celebration-fall{0%{opacity:0;transform:translateY(-20px) rotate(var(--turn))}8%,80%{opacity:.65}100%{opacity:0;transform:translateY(105vh) rotate(calc(var(--turn) + 300deg))}}
@keyframes celebration-burst{0%,48%,100%{opacity:0;transform:scale(.3)}52%{opacity:.7;transform:scale(.6)}70%{opacity:0;transform:scale(1.65)}}
@media(max-width:1400px){.edge-lantern{width:38px;height:48px;margin-left:-19px}.edge-lantern>span{font-size:23px}.edge-lantern>i{height:28px;width:12px;left:calc(50% - 6px)}.firecracker-string{transform:scale(1.4)}.firecracker-right{transform:scaleX(-1) scale(1.4)}.edge-medallion{display:none}}
@media(max-width:640px){.festival-firecrackers{--edge-width:22px}.edge-lantern{top:13vh;width:26px;height:34px;margin-left:-13px;opacity:.7}.edge-lantern>span{font-size:18px}.celebration-right .edge-lantern{top:18vh}.firecracker-string{top:37vh;left:4px;transform:scale(1.65)}.firecracker-right{top:55vh;left:auto;right:4px;transform:scaleX(-1) scale(1.65)}.gold-confetti:nth-child(odd){display:none}.edge-burst{top:29vh}.burst-two{top:85vh}}
@media(prefers-reduced-motion:reduce){:root[data-theme=red] .festival-firecrackers{display:none}.festival-firecrackers *{animation:none!important}}

/* The koi and lotus artwork frames the page, while ivory panels keep data calm. */
:root[data-theme=red] body{background:#fff5e7;isolation:isolate}
:root[data-theme=red] body::before{content:'';position:fixed;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(90deg,#fff5e7b3,#fff5e7f2 24%,#fff8effa 50%,#fff5e7f2 76%,#fff5e7b3),url('/illustrations/golden-lotus-koi.webp') center/cover no-repeat;animation:festive-warmth 14s ease-in-out infinite alternate}
:root[data-theme=red] .container>header{background:#a61624;box-shadow:0 10px 28px #93152b22}
:root[data-theme=red] .container>header::before{content:'';position:absolute;inset:0;z-index:-2;background:linear-gradient(90deg,#9d122742,#a5151d8c 35%,#ac17217a 65%,#8c13285c),url('/illustrations/golden-lotus-koi.webp') center 54%/cover no-repeat;opacity:.92;animation:header-silk-drift 18s ease-in-out infinite alternate;pointer-events:none}
:root[data-theme=red] header h1{text-shadow:0 2px 8px #680c27a6;color:#ffe7ae}
:root[data-theme=red] .card,:root[data-theme=red] .control-panel,:root[data-theme=red] .custom-bar{background:#fffdf8f7;box-shadow:0 4px 18px #a6422010}
:root[data-theme=red] .newyear-lion{animation:lion-happy-hop 4.8s ease-in-out infinite;transform-origin:50% 88%;bottom:0;will-change:transform}
:root[data-theme=red] .hanging-lantern{animation:header-lantern-sway 5s ease-in-out infinite;transform-origin:50% -40px}
.lion-charms{position:absolute;right:0;bottom:0;width:230px;height:230px;pointer-events:none}
.lion-charms i{position:absolute;font-style:normal;color:#ffe6a5;text-shadow:0 0 8px #f8bd55;animation:lion-star-twinkle 2.8s ease-in-out infinite}
.lion-charms i:nth-child(1){left:12px;top:32px;font-size:22px}.lion-charms i:nth-child(2){right:20px;top:12px;font-size:28px;animation-delay:-.9s}.lion-charms i:nth-child(3){left:26px;bottom:34px;font-size:17px;animation-delay:-1.8s}
.koi-pond{display:none;position:fixed;inset:0;overflow:hidden;pointer-events:none;z-index:0;user-select:none}
:root[data-theme=red] .koi-pond{display:block}
.koi-swimmer{position:absolute;width:clamp(130px,12vw,240px);left:clamp(-70px,calc((100vw - 1280px)/4 - 70px),130px);top:43vh;opacity:.76;animation:koi-swim-left 24s ease-in-out infinite;will-change:transform}
.koi-swimmer img{display:block;width:100%;height:auto;object-fit:contain;filter:drop-shadow(0 6px 12px #b56a1726);animation:koi-body-sway 4s ease-in-out infinite;transform-origin:50% 45%}
.koi-right{left:auto;right:clamp(-70px,calc((100vw - 1280px)/4 - 70px),130px);top:28vh;animation:koi-swim-right 28s ease-in-out infinite;animation-delay:-8s}
.koi-right img{transform:scaleX(-1);animation-name:koi-body-sway-right;animation-delay:-1.5s}
/* Fewer competing effects: the moving fish are the main decoration. */
.celebration-rail .edge-medallion{display:none}.celebration-rail .gold-confetti:nth-child(2n){display:none}
.celebration-rail .edge-burst{opacity:.35}
@keyframes lion-happy-hop{0%,40%,100%{transform:translateY(0) rotate(0) scale(1)}8%{transform:translateY(-9px) rotate(-4deg) scale(1.025)}16%{transform:translateY(0) rotate(2deg) scale(1)}24%{transform:translateY(-13px) rotate(4deg) scale(1.025)}33%{transform:translateY(0) rotate(-2deg)}66%{transform:translateY(-3px) rotate(-3deg)}78%{transform:translateY(0) rotate(2deg)}}
@keyframes lion-star-twinkle{0%,100%{opacity:.25;transform:scale(.65) rotate(-10deg)}50%{opacity:.95;transform:scale(1.15) rotate(15deg)}}
@keyframes header-lantern-sway{0%,100%{transform:rotate(-8deg)}50%{transform:rotate(-2deg)}}
@keyframes koi-swim-left{0%,100%{transform:translate3d(0,16vh,0) rotate(-10deg)}35%{transform:translate3d(16px,-10vh,0) rotate(4deg)}68%{transform:translate3d(-8px,-24vh,0) rotate(-6deg)}}
@keyframes koi-swim-right{0%,100%{transform:translate3d(0,-8vh,0) rotate(9deg)}40%{transform:translate3d(-14px,24vh,0) rotate(-5deg)}72%{transform:translate3d(8px,8vh,0) rotate(3deg)}}
@keyframes koi-body-sway{0%,100%{transform:rotate(-3deg)}50%{transform:rotate(3deg)}}
@keyframes koi-body-sway-right{0%,100%{transform:scaleX(-1) rotate(-3deg)}50%{transform:scaleX(-1) rotate(3deg)}}
@keyframes festive-warmth{from{opacity:.85}to{opacity:1}}
@keyframes header-silk-drift{from{background-position:center,center 48%}to{background-position:center,center 59%}}
@media(max-width:1400px){.koi-swimmer{opacity:.5}}
@media(max-width:640px){.koi-swimmer{width:110px;left:-66px;opacity:.35}.koi-right{left:auto;right:-66px}.lion-charms{width:150px;height:150px;right:14px}.lion-charms i:nth-child(1){font-size:15px}.lion-charms i:nth-child(2){font-size:20px}:root[data-theme=red] .container>header::before{background-position:center,38% center;background-size:auto,auto 100%;animation:none}:root[data-theme=red] body::before{background-image:linear-gradient(#fff5e7ed,#fff5e7e6),url('/illustrations/golden-lotus-koi.webp')}}
@media(prefers-reduced-motion:reduce){.koi-swimmer,.koi-swimmer img,:root[data-theme=red] .newyear-lion,:root[data-theme=red] .hanging-lantern,.lion-charms i,:root[data-theme=red] body::before,:root[data-theme=red] .container>header::before{animation:none;will-change:auto}}

.comparison-reference{margin-top:24px;border-top:1px solid var(--border);padding-top:18px}.comparison-reference>summary{font-weight:800;color:var(--primary);cursor:pointer;font-size:18px}.reference-play{margin-top:18px}.reference-lead{padding:12px;background:var(--dark);border-radius:8px}.reference-reason{min-width:240px;max-width:450px;white-space:normal;line-height:1.8}.comparison-reference th{white-space:nowrap}

:root[data-theme=red] .container>header::before{background:radial-gradient(ellipse at 30% 0%,#e6483766,transparent 65%),linear-gradient(115deg,#a71224,#bd1928 55%,#981429);animation:none}
:root[data-theme=red] .newyear-art>.hanging-lantern{display:none}
.header-koi-lane{position:absolute;left:8px;top:6px;width:240px;height:220px;pointer-events:none}
.header-koi-lane img{position:absolute;left:22px;top:16px;width:132px;height:174px;object-fit:contain;animation:header-koi-cross 9s ease-in-out infinite;transform-origin:center}
@keyframes header-koi-cross{0%,100%{transform:translate3d(0,8px,0) rotate(44deg)}50%{transform:translate3d(48px,-4px,0) rotate(48deg)}}
.koi-pool{--pond-delay:0s;position:absolute;width:clamp(160px,calc((100vw - 1280px)/2 - 32px),340px);height:340px;left:max(0px,calc((100vw - 1280px)/4 - 165px));bottom:9vh;overflow:hidden}
.pool-right{left:auto;right:max(0px,calc((100vw - 1280px)/4 - 165px));bottom:27vh;--pond-delay:-4s;transform:scaleX(-1)}
.water-surface{position:absolute;bottom:31px;left:4%;width:92%;height:35px;border-radius:50%;background:radial-gradient(ellipse,#b4d9d047,#f5efcb30 52%,transparent 72%);border-bottom:1px solid #d4b77055}
.koi-jumper{position:absolute;left:calc(50% - 65px);bottom:56px;width:110px;height:150px;transform-origin:50% 60%;animation:koi-water-leap 8s linear infinite;animation-delay:var(--pond-delay);will-change:transform,opacity}
.koi-jumper img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 4px 5px #a9682320)}
.water-ripple{position:absolute;bottom:27px;left:30%;width:50%;height:27px;border:1px solid #91bfb9a6;border-radius:50%;opacity:0;animation:water-ring 8s ease-out infinite;animation-delay:var(--pond-delay)}
.ripple-two{bottom:21px;width:58%;left:26%;animation-name:water-ring-outer;border-color:#fff8d8}
.splash{position:absolute;left:65%;bottom:54px;width:1px;height:1px}
.splash i{position:absolute;width:4px;height:10px;border-radius:60% 60% 55% 55%;background:linear-gradient(#fffdf0,#a8d4cecc);box-shadow:0 0 3px #fff7d3;opacity:0;animation:water-drops 8s ease-out infinite;animation-delay:var(--pond-delay)}
@keyframes koi-water-leap{0%,8%{opacity:0;transform:translate3d(-45px,85px,0) rotate(-24deg) scale(.8)}12%{opacity:.9;transform:translate3d(-38px,12px,0) rotate(-16deg)}24%{opacity:.95;transform:translate3d(-12px,-76px,0) rotate(7deg)}36%{opacity:.95;transform:translate3d(20px,-110px,0) rotate(43deg)}48%{opacity:.95;transform:translate3d(47px,-75px,0) rotate(88deg)}60%{opacity:.85;transform:translate3d(64px,13px,0) rotate(136deg)}65%,100%{opacity:0;transform:translate3d(70px,90px,0) rotate(148deg) scale(.8)}}
@keyframes water-ring{0%,59%{opacity:0;transform:scale(.3)}62%{opacity:.8;transform:scale(.6)}81%{opacity:0;transform:scale(1.5)}100%{opacity:0;transform:scale(1.5)}}
@keyframes water-ring-outer{0%,62%{opacity:0;transform:scale(.35)}65%{opacity:.8;transform:scale(.65)}88%,100%{opacity:0;transform:scale(1.7)}}
@keyframes water-drops{0%,59%{opacity:0;transform:translate(0,0) scale(.4)}61%{opacity:.9;transform:translate(0,0) scale(.7)}69%{opacity:.8;transform:translate(var(--dx),var(--dy)) rotate(var(--dr))}79%,100%{opacity:0;transform:translate(var(--dx),20px) rotate(var(--dr)) scale(.3)}}
@media(max-width:1500px){.koi-pool{width:170px;left:-40px;opacity:.5}.pool-right{left:auto;right:-40px}}
@media(max-width:1100px){.koi-pool{display:none}}
@media(max-width:640px){.header-koi-lane{top:auto;bottom:0;left:4px;width:150px;height:130px}.header-koi-lane img{width:80px;height:108px;top:8px;left:18px;animation-name:header-koi-cross-small}}
@keyframes header-koi-cross-small{0%,100%{transform:translate3d(0,4px,0) rotate(44deg)}50%{transform:translate3d(18px,-3px,0) rotate(48deg)}}
@media(prefers-reduced-motion:reduce){.header-koi-lane img,.koi-jumper,.water-ripple,.splash i{animation:none;will-change:auto}.koi-jumper{opacity:.7;transform:translateY(-25px) rotate(35deg)}.splash,.water-ripple{display:none}}

.streak-pair{display:grid;gap:14px}.hit-streak-block{border-top:1px solid var(--border);padding-top:12px}.hit-streak-block>strong{display:block;margin-bottom:8px;color:var(--success,#23805b)}

.selection-bulk{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0 12px}.selection-bulk .btn{padding:5px 12px;min-height:32px}

.reference-top-pick{padding:16px;border:1px solid var(--border);border-radius:12px;background:var(--dark);margin:12px 0}.reference-top-pick b{display:inline-block;background:#f7d987;color:#9e2430;border-radius:4px;padding:2px 5px;margin:2px 0}.reference-rank{font-weight:800;white-space:nowrap;color:var(--primary)}

/* Larger complete fish; existing header and mobile background motifs are retained. */
@media(min-width:641px){
 :root[data-theme=red] .container>header{min-height:280px}
 .header-koi-lane{left:0;top:0;width:310px;height:280px}
 .header-koi-lane img{width:180px;height:234px;left:46px;top:22px}
 @keyframes header-koi-cross{0%,100%{transform:translate3d(0,0,0) rotate(44deg)}50%{transform:translate3d(26px,-2px,0) rotate(46deg)}}
}
.koi-pool{width:clamp(260px,calc((100vw - 1280px)/2 - 12px),420px);height:490px;left:max(0px,calc((100vw - 1280px)/4 - 200px));bottom:6vh}
.pool-right{left:auto;right:max(0px,calc((100vw - 1280px)/4 - 200px));bottom:22vh}
.koi-jumper{width:190px;height:256px;left:calc(50% - 108px);bottom:60px}
.water-surface{height:46px}.water-ripple{height:36px}.splash i{width:5px;height:13px}
@media(min-width:1101px) and (max-width:1500px){.koi-pool{width:260px;left:-48px;opacity:.85}.pool-right{left:auto;right:-48px}.koi-jumper{width:170px;height:230px;left:calc(50% - 104px)}}
@media(max-width:1100px){.koi-pool{display:none}}
@media(max-width:640px){.header-koi-lane{width:175px;height:156px;left:0;bottom:0}.header-koi-lane img{width:108px;height:140px;left:26px;top:8px}}

/* Transparent paper panels reveal the existing red-theme artwork. */
:root[data-theme=red] .container .card,
:root[data-theme=red] .container .control-panel,
:root[data-theme=red] .container .custom-bar,
:root[data-theme=red] .container .model-choice,
:root[data-theme=red] .container .capture-selection,
:root[data-theme=red] .container .simulation-model,
:root[data-theme=red] .container #captureChoices label,
:root[data-theme=red] .container .recommendation-card{background:rgba(255,253,246,.23);box-shadow:0 4px 16px #8c35200b}
:root[data-theme=red] .container .model-choice[aria-pressed=true]{background:rgba(255,228,177,.36);border-color:var(--primary);box-shadow:inset 0 0 0 1px var(--primary)}
:root[data-theme=red] .container .input-field{background:rgba(255,252,243,.65)}
:root[data-theme=red] .container .fixed-training{background:rgba(250,229,170,.6)}
:root[data-theme=red] .container .tabs{background:rgba(255,249,237,.6)}
:root[data-theme=red] .tabs .tab-btn{color:#80534e;border-bottom-color:transparent;background:transparent;border-radius:8px 8px 0 0}
:root[data-theme=red] .tabs .tab-btn:hover{background:#fff4e6}
:root[data-theme=red] .tabs .tab-btn.active{color:#7c3036;border-bottom-color:#a95753;background:#f7e5d7;font-weight:700}

/* Phone layouts keep the artwork visible rather than hiding both fish lanes. */
@media(max-width:640px){
 :root[data-theme=red] body::before{background-image:linear-gradient(90deg,#fff5e7b8,#fff5e7dc 35%,#fff5e7dc 65%,#fff5e7b8),url('/illustrations/golden-lotus-koi.webp');background-size:100% 100%,100% auto;background-position:center,center top;background-repeat:no-repeat,repeat-y;animation:none}
 .koi-pool{display:block;width:150px;height:300px;left:-35px;bottom:14vh;opacity:.45;pointer-events:none}
 .pool-right{left:auto;right:-35px;bottom:42vh}
 .koi-jumper{width:105px;height:142px;left:10px;bottom:52px}
 .water-surface{height:22px}.water-ripple{height:18px}.splash i{width:3px;height:8px}
 :root[data-theme=red] .container .card,:root[data-theme=red] .container .control-panel,:root[data-theme=red] .container .custom-bar,:root[data-theme=red] .container .model-choice{background:rgba(255,253,246,.28)}
}

/* Use reference two as-is; CSS viewport cropping keeps screenshot chrome outside view. */
:root[data-theme=blue] body{background:#e6f5ff;isolation:isolate}
:root[data-theme=blue] body::before{content:'';position:fixed;inset:0;pointer-events:none;z-index:-1;background-image:linear-gradient(110deg,#f4fcff38,#f9fdff66),url('/illustrations/blue-watercolor-reference.jpg');background-size:100% 100%,100% 158%;background-position:center,center;background-repeat:no-repeat}
:root[data-theme=blue] .container .card,:root[data-theme=blue] .container .control-panel,:root[data-theme=blue] .container .custom-bar,:root[data-theme=blue] .container .model-choice,:root[data-theme=blue] .container .capture-selection,:root[data-theme=blue] .container .simulation-model{background:rgba(255,255,255,.48);border-color:#b7d5e7;box-shadow:0 4px 18px #4e87a80a}
:root[data-theme=blue] .container .model-choice[aria-pressed=true]{background:#e1f1ff8c;border-color:var(--primary)}
:root[data-theme=blue] .container .input-field{background:rgba(255,255,255,.72)}
:root[data-theme=blue] .container .tabs{background:#f6fcff94}

/* Simplified controls requested in v33.21 */

#panel-predict:not([data-model="quant"]) .control-group:has(> #predictModelChoice),#panel-backtest:not([data-model="quant"]) .control-group:has(> #backtestModelChoice),.control-group:has(> #simNormalTraining){display:none!important}
.capture-row{border-bottom:2px solid var(--border,#d4b792);margin-bottom:20px;padding-bottom:24px}

/* Full header swim, turning beside the lion. */
.header-koi-lane{inset:0!important;width:100%!important;height:100%!important;overflow:hidden;container-type:inline-size}
.header-koi-lane img{width:230px!important;height:290px!important;top:0!important;left:24px;animation:header-koi-wide 20s linear infinite!important;will-change:left,transform}
@keyframes header-koi-wide{
 0%{left:24px;transform:scaleX(1) rotate(44deg)}
 46%{left:calc(100% - 250px);transform:scaleX(1) rotate(44deg)}
 50%{left:calc(100% - 250px);transform:scaleX(-1) rotate(44deg)}
 96%{left:24px;transform:scaleX(-1) rotate(44deg)}
 100%{left:24px;transform:scaleX(1) rotate(44deg)}
}
@media(max-width:640px){
 .header-koi-lane img{width:130px!important;height:166px!important;top:auto!important;bottom:0;animation-duration:14s!important}
 @keyframes header-koi-wide{
 0%{left:8px;transform:scaleX(1) rotate(44deg)}
 46%{left:calc(100% - 138px);transform:scaleX(1) rotate(44deg)}
 50%{left:calc(100% - 138px);transform:scaleX(-1) rotate(44deg)}
 96%{left:8px;transform:scaleX(-1) rotate(44deg)}
 100%{left:8px;transform:scaleX(1) rotate(44deg)}
 }
}
@media(prefers-reduced-motion:reduce){.header-koi-lane img{animation:none!important;transform:rotate(44deg)}}

/* v33.25: reference-four mascot stays in the original left header position. */
.header-wealth-ram{position:absolute;left:8px;top:0;width:300px;height:100%;pointer-events:none;display:flex;align-items:center;justify-content:center}
.header-wealth-ram picture{display:block;width:100%;height:100%}
.header-wealth-ram img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 7px 7px #610c2340)}
@media(max-width:900px) and (min-width:641px){.header-wealth-ram{width:230px;left:0}}
@media(max-width:640px){.header-wealth-ram{width:126px;height:142px;top:auto;bottom:0;left:0}}

/* Align visible mascot feet with the lion; preserve the independent koi route. */
.header-wealth-ram{top:auto;bottom:-14px;height:260px;width:260px;left:12px;z-index:2}
.header-koi-lane{z-index:1}
@media(max-width:900px) and (min-width:641px){.header-wealth-ram{width:220px;height:240px;left:0;bottom:-14px}}
@media(max-width:640px){.header-wealth-ram{width:154px;height:154px;left:0;bottom:-10px}}

.training-model-list{display:grid;gap:10px;margin:16px 0}.training-model-row{display:grid;grid-template-columns:minmax(180px,1fr) minmax(140px,240px) 40px 40px;gap:8px;align-items:center}.training-model-row label{display:flex;align-items:center;gap:6px}.training-overlap label{display:inline-block;margin:8px}.training-overlap{margin:16px 0}.training-model-row .model-name-edit{width:100%;min-width:0}
@media(max-width:640px){.training-model-row{grid-template-columns:1fr 38px 38px}.training-model-row label{grid-column:1/-1}.training-model-row .model-name-edit{grid-column:1}}

.training-model-row{display:flex}.model-manager{padding:16px;margin:14px 0;border:1px solid #d9b689;border-radius:12px}.model-manager-row{display:grid;grid-template-columns:minmax(120px,1fr) 100px 38px 38px;gap:6px;align-items:center;margin:8px 0}.model-manager-row input.input-field{width:100%;min-width:0}
@media(max-width:640px){:root[data-theme=red] .container>header{min-height:420px}.model-manager-row{grid-template-columns:1fr 38px 38px}.model-manager-row>.input-field{grid-column:1/-1}}

.streak-range-layout{display:grid;grid-template-columns:minmax(130px,1fr) minmax(140px,1fr);gap:14px}.streak-range-list{display:flex;flex-direction:column;gap:8px;max-height:190px;overflow:auto;font-size:12px}.current-miss-count{font-weight:700;color:#a91526;margin:0 0 8px}

.simulation-model,.recommendation-card{position:relative}.simulation-model>h3{padding-right:90px}.simulation-model>.copy-model-numbers,.recommendation-card>.copy-model-numbers{float:right;margin:0 0 8px 8px}.copy-numbers-fallback{display:block;width:100%;min-height:50px}

/* One scrolling body; footer never participates in content overflow. */
#configModal .modal{max-width:calc(100vw - 24px);box-sizing:border-box}
#configModal .config-body{flex:1 1 0;min-height:0;overflow-y:auto;scrollbar-gutter:stable}
#configModal .modal-actions{position:relative;z-index:4;flex:0 0 auto;background:var(--bg-card,#fffdf7)}
#configModal .model-manager{margin:16px 0;max-width:100%;box-sizing:border-box}
.simulation-model>.copy-model-numbers,.recommendation-card>.copy-model-numbers{position:absolute;top:16px;right:16px;float:none;margin:0;z-index:2}
.simulation-model>h3{min-height:36px;padding-right:94px}.rec-card-heading{padding-right:90px}

/* Calm table text; ranges occupy their own column. */
.streak-count-only{display:block}.streak-period-cell{min-width:170px;vertical-align:top!important}.streak-period-cell .streak-range-list{margin:12px 0 22px;max-height:150px;color:#526578;font-weight:400;line-height:1.8}.streak-period-cell .streak-range-list strong{color:#485765;font-weight:600}
#panel-backtest .miss-round-control,#panel-simulate .miss-round-control{color:#453e36;font-weight:400}#panel-backtest .miss-round-control strong,#panel-simulate .miss-round-control strong{color:#453e36}#panel-backtest .miss-round-control output,#panel-simulate .miss-round-control output{color:#526578;font-weight:500}.current-miss-count{color:#ab2536;font-weight:600;font-size:13px}.hit-streak-block>strong{color:#21835b}

/* Fixed settings keep their values for calculation, without occupying form space. */
.control-group:has(> .fixed-training:not([hidden])){display:none!important}
#panel-simulate #empty-simulate{display:none!important}
#comparisonTrainingChoices{margin-top:20px}

.history-rewind-controls{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.history-rewind-controls>input{width:115px;min-height:36px;padding:6px 9px}.history-rewind-controls>label{font-size:12px}.history-rewind-status{font-size:12px;color:var(--text-muted)}
@media(max-width:640px){.history-rewind-controls{flex-basis:100%}.history-rewind-status{flex-basis:100%}}

.compact-position-list{display:grid;gap:12px;margin:12px 0}.compact-position-row{display:grid;grid-template-columns:44px minmax(0,1fr);gap:8px;align-items:center}.compact-position-row>span{white-space:nowrap;color:var(--text-muted)}.compact-position-row .simulation-digits{display:flex;flex-wrap:wrap;gap:5px}.reference-top-pick .compact-position-row b{margin:0}.reference-method{margin:12px 0;color:var(--text-muted)}.reference-method p{padding:10px 0}.compact-number-card{margin-bottom:16px}
@media(max-width:640px){
 .custom-bar{display:grid!important;grid-template-columns:1fr 1.15fr 1.25fr!important;gap:8px!important;align-items:center}
 .custom-bar>label{grid-column:1/-1}.custom-bar>button[onclick*="openConfigModal"]{grid-column:1;width:100%;min-width:0}
 .custom-bar>.history-rewind-controls{grid-column:2;display:block;min-width:0;flex-basis:auto;margin:0}
 .history-rewind-controls>select{width:100%;min-width:0;min-height:44px;padding:8px 4px;font-size:16px}
 .custom-bar>#refreshDataBtn{grid-column:3;width:100%;min-width:0}
 .custom-bar>.btn{font-size:12px;min-height:44px;padding:8px 4px;white-space:nowrap;min-width:0}
 .custom-bar>.custom-summary,.custom-bar>#dataRefreshStatus{grid-column:1/-1}
 :root[data-theme=red] .container .tabs{background:#fff1df}:root[data-theme=blue] .container .tabs{background:#edf6ff}
 .comparison-reference .reference-lead{font-size:14px;line-height:1.6}.reference-top-pick{padding:12px!important;background:#fff6e6!important}
 .compact-position-row{grid-template-columns:36px minmax(0,1fr);gap:6px}.compact-position-row .simulation-digits{gap:4px}.compact-position-row .simulation-digits b{font-size:14px;min-width:24px;padding:3px 4px}
 .reference-top-pick small{display:block;line-height:1.6}.comparison-reference>p.dim{font-size:12px;line-height:1.6}
}
