:root {
  color-scheme: light;
  --ink: #111111;
  --paper: #f6f6f0;
  --white: #ffffff;
  --line: #161616;
  --muted: #70706a;
  --blue-100: #edfbff;
  --blue-300: #c0feff;
  --blue-700: #25c5f6;
  --blue-900: #1748ed;
  --red-100: #fff0f0;
  --red-300: #ffc7c7;
  --red-700: #ff615e;
  --red-900: #e82d2d;
  --orange-100: #fff3e8;
  --orange-300: #ffd09d;
  --orange-700: #ff9634;
  --orange-900: #f06400;
  --green-100: #eafff3;
  --green-300: #b9fbd6;
  --green-700: #27d17f;
  --green-900: #008c52;
  --soft-divider: rgba(0, 0, 0, .05);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 600;
}

button,
input,
textarea { font: inherit; }

button { border-radius: 0; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--blue-900);
  outline-offset: 3px;
}

.mobile-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--white);
  border-inline: 1px solid #deded8;
}

.masthead {
  display: grid;
  grid-template-columns: 1fr 64px;
  min-height: 132px;
  border-bottom: 2px solid var(--line);
}

.masthead-copy { padding: 18px 18px 16px; }

.eyebrow,
.kicker {
  margin: 0 0 8px;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.masthead h1 {
  margin: 0;
  color: var(--blue-900);
  font-size: clamp(34px, 9vw, 64px);
  line-height: .96;
  letter-spacing: -.06em;
}

.masthead-mark {
  display: grid;
  place-items: center;
  background: var(--blue-900);
  color: var(--white);
  font-size: 42px;
  line-height: 1;
}

.submit-masthead {
  display: flex;
  min-height: 116px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 18px;
  border-bottom: 2px solid var(--soft-divider);
}
.submit-masthead .masthead-copy { min-width: 0; padding: 0; }
.submit-masthead h1 {
  max-width: 9em;
  margin: 0;
  color: var(--blue-900);
  font-size: clamp(28px, 7vw, 46px);
  line-height: 1.02;
  letter-spacing: -.06em;
}
.header-signal {
  width: min(30vw, 145px);
  height: auto;
  flex: none;
  object-fit: contain;
}
.submit-section { padding-top: 24px; }

.intro {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: var(--blue-100);
  color: var(--blue-900);
  border-bottom: 2px solid var(--blue-900);
}

.intro p { max-width: 44em; margin: 0; font-size: 15px; line-height: 1.5; }

.section { padding: 24px 18px 30px; border-bottom: 2px solid var(--soft-divider); }

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

.section-heading h2 {
  margin: 0;
  font-size: clamp(27px, 7.4vw, 42px);
  line-height: 1;
  letter-spacing: -.04em;
}

.section-index {
  flex: none;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  color: var(--muted);
  font-size: 13px;
}

.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label, .field-label { font-size: 16px; line-height: 1.35; }
.field-label { margin: 0; }

.field input,
.field textarea,
.admin-login input {
  width: 100%;
  border: 2px solid rgba(0, 0, 0, .1);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  padding: 13px 14px;
  font-size: 16px;
  font-weight: 600;
  appearance: none;
}

.field textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.55;
}

.field-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

.track-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.track-option { position: relative; min-height: 112px; }
.track-option input { position: absolute; opacity: 0; pointer-events: none; }
.track-option label {
  display: flex;
  height: 100%;
  min-height: 112px;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 0;
  cursor: pointer;
  background: var(--track-pale);
  color: var(--track-dark);
  transition: background .15s ease, color .15s ease;
}

.track-option input:checked + label { background: var(--track-dark); color: var(--white); }
.track-option input:focus-visible + label { outline: 3px solid var(--ink); outline-offset: -5px; }
.track-option small { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.track-option span { font-size: 15px; line-height: 1.25; }

.theme-blue { --track-pale: var(--blue-100); --track-mid: var(--blue-700); --track-dark: var(--blue-900); --track-soft: var(--blue-300); }
.theme-red { --track-pale: var(--red-100); --track-mid: var(--red-700); --track-dark: var(--red-900); --track-soft: var(--red-300); }
.theme-orange { --track-pale: var(--orange-100); --track-mid: var(--orange-700); --track-dark: var(--orange-900); --track-soft: var(--orange-300); }
.theme-green { --track-pale: var(--green-100); --track-mid: var(--green-700); --track-dark: var(--green-900); --track-soft: var(--green-300); }

.primary-button,
.secondary-button,
.action-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border: 2px solid var(--line);
  background: var(--blue-700);
  color: var(--blue-100);
  cursor: pointer;
  font-size: 22px;
  font-weight: 700;
  text-align: left;
}

.primary-button:hover { background: var(--blue-900); }
.primary-button:disabled { background: #d4d4ce; color: #888882; cursor: wait; }
.button-symbol { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-weight: 500; }
.submit-button { border: 0; }

.skip-vote-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--blue-900);
  padding: 14px 8px 0;
  cursor: pointer;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.back-link {
  display: block;
  border-bottom: 2px solid var(--line);
  background: var(--blue-100);
  color: var(--blue-900);
  padding: 12px 18px;
  font-size: 13px;
  text-decoration: none;
}
.back-link:hover { background: var(--blue-300); }

.notice {
  display: none;
  margin-top: 14px;
  padding: 12px;
  border: 2px solid var(--line);
  background: var(--blue-100);
  color: var(--blue-900);
  font-size: 14px;
  line-height: 1.45;
}
.notice.show { display: block; }
.notice.error { background: var(--red-100); color: var(--red-900); }

.identity-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 18px;
  padding: 12px;
  border: 2px solid var(--line);
  background: #f1f1eb;
  font-size: 13px;
}
.identity-bar button { border: 0; background: transparent; color: var(--blue-900); cursor: pointer; text-decoration: underline; }

.vote-id-form { display: grid; width: 100%; grid-template-columns: 1fr auto; gap: 0; }
.vote-id-form label { grid-column: 1 / -1; margin-bottom: 7px; }
.vote-id-form input {
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--white);
  padding: 10px 11px;
}
.vote-id-form button {
  border: 2px solid var(--line);
  border-left: 0;
  background: var(--blue-700);
  color: var(--blue-100);
  padding: 8px 12px;
  text-decoration: none;
}

.filter-row { display: flex; gap: 0; overflow-x: auto; margin: 0 -18px 18px; padding: 0 18px; }
.vote-section { padding-top: 20px; }
.filter-button {
  flex: none;
  min-height: 38px;
  border: 2px solid var(--line);
  border-right-width: 0;
  background: var(--white);
  padding: 7px 12px;
  cursor: pointer;
  color: var(--blue-900);
  font-size: 14px;
  font-weight: 700;
}
.filter-button:last-child { border-right-width: 2px; }
.filter-button.active { background: var(--ink); color: var(--white); }

.vote-limit {
  margin: 0 0 18px;
  padding: 10px 12px;
  background: rgba(23, 72, 237, .08);
  color: var(--blue-900);
  font-size: 13px;
}
.vote-limit.exhausted { background: var(--ink); color: var(--white); }

.question-list { display: grid; gap: 14px; }

.question-card {
  display: grid;
  grid-template-columns: 7px 1fr;
  border: 0;
  background: var(--track-pale);
}
.question-stripe { background: var(--track-dark); }
.question-body { min-width: 0; padding: 14px; }
.question-topline { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.question-track {
  color: var(--track-dark);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.question-id { color: var(--muted); font-size: 11px; white-space: nowrap; }
.question-text { margin: 14px 0 18px; font-size: 19px; line-height: 1.42; letter-spacing: -.02em; }
.vote-row { display: flex; align-items: stretch; justify-content: flex-end; }
.vote-button {
  display: flex;
  min-width: 122px;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 2px solid var(--track-dark);
  background: var(--track-mid);
  color: var(--white);
  padding: 8px 10px;
  cursor: pointer;
}
.vote-button.voted { background: var(--track-dark); }
.vote-button:disabled:not(.voted) { opacity: .35; cursor: not-allowed; }
.vote-button:hover { filter: saturate(1.15) brightness(.96); }
.vote-count { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: 15px; }

.empty-state {
  padding: 34px 18px;
  border: 2px dashed #aaa9a2;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.footer {
  padding: 18px;
  background: var(--ink);
  color: var(--white);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.6;
}

.brand-footer {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: center;
  padding: 16px 11px;
  background: var(--white);
}
.brand-footer img {
  display: block;
  width: min(34%, 123px);
  height: auto;
}

@media (min-width: 640px) {
  .masthead-copy, .intro, .section { padding-left: 28px; padding-right: 28px; }
  .submit-masthead { padding: 28px; }
  .filter-row { margin-left: -28px; margin-right: -28px; padding-left: 28px; padding-right: 28px; }
  .track-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Projection screen */
.screen-body {
  min-height: 100vh;
  overflow: hidden;
  background: var(--screen-pale, var(--blue-100));
  transition: background .6s ease;
}

.screen-shell {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
  color: var(--screen-dark, var(--blue-900));
}

.screen-header {
  display: grid;
  grid-template-columns: 1fr auto;
  border-bottom: clamp(3px, .4vw, 8px) solid currentColor;
}
.screen-brand { padding: clamp(20px, 3vw, 54px); }
.screen-brand .eyebrow { font-size: clamp(12px, 1.1vw, 22px); }
.screen-brand h1 { margin: 0; font-size: clamp(38px, 5.7vw, 110px); line-height: .9; letter-spacing: -.06em; }
.screen-clock {
  display: grid;
  min-width: clamp(150px, 18vw, 350px);
  place-items: center;
  border-left: clamp(3px, .4vw, 8px) solid currentColor;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: clamp(24px, 3.1vw, 60px);
}

.screen-stage { display: grid; min-height: 0; overflow: hidden; grid-template-columns: minmax(0, 1fr) clamp(170px, 18vw, 360px); }
.screen-question-wrap {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 96px);
}
.screen-track-icon {
  position: absolute;
  top: clamp(24px, 3vw, 58px);
  right: clamp(24px, 3vw, 58px);
  width: clamp(54px, 7vw, 120px);
  height: auto;
}
.screen-track { margin: 0; font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: clamp(14px, 1.55vw, 30px); text-transform: uppercase; }
.screen-question {
  max-width: 18em;
  margin: clamp(28px, 4vh, 70px) 0;
  font-size: clamp(42px, 6.3vw, 122px);
  line-height: 1.07;
  letter-spacing: -.055em;
  text-wrap: balance;
}
.screen-meta { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.screen-submit-id { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: clamp(14px, 1.5vw, 28px); }
.screen-progress { display: flex; gap: 8px; }
.screen-progress span { width: clamp(24px, 3.4vw, 66px); height: clamp(6px, .7vw, 13px); background: currentColor; opacity: .2; }
.screen-progress span.active { opacity: 1; }
.screen-votes {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: clamp(3px, .4vw, 8px) solid currentColor;
  background: var(--screen-mid, var(--blue-700));
  color: var(--screen-pale, var(--blue-100));
}
.screen-votes-number { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: clamp(70px, 12vw, 230px); line-height: .9; letter-spacing: -.08em; }
.screen-votes-label { margin-top: 16px; font-size: clamp(18px, 2vw, 38px); }
.screen-question-wrap,
.screen-votes { transition: transform .75s ease, opacity .75s ease; }
.screen-stage.is-leaving > .screen-question-wrap,
.screen-stage.is-leaving > .screen-votes { transform: translateY(-190px); opacity: 0; }
.screen-stage.is-entering > .screen-question-wrap,
.screen-stage.is-entering > .screen-votes { transform: translateY(190px); opacity: 0; }
.screen-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: clamp(10px, 1.2vw, 22px) clamp(20px, 3vw, 54px); background: var(--screen-dark, var(--blue-900)); color: var(--screen-pale, var(--blue-100)); }
.screen-footer-brand { display: block; width: clamp(112px, 14vw, 240px); height: auto; filter: brightness(0) invert(1); }
.screen-qr-wrap {
  position: fixed;
  right: 30px;
  bottom: 30px;
  z-index: 10;
  padding: clamp(5px, .45vw, 9px);
  background: var(--white);
}
.screen-qr { display: block; width: clamp(108px, 10.5vw, 198px); height: clamp(108px, 10.5vw, 198px); }
.screen-empty { display: grid; grid-column: 1 / -1; place-items: center; padding: 7vw; text-align: center; }
.screen-empty h2 { max-width: 12em; margin: 0; font-size: clamp(50px, 8vw, 150px); line-height: .94; letter-spacing: -.06em; }
.screen-empty p { font-size: clamp(16px, 1.5vw, 30px); }

/* Admin */
.admin-body { min-height: 100vh; background: #ebebe5; }
.admin-shell { width: min(1400px, 100%); margin: 0 auto; padding: 20px; }
.admin-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 22px 0; border-bottom: 4px solid var(--line); }
.admin-header h1 { margin: 0; font-size: clamp(34px, 5vw, 72px); line-height: .92; letter-spacing: -.055em; }
.admin-links { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-links a { border: 2px solid var(--line); background: var(--white); color: var(--ink); padding: 8px 10px; text-decoration: none; font-size: 13px; }
.admin-links a:hover { background: var(--blue-900); color: var(--white); }
.admin-login { width: min(440px, 100%); margin: 12vh auto; border: 3px solid var(--line); background: var(--white); padding: 24px; }
.admin-login h1 { margin: 0 0 8px; font-size: 42px; line-height: 1; }
.admin-login p { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.admin-login input { margin-bottom: 10px; }
.admin-dashboard[hidden], .admin-login[hidden] { display: none; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-left: 2px solid var(--line); margin: 20px 0; }
.admin-stat { border: 2px solid var(--line); border-left: 0; background: var(--white); padding: 14px; }
.admin-stat strong { display: block; font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: 36px; }
.admin-stat span { color: var(--muted); font-size: 12px; }
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0; }
.admin-tabs { display: flex; flex-wrap: wrap; }
.admin-tab { min-height: 40px; border: 2px solid var(--line); border-right: 0; background: var(--white); padding: 8px 12px; cursor: pointer; }
.admin-tab:last-child { border-right: 2px solid var(--line); }
.admin-tab.active { background: var(--ink); color: var(--white); }
.admin-refresh { border: 2px solid var(--line); background: var(--blue-700); color: var(--blue-100); padding: 8px 14px; cursor: pointer; }
.admin-list { display: grid; gap: 10px; }
.admin-card { display: grid; grid-template-columns: 9px 1fr auto; border: 2px solid var(--line); background: var(--white); }
.admin-card-stripe { background: var(--track-dark); }
.admin-card-content { min-width: 0; padding: 15px; }
.admin-card-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.admin-card-meta .track-name { color: var(--track-dark); }
.admin-card-question { margin: 10px 0 0; font-size: 20px; line-height: 1.4; }
.admin-actions { display: grid; grid-auto-rows: 1fr; min-width: 118px; border-left: 2px solid var(--line); }
.admin-actions button { border: 0; border-bottom: 2px solid var(--line); background: var(--white); cursor: pointer; padding: 8px 12px; }
.admin-actions button:last-child { border-bottom: 0; }
.admin-actions .approve { background: var(--green-700); color: #00391f; }
.admin-actions .reject { background: var(--red-700); color: #4a0000; }
.admin-actions .pending { background: var(--orange-300); }
.admin-actions .delete { color: var(--red-900); }
.admin-actions button:hover { filter: brightness(.92); }

@media (max-width: 720px) {
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-card { grid-template-columns: 7px 1fr; }
  .admin-actions { grid-column: 2; grid-template-columns: repeat(3, 1fr); border-top: 2px solid var(--line); border-left: 0; }
  .admin-actions button { border-right: 2px solid var(--line); border-bottom: 0; }
  .admin-actions button:last-child { border-right: 0; }
  .screen-stage { grid-template-columns: 1fr; }
  .screen-votes { min-height: 160px; border-top: 4px solid currentColor; border-left: 0; }
}
