/*
 * Simulador electoral provincial - MIT License (c) 2026 Guillermo Cano Soto
 */
:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #102235;
  --text: #f2f7ff;
  --muted: #9db1c1;
  --accent: #ff6b6b;
  --accent-2: #46c6b1;
  --accent-3: #ffd166;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #07111f, #12263a);
  color: var(--text);
}
.page-shell { max-width: 1400px; margin: 0 auto; padding: 32px; }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: start; margin-bottom: 24px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.2em; color: var(--accent-2); font-size: 0.8rem; margin-bottom: 8px; }
.hero h1 { margin: 0 0 12px; font-size: 2rem; line-height: 1.2; }
.intro { max-width: 800px; color: var(--muted); line-height: 1.6; }
.hero-card { min-width: 280px; background: rgba(16,34,53,.92); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 18px; box-shadow: 0 12px 26px rgba(0,0,0,.2); }
.hero-verdict { margin: 14px 0 0; max-width: 560px; padding: 12px 16px; border-radius: 12px; background: rgba(255,209,102,.08); border: 1px solid rgba(255,209,102,.3); color: var(--muted); font-size: .92rem; line-height: 1.5; }
.hero-verdict strong { color: var(--accent-3); }
.quick-scenarios { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.quick-scenarios .qs-btn.active { border-color: var(--accent-3); color: var(--accent-3); background: rgba(255,209,102,.12); }
.hero-stat { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.hero-stat:last-child { border-bottom: 0; }
.hero-stat span { display: block; font-size: 1.7rem; font-weight: 700; }
.hero-stat small { color: var(--muted); }
.hero-stat.alt span { color: var(--accent-2); }
.hero-stat.gain span { color: var(--accent-3); }
.panel-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: start; }
.map-card, .detail-card { background: rgba(16,34,53,.92); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; padding: 18px; box-shadow: 0 10px 28px rgba(0,0,0,.22); }
.map-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.map-editor { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.map-editor-head h3 { margin: 0 0 4px; font-size: 1.05rem; }
.map-editor-head p { margin: 0 0 12px; font-size: .85rem; color: rgba(255,255,255,.65); }
.detail-card { position: sticky; top: 18px; max-height: calc(100vh - 36px); overflow-y: auto; scrollbar-color: var(--accent-2) rgba(255,255,255,.08); }
.card-head h2 { margin: 0 0 6px; font-size: 1.1rem; }
.card-head p { margin: 0 0 12px; color: var(--muted); font-size: 0.95rem; }
#map { width: 100%; display: block; min-height: 520px; }
.base-land { fill: #163b50; stroke: #7fd0ff; stroke-width: 1.8; opacity: 0.9; }
.province { cursor: pointer; transition: transform .16s ease, fill .16s ease; stroke: #dce9f2; stroke-width: 1; }
.province:hover { transform: translateY(-2px); }
.province.active { stroke: #fff; stroke-width: 2.2; }
.legend { display: flex; gap: 20px; margin-top: 8px; color: var(--muted); font-size: .9rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot.left-win { background: #e3425b; }
.dot.right-win { background: #1474c9; }
.dot.neutral { background: #2a5c7a; }
.dot.hatch-sample { border-radius: 2px; background: repeating-linear-gradient(45deg, #f2f7ff 0 2px, transparent 2px 4px); border: 1px solid rgba(255,255,255,.35); }
#map-tooltip { position: fixed; z-index: 60; pointer-events: none; padding: 6px 10px; max-width: 240px; border-radius: 8px; background: rgba(7,17,31,.96); border: 1px solid rgba(255,255,255,.16); color: var(--text); font-size: .78rem; line-height: 1.4; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.hidden { display: none !important; }
.risk-margin { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(255,209,102,.08); border: 1px solid rgba(255,209,102,.25); font-size: .88rem; color: var(--muted); }
.risk-margin strong { color: var(--accent-3); }
.province-detail h3 { margin-top: 0; font-size: 1.2rem; }
.province-detail p, .province-detail li { color: var(--muted); line-height: 1.6; }
.province-detail ul { padding-left: 18px; }
.big-number { font-size: 2rem; font-weight: 800; color: var(--accent-3); }
.delta { margin-top: 10px; font-size: 0.95rem; color: var(--text); }
.detail-grid { display: grid; gap: 12px; margin-top: 12px; }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.scenario-panel { border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 12px; background: rgba(255,255,255,.03); }
.scenario-panel.winner-left { border-color: rgba(227,66,91,.5); background: linear-gradient(180deg, rgba(227,66,91,.1), rgba(227,66,91,.02)); }
.scenario-panel.winner-right { border-color: rgba(20,116,201,.5); background: linear-gradient(180deg, rgba(20,116,201,.1), rgba(20,116,201,.02)); }
.scenario-panel.winner-tie { border-color: rgba(42,92,122,.5); background: linear-gradient(180deg, rgba(42,92,122,.1), rgba(42,92,122,.02)); }
.scenario-panel.winner-left h4 { color: #e3425b; }
.scenario-panel.winner-right h4 { color: #1474c9; }
.scenario-panel.winner-left .scenario-summary strong { color: #e3425b; }
.scenario-panel.winner-right .scenario-summary strong { color: #1474c9; }
.winner-flip { margin: 0; padding: 3px 8px; border-radius: 99px; background: rgba(255,209,102,.14); border: 1px solid rgba(255,209,102,.5); color: var(--accent-3); font-style: normal; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.scenario-panel h4 { margin: 0 0 4px; font-size: 1rem; }
.scenario-panel .panel-copy { margin-bottom: 4px; }
.party-table .left-party td:first-child { color: #e3425b; }
.party-table tr.no-seat td:first-child { color: #d96c75; }
.no-seat-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 99px; background: rgba(217,108,117,.15); color: #d96c75; font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; white-space: nowrap; }
.scenario-summary { display: flex; flex-wrap: wrap; gap: 7px; margin: 9px 0; }
.scenario-summary span { padding: 4px 7px; border-radius: 5px; background: rgba(255,255,255,.06); color: var(--muted); font-size: .75rem; }
.scenario-summary strong { color: var(--text); }
.scenario-sub { width: 100%; color: var(--muted); font-size: .72rem; }
.advanced-editor { margin-top: 12px; border-top: 1px solid rgba(255,255,255,.1); padding-top: 9px; }
.advanced-editor summary { cursor: pointer; color: var(--accent-2); font-size: .82rem; font-weight: 600; }
.advanced-editor .coalition-editor { margin-bottom: 0; }
.scenario-panel h4 { margin: 0 0 6px; font-size: 1rem; }
.panel-copy { margin: 0 0 10px; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.coalition-editor { margin: 12px 0 14px; padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: rgba(7,17,31,.38); }
.scenario-editor.coalition-editor { border-color: rgba(70,198,177,.35); background: rgba(70,198,177,.05); }
.editor-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.editor-head h5 { margin: 0 0 3px; font-size: .92rem; }
.editor-head p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.reset-editor { border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: 5px 8px; color: var(--text); background: transparent; cursor: pointer; font: inherit; font-size: .75rem; white-space: nowrap; }
.reset-editor:hover { border-color: var(--accent-2); color: var(--accent-2); }
.editor-budget { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 12px 0 10px; font-size: .8rem; }
.editor-budget strong { color: var(--accent-3); }
.editor-budget small { grid-column: 1 / -1; color: var(--muted); }
.party-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) 1.2fr 58px 26px; gap: 10px; align-items: center; margin-top: 12px; font-size: .8rem; }
.party-row.left { box-shadow: inset 3px 0 0 #e3425b; background: rgba(227,66,91,.06); border-radius: 6px; }
.coalition-row { padding: 8px; }
.coalition-name { font-weight: 700; }
.coalition-members { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.coalition-member { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 8px; border-radius: 99px; background: rgba(255,255,255,.05); color: var(--muted); font-size: .72rem; }
.coalition-member i { width: 8px; height: 8px; border-radius: 50%; }
.coalition-member.at-risk { border: 1px solid rgba(217,108,117,.45); background: rgba(217,108,117,.12); }
.coalition-warn { font-style: normal; color: #d96c75; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.coalition-member button { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: .9rem; line-height: 1; padding: 0; }
.coalition-member button:hover { color: #d96c75; }
.orientation-toggle { border: 1px solid rgba(255,255,255,.18); border-radius: 6px; padding: 4px 7px; cursor: pointer; font: inherit; font-size: .68rem; font-weight: 700; white-space: nowrap; background: transparent; }
.orientation-toggle.left { border-color: rgba(227,66,91,.6); color: #e3425b; background: rgba(227,66,91,.1); }
.orientation-toggle.right { border-color: rgba(20,116,201,.6); color: #1474c9; background: rgba(20,116,201,.1); }
.united-toggle { display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.united-toggle input { accent-color: #e3425b; }
.united-icon { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; vertical-align: -2px; }
.party-row.left .united-toggle { color: #e3425b; }
.party-name-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.party-name { width: 100%; min-width: 0; padding: 5px 6px; border: 1px solid rgba(255,255,255,.16); border-radius: 5px; color: var(--text); background: rgba(255,255,255,.06); font: inherit; font-size: .78rem; }
.party-name:focus { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.party-name-wrap output { color: var(--accent-2); font-size: .72rem; }
.party-name-wrap output.left { color: #e3425b; }
.party-row input[type="range"] { width: 100%; accent-color: var(--accent-2); }
.party-row.left input[type="range"], .coalition-row input[type="range"] { accent-color: #e3425b; }
.threshold-warn { color: #d96c75; font-size: .68rem; font-weight: 600; }
.party-seats { color: var(--muted); font-size: .68rem; font-weight: 400; white-space: nowrap; }
.party-remove { width: 26px; height: 26px; border: 1px solid rgba(217,108,117,.4); border-radius: 6px; color: #d96c75; background: transparent; cursor: pointer; font: inherit; font-size: 1rem; line-height: 1; }
.party-remove:hover { background: rgba(217,108,117,.15); }
.party-add { margin-top: 12px; width: 100%; padding: 8px; border: 1px dashed rgba(70,198,177,.45); border-radius: 8px; color: var(--accent-2); background: transparent; cursor: pointer; font: inherit; font-size: .8rem; }
.party-add:hover { background: rgba(70,198,177,.1); }
.vote-number { width: 58px; padding: 5px 4px; border: 1px solid rgba(255,255,255,.16); border-radius: 5px; color: var(--text); background: rgba(255,255,255,.06); font: inherit; }
.vote-number:focus, .reset-editor:focus-visible, .party-row input[type="range"]:focus-visible, .party-name:focus-visible, .united-toggle input:focus-visible, .orientation-toggle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.list-order { margin: 12px 0; padding: 11px; border: 1px solid rgba(255,209,102,.28); border-radius: 10px; background: rgba(255,209,102,.06); }
.list-order > summary { cursor: pointer; color: var(--accent-3); font-size: .82rem; font-weight: 700; }
.list-order > summary span { float: right; color: var(--muted); font-size: .72rem; font-weight: 400; }
.list-order-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.list-order h5 { margin: 10px 0 0; font-size: .92rem; }
.list-order p { color: var(--muted); font-size: .76rem; }
.list-order p { margin: 4px 0 9px; line-height: 1.4; }
.list-order ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 8px; margin: 0; padding: 0; list-style: none; }
.list-order li { display: flex; align-items: center; gap: 7px; padding: 5px 6px; border-radius: 5px; font-size: .8rem; }
.list-order li strong { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--text); background: rgba(255,209,102,.18); font-size: .72rem; }
.list-order select { min-width: 0; flex: 1; padding: 4px 5px; border: 1px solid rgba(255,209,102,.35); border-radius: 5px; color: var(--text); background: #172c3d; font: inherit; font-size: .78rem; }
.list-order select:focus { outline: 2px solid var(--accent-3); outline-offset: 2px; }
.list-order-note { display: block; margin-top: 9px; color: var(--muted); font-size: .68rem; line-height: 1.35; }
.quotient-explanation { margin: 12px 0; border-top: 1px solid rgba(255,255,255,.1); padding-top: 9px; }
.quotient-explanation summary { cursor: pointer; color: var(--accent-2); font-size: .82rem; font-weight: 600; }
.quotient-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin-top: 8px; }
.quotient-grid div { display: grid; grid-template-columns: 20px 1fr; gap: 2px 6px; padding: 5px; border-radius: 5px; background: rgba(255,255,255,.04); font-size: .75rem; }
.quotient-grid strong { grid-row: span 2; color: var(--accent-3); }
.quotient-grid small { grid-column: 2; color: var(--muted); font-size: .68rem; }
.threshold-copy { margin: 9px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.4; }
.threshold-copy strong { color: var(--text); }
.party-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.party-table th, .party-table td { text-align: left; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.party-table th { color: var(--muted); font-weight: 600; }
.fair-order { margin: 8px 0 12px; padding-left: 18px; color: var(--text); }
.fair-order li { margin-bottom: 6px; }
.fair-order span { display: inline-block; width: 18px; color: var(--accent-2); font-weight: 700; }
.note { margin-top: 10px; color: var(--muted); line-height: 1.6; }
.methodology-card { margin-top: 24px; background: rgba(16,34,53,.92); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; padding: 18px; box-shadow: 0 10px 28px rgba(0,0,0,.22); }
.hemicycle-card { margin-top: 20px; background: rgba(16,34,53,.92); border: 1px solid rgba(255,255,255,.08); border-radius: 20px; padding: 14px 18px; box-shadow: 0 10px 28px rgba(0,0,0,.22); }
.hemicycle-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.control-label { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.hemicycle-toggle { display: flex; align-items: center; gap: 12px; }
.hemicycle-btn { border: 1px solid rgba(255,255,255,.18); border-radius: 7px; padding: 8px 14px; color: var(--muted); background: transparent; cursor: pointer; font: inherit; font-size: .78rem; }
.hemicycle-btn:hover { border-color: var(--accent-2); color: var(--text); }
.hemicycle-btn.active { border-color: var(--accent-2); color: var(--accent-2); background: rgba(70,198,177,.12); }
#hemicycle-svg { height: 360px; width: auto; max-width: 100%; margin: 0 auto; display: block; }
.majority-line { stroke: var(--accent-3); stroke-width: 0.8; stroke-dasharray: 2.5 1.6; }
.majority-tag-bg { fill: rgba(7,17,31,.92); stroke: rgba(255,209,102,.4); stroke-width: 0.3; }
.majority-label { fill: var(--accent-3); font-size: 3.2px; font-weight: 800; }
.hemicycle-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; color: var(--muted); font-size: .82rem; }
.hemicycle-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hemicycle-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.hemicycle-legend strong { color: var(--text); }
.map-controls { display: flex; flex-direction: column; gap: 12px; margin: 12px 0 18px; }
.map-controls .legend { margin-top: 0; }
.map-toggle-row { display: flex; align-items: center; gap: 12px; }
.methodology-card summary { cursor: pointer; color: var(--text); font-weight: 700; }
.methodology-card div { max-width: 850px; color: var(--muted); font-size: .85rem; line-height: 1.55; }
.methodology-card a { color: var(--accent-2); }
.guide-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.guide-list li { color: var(--muted); line-height: 1.55; }
.guide-list strong { color: var(--text); }
.contact-form { display: grid; gap: 10px; max-width: 420px; margin-top: 12px; }
.contact-form label { display: grid; gap: 4px; color: var(--muted); font-size: .78rem; }
.contact-form input, .contact-form textarea { padding: 7px 9px; border: 1px solid rgba(255,255,255,.16); border-radius: 6px; color: var(--text); background: rgba(255,255,255,.06); font: inherit; font-size: .82rem; }
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.contact-form button { justify-self: start; padding: 7px 16px; border: 1px solid rgba(70,198,177,.5); border-radius: 7px; color: var(--accent-2); background: rgba(70,198,177,.1); cursor: pointer; font: inherit; font-size: .8rem; }
.contact-form button:hover { background: rgba(70,198,177,.2); }
@media (max-width: 980px) {
  .hero, .panel-grid { display: block; }
  .hero-card { margin-top: 16px; }
  .detail-card { position: static; max-height: none; overflow: visible; margin-top: 18px; }
  #map { min-height: 0; height: min(70vw, 520px); }
}
@media (max-width: 720px) {
  .comparison-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .page-shell { padding: 16px; }
  .map-card, .detail-card { padding: 12px; border-radius: 14px; }
  #map { height: 100vw; max-height: 420px; }
  .legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: .78rem; }
  .map-controls { align-items: flex-start; flex-direction: column; }
  .party-row { grid-template-columns: auto auto 1fr 58px 26px; }
  .party-name-wrap { grid-column: 1 / -1; }
  .editor-head { align-items: center; }
  .list-order ol { grid-template-columns: 1fr 1fr; }
  .methodology-card { margin-top: 16px; padding: 12px; border-radius: 14px; }
}
