/* Trail-map palette: snow, ink, and the three trail-sign colors. */
:root {
  --snow: #F2F5F8;
  --paper: #FFFFFF;
  --ink: #121C2D;
  --ink-2: #4B586B;
  --line: #D2DAE3;
  --blue: #1B5BD0;
  --blue-wash: #E8F0FD;
  --green: #1C7C54;
  --green-wash: #E3F3EB;
  --yellow: #F4B90B;
  --yellow-wash: #FDF3D3;
  --red: #B93227;
  --gray-wash: #E6EAEF;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--snow);
  color: var(--ink);
  font: 400 17px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 560px; margin: 0 auto; padding: 20px 16px 96px; }
#app.wide { max-width: 880px; }
.boot { color: var(--ink-2); padding: 40px 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0; letter-spacing: .005em; }
h2 { font-size: 30px; margin: 40px 0 6px; }
h3 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-2); }
.small { font-size: 15px; }
a { color: var(--blue); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Lift ticket ---------- */
.ticket {
  position: relative;
  margin: 18px 6px 34px;
  background: var(--paper);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(18,28,45,.08), 0 14px 30px -18px rgba(18,28,45,.45);
  transform: rotate(-1.2deg);
  transform-origin: 50% -30px;
  animation: hang 900ms cubic-bezier(.3,1.4,.5,1) both;
}
@keyframes hang { from { transform: rotate(-7deg); } 60% { transform: rotate(.6deg); } to { transform: rotate(-1.2deg); } }
@media (prefers-reduced-motion: reduce) { .ticket { animation: none; } }
.ticket-top {
  background: var(--blue);
  color: #fff;
  border-radius: 14px 14px 0 0;
  padding: 46px 22px 24px;
}
.ticket-top::before { /* the punch hole a wicket goes through */
  content: "";
  position: absolute; top: 14px; left: 50%;
  width: 46px; height: 14px; margin-left: -23px;
  border-radius: 7px;
  background: var(--snow);
  box-shadow: inset 0 1px 2px rgba(18,28,45,.35);
}
.ticket h1 { font-size: clamp(40px, 12.5vw, 62px); text-wrap: balance; }
.ticket-top p { margin: 12px 0 0; font-size: 17px; line-height: 1.4; max-width: 34ch; color: #E4ECFB; }
.ticket-stub {
  position: relative;
  border-top: 2px dashed var(--line);
  padding: 16px 22px 18px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.ticket-stub::before, .ticket-stub::after { /* tear notches */
  content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--snow);
}
.ticket-stub::before { left: -10px; }
.ticket-stub::after { right: -10px; }
.ticket-stub .admit { font-size: 15px; color: var(--ink-2); }
.ticket-stub .name { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; }
.ticket-stub svg { flex: none; }

/* ---------- Forms ---------- */
.q { margin: 28px 0 0; }
.q > .label { font-weight: 600; font-size: 19px; line-height: 1.3; margin: 0 0 4px; }
.q > .help { color: var(--ink-2); font-size: 15px; margin: 0 0 10px; max-width: 52ch; }
.q > .label + .opts, .q > .label + input, .q > .label + textarea, .q > .label + .scale, .q > .label + .dates { margin-top: 10px; }
.opts { display: grid; gap: 8px; }
.opts.chips { display: flex; flex-wrap: wrap; }
.opt {
  display: flex; align-items: center; gap: 10px;
  min-height: 50px; padding: 10px 14px;
  background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--r);
  text-align: left; cursor: pointer;
}
.opt::before {
  content: ""; flex: none; width: 20px; height: 20px;
  border: 1.5px solid #9AA6B5; border-radius: 50%; background: var(--paper);
}
.opt.box::before { border-radius: 5px; }
.opt[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-wash); font-weight: 500; }
.opt[aria-pressed="true"]::before {
  border-color: var(--blue); background: var(--blue) center/12px no-repeat
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.3l2.7 2.7L10 3.6' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.opts.chips .opt { min-height: 42px; padding: 7px 12px; font-size: 16px; }
.opts.chips .opt::before { display: none; }
.opts.chips .opt[aria-pressed="true"] { background: var(--blue); color: #fff; }
.opt:disabled, .seg button:disabled, .scale button:disabled { cursor: default; opacity: .75; }
input[type="text"], input[type="tel"], input[type="email"], textarea, select {
  width: 100%; padding: 12px 14px;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #8490A0; }

.dates { display: grid; gap: 14px; }
.date-row .when { font-weight: 500; margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button {
  min-height: 46px; padding: 6px 4px; cursor: pointer;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r);
}
.seg button[aria-pressed="true"] { font-weight: 600; border-color: var(--ink); }
.seg button[aria-pressed="true"][data-v="yes"] { background: var(--green); border-color: var(--green); color: #fff; }
.seg button[aria-pressed="true"][data-v="maybe"] { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.seg button[aria-pressed="true"][data-v="no"] { background: var(--ink); color: #fff; }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale button {
  min-height: 58px; display: grid; place-items: center; gap: 2px; padding: 6px 0; cursor: pointer;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r);
  font-family: var(--display); font-weight: 700; font-size: 22px;
}
.scale button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-wash); box-shadow: inset 0 0 0 1.5px var(--blue); }
.scale-ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.scale-ends span:last-child { text-align: right; }

.actions { margin-top: 36px; display: grid; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px; cursor: pointer; text-decoration: none;
  background: var(--ink); color: #fff; border: 0; border-radius: var(--r);
  font-weight: 600; font-size: 18px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.quiet { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.sm { min-height: 40px; padding: 6px 12px; font-size: 15px; border-radius: 8px; }
.err { color: var(--red); font-weight: 500; margin: 12px 0 0; }
.save-state { font-size: 14px; color: var(--ink-2); min-height: 21px; text-align: center; }

.panel { background: var(--paper); border: 1.5px solid var(--line); border-radius: 14px; padding: 20px; margin-top: 20px; }
.panel.sent { border-color: var(--green); background: var(--green-wash); }
.panel h2 { margin-top: 0; }
.foot { margin-top: 40px; color: var(--ink-2); font-size: 15px; }

/* ---------- Organizer screens ---------- */
.bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.bar h1 { font-size: 30px; }
.tabs {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px 8px; padding: 0 16px; border-bottom: 1.5px solid var(--line);
  position: sticky; top: 0; background: var(--snow); z-index: 5;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; padding: 12px 10px 10px; background: none; border: 0; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1.5px; color: var(--ink-2); font-weight: 500; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.stat b { display: block; font-family: var(--display); font-size: 40px; line-height: 1; font-weight: 700; }
.stat span { font-size: 15px; color: var(--ink-2); }

.tally { display: grid; gap: 12px; margin-top: 12px; }
.tally .row .top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 12px; font-size: 16px; }
.tally .row .top span:last-child { color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.track { display: flex; height: 12px; margin-top: 5px; background: var(--gray-wash); border-radius: 3px; overflow: hidden; gap: 2px; }
.track i { display: block; height: 100%; min-width: 0; }
.track .yes { background: var(--green); }
.track .maybe { background: var(--yellow); }
.track .no { background: var(--ink); }
.track .one { background: var(--blue); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.lead { font-size: 13px; font-weight: 600; color: var(--green); margin-left: 6px; }
.grid2 { display: grid; gap: 0 28px; }
@media (min-width: 700px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.empty { color: var(--ink-2); padding: 14px 0; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.filters button { padding: 7px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper); cursor: pointer; font-size: 15px; }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.person { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px; }
.person .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.person .who { font-weight: 600; font-size: 18px; }
.person .meta { font-size: 14px; color: var(--ink-2); }
.pill { flex: none; font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--gray-wash); color: var(--ink-2); white-space: nowrap; }
.pill.answered { background: var(--green-wash); color: var(--green); }
.pill.opened { background: var(--blue-wash); color: var(--blue); }
.pill.sent { background: var(--yellow-wash); color: #7A5B00; }
.person .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.detail { border-top: 1.5px solid var(--line); margin-top: 12px; padding-top: 12px; }
.detail dl { margin: 0 0 14px; display: grid; gap: 8px; }
.detail dt { font-size: 14px; color: var(--ink-2); }
.detail dd { margin: 0; }
.fields { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.fields label { font-size: 14px; color: var(--ink-2); display: grid; gap: 3px; }
.fields .full { grid-column: 1 / -1; }
.fields input, .fields select { padding: 9px 10px; font-size: 16px; }

.section-head { scroll-margin-top: 56px; margin-top: 44px; padding-top: 16px; border-top: 3px solid var(--ink); }
.section-head h2 { margin: 0; }
.section-head.private { border-top-color: var(--yellow); }
.section-head .note { color: var(--ink-2); font-size: 15px; margin: 4px 0 0; }
.sticky-state {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(242,245,248,.94); backdrop-filter: blur(6px); border-top: 1.5px solid var(--line);
  font-size: 14px; color: var(--ink-2); text-align: center;
}
.setting { margin-top: 22px; }
.setting label { display: block; font-weight: 600; margin-bottom: 4px; }
.setting .help { font-size: 14px; color: var(--ink-2); margin: 0 0 8px; }
.switch { display: flex; gap: 10px; align-items: center; }
.switch input { width: 22px; height: 22px; }

#toast {
  position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); z-index: 20;
}
#toast.on { opacity: 1; }

/* ---------- Places scorecard ---------- */
.weights { display: grid; gap: 14px 24px; margin-top: 12px; }
@media (min-width: 640px) { .weights { grid-template-columns: 1fr 1fr; } }
.weight label { display: flex; justify-content: space-between; font-weight: 600; }
.weight label span { font-weight: 400; font-variant-numeric: tabular-nums; }
.weight input[type="range"] { width: 100%; margin: 6px 0 0; accent-color: var(--blue); height: 28px; }
.place { padding: 16px; margin-bottom: 12px; }
.place-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.rank { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1; min-width: 26px; color: var(--ink-2); }
.place-name h3 { font-size: 28px; font-weight: 700; margin: 0; }
.place-name .meta { font-size: 14px; color: var(--ink-2); }
.place-score { text-align: right; line-height: 1; }
.place-score b { display: block; font-family: var(--display); font-size: 38px; font-weight: 700; }
.place-score span { font-size: 13px; color: var(--ink-2); }
.track.total { height: 8px; margin: 12px 0 14px; }
.crit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.crit .top { display: flex; justify-content: space-between; font-size: 15px; }
.crit .top span:last-child { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.crit .track { height: 6px; margin-top: 4px; }
.crit .track .one { background: var(--ink); }
.verdict { margin: 14px 0 8px; max-width: 62ch; }
.facts-line { margin: 0; padding: 0 0 0 18px; font-size: 15px; color: var(--ink-2); }
.facts-line li { margin: 2px 0; }
.fact-group h4, .detail h4 { font-family: var(--body); font-size: 16px; font-weight: 600; margin: 16px 0 4px; }
.fact-group ul, .sources { margin: 0; padding-left: 18px; font-size: 15.5px; max-width: 68ch; }
.fact-group li, .sources li { margin: 4px 0; }
.steppers { display: grid; gap: 8px; margin-top: 8px; }
.step-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper b { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.stepper button { width: 40px; height: 40px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; font-size: 20px; line-height: 1; }
.stepper button.reset { width: auto; height: 40px; padding: 0 10px; font-size: 14px; color: var(--blue); }

/* ---------- Shell, sign-in and admin area ---------- */
.bar { align-items: center; }
.who-am-i { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.who-am-i span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkish { background: none; border: 0; padding: 8px 0 8px 8px; color: var(--blue); cursor: pointer; text-decoration: underline; font-size: 15px; white-space: nowrap; }
.admin-tag {
  flex: none; display: inline-block; padding: 1px 8px; border-radius: 4px;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.6; vertical-align: middle;
}
.who .admin-tag { margin-left: 8px; }
.tabs { align-items: stretch; }
.admin-group { display: flex; align-items: center; gap: 2px; margin-left: 10px; padding-left: 12px; border-left: 1.5px solid var(--line); }
.admin-group .admin-tag { margin-right: 6px; }
.tabs button.admin-tab[aria-selected="true"] { border-bottom-color: var(--ink); }
.admin-banner {
  display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline;
  margin: 14px 0 4px; padding: 10px 14px; border-radius: var(--r);
  background: var(--ink); color: #fff; font-size: 15px;
}
.admin-banner span { color: #C9D2DF; }
.signin { margin-top: 0; }
.signin h2 { margin: 0 0 6px; }
.field-label { display: block; font-weight: 600; margin: 16px 0 6px; }
.code-input { font-family: var(--display); font-weight: 600; font-size: 24px; letter-spacing: .12em; text-transform: uppercase; }
.code-input::placeholder { letter-spacing: .12em; font-weight: 600; }
.detail .msg { white-space: pre-wrap; font-size: 15px; background: var(--snow); border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; user-select: all; }

/* ---------- Stack-rank question ---------- */
.opt.rankopt::before { display: none; }
.rank-no {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid #9AA6B5; font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--ink-2);
}
.opt.rankopt[aria-pressed="true"] .rank-no { background: var(--blue); border-color: var(--blue); color: #fff; }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; }
