@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@900&display=swap');

.archive-query-shell{position:sticky;top:62px;z-index:55;padding:16px clamp(16px,4vw,48px) 18px;background:rgba(13,13,13,.97);backdrop-filter:blur(14px);border-bottom:1px solid #23201c;box-shadow:0 12px 36px rgba(0,0,0,.16)}
.archive-query-heading{display:flex;align-items:end;justify-content:space-between;gap:20px;margin-bottom:12px}.archive-query-heading span{font:800 9px 'Archivo';letter-spacing:.2em;color:#E4022B}.archive-query-heading h2{margin:3px 0 0;font-size:17px;letter-spacing:-.02em}.archive-query-heading p{margin:0;color:#777168;font-size:10px;line-height:1.6;text-align:right}.archive-query-grid{display:grid;grid-template-columns:minmax(150px,.82fr) minmax(210px,1.15fr) minmax(150px,.75fr) minmax(190px,1fr) minmax(180px,1fr);gap:8px;align-items:end}.archive-query-field{min-width:0}.archive-query-field>label{display:block;margin:0 0 6px;color:#817a71;font:800 9px 'Archivo','Noto Sans TC';letter-spacing:.12em}.archive-query-static,.archive-query-field select{display:flex;align-items:center;width:100%;height:44px;border:1px solid #38332e;border-radius:10px;background:#181512;color:#f4f1ea;padding:0 12px;font-size:12px;font-weight:900}.archive-query-static{color:#d8d2c9}.archive-query-field select{appearance:none;background:#181512 url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a39b91' stroke-width='2.4'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e") no-repeat right 11px center/15px;padding-right:34px;cursor:pointer;outline:0}.archive-query-field select:focus-visible{border-color:#E4022B;box-shadow:0 0 0 3px rgba(228,2,43,.12)}.archive-query-field select option{background:#171411}.archive-segment{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;height:44px;border:1px solid #38332e;border-radius:10px;padding:3px;background:#13110f;gap:3px}.archive-segment button{min-width:0;border:0;border-radius:7px;background:transparent;color:#8f8880;font-size:11px;font-weight:900;cursor:pointer;transition:.18s}.archive-segment button:hover{color:#fff}.archive-segment button.on{background:#f4f1ea;color:#161310;box-shadow:0 2px 10px rgba(0,0,0,.18)}.archive-segment button:focus-visible{outline:2px solid #E4022B;outline-offset:1px}

#archive-compare-slot{display:none;margin-top:12px}.archive-comparing #archive-compare-slot{display:block}.archive-comparing .archive-single-control{display:none}.archive-compare-workspace{border:1px solid #302b27;border-radius:14px;background:linear-gradient(180deg,#171411 0%,#11100e 100%);overflow:hidden}.archive-compare-top{display:grid;grid-template-columns:minmax(140px,180px) 44px minmax(140px,180px) minmax(330px,1fr);gap:8px;align-items:end;padding:12px}.archive-year-select{display:grid;gap:6px}.archive-year-select span,.archive-layer-field>span{font:800 9px 'Archivo','Noto Sans TC';letter-spacing:.12em;color:#817a71}.archive-year-select select{width:100%;height:44px;appearance:none;border:1px solid #3a3530;border-radius:9px;background:#1d1a17 url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f6c945' stroke-width='2.4'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e") no-repeat right 10px center/15px;padding:0 34px 0 11px;color:#f4f1ea;font:900 14px 'Archivo';outline:0;cursor:pointer}.archive-year-select option{background:#171411}.archive-year-select option:disabled{color:#5d5750}.archive-compare-swap{width:44px;height:44px;border:1px solid #3a3530;border-radius:9px;background:#151311;color:#f6c945;font:900 18px 'Archivo';cursor:pointer}.archive-compare-swap:hover{border-color:#f6c945}.archive-layer-field{display:grid;gap:6px}.archive-layer-switch{grid-template-columns:repeat(3,1fr)}.archive-layer-switch button{font-size:10px}.archive-layer-switch button.on{background:#f6c945;color:#111}.archive-compare-body{display:grid;grid-template-columns:minmax(0,1.18fr) minmax(330px,.82fr);border-top:1px solid #2c2824}.archive-compare-summary{padding:12px}.archive-compare-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.archive-compare-kicker{font:800 9px 'Archivo';letter-spacing:.18em;color:#f6c945}.archive-compare-title{margin:4px 0 0;font-size:19px;letter-spacing:-.025em}.archive-compare-note{max-width:520px;color:#89827a;font-size:10px;line-height:1.55;text-align:right}.archive-compare-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-top:10px}.archive-compare-stat{min-height:62px;border:1px solid #322e29;border-radius:10px;padding:9px 10px;background:#151311}.archive-compare-stat span{display:block;color:#777168;font-size:9px;font-weight:800}.archive-compare-stat strong{display:block;margin-top:4px;color:#f4f1ea;font:900 16px 'Archivo','Noto Sans TC'}.archive-flips{display:flex;gap:6px;overflow:auto;margin-top:8px;scrollbar-width:none}.archive-flips::-webkit-scrollbar{display:none}.archive-flip{flex:0 0 auto;min-height:34px;display:flex;align-items:center;gap:6px;border:1px solid #39342f;border-radius:999px;padding:6px 9px;background:#151311;color:#bbb4aa;font-size:10px;font-weight:900;cursor:pointer}.archive-flip i{width:7px;height:7px;border-radius:50%}.archive-flip b{color:#f6c945}.archive-flip.selected{border-color:#f6c945;color:#fff}.archive-flip-empty{cursor:default}.archive-compare-inspector{padding:12px;border-left:1px solid #2c2824;background:#13110f}.archive-compare-detail{color:#aaa39a;font-size:11px;line-height:1.6}.archive-compare-detail>strong{color:#fff;font-size:14px}.archive-compare-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:9px}.archive-compare-detail-cell{border:1px solid #312d28;border-radius:9px;background:#171411;padding:8px 9px}.archive-compare-detail-cell span{display:block;color:#736e67;font-size:8px;font-weight:800}.archive-compare-detail-cell b{display:block;margin-top:3px;color:#e8e2da;font:800 11px 'Archivo','Noto Sans TC'}.archive-compare-na{margin-top:7px;color:#7d766d;font-size:9px;font-weight:700}.archive-party-switch{display:none;margin-top:10px;grid-template-columns:1fr 1fr}.archive-party-switch.show{display:grid}.archive-map-legend{display:flex;align-items:center;gap:8px;margin-top:10px;color:#8d867e;font-size:9px;font-weight:800}.archive-map-legend .legend-bar{height:7px;flex:1;min-width:90px;max-width:220px;border-radius:999px;background:linear-gradient(90deg,#69717d 0%,#302c28 50%,#f4f1ea 100%)}.archive-map-legend.swing .legend-bar{background:linear-gradient(90deg,#000095 0%,#302c28 50%,#00A600 100%)}.archive-map-legend.winner .legend-bar{display:none}

body.archive-comparing .map-title small{color:#f6c945}body.archive-comparing .county,body.archive-comparing .archive-county{transition:opacity .2s,stroke .2s,stroke-width .2s,filter .2s,fill .2s}.archive-compare-muted,[data-compare-muted="true"]{opacity:.48!important;stroke:#4a4540!important;stroke-width:.8!important}.archive-flipped,[data-compare-flip="true"]{opacity:1!important;stroke:#f6c945!important;stroke-width:2.4!important}.archive-compare-selected,[data-compare-selected="true"]{filter:brightness(1.16) drop-shadow(0 6px 9px rgba(0,0,0,.3))!important;stroke:#fff!important;stroke-width:2.2!important}

#candidates .candidate.elected.archive-elected-card{position:relative;overflow:visible;background:#f4f1ea;color:#1a1714;border-radius:20px;padding:18px;border:1px solid #f4f1ea;box-shadow:0 14px 34px rgba(244,241,234,.12)}#candidates .candidate.elected.archive-elected-card::before{display:none!important;content:none!important}.archive-elected-card .cand-head{padding-right:96px;min-height:74px;align-items:flex-start}.archive-elected-card .cand-name{color:#1a1714}.archive-elected-card .cand-no{background:#e6e1d6;color:#1a1714;box-shadow:0 0 0 2px #E4022B}.archive-elected-card .cand-party{color:#4a443a}.archive-elected-card .cand-votes{color:#c40225}.archive-elected-card .cand-votes small{color:#8a8375}.archive-elected-card .bar{background:#e2ddd1}.archive-elected-stamp{position:absolute;right:12px;top:10px;width:92px;height:92px;transform:rotate(-11deg);filter:drop-shadow(0 4px 8px rgba(228,2,43,.22));pointer-events:none;z-index:2}

#mobile-map{display:none;position:absolute;inset:70px 4px 74px;width:calc(100% - 8px);height:calc(100% - 144px);overflow:visible;filter:drop-shadow(0 20px 42px rgba(0,0,0,.18))}.archive-county{cursor:pointer;vector-effect:non-scaling-stroke;stroke:#4a4540;stroke-width:.8;transition:filter .2s,stroke .2s,opacity .2s,fill .2s}.archive-inset-box{fill:#13110f;stroke:#3a3530;stroke-width:1}.archive-inset-label{fill:#8f8880;font:800 9px 'Noto Sans TC';letter-spacing:.04em;pointer-events:none}

@media(max-width:1100px){.archive-query-grid{grid-template-columns:1fr 1.2fr 1fr 1fr}.archive-query-grid #archive-region-field{grid-column:4}.archive-compare-top{grid-template-columns:1fr 44px 1fr}.archive-layer-field{grid-column:1/-1}.archive-compare-body{grid-template-columns:1fr}.archive-compare-inspector{border-left:0;border-top:1px solid #2c2824}}
@media(max-width:760px){.archive-query-shell{position:relative;top:auto;padding:14px}.archive-query-heading{display:block}.archive-query-heading p{margin-top:4px;text-align:left}.archive-query-grid{grid-template-columns:1fr 1fr}.archive-query-field:first-child{grid-column:1}.archive-query-grid #archive-region-field{grid-column:auto}.archive-compare-heading{display:block}.archive-compare-note{margin-top:6px;text-align:left}.archive-compare-stats{grid-template-columns:repeat(3,1fr)}}
@media(max-width:660px){body.history-archive #map{display:none!important}body.history-archive #mobile-map{display:block}body.history-archive .map-panel{min-height:clamp(500px,68svh,620px)}body.history-archive .map-status{bottom:12px}.archive-query-grid{grid-template-columns:1fr}.archive-query-field,.archive-query-grid #archive-region-field{grid-column:auto}.archive-query-static,.archive-query-field select,.archive-segment{height:46px}.archive-query-field .archive-segment{height:48px}.archive-compare-top{grid-template-columns:minmax(0,1fr) 44px minmax(0,1fr);gap:6px}.archive-layer-field{grid-column:1/-1}.archive-layer-switch{grid-template-columns:1fr}.archive-layer-switch{grid-auto-flow:row;height:auto;padding:3px}.archive-layer-switch button{min-height:40px}.archive-compare-body{display:block}.archive-compare-summary,.archive-compare-inspector{padding:10px}.archive-compare-stats{gap:4px}.archive-compare-stat{padding:8px 7px}.archive-compare-stat strong{font-size:14px;overflow-wrap:anywhere}.archive-compare-detail-grid{grid-template-columns:1fr 1fr}.archive-flip{min-height:40px}.archive-inset-label{font-size:8px}#candidates .candidate.elected.archive-elected-card{padding:16px}.archive-elected-card .cand-head{padding-right:82px;min-height:70px}.archive-elected-stamp{right:7px;top:8px;width:80px;height:80px}}
@media(max-width:390px){.archive-compare-top{grid-template-columns:1fr 42px 1fr}.archive-year-select select{font-size:13px}.archive-compare-swap{width:42px}.archive-compare-detail-grid{grid-template-columns:1fr}.archive-elected-card .cand-head{padding-right:74px}.archive-elected-stamp{width:72px;height:72px}}
@media(prefers-reduced-motion:reduce){.archive-segment button,.archive-county{transition:none!important}}

body.history-archive #candidates .candidate.elected.archive-elected-card,
body.history-archive #candidates .candidate.elected.archive-elected-card:hover{background:#f4f1ea!important;color:#1a1714!important;border-color:#f4f1ea!important;border-radius:20px!important;box-shadow:0 14px 34px rgba(244,241,234,.12)!important}

.archive-insights{margin-top:26px;padding-top:2px;border-top:1px solid var(--line)}.overview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.overview-stat{min-width:0;border:1px solid #34302b;border-radius:11px;background:#181512;padding:11px 12px}.overview-stat:last-child{grid-column:1/-1}.overview-stat span{display:flex;justify-content:space-between;gap:6px;color:#8d867e;font-size:10px;font-weight:800}.overview-stat span small{font:700 8px 'Archivo';letter-spacing:.09em}.overview-stat strong{display:block;margin-top:5px;color:#f4f1ea;font:900 18px 'Archivo','Noto Sans TC';font-variant-numeric:tabular-nums}.insight-card{margin-top:10px;border:1px solid #34302b;border-radius:13px;background:#181512;padding:14px}.insight-head{display:flex;align-items:end;justify-content:space-between;gap:12px;margin-bottom:13px}.insight-head small{display:block;color:#E4022B;font:800 8px 'Archivo';letter-spacing:.15em}.insight-head h3{margin:3px 0 0;color:#f4f1ea;font-size:14px}.insight-head>span{color:#817a71;font-size:9px;font-weight:800}.party-summary{display:grid;gap:11px}.party-summary-row{display:grid;grid-template-columns:9px minmax(0,1fr) auto;gap:8px 9px;align-items:center}.party-summary-row>i{width:9px;height:9px;border-radius:50%}.party-summary-row>div b{display:block;color:#e8e2da;font-size:11px}.party-summary-row>div small{display:block;color:#777168;font-size:8px;margin-top:1px}.party-summary-row>strong{text-align:right;color:#f4f1ea;font:900 11px 'Archivo';font-variant-numeric:tabular-nums}.party-summary-row>strong small{margin-left:7px;color:#999188;font-size:9px}.party-summary-row>span{grid-column:2/-1;height:4px;border-radius:99px;background:#2a2622;overflow:hidden}.party-summary-row>span em{display:block;height:100%;border-radius:99px}.turnout-trend svg{display:block;width:100%;height:auto;overflow:visible}.trend-axis{stroke:#5a534b;stroke-width:1}.trend-grid{stroke:#302c28;stroke-width:1;stroke-dasharray:3 4}.trend-line{fill:none;stroke:#E4022B;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.trend-point circle{fill:#f4f1ea;stroke:#E4022B;stroke-width:2}.trend-point.current circle{fill:#E4022B;stroke:#fff}.trend-year,.trend-y{fill:#7f7870;font:700 9px 'Archivo'}.trend-value{fill:#b9b1a7;font:800 8px 'Archivo'}.trend-point.current .trend-value{fill:#ff7890}.trend-empty{padding:22px;text-align:center;color:#817a71;font-size:11px}

/* Election year rail: keeps the primary archive navigation visible, following
   the CEC database's year-first information hierarchy. */
.archive-year-nav{position:relative;z-index:2;display:flex;align-items:center;gap:18px;margin-top:24px;padding-top:18px;border-top:1px solid #2b2723}
.archive-year-nav>span{flex:none;color:#8c857c;font:800 10px 'Archivo','Noto Sans TC';letter-spacing:.16em}
body.history-archive #years,.local-year-nav .years{display:flex!important;align-items:stretch;gap:8px;min-width:0;overflow-x:auto;overscroll-behavior-inline:contain;scroll-snap-type:x proximity;scrollbar-width:none;-webkit-overflow-scrolling:touch}
body.history-archive #years::-webkit-scrollbar,.local-year-nav .years::-webkit-scrollbar{display:none}
.archive-year-nav .year-btn{position:relative;flex:0 0 auto;min-width:82px;min-height:54px;display:grid;align-content:center;gap:2px;border:1px solid #39342f;border-radius:10px;background:#161310;color:#8f8880;padding:8px 13px;text-align:left;cursor:pointer;scroll-snap-align:center;transition:transform .28s cubic-bezier(.16,1,.3,1),border-color .22s ease,background .22s ease,color .22s ease,box-shadow .22s ease}
.archive-year-nav .year-btn span{font:900 16px 'Archivo';font-variant-numeric:tabular-nums}.archive-year-nav .year-btn small{font-size:9px;font-weight:800;color:#69635c}
.archive-year-nav .year-btn:hover{transform:translateY(-2px);border-color:#6a6058;color:#fff}.archive-year-nav .year-btn.on{border-color:#E4022B;background:#2b1015;color:#fff;box-shadow:inset 3px 0 0 #E4022B,0 10px 25px rgba(228,2,43,.12)}.archive-year-nav .year-btn.on small{color:#d9aaaF}
#archive-single-year-field{display:none!important}.archive-query-grid{grid-template-columns:minmax(160px,.9fr) minmax(220px,1.2fr) minmax(190px,1fr) minmax(190px,1fr)}

@media(max-width:660px){
  body.history-product{background:#0d0d0d}
  body.history-archive .archive-head,.local-executive-page .local-hero{padding:24px 16px 18px;background:linear-gradient(145deg,#310c13 0%,#180e0f 54%,#0d0d0d 100%)}
  body.history-archive .archive-title-row,.local-executive-page .local-hero-row{display:block;margin-top:8px}
  body.history-archive .archive-breadcrumb,.local-executive-page .kicker{font-size:8px;letter-spacing:.15em}
  body.history-archive .archive-head h1,.local-executive-page .local-hero h1{font-size:clamp(29px,9.5vw,38px);line-height:1.05;letter-spacing:-.04em}
  body.history-archive .archive-intro,.local-executive-page .local-hero p{display:none}
  .archive-year-nav{display:block;margin:18px -16px 0;padding:14px 0 0;border-color:rgba(255,255,255,.12)}
  .archive-year-nav>span{display:block;margin:0 16px 9px;color:#c19c9f;font-size:9px}
  body.history-archive #years,.local-year-nav .years{padding:0 16px 4px;gap:7px;scroll-padding-inline:16px}
  .archive-year-nav .year-btn{min-width:76px;min-height:50px;border-color:rgba(255,255,255,.16);background:rgba(14,11,10,.45);padding:7px 11px}
  .archive-year-nav .year-btn span{font-size:15px}.archive-year-nav .year-btn.on{background:#f4f1ea;color:#251014;border-color:#f4f1ea;box-shadow:none}.archive-year-nav .year-btn.on small{color:#765e61}

  .archive-query-shell{position:relative;top:auto;padding:14px 16px 16px;background:#100e0d;box-shadow:none}
  .archive-query-heading{margin-bottom:10px}.archive-query-heading p{display:none}.archive-query-heading h2{font-size:14px}.archive-query-heading span{font-size:8px}
  .archive-query-grid{grid-template-columns:1fr 1fr;gap:10px 8px}
  .archive-query-field:first-child{grid-column:1}.archive-query-field>label{margin-bottom:5px;font-size:8px}
  #archive-single-year-field{display:none!important}
  #archive-single-level-field,#archive-region-field{grid-column:auto!important}
  .archive-query-field select,.archive-query-static,.archive-segment{height:42px!important;min-height:42px;border-radius:8px}
  body.history-archive .archive-query-statebar{display:none!important}

  body.history-archive .layout{display:flex;flex-direction:column;border-top:1px solid #25211e}
  body.history-archive .result-panel{order:1;padding:24px 16px 34px;background:#f0ede5;color:#171310}
  body.history-archive .map-panel{order:2;min-height:430px;background:radial-gradient(90% 90% at 48% 44%,#171512 0%,#0d0d0d 72%);border-top:1px solid #29241f;border-bottom:0}
  body.history-archive .election-meta{padding-bottom:18px;border-color:#cbc5ba}
  body.history-archive #election-title{color:#171310;font-size:27px}
  body.history-archive .meta-stats strong{color:#171310}.result-panel .meta-stats span,.result-panel .section-label{color:#756e65}
  body.history-archive .candidate-list{grid-template-columns:1fr 1fr;gap:9px}
  body.history-archive .candidate{min-width:0;padding:13px!important;border-color:#d0c9bd!important;background:#e6e1d7!important;color:#171310;border-radius:10px!important;box-shadow:none!important}
  body.history-archive .candidate .cand-head{display:block;padding-right:0;min-height:0}.candidate .cand-name{font-size:14px!important;line-height:1.45}.candidate .cand-no{width:22px;height:22px;margin-right:5px;background:#d3cdc1;color:#171310}.candidate .cand-party{color:#766f65}.candidate .cand-votes{margin-top:12px;text-align:left;color:#171310;font-size:17px!important}.candidate .cand-votes small{display:inline;margin-left:7px;color:#756e65}.candidate .bar{margin-top:8px;background:#d2ccc1}
  body.history-archive #candidates .candidate.elected.archive-elected-card{grid-column:1/-1;padding:15px!important;border-color:#171310!important;background:#171310!important;color:#f4f1ea!important;border-radius:12px!important;box-shadow:none!important}
  body.history-archive #candidates .candidate.elected.archive-elected-card .cand-head{padding-right:64px}.archive-elected-card .cand-name{color:#fff!important}.archive-elected-card .cand-no{background:#f4f1ea!important}.archive-elected-card .cand-party{color:#b9b1a7!important}.archive-elected-card .cand-votes{color:#ff4764!important}.archive-elected-stamp{width:60px!important;height:60px!important;right:7px!important;top:7px!important}
  body.history-archive .county-detail{border-color:#cbc5ba}.county-card{border-color:#c9c1b5;background:#e6e1d7}.county-head{border-color:#c9c1b5}.county-head h3,.county-row-name,.county-row-votes,.county-row-share{color:#171310}.county-summary{background:#d9d2c6;color:#4f4941}.county-empty{border-color:#bdb6aa;color:#6d665e}.county-empty strong{color:#27221e}.source{border-color:#cbc5ba;color:#756e65}.source a{color:#403a34}
  body.history-archive .archive-insights{border-color:#cbc5ba}.overview-stat,.insight-card{border-color:#c9c1b5;background:#e6e1d7}.overview-stat strong,.insight-head h3,.party-summary-row>div b,.party-summary-row>strong{color:#171310}.party-summary-row>span{background:#cbc4b8}.trend-grid{stroke:#d2cbbf}.trend-axis{stroke:#9f978c}.trend-point circle{fill:#f4f1ea}.trend-value{fill:#5f5850}.insight-head>span,.overview-stat span{color:#6f685f}
  body.history-archive #mobile-map{inset:68px 4px 68px;height:calc(100% - 136px)}
}

@media(max-width:380px){
  .archive-query-grid{grid-template-columns:1fr}.archive-query-field:first-child,#archive-single-level-field,#archive-region-field{grid-column:1!important}
  body.history-archive .candidate-list{grid-template-columns:1fr}
  body.history-archive #candidates .candidate.elected.archive-elected-card{grid-column:auto}
}
