/* ============================================================
   Pop-up events: the guest's phone pages and the TV board.
   Every class is .pu-* so nothing here reaches another page.
   Tokens come from theme.css. The TV is a broadcast timing tower:
   full-width rows parted by hairlines, position left, time right.
   ============================================================ */

.pu-body {
  min-height: 100%;
  background: var(--bg);
  background-image: none;
  color: var(--ink);
  font-family: var(--font-text);
}

/* Roman heads, as the Hallmark design.md asks: never italic. */
.pu-body h1, .pu-body h2 { font-style: normal; }

/* ---------- phone ---------- */
.pu-phone {
  max-width: 30rem;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px 48px;
}
.pu-phone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--edge);
}
.pu-phone-head .wordmark-logo { height: 28px; width: auto; }
.pu-phone-head .wordmark { font-size: 1.4rem; }
.pu-event-name { font-size: 0.95rem; color: var(--ink-muted); text-align: right; }
.pu-rig-name {
  margin-top: 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1.02;
}
.pu-panel { margin-top: 18px; }
.pu-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.1;
}
.pu-lead { margin-top: 6px; font-size: 1.05rem; color: var(--ink-muted); }
.pu-quiet { color: var(--ink-faint); }
.pu-notice { margin-top: 16px; padding: 10px 12px; background: var(--pb-soft); color: var(--pb); border-radius: var(--radius); }

.pu-form { margin-top: 20px; display: grid; gap: 14px; }
.pu-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pu-field label { display: block; font-size: 0.9rem; color: var(--ink-muted); margin-bottom: 4px; }
.pu-field input {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  font-size: 1.1rem; /* 16px or more: no zoom on focus in iOS */
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius);
}
.pu-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.pu-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 1.05rem;
  line-height: 1.35;
  cursor: pointer;
}
.pu-check input { width: 24px; height: 24px; margin-top: 1px; flex: none; accent-color: var(--accent); }
.pu-errors {
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  background: var(--danger-soft);
  color: var(--ink);
  font-size: 0.95rem;
  list-style: none;
}
.pu-field-error { margin-top: 6px; }
.pu-field input[aria-invalid="true"] { border-color: var(--danger); }
.pu-start-form { margin-top: 20px; }
.pu-start {
  display: block;
  width: 100%;
  min-height: 64px;
  margin-top: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.pu-start:hover { background: var(--accent-hover); }
.pu-not-me, .pu-my-page { margin-top: 18px; text-align: center; }
.pu-not-me a, .pu-my-page a { color: var(--ink-muted); text-decoration: underline; text-underline-offset: 4px; }

.pu-times { margin-top: 22px; border-top: 1px solid var(--edge); }
.pu-time-row { padding: 14px 0; border-bottom: 1px solid var(--edge); }
.pu-combo { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 0.95rem; color: var(--ink-muted); }
.pu-best {
  margin-top: 2px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pu-rank { margin-top: 4px; font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; }
.pu-off-mark { margin-left: 8px; font-size: 0.95rem; color: var(--warm); }
.pu-legend { margin-top: 10px; font-size: 0.95rem; color: var(--ink-muted); }

.pu-discount { margin-top: 26px; text-align: center; }
.pu-qr { width: min(72vw, 260px); margin: 0 auto; background: #fff; padding: 10px; border-radius: var(--radius); }
.pu-qr svg { display: block; width: 100%; height: auto; }
.pu-discount-line {
  margin-top: 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.15;
}

/* ---------- TV board ---------- */
body.pu-tv-body { overflow: hidden; cursor: none; height: 100vh; }
.pu-tv {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 3.4vh 3.2vw 2.6vh;
}
.pu-tv-head {
  display: flex;
  align-items: center;
  gap: 2.4vw;
  padding-bottom: 2vh;
  border-bottom: 2px solid var(--accent);
}
.pu-tv-brand .wordmark-logo { height: 6vh; width: auto; display: block; }
.pu-tv-brand .wordmark { font-size: 5vh; }
.pu-tv-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 6vh;
  line-height: 1;
  letter-spacing: -0.01em;
}

.pu-tv-boards {
  display: grid;
  grid-template-columns: repeat(var(--pu-columns, 2), minmax(0, 1fr));
  /* One row the height of the screen's middle, never the height of the
     longest column: the columns page what does not fit. */
  grid-template-rows: minmax(0, 1fr);
  gap: 3.2vw;
  padding-top: 3vh;
  min-height: 0;
  overflow: hidden;
}
.pu-tv-board { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pu-tv-board-head { padding-bottom: 1.6vh; }
.pu-tv-track {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 5.2vh;
  line-height: 1.02;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pu-tv-sub {
  display: flex;
  gap: 1.2vw;
  margin-top: 0.6vh;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 3vh;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
}
.pu-tv-car { color: var(--accent); }
.pu-tv-none { font-size: 2.6vh; color: var(--ink-faint); margin-top: 1.4vh; }

.pu-tower { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--edge-strong); }
/* Under the podium: the rest, a page at a time (pop_up_tv_controller.js sets
   the view's height to whole rows and shifts the list). Without the script
   the pager clips what does not fit. */
.pu-podium { flex: none; }
.pu-pager { flex: 1 1 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; margin-top: 1vh; }
.pu-pager-view { flex: none; overflow: hidden; box-sizing: content-box; border-top: 1px solid var(--edge-strong); }
.pu-rest { border-top: 0; }
.pu-tv-page {
  flex: none;
  margin-top: 1.4vh;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.6vh;
  line-height: 1.2;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pu-tower-row {
  display: grid;
  grid-template-columns: 6.4vh minmax(0, 1fr) auto 10.5vh;
  align-items: center;
  column-gap: 1.4vw;
  height: 6.3vh;
  border-bottom: 1px solid var(--edge);
  font-variant-numeric: tabular-nums;
}
.pu-pos {
  align-self: stretch;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.6vh;
  color: var(--ink);
  background: var(--surface-2);
}
.pu-name {
  display: flex;
  align-items: center;
  gap: 0.8vw;
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 4vh;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pu-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pu-time {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 4.3vh;
  text-align: right;
  white-space: nowrap;
}
.pu-gap {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.9vh;
  color: var(--ink-muted);
  text-align: right;
  white-space: nowrap;
}
/* A new best's row lights up for a moment (pop_up_tv_controller.js). */
.pu-tower-row { --pu-flash: color-mix(in srgb, var(--accent) 30%, transparent); }
.pu-tower-row.is-leader .pu-pos { background: var(--accent); color: var(--accent-ink); }
.pu-tower-row.is-leader .pu-time { color: var(--fastest); }
.pu-off {
  display: inline-block;
  flex: none;
  padding: 0.1em 0.35em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.55em;
  line-height: 1.1;
  color: var(--warm);
  border: 2px solid currentColor;
  border-radius: 2px;
}

.pu-tv-empty { grid-column: 1 / -1; justify-content: center; align-items: center; text-align: center; }
.pu-tv-empty-title { font-family: var(--font-display); font-weight: 700; font-size: 8vh; }
.pu-tv-empty-sub { font-size: 3.4vh; color: var(--ink-muted); margin-top: 1.4vh; }

.pu-tv-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2vw;
  padding-top: 1.8vh;
  border-top: 1px solid var(--edge-strong);
}
.pu-on-track { display: flex; align-items: center; gap: 2vw; min-width: 0; overflow: hidden; white-space: nowrap; }
.pu-on-track-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.8vh;
  color: var(--accent-ink);
  background: var(--accent);
  padding: 0.3vh 0.8vw;
  border-radius: 2px;
}
.pu-on-track-none { font-size: 2.8vh; color: var(--ink-muted); }
.pu-on-track-item { display: inline-flex; align-items: center; gap: 0.7vw; font-size: 2.8vh; color: var(--ink-muted); }
.pu-on-track-item strong { font-family: var(--font-display); font-weight: 700; font-size: 3.2vh; color: var(--ink); }
.pu-live-dot { width: 1.2vh; height: 1.2vh; border-radius: 50%; background: var(--pb); }
.pu-tv-foot .pu-legend { margin: 0; font-size: 2.4vh; white-space: nowrap; display: flex; align-items: center; gap: 0.6vw; }
.pu-tv-foot .pu-off { font-size: 2vh; }
