:root {
  color-scheme: dark;
  --surface-1:      #1a1a19;
  --page-plane:     #0d0d0d;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --gridline:       #2c2c2a;
  --baseline:       #383835;
  --border:         rgba(255,255,255,0.10);
  --series-1:       #3987e5; /* blue */
  --series-2:       #d95926; /* orange */
  --series-3:       #199e70; /* aqua */
  --good:           #0ca30c;
  --critical:       #e66767;
  --black-panel:    #0a0a0a;
  --white-panel:    #f4f3f0;
  --white-panel-ink:#141414;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex;
  justify-content: center;
  padding: 24px 12px 60px;
}

.phone {
  width: 100%;
  max-width: 420px;
  background: var(--surface-1);
  border-radius: 28px;
  border: 1px solid var(--border);
  overflow: hidden;
  min-height: 780px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 80px rgba(0,0,0,0.5);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--gridline);
}
.topbar .back {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 20px;
  width: 24px;
}
.topbar h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
  flex: 1;
}
.brand {
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand .tick { color: var(--series-1); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 8px;
}

.mockup-note {
  font-size: 10px;
  text-align: center;
  color: var(--text-muted);
  padding: 6px 16px;
  border-top: 1px dashed var(--gridline);
  background: var(--page-plane);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--page-plane);
  border: 1px solid var(--gridline);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 20px 0 10px;
}
.section-title:first-child { margin-top: 0; }

.feed-card {
  background: var(--page-plane);
  border: 1px solid var(--gridline);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.feed-card .headline {
  font-size: 13.5px;
  line-height: 1.4;
  margin: 0 0 6px;
}
.feed-card .meta {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.delta-down { color: var(--critical); font-weight: 600; }
.delta-up { color: var(--good); font-weight: 600; }

.election-list { display: flex; flex-direction: column; gap: 10px; }
.election-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--page-plane);
  border: 1px solid var(--gridline);
  border-radius: 14px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
}
.election-row .flag { font-size: 22px; }
.election-row .name { font-size: 14px; font-weight: 600; }
.election-row .sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.election-row .chev { margin-left: auto; color: var(--text-muted); }

.candidate-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.candidate-chip {
  flex: 0 0 auto;
  width: 84px;
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--gridline);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin: 0 auto 6px;
  border: 1px solid var(--border);
}
.candidate-chip .cname { font-size: 11px; line-height: 1.3; }
.candidate-chip .capprove { font-size: 11px; color: var(--series-1); font-weight: 600; }

.bottom-nav {
  display: flex;
  border-top: 1px solid var(--gridline);
  background: var(--surface-1);
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 10px 4px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10.5px;
}
.bottom-nav a .icon { display: block; font-size: 18px; margin-bottom: 2px; }
.bottom-nav a.active { color: var(--series-1); }

/* Election page */
.candidate-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--page-plane);
  border: 1px solid var(--gridline);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
}
.candidate-card .avatar { width: 48px; height: 48px; margin: 0; flex-shrink: 0; }
.candidate-card .info { flex: 1; }
.candidate-card .cname { font-size: 14.5px; font-weight: 600; }
.party-chip {
  display: inline-block;
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--gridline);
  border-radius: 6px;
  padding: 1px 6px;
  margin-top: 3px;
}
.candidate-card .approve-num { font-size: 18px; font-weight: 700; color: var(--series-1); }
.candidate-card .approve-label { font-size: 9.5px; color: var(--text-muted); text-align: right; }

.compare-cta {
  display: block;
  text-align: center;
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--series-1);
  color: var(--series-1);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}

/* Figure page */
.figure-header { text-align: center; padding: 10px 0 16px; }
.figure-header .avatar { width: 72px; height: 72px; font-size: 26px; }
.figure-header .fname { font-size: 18px; font-weight: 700; margin: 8px 0 2px; }
.figure-header .fsub { font-size: 12px; color: var(--text-muted); }

.approve-block { text-align: center; margin-bottom: 14px; }
.approve-block .big-num { font-size: 34px; font-weight: 700; }
.approve-block .big-label { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }

.sparkline-wrap { display: flex; justify-content: center; margin-bottom: 10px; }

.vote-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: var(--series-1);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 18px;
  cursor: pointer;
}
.vote-btn.voted { background: var(--good); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--gridline);
}
.split .col { padding: 10px; }
.split .black { background: var(--black-panel); }
.split .white { background: var(--white-panel); color: var(--white-panel-ink); }
.split .col-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  font-weight: 700;
}
.split .black .col-title { color: var(--critical); }
.split .white .col-title { color: var(--good); }

.event-card {
  border-radius: 10px;
  padding: 8px 9px;
  margin-bottom: 8px;
  text-decoration: none;
  display: block;
}
.split .black .event-card { background: #171717; color: #eee; }
.split .white .event-card { background: #ffffff; color: #141414; border: 1px solid #e3e1da; }
.event-card .etext { font-size: 12px; line-height: 1.35; margin-bottom: 5px; }
.event-card .emeta { font-size: 10.5px; opacity: 0.65; display: flex; align-items: center; gap: 4px; }
.verified-badge { color: var(--series-1); }
.split .white .verified-badge { color: #256abf; }

.add-event-btn {
  display: block;
  text-align: center;
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  border-radius: 12px;
  border: 1px dashed var(--text-muted);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
}

/* Forms */
.field-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; display: block; }
.text-input, textarea.text-input {
  width: 100%;
  background: var(--page-plane);
  border: 1px solid var(--gridline);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 4px;
}
.char-count { font-size: 10.5px; color: var(--text-muted); text-align: right; margin-bottom: 16px; }

.similar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--gridline);
  border-radius: 10px;
  padding: 9px 10px;
  margin-bottom: 8px;
}
.similar-item .stext { flex: 1; font-size: 12.5px; }
.pick-btn {
  font-size: 11px;
  background: var(--gridline);
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.side-toggle { display: flex; gap: 8px; margin: 14px 0 20px; }
.side-toggle label {
  flex: 1;
  text-align: center;
  padding: 12px 6px;
  border-radius: 10px;
  border: 1px solid var(--gridline);
  font-size: 12.5px;
  cursor: pointer;
}
.side-toggle input { display: none; }
.side-toggle .neg { color: var(--critical); }
.side-toggle .pos { color: var(--good); }
.side-toggle input:checked + span { font-weight: 700; }
.side-toggle label:has(input:checked).neg-label { background: rgba(230,103,103,0.12); border-color: var(--critical); }
.side-toggle label:has(input:checked).pos-label { background: rgba(12,163,12,0.12); border-color: var(--good); }

.primary-btn {
  display: block;
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: none;
  background: var(--series-1);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.category-row { display: flex; gap: 8px; margin-bottom: 16px; }
.category-row label {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  border: 1px solid var(--gridline);
  border-radius: 10px;
  font-size: 11.5px;
  cursor: pointer;
}
.category-row input { display: none; }
.category-row label:has(input:checked) { background: rgba(57,135,229,0.15); border-color: var(--series-1); color: var(--series-1); font-weight: 600; }

.hint { font-size: 11px; color: var(--text-muted); margin: 4px 0 16px; line-height: 1.5; }

/* Event detail */
.event-detail-head { margin-bottom: 14px; }
.event-detail-head .etitle { font-size: 16px; font-weight: 700; line-height: 1.4; margin-bottom: 4px; }
.event-detail-head .esub { font-size: 12px; color: var(--text-muted); }

.count-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin: 12px 0 10px;
  padding: 0 4px;
}
.count-row .c-neg { color: var(--critical); }
.count-row .c-pos { color: var(--good); }

.opinion-col-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }
.opinion-chip {
  display: inline-block;
  font-size: 12px;
  background: var(--page-plane);
  border: 1px solid var(--gridline);
  border-radius: 20px;
  padding: 6px 12px;
  margin: 0 6px 6px 0;
}

.mark-btns { display: flex; gap: 10px; margin-top: 16px; }
.mark-btns button {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
  border: 1px solid var(--gridline);
  background: var(--page-plane);
  color: var(--text-primary);
}

/* Compare page */
.compare-picker { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.compare-picker .pchip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 20px;
  border: 1px solid var(--series-1);
  color: var(--series-1);
}
.compare-picker .add-chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 20px;
  border: 1px dashed var(--text-muted);
  color: var(--text-muted);
}

.legend { display: flex; gap: 14px; justify-content: center; margin: 6px 0 16px; flex-wrap: wrap; }
.legend .litem { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-secondary); }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; }

.compare-bars { display: flex; flex-direction: column; gap: 12px; }
.compare-bar-row .brow-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.bar-track { height: 10px; border-radius: 5px; background: var(--gridline); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }

.link-plain { color: var(--series-1); text-decoration: none; }
