:root {
  --ink: #180807;
  --velvet: #2a080c;
  --wine: #5e111a;
  --deep-wine: #3a0c12;
  --gold: #d8aa38;
  --gold-bright: #ffe79a;
  --gold-dark: #7d5314;
  --cream: #fff0c2;
  --muted: #c9b88c;
  --shadow: rgba(0, 0, 0, .42);
  --panel: rgba(55, 10, 15, .78);
  --panel-light: rgba(255, 229, 158, .09);
  --border: rgba(242, 197, 91, .42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 215, 101, .16), transparent 28rem),
    radial-gradient(circle at 80% 15%, rgba(122, 14, 28, .78), transparent 28rem),
    linear-gradient(135deg, #170607 0%, #29070c 45%, #090404 100%);
  color: var(--cream);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", "Songti TC", serif;
  line-height: 1.65;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background:
    repeating-radial-gradient(circle at 18% 16%, rgba(255, 255, 255, .12) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, transparent 0 8px, rgba(255, 219, 114, .03) 8px 9px);
  mix-blend-mode: overlay;
  z-index: 0;
}

a {
  color: inherit;
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 24%, #fff6cd, #e0ab36 45%, #714513 100%);
  color: #2b0708;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .45), inset 0 0 10px rgba(255, 255, 255, .55);
  font-weight: 900;
  font-size: 28px;
}

.brand strong {
  display: block;
  font-size: 20px;
  letter-spacing: .08em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-nav a {
  padding: 9px 12px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 999px;
  transition: .2s ease;
}

.top-nav a:hover {
  color: var(--gold-bright);
  background: rgba(255, 232, 166, .08);
}

.nav-pill {
  border: 1px solid var(--border);
  color: var(--gold-bright) !important;
  background: rgba(255, 216, 92, .08);
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.section-frame,
.glass-card,
.stat-card,
.search-stage,
.pick-card,
.summary-card,
.control-panel,
.fact-card,
.candidate-card,
.empty-state {
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(255, 245, 198, .08), transparent 35%),
    linear-gradient(135deg, rgba(92, 14, 24, .88), rgba(20, 6, 7, .88));
  box-shadow:
    0 28px 80px var(--shadow),
    inset 0 0 52px rgba(246, 205, 94, .05);
  backdrop-filter: blur(10px);
}

.section-frame {
  border-radius: 36px;
}

.hero {
  min-height: 680px;
  padding: clamp(42px, 7vw, 86px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
}

.hero::before {
  width: 470px;
  height: 470px;
  right: -120px;
  top: -130px;
  background:
    radial-gradient(circle, rgba(255, 235, 156, .42), rgba(202, 145, 32, .12) 45%, transparent 70%);
  filter: blur(2px);
}

.hero::after {
  width: 620px;
  height: 200px;
  right: 12%;
  bottom: 8%;
  transform: rotate(-10deg);
  background:
    linear-gradient(90deg, transparent, rgba(255, 220, 116, .15), transparent);
}

.hero-ornament {
  position: absolute;
  right: clamp(22px, 6vw, 88px);
  top: clamp(20px, 7vw, 74px);
  font-size: clamp(90px, 17vw, 220px);
  color: rgba(248, 214, 115, .12);
  line-height: 1;
}

.kicker {
  margin: 0 0 12px;
  color: var(--gold);
  letter-spacing: .24em;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 900;
}

.hero h1,
.result-hero h1 {
  margin: 0;
  max-width: 920px;
  font-size: clamp(58px, 11vw, 146px);
  line-height: .88;
  letter-spacing: -.06em;
  background: linear-gradient(92deg, #fff7d4 0%, #ffc94e 34%, #fff2b6 55%, #8d5b12 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, .45));
}

.hero-copy {
  max-width: 760px;
  margin: 30px 0 0;
  color: #f4e5b9;
  font-size: clamp(18px, 2vw, 24px);
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 36px;
}

.btn {
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 900;
  font-family: inherit;
  transition: .22s ease;
}

.btn-primary {
  color: #24090b;
  background:
    linear-gradient(135deg, #fff2ac, #e1ac31 42%, #8a5a16);
  box-shadow:
    0 16px 30px rgba(0, 0, 0, .36),
    inset 0 1px 0 rgba(255, 255, 255, .55);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.btn-ghost {
  color: var(--gold-bright);
  border: 1px solid var(--border);
  background: rgba(255, 230, 150, .08);
}

.btn-ghost:hover {
  background: rgba(255, 230, 150, .14);
}

.btn:disabled {
  opacity: .36;
  cursor: not-allowed;
  transform: none;
}

.ticker {
  margin-top: 46px;
  padding: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 231, 154, .24);
  border-bottom: 1px solid rgba(255, 231, 154, .24);
}

.ticker span,
.chips a,
.party-badge,
.elected-badge,
.pick-tag {
  border: 1px solid rgba(255, 231, 154, .3);
  border-radius: 999px;
  background: rgba(255, 239, 181, .08);
  color: var(--gold-bright);
  padding: 6px 10px;
  font-size: 13px;
  text-decoration: none;
}

.why-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr 1fr 1fr;
  gap: 18px;
  margin: 22px 0;
}

.glass-card,
.stat-card,
.summary-card {
  border-radius: 28px;
  padding: 28px;
}

.big-question h2,
.search-stage h2,
.editor-picks h2,
.control-panel h2,
.quick-summary h2 {
  margin: 0;
  color: var(--gold-bright);
  line-height: 1.18;
}

.big-question p,
.search-stage p,
.section-title p {
  color: var(--muted);
}

.stat-card strong,
.summary-card strong {
  display: block;
  margin-top: 8px;
  color: var(--gold-bright);
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1;
}

.stat-label,
.summary-card span,
.fact-card span {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.search-stage {
  margin: 22px 0;
  padding: clamp(28px, 5vw, 56px);
  border-radius: 36px;
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 28px;
  align-items: center;
}

.search-box {
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 230, 160, .08);
  border: 1px solid rgba(255, 230, 160, .24);
}

.search-box label,
.sort-box {
  color: var(--gold-bright);
  font-weight: 900;
}

.search-row,
.mini-search {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 226, 143, .34);
  border-radius: 999px;
  padding: 0 18px;
  color: var(--cream);
  background: rgba(12, 4, 4, .74);
  outline: none;
  font: inherit;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold-bright) 50%),
    linear-gradient(135deg, var(--gold-bright) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) 21px,
    calc(100% - 15px) 21px;
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
  padding-right: 44px;
}

input::placeholder {
  color: rgba(255, 238, 190, .45);
}

input:focus,
select:focus {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 4px rgba(255, 218, 97, .12);
}

.example-panel {
  grid-column: 1 / -1;
  padding-top: 12px;
}

.example-panel h3 {
  margin: 0 0 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chips a:hover,
.pick-card:hover {
  border-color: rgba(255, 238, 184, .74);
}

.editor-picks {
  padding: 48px 0 28px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.section-title p {
  max-width: 520px;
}

.section-title.compact {
  display: block;
  margin-bottom: 14px;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.pick-card {
  min-height: 260px;
  border-radius: 30px;
  padding: 26px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: .22s ease;
}

.pick-card:hover {
  transform: translateY(-4px) rotate(-.4deg);
  box-shadow: 0 36px 90px rgba(0, 0, 0, .55);
}

.pick-card h3 {
  margin: 20px 0 8px;
  color: var(--gold-bright);
  font-size: 30px;
}

.pick-card p,
.pick-card em {
  color: var(--muted);
}

.site-footer {
  width: min(1180px, calc(100% - 36px));
  margin: 42px auto 0;
  padding: 28px 0 46px;
  color: var(--muted);
  border-top: 1px solid rgba(255, 231, 154, .2);
}

.site-footer code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 230, 150, .1);
  color: var(--gold-bright);
}

.results-shell {
  padding-bottom: 24px;
}

.result-hero {
  padding: clamp(30px, 5vw, 60px);
  margin-bottom: 18px;
}

.result-hero h1 {
  font-size: clamp(46px, 7vw, 92px);
}

.mini-search {
  max-width: 820px;
  margin-top: 26px;
}

.data-status {
  margin: 14px 0 0;
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.summary-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.control-panel {
  border-radius: 30px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
}

.sort-box {
  display: grid;
  gap: 8px;
  min-width: min(360px, 100%);
}

.quick-summary {
  margin-bottom: 18px;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.fact-card {
  padding: 18px;
  border-radius: 22px;
}

.fact-card strong {
  display: block;
  margin-top: 6px;
  color: var(--gold-bright);
  font-size: 17px;
}

.result-list {
  display: grid;
  gap: 16px;
}

.candidate-card {
  border-radius: 30px;
  padding: 20px;
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 18px;
}

.rank-medal {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #2b080a;
  background:
    radial-gradient(circle at 35% 25%, #fff7ce, #e2ab34 55%, #875713 100%);
  box-shadow: inset 0 0 12px rgba(255, 255, 255, .45), 0 12px 24px rgba(0, 0, 0, .32);
  font-weight: 900;
}

.candidate-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.candidate-title h3 {
  margin: 8px 0 0;
  font-size: clamp(28px, 4vw, 42px);
  color: var(--gold-bright);
}

.candidate-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.elected-badge {
  color: #1e0908;
  background: linear-gradient(135deg, #fff1aa, #d3a136);
  border: 0;
}

.money-big {
  color: #fff3b9;
  font-size: clamp(22px, 3vw, 34px);
  white-space: nowrap;
}

.bar-shell {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(255, 230, 150, .22);
  background: rgba(0, 0, 0, .28);
}

.bar-shell span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #815112, #f0c65d, #fff2a7);
}

.money-grid {
  margin: 18px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.money-grid div {
  min-width: 0;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 238, 187, .06);
  border: 1px solid rgba(255, 238, 187, .13);
}

.money-grid dt {
  color: var(--muted);
  font-size: 13px;
}

.money-grid dd {
  margin: 2px 0 0;
  color: var(--cream);
  font-weight: 900;
  word-break: break-word;
}

.money-grid small {
  display: block;
  color: var(--gold);
}

.pagination {
  margin: 24px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

#pageInfo {
  color: var(--muted);
}

.empty-state {
  border-radius: 28px;
  padding: 42px;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--gold-bright);
  font-size: 34px;
}

@media (max-width: 920px) {
  .site-header,
  .candidate-title,
  .control-panel,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .why-grid,
  .summary-grid,
  .pick-grid,
  .fact-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-stage {
    grid-template-columns: 1fr;
  }

  .money-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .money-big {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  main,
  .site-header,
  .site-footer {
    width: min(100% - 24px, 1180px);
  }

  .hero {
    min-height: 600px;
    padding: 32px 24px;
  }

  .hero h1 {
    font-size: clamp(48px, 18vw, 86px);
  }

  .search-row,
  .mini-search {
    flex-direction: column;
  }

  .why-grid,
  .summary-grid,
  .pick-grid,
  .fact-grid,
  .money-grid {
    grid-template-columns: 1fr;
  }

  .candidate-card {
    grid-template-columns: 1fr;
  }

  .rank-medal {
    width: 54px;
    height: 54px;
  }

  .top-nav {
    width: 100%;
    justify-content: flex-start;
  }
}


/* v3: split simple search and advanced dropdown search */
.split-search-stage {
  grid-template-columns: .72fr 1.28fr;
}

.search-intro {
  align-self: start;
}

.layered-search,
.results-search {
  display: grid;
  gap: 18px;
}

.results-search {
  margin-top: 28px;
}

.search-mode {
  padding: 22px;
  border-radius: 26px;
  background: rgba(255, 230, 160, .07);
  border: 1px solid rgba(255, 230, 160, .2);
}

.simple-mode {
  background:
    linear-gradient(135deg, rgba(255, 234, 151, .13), rgba(255, 234, 151, .04)),
    rgba(12, 4, 4, .26);
}

.advanced-mode {
  background:
    linear-gradient(135deg, rgba(137, 22, 32, .38), rgba(255, 230, 160, .04)),
    rgba(12, 4, 4, .18);
}

.mode-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.mode-number {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #2b080a;
  font-weight: 900;
  background: radial-gradient(circle at 35% 25%, #fff7ce, #e2ab34 55%, #875713 100%);
  box-shadow: inset 0 0 12px rgba(255, 255, 255, .45), 0 10px 22px rgba(0, 0, 0, .3);
}

.mode-heading h2,
.mode-heading h3 {
  margin: 0;
  color: var(--gold-bright);
  line-height: 1.15;
  font-size: clamp(22px, 2.3vw, 30px);
}

.mode-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.filter-grid {
  display: grid;
  gap: 12px;
}

.home-filter-grid,
.result-filter-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.filter-grid label {
  display: grid;
  gap: 7px;
  color: var(--gold-bright);
  font-weight: 900;
}

.advanced-submit,
.advanced-actions {
  margin-top: 16px;
}

.advanced-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.list-head {
  margin: 22px 0 14px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.list-head h2 {
  margin: 0;
  color: var(--gold-bright);
}

.list-head p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
}

.compact-result-list {
  gap: 12px;
}

.candidate-details {
  display: block;
  padding: 0;
  overflow: hidden;
}

.candidate-details summary {
  list-style: none;
  cursor: pointer;
  padding: 18px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.candidate-details summary::-webkit-details-marker {
  display: none;
}

.candidate-details summary:hover {
  background: rgba(255, 234, 164, .055);
}

.candidate-summary-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.candidate-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.candidate-name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
}

.candidate-name-line strong {
  color: var(--gold-bright);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.1;
}

.candidate-name-line em {
  color: var(--muted);
  font-style: normal;
}

.candidate-summary-money {
  min-width: 172px;
  text-align: right;
  display: grid;
  gap: 2px;
}

.candidate-summary-money small,
.candidate-summary-money em {
  color: var(--muted);
  font-style: normal;
}

.candidate-summary-money strong {
  color: #fff3b9;
  font-size: clamp(20px, 2.4vw, 30px);
  white-space: nowrap;
}

.candidate-details[open] .candidate-summary-money em {
  color: var(--gold-bright);
}

.candidate-expanded {
  padding: 0 18px 18px 110px;
  border-top: 1px solid rgba(255, 238, 187, .1);
}

.party-badge,
.elected-badge,
.loser-badge,
.incumbent-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 230, 150, .23);
  color: var(--gold-bright);
  background: rgba(255, 238, 187, .07);
  font-size: 13px;
  font-weight: 900;
}

.loser-badge {
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
}

.incumbent-badge {
  color: #fff1aa;
  border-color: rgba(255, 241, 170, .34);
}

@media (max-width: 920px) {
  .split-search-stage,
  .home-filter-grid,
  .result-filter-grid {
    grid-template-columns: 1fr;
  }

  .list-head,
  .candidate-details summary {
    align-items: flex-start;
  }

  .candidate-details summary {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .candidate-summary-money {
    grid-column: 2;
    text-align: left;
  }

  .candidate-expanded {
    padding-left: 18px;
  }
}

@media (max-width: 640px) {
  .search-mode {
    padding: 18px;
  }

  .candidate-details summary {
    grid-template-columns: 1fr;
  }

  .candidate-summary-money {
    grid-column: auto;
  }
}
