:root {
  --steel: #E6EAE8;
  --steel-deep: #CDD3D0;
  --paper: #FFFFFF;
  --ink: #1F2A37;
  --ink-soft: #55606B;
  --basil: #2E6A4C;
  --basil-deep: #23533B;
  --amber: #E3A13B;
  --tomato: #C2412D;
  --round: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--steel);
  color: var(--ink);
  font: 17px/1.5 var(--text);
  min-height: 100dvh;
}
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-t)) 18px calc(96px + var(--safe-b));
}
h1, h2, h3 { font-family: var(--round); line-height: 1.15; margin: 0; }
h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 22px; font-weight: 750; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
a { color: var(--basil-deep); }
.muted { color: var(--ink-soft); }
.small { font-size: 15px; }
.stack > * + * { margin-top: 14px; }
.section { margin-top: 32px; }
.section > h2 { margin-bottom: 12px; }

/* ---------- buttons & fields ---------- */
button, .btn {
  font: 600 17px/1 var(--text);
  border: 0;
  border-radius: 14px;
  padding: 15px 18px;
  min-height: 50px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--steel-deep);
}
button.do { background: var(--basil); color: #fff; box-shadow: none; }
button.do:active { background: var(--basil-deep); }
button.quiet { background: transparent; box-shadow: none; color: var(--ink-soft); padding-inline: 10px; }
button.danger { color: var(--tomato); }
button[disabled] { opacity: .55; cursor: default; }
button.wide, .btn.wide { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

label { display: block; font-weight: 600; margin-bottom: 6px; }
input, textarea {
  width: 100%;
  font: 17px/1.4 var(--text);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--steel-deep);
  border-radius: 12px;
  padding: 13px 14px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--basil); outline: none; box-shadow: 0 0 0 3px rgba(46,106,76,.18); }
input.code { font: 700 28px/1 var(--round); letter-spacing: .35em; text-align: center; }
.error { color: var(--tomato); font-weight: 600; }

/* ---------- header ---------- */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.brand-switch {
  font: 600 15px/1 var(--text);
  min-height: 36px; padding: 8px 12px; border-radius: 999px;
}
.hello { margin-top: 6px; }

/* ---------- the rail: tickets that need you ---------- */
.rail-wrap { margin: 24px -18px 0; }
.rail-bar {
  height: 10px; margin: 0 18px;
  border-radius: 5px;
  background: linear-gradient(#B9C1BD, #9AA4A0);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 1px 2px rgba(31,42,55,.25);
}
.rail {
  display: flex; gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 18px 18px;
  scroll-padding-inline: 18px;
  align-items: flex-start;
  margin-top: -5px;
  -webkit-overflow-scrolling: touch;
}
.ticket {
  flex: 0 0 78%;
  max-width: 300px;
  scroll-snap-align: start;
  position: relative;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  padding: 26px 18px 22px;
  border-radius: 2px 2px 6px 6px;
  box-shadow: 0 6px 14px rgba(31,42,55,.12);
  transform-origin: top center;
  /* torn bottom edge */
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat,
    radial-gradient(circle at 6px 0, transparent 5.5px, #000 6px) bottom / 12px 8px repeat-x;
          mask: linear-gradient(#000 0 0) top / 100% calc(100% - 8px) no-repeat,
    radial-gradient(circle at 6px 0, transparent 5.5px, #000 6px) bottom / 12px 8px repeat-x;
}
.ticket::before { /* the clip that holds it on the rail */
  content: ""; position: absolute; top: -2px; left: 50%; width: 46px; height: 14px;
  transform: translateX(-50%);
  border-radius: 0 0 6px 6px;
  background: linear-gradient(#C9D0CD, #A9B2AE);
}
.ticket:nth-child(odd) { transform: rotate(-1.2deg); }
.ticket:nth-child(even) { transform: rotate(1deg); }
.ticket .kind { font: 700 15px/1 var(--round); color: #8A5A10; display: flex; align-items: center; gap: 6px; }
.ticket .kind::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); }
.ticket h3 { margin-top: 10px; font-size: 21px; }
.ticket p { margin-top: 6px; color: var(--ink-soft); font-size: 15px; }
.ticket .go { margin-top: 16px; font-weight: 700; color: var(--basil-deep); }
.rail-empty {
  margin: 0 18px; padding: 22px 18px 18px;
  background: rgba(255,255,255,.55);
  border-radius: 0 0 12px 12px;
}
@media (prefers-reduced-motion: no-preference) {
  .rail.arrive .ticket { animation: swing .7s cubic-bezier(.3,1.6,.5,1) both; }
  .rail.arrive .ticket:nth-child(2) { animation-delay: .08s; }
  .rail.arrive .ticket:nth-child(3) { animation-delay: .16s; }
  @keyframes swing { from { transform: rotate(6deg) translateY(-10px); opacity: 0; } }
}

/* ---------- lists ---------- */
.list { background: var(--paper); border-radius: 16px; overflow: hidden; }
.list > * + * { border-top: 1px solid var(--steel); }
.item { display: flex; gap: 12px; padding: 14px 16px; align-items: flex-start; color: inherit; text-decoration: none; }
.item .when { margin-left: auto; white-space: nowrap; color: var(--ink-soft); font-size: 14px; }
.item .what { min-width: 0; }
.item .what p { color: var(--ink-soft); font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 8px; flex: none; background: var(--steel-deep); }
.dot.wait { background: var(--amber); }
.dot.live { background: var(--basil); }
.dot.coming { background: var(--ink); }

/* ---------- question & approval paper ---------- */
.paper { background: var(--paper); border-radius: 16px; padding: 18px; }
.paper .topic { font-weight: 700; color: var(--basil-deep); font-size: 15px; }
.paper .q { font: 700 20px/1.3 var(--round); margin-top: 4px; }
.done-note { display: flex; gap: 10px; align-items: center; color: var(--basil-deep); font-weight: 600; }
.media { margin: 0 -18px; background: var(--ink); }
.media video, .media img { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: var(--ink); }
.media .placeholder { color: #fff; padding: 40px 18px; text-align: center; opacity: .8; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 600; }
.caption { white-space: pre-wrap; }
.tags { color: var(--basil-deep); font-size: 15px; }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--steel-deep);
  padding-bottom: var(--safe-b);
  z-index: 10;
}
.tabs a {
  position: relative;
  flex: 1; max-width: 140px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 10px;
  font: 600 12px/1.2 var(--text);
  color: var(--ink-soft); text-decoration: none;
}
.tabs .tab-ico { font: 700 21px/1 var(--round); }
.tabs a.on { color: var(--basil); }
.badge {
  position: absolute; top: 4px; left: calc(50% + 8px);
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--amber); color: var(--ink);
  font: 700 12px/18px var(--text); text-align: center;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-b));
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 999px;
  font-weight: 600; font-size: 15px;
  max-width: calc(100% - 36px);
  z-index: 20;
}

/* ---------- sign in ---------- */
.signin { min-height: 80dvh; display: flex; flex-direction: column; justify-content: center; }
.signin .mark { font: 800 44px/1 var(--round); letter-spacing: -0.03em; }
.signin .mark span { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--amber); margin-left: 4px; vertical-align: 6px; }

.spinner { padding: 40px 0; text-align: center; color: var(--ink-soft); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.back { display: inline-block; margin-bottom: 10px; font-weight: 600; text-decoration: none; }
