:root {
  --bg: #02030a;
  --surface: rgba(6, 9, 22, 0.6);
  --surface-2: rgba(22, 28, 52, 0.55);
  --line: rgba(160, 185, 255, 0.16);
  --line-strong: rgba(160, 185, 255, 0.34);
  --text: #f5f7ff;
  --muted: #b3bdd6;
  --accent: #ff6a3d;
  --accent-2: #ffd166;
  --accent-soft: rgba(255, 106, 61, 0.16);
  --track: rgba(160, 185, 255, 0.12);
  --error: #ff8a7a;
  --radius: 14px;
  --display: 'Unbounded', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', 'Noto Sans', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 600px at 15% 10%, rgba(70, 60, 160, 0.18), transparent 60%),
    radial-gradient(800px 500px at 90% 90%, rgba(30, 90, 170, 0.14), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-bottom: 48px; position: relative; z-index: 1; }
#space { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
/* Keeps the globe a backdrop: darkens the edges and the reading column. */
body::after { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 52%, rgba(2, 3, 10, 0.1) 0%, rgba(2, 3, 10, 0.55) 70%, rgba(2, 3, 10, 0.8) 100%); }
#site-header { z-index: 5; }
#site-footer { position: relative; z-index: 2; background: rgba(2, 3, 10, 0.7); }
.panel, .grp-head, .group-card, .option, .pill span, .select { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
a { color: var(--accent-2); }
h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0 0 12px; }
h1 { font-size: clamp(28px, 5vw, 44px); letter-spacing: -0.01em; }
h2 { font-size: 19px; font-weight: 500; }
:lang(ar) h1, :lang(ar) h2, :lang(hi) h1, :lang(hi) h2, :lang(zh) h1, :lang(zh) h2,
:lang(ja) h1, :lang(ja) h2, :lang(ko) h1, :lang(ko) h2 { font-family: var(--body); }

.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* header */
#site-header { border-bottom: 1px solid var(--line); background: rgba(2, 3, 10, 0.78); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--display); font-size: 15px; font-weight: 500; }
.brand-mark { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #9cc4ff, #2a5bd0 55%, #0a1a44); box-shadow: 0 0 12px rgba(120, 170, 255, 0.6); flex: none; }
.nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current] { color: var(--text); background: var(--surface-2); }
.lang select { background-color: #0b1022; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 34px 6px 10px; font: inherit; font-size: 14px; background-position: right 12px center; }
@media (max-width: 620px) {
  .nav { order: 3; width: 100%; margin: 0; }
  .lang { margin-inline-start: auto; }
}

/* hero */
.hero { padding: 40px 0 24px; }
.small-hero { padding: 32px 0 16px; }
.kicker { color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 600; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.lead { color: var(--muted); font-size: 18px; margin: 0; max-width: 620px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(232, 87, 42, .7); } 100% { box-shadow: 0 0 0 10px rgba(232, 87, 42, 0); } }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.notice { border-color: rgba(255, 106, 61, 0.55); background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--surface); }
@media (max-width: 620px) { .panel { padding: 18px 16px; } }

/* form */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.q { margin-bottom: 28px; }
legend, .legend { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 12px; padding: 0; }
.step { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; color: var(--accent-2); flex: none; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill input, .group-card input, .option input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); cursor: pointer; font-size: 15px; transition: border-color .15s, background .15s; }
.pill span:hover { border-color: var(--line-strong); }
.pill input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: #fff; }
.pill input:focus-visible + span, .group-card:has(input:focus-visible), .option:has(input:focus-visible) { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.when-pill span { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.25; border-radius: 12px; padding: 8px 14px; }
.when-pill small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.when-pill input:checked + span small { color: var(--accent-2); }
.stat { font-family: var(--display); font-size: clamp(18px, 3vw, 24px); color: var(--accent-2); margin: 0 0 14px; line-height: 1.3; }
:lang(ar) .stat, :lang(hi) .stat, :lang(zh) .stat, :lang(ja) .stat, :lang(ko) .stat { font-family: var(--body); font-weight: 600; }
.period { padding: 6px 2px; }
.period .bar-label { font-variant-numeric: tabular-nums; font-weight: 600; }
.period .bar-fill { background: linear-gradient(90deg, #4a7bff, #8fb4ff); }
[dir="rtl"] .period .bar-fill { background: linear-gradient(270deg, #4a7bff, #8fb4ff); }
.period.is-mine .bar-fill { background: var(--accent-2); }
/* Own chevron instead of the native one, which sits flush against the edge. */
.select, .lang select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23b3bdd6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 12px 8px; cursor: pointer;
}
[dir="rtl"] .select { padding: 10px 12px 10px 42px; background-position: left 16px center; }
[dir="rtl"] .lang select { padding: 6px 10px 6px 34px; background-position: left 12px center; }
.select:focus-visible, .lang select:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.select option, .lang select option { background: #0b1022; color: var(--text); }
.select { width: 100%; max-width: 420px; background-color: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 42px 10px 12px; font: inherit; background-position: right 16px center; }
.q .small { margin: 8px 0 0; }

.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.group-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.group-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.group-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.gc-icon { font-size: 22px; line-height: 1; }
.gc-name { font-weight: 600; font-size: 15px; line-height: 1.3; }

.options { display: grid; gap: 8px; }
.option { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.option::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option:has(input:checked)::before { border-color: var(--accent); background: radial-gradient(var(--accent) 45%, transparent 50%); }

#turnstile { margin: 8px 0; }
.error { color: var(--error); min-height: 1.5em; margin: 8px 0; }
.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.submit-row p { margin: 0; }

.btn { display: inline-block; background: var(--accent); color: #12060a; border: 0; border-radius: 999px; box-shadow: 0 0 24px rgba(255, 106, 61, 0.35); padding: 11px 22px; font: 600 15px var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.big { padding: 14px 28px; font-size: 16px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.chip { display: inline-block; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; }
.chip:hover { border-color: var(--line-strong); }

/* results */
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.filters .select { max-width: none; }
@media (max-width: 620px) { .filters { grid-template-columns: 1fr; } }
.chart { display: grid; gap: 6px; margin-top: 12px; }
.empty { padding: 24px 0; text-align: center; }

.bar-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 64px; align-items: center; gap: 12px; width: 100%; }
.grp-head { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 64px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.grp-head:hover { border-color: var(--line-strong); }
.grp.is-mine .grp-head { border-color: rgba(242, 181, 68, 0.6); }
.bar-label { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; font-weight: 600; min-width: 0; }
.bar-track { height: 10px; background: var(--track); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #d8431c, var(--accent)); border-radius: 99px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
[dir="rtl"] .bar-fill { background: linear-gradient(270deg, #d8431c, var(--accent)); }
.bar-val { text-align: end; font-variant-numeric: tabular-nums; font-weight: 600; }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); justify-self: center; transition: transform .2s; }
.is-open .chev { transform: rotate(-135deg); }
.grp-body { display: grid; gap: 10px; padding: 12px 14px 10px 44px; }
[dir="rtl"] .grp-body { padding: 12px 44px 10px 14px; }
.sub .bar-label { font-weight: 400; color: var(--muted); font-size: 15px; }
.sub .bar-fill { background: #8fb4ff; opacity: .75; }
.sub.is-mine .bar-label { color: var(--text); }
.sub.is-mine .bar-fill { background: var(--accent-2); opacity: 1; }
.badge { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #12060a; background: var(--accent-2); padding: 2px 7px; border-radius: 99px; }
@media (max-width: 620px) {
  .bar-row, .grp-head { grid-template-columns: minmax(0, 1fr) 56px; }
  .grp-head { grid-template-columns: minmax(0, 1fr) 56px 16px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .grp-body { padding-inline-start: 14px; }
}

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: start; color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }

.share-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* about */
.prose h2 { margin-top: 28px; }
.prose h2:first-child { margin-top: 0; }
.prose p { color: #dfe5f5; margin: 0 0 12px; max-width: 68ch; }

/* footer */
#site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-top: 20px; padding-bottom: 28px; }
.foot p { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* home: poll list */
.home-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 18px; }
.home-filters .search { flex: 1 1 220px; max-width: 360px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; font: inherit; }
.home-filters .search::placeholder { color: var(--muted); }
.home-filters .select { width: auto; max-width: 220px; margin-inline-start: auto; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.chip-btn:hover { border-color: var(--line-strong); }
.chip-btn.is-on { border-color: var(--accent); background: var(--accent-soft); }
.poll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.poll-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; backdrop-filter: blur(6px); }
.poll-cover { position: relative; display: block; aspect-ratio: 1200 / 630; background: #050814; }
.poll-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poll-cover .status { position: absolute; top: 12px; inset-inline-start: 12px; display: inline-flex; align-items: center; gap: 6px; background: rgba(2, 3, 10, 0.75); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.poll-cover .status:empty { display: none; }
.poll-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.poll-body h2 { margin: 0; font-size: 22px; }
.poll-body h2 a { color: var(--text); text-decoration: none; }
.poll-body p { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
.poll-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 6px; }
.poll-actions { display: flex; gap: 8px; }
.poll-actions .btn { padding: 9px 18px; font-size: 14px; }

/* terms */
.legal h2 { font-size: 17px; margin-top: 26px; }
.legal p, .legal li { color: #dfe5f5; max-width: 72ch; }
.legal ul { padding-inline-start: 20px; margin: 0 0 12px; }
.legal li { margin-bottom: 6px; }
.updated { color: var(--muted); font-size: 14px; }
