:root {
  color-scheme: dark;
  --navy: #101a2e;
  --navy-2: #172640;
  --panel: rgba(25, 39, 64, 0.92);
  --panel-2: #1b2b46;
  --line: rgba(214, 225, 241, 0.12);
  --text: #f4f6fb;
  --muted: #9baac1;
  --lime: #c8f169;
  --lime-ink: #1c2a10;
  --amber: #ffc66d;
  --coral: #ff797d;
  --blue: #8cb8ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 82% -12%, rgba(111, 153, 231, 0.17), transparent 68%),
    radial-gradient(700px 440px at -8% 88%, rgba(200, 241, 105, 0.08), transparent 66%),
    var(--navy);
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
a { color: inherit; }

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--muted);
}
.boot-screen .brand-mark { margin-bottom: 14px; }

.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 13px;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 7px 28px rgba(200, 241, 105, 0.19);
}
.brand-word { font-size: 18px; font-weight: 760; letter-spacing: -0.04em; }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }

button {
  border: 0;
  cursor: pointer;
  transition: transform 120ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }

.btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 680;
  letter-spacing: -0.01em;
}
.btn-primary { background: var(--lime); color: var(--lime-ink); }
.btn-primary:hover { background: #d8fa9c; }
.btn-secondary { background: #263957; border: 1px solid rgba(214, 225, 241, 0.13); }
.btn-secondary:hover { background: #304563; }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--text); background: rgba(255,255,255,.06); }
.btn-danger { background: rgba(255, 121, 125, .13); color: #ff9b9f; border: 1px solid rgba(255, 121, 125, .16); }
.btn-small { min-height: 34px; padding: 0 11px; font-size: 12px; border-radius: 10px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.07); border-color: var(--line); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.landing {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 58px;
}
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}
.nav-note { color: var(--muted); font-size: 13px; }
.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(350px, .94fr);
  gap: 56px;
  align-items: center;
  padding: clamp(64px, 12vh, 120px) 0 84px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 750;
  font-size: 11px;
}
.eyebrow-dot { width: 7px; height: 7px; border-radius: 100%; background: currentColor; box-shadow: 0 0 14px currentColor; }
.landing h1 {
  max-width: 650px;
  margin: 18px 0 18px;
  font-size: clamp(48px, 7vw, 78px);
  line-height: .99;
  letter-spacing: -.065em;
}
.landing h1 span { color: var(--lime); }
.hero-copy { max-width: 510px; color: #bbc7d8; font-size: 18px; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 28px; }
.hero-subnote { color: var(--muted); font-size: 12px; }
.hero-mini {
  position: relative;
  overflow: hidden;
  padding: 23px;
  border: 1px solid rgba(219, 230, 245, .16);
  border-radius: 24px;
  background: linear-gradient(150deg, rgba(42, 61, 91, .96), rgba(21, 34, 56, .98));
  box-shadow: 0 34px 90px rgba(0, 0, 0, .24);
}
.hero-mini::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  top: -145px;
  right: -75px;
  border-radius: 50%;
  background: rgba(200, 241, 105, .16);
  filter: blur(22px);
  pointer-events: none;
}
.mini-topline { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.live-pill, .state-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(200, 241, 105, .11);
  color: var(--lime);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.live-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mini-countdown {
  padding: 28px 0 25px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-size: clamp(52px, 8vw, 80px);
  font-weight: 680;
  letter-spacing: -.055em;
}
.mini-progress, .progress-track { height: 7px; overflow: hidden; background: rgba(255,255,255,.1); border-radius: 8px; }
.mini-progress span, .progress-fill { display: block; width: 43%; height: 100%; border-radius: inherit; background: var(--lime); }
.mini-agenda { display: grid; gap: 10px; margin-top: 21px; }
.mini-agenda-row { display: flex; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; color: #d9e0ec; font-size: 13px; }
.mini-agenda-row.active { border-color: rgba(200, 241, 105, .38); background: rgba(200, 241, 105, .08); }
.mini-agenda-row small { color: var(--muted); }
.landing-footer { border-top: 1px solid var(--line); padding-top: 22px; display: flex; justify-content: space-between; gap: 18px; color: var(--muted); font-size: 12px; }

.page-shell { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 46px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 24px; }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.room-breadcrumb { color: var(--muted); font-size: 12px; }
.dashboard-title { margin: 6px 0 0; font-size: 22px; letter-spacing: -.045em; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr); gap: 20px; align-items: start; }
.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0,0,0,.11);
}
.control-panel { padding: clamp(20px, 3vw, 32px); }
.rundown-panel { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.panel-heading h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.panel-heading p { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.state-pill.paused { background: rgba(140,184,255,.11); color: var(--blue); }
.clock-wrap { padding: 28px 0 22px; text-align: center; }
.current-label { color: #d7e0ed; font-size: 14px; font-weight: 650; }
.current-speaker { min-height: 18px; margin-top: 5px; color: var(--muted); font-size: 12px; }
.clock-value {
  margin: 14px 0 18px;
  font-size: clamp(64px, 10vw, 112px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.075em;
  font-weight: 670;
  line-height: 1;
}
.clock-value.over { color: var(--coral); }
.clock-value.warn { color: var(--amber); }
.progress-track { height: 8px; max-width: 620px; margin: 0 auto; background: rgba(255,255,255,.08); }
.progress-fill { width: 0; transition: width 160ms linear, background 160ms ease; }
.progress-fill.warn { background: var(--amber); }
.progress-fill.over { background: var(--coral); }
.control-buttons { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 9px; }
.control-buttons .btn-primary { min-width: 138px; }
.time-adjust { margin-top: 12px; display: flex; justify-content: center; gap: 8px; }
.control-footnote { text-align: center; margin: 20px 0 0; color: var(--muted); font-size: 11px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-title-row h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.item-count { color: var(--muted); font-size: 11px; }
.rundown-list { display: grid; gap: 9px; }
.rundown-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(214,225,241,.09);
  border-radius: 13px;
  background: rgba(255,255,255,.025);
}
.rundown-item.selected { border-color: rgba(200,241,105,.5); background: rgba(200,241,105,.065); }
.item-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.07);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
  font-family: inherit;
}
.drag-handle { cursor: grab; user-select: none; touch-action: none; }
.drag-handle:hover { transform: none; border-color: rgba(214,225,241,.3); }
.drag-handle:active { cursor: grabbing; transform: scale(.94); }
.drag-handle { transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease; }
.rundown-item.is-dragging .drag-handle { border-color: rgba(200,241,105,.46); background: rgba(200,241,105,.18); color: var(--lime); transform: scale(1.08); }
.selected .item-index { background: var(--lime); color: var(--lime-ink); }
.item-title { font-size: 13px; font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }
.item-duration { color: #d9e2ef; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-actions { display: flex; gap: 1px; margin-left: 2px; cursor: pointer; }
.item-actions button { cursor: pointer; }
.empty-rundown { padding: 28px 14px; border: 1px dashed rgba(214,225,241,.17); border-radius: 13px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.6; }
.rundown-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.online-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.online-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }
.online-status.offline::before { background: var(--coral); }
.online-status.unconfirmed::before { background: var(--amber); }
.online-status.offline.unconfirmed::before { background: var(--coral); }
.connection-notice { display: flex; align-items: center; margin: -8px 0 18px; padding: 11px 14px; border: 1px solid rgba(255,121,125,.28); border-radius: 11px; background: rgba(123,31,40,.2); color: #ffc0c2; font-size: 12px; line-height: 1.45; }
.connection-notice.is-warning { border-color: rgba(255,195,92,.3); background: rgba(126,84,23,.18); color: #ffe0a6; }
.connection-notice[hidden] { display: none !important; }
.room-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.viewer-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(20px, 4vw, 56px);
  background:
    radial-gradient(900px 600px at 50% 45%, rgba(44, 65, 96, .6), transparent 72%),
    #0a1322;
  text-align: center;
}
.viewer-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); }
.viewer-brand { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; }
.viewer-brand .brand-mark { width: 28px; height: 28px; border-radius: 9px; font-size: 14px; }
.viewer-main { width: min(1100px, 100%); margin: auto; padding: 5vh 0; }
.viewer-title { max-width: 92vw; margin: 0; color: var(--lime); text-transform: uppercase; font-size: clamp(20px, 3.1vw, 44px); font-weight: 780; line-height: 1.08; letter-spacing: .13em; text-wrap: balance; }
.viewer-speaker { margin: 12px 0 0; color: #bdc9da; font-size: clamp(16px, 2.2vw, 24px); }
.viewer-clock {
  margin: clamp(18px, 4vh, 42px) 0;
  font-size: clamp(100px, 24vw, 320px);
  font-weight: 650;
  line-height: .9;
  letter-spacing: -.085em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.viewer-clock.warn { color: var(--amber); }
.viewer-clock.over { color: var(--coral); }
.viewer-progress { width: min(760px, 80%); height: 9px; margin: 0 auto; background: rgba(255,255,255,.08); border-radius: 10px; overflow: hidden; }
.viewer-progress span { display: block; width: 0; height: 100%; background: var(--lime); border-radius: inherit; }
.viewer-progress span.warn { background: var(--amber); }
.viewer-progress span.over { background: var(--coral); }
.viewer-next { min-height: 66px; color: var(--muted); }
.viewer-next-label { margin: 0 0 8px; text-transform: uppercase; letter-spacing: .16em; font-size: 10px; font-weight: 760; }
.viewer-next-title { color: #d9e2ef; font-size: clamp(14px, 2vw, 20px); }
.viewer-next-speaker { margin-top: 4px; font-size: 12px; }
.viewer-empty { color: var(--muted); font-size: 18px; }
.viewer-fullscreen { position: fixed; right: 22px; bottom: 18px; opacity: .28; }
.viewer-fullscreen:hover { opacity: 1; }

dialog {
  width: min(440px, calc(100% - 28px));
  padding: 0;
  color: var(--text);
  background: #172640;
  border: 1px solid rgba(214,225,241,.16);
  border-radius: 19px;
  box-shadow: 0 30px 100px rgba(0,0,0,.5);
  opacity: 0;
  transform: translateY(10px) scale(.985);
  transition: opacity 190ms cubic-bezier(.2,.7,.25,1), transform 190ms cubic-bezier(.2,.7,.25,1), display 190ms allow-discrete, overlay 190ms allow-discrete;
}
dialog[open] { opacity: 1; transform: translateY(0) scale(1); }
dialog::backdrop {
  background: rgba(4,9,17,0);
  backdrop-filter: blur(0);
  transition: background-color 190ms ease, backdrop-filter 190ms ease, display 190ms allow-discrete, overlay 190ms allow-discrete;
}
dialog[open]::backdrop { background: rgba(4,9,17,.74); backdrop-filter: blur(4px); }
@starting-style {
  dialog[open] { opacity: 0; transform: translateY(10px) scale(.985); }
  dialog[open]::backdrop { background: rgba(4,9,17,0); backdrop-filter: blur(0); }
}
.dialog-body { padding: 24px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.field { display: grid; gap: 7px; margin: 13px 0; }
.field label { color: #c5d0df; font-size: 11px; font-weight: 680; }
.field input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(214,225,241,.14);
  border-radius: 10px;
  background: rgba(3,10,20,.3);
  color: var(--text);
}
.field input::placeholder { color: #71819a; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 21px; }
.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  padding: 11px 16px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 11px;
  background: #263957;
  color: var(--text);
  box-shadow: 0 12px 34px rgba(0,0,0,.25);
  font-size: 12px;
  transition: opacity 190ms cubic-bezier(.2,.7,.25,1), transform 190ms cubic-bezier(.2,.7,.25,1);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.back-link { display: inline-flex; align-items: center; text-decoration: none; }
.clipboard-fallback { position: fixed; top: 0; left: -10000px; opacity: 0; }
.error-page { padding: 28px; width: min(580px, calc(100% - 40px)); margin: 12vh auto; }
.error-page h1 { margin: 22px 0 8px; font-size: 32px; letter-spacing: -.05em; }
.error-page p { color: var(--muted); line-height: 1.6; }
.error-page .btn-row { margin-top: 22px; }

@media (max-width: 900px) {
  .landing-hero { grid-template-columns: 1fr; gap: 38px; padding-top: 70px; }
  .hero-mini { width: min(560px, 100%); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .landing, .page-shell { width: min(100% - 28px, 1440px); }
  .landing { padding-top: 18px; }
  .nav-note { display: none; }
  .landing-hero { padding: 58px 0 56px; gap: 32px; }
  .landing h1 { font-size: clamp(46px, 15vw, 68px); }
  .hero-copy { font-size: 16px; }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .landing-footer { flex-direction: column; }
  .page-shell { padding-top: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .topbar-left { align-items: flex-start; }
  .dashboard-title { font-size: 20px; }
  .control-panel, .rundown-panel { padding: 18px; border-radius: 16px; }
  .clock-wrap { padding: 27px 0 20px; }
  .clock-value { font-size: clamp(62px, 17vw, 92px); }
  .control-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .control-buttons .btn-primary { min-width: 0; grid-column: span 2; }
  .time-adjust { margin-top: 8px; }
  .rundown-item { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; padding: 10px 8px; }
  .item-actions .icon-btn { width: 28px; height: 30px; }
  .item-actions .edit-label { display: none; }
  .viewer-screen { padding: 18px; }
  .viewer-header { font-size: 10px; }
  .viewer-clock { font-size: clamp(82px, 21vw, 150px); }
  .viewer-progress { width: 88%; height: 7px; }
  .viewer-fullscreen { right: 12px; bottom: 10px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
}
/* Operator desk layout */
.page-shell { width: min(1760px, calc(100% - 36px)); padding-top: 18px; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(270px, .78fr) minmax(430px, 1.35fr) minmax(280px, .78fr);
  gap: 14px;
  align-items: start;
}
.left-rail { display: grid; gap: 14px; min-width: 0; }
.control-panel, .rundown-panel, .messages-panel, .summary-panel { padding: 18px; border-radius: 14px; }
.panel { background: #171e2a; border-color: rgba(214,225,241,.11); box-shadow: 0 14px 36px rgba(0,0,0,.16); }
.panel-heading { align-items: center; }
.panel-heading h2, .section-title-row h2 { font-size: 14px; }
.panel-heading p { font-size: 11px; }
.dashboard-title { font-size: 19px; }
.stage-preview {
  position: relative;
  overflow: hidden;
  min-height: 250px;
  margin: 16px 0 14px;
  padding: 13px 16px 18px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: radial-gradient(ellipse at 50% 54%, #263142 0%, #111722 76%);
  text-align: center;
}
.preview-topline { display: flex; align-items: center; justify-content: flex-start; gap: 7px; color: #93a4bc; font-size: 9px; font-weight: 800; letter-spacing: .11em; }
.preview-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px rgba(200,241,105,.7); }
.preview-timer { margin: 24px 0 11px; color: var(--text); font-size: clamp(50px, 5vw, 74px); font-weight: 720; line-height: .95; letter-spacing: -.07em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.preview-timer.warn { color: var(--amber); }
.preview-timer.over { color: var(--coral); }
.preview-segment { color: #e6edf7; font-size: 13px; font-weight: 740; overflow-wrap: anywhere; }
.preview-speaker { min-height: 17px; margin-top: 4px; color: var(--muted); font-size: 11px; }
.preview-message { margin: 10px auto 0; padding: 6px 9px; width: fit-content; max-width: 100%; border-radius: 5px; background: rgba(0,0,0,.55); font-size: 11px; }
.preview-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 5px; background: rgba(255,255,255,.09); }
.preview-progress span { display: block; height: 100%; width: 0; background: var(--lime); transition: width 160ms linear; }
.preview-progress span.warn { background: var(--amber); }
.preview-progress span.over { background: var(--coral); }
.stage-preview.hide-stage-speaker .preview-speaker,
.stage-preview.hide-stage-progress .preview-progress { display: none; }
.compact-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.compact-controls .btn { min-height: 36px; padding: 0 8px; font-size: 11px; border-radius: 8px; }
.compact-controls .btn-primary { min-width: 0; grid-column: span 2; }
.time-adjust { margin-top: 6px; }
.control-footnote { margin-top: 12px; font-size: 10px; line-height: 1.45; }
.summary-panel { display: grid; gap: 0; }
.summary-time { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.summary-time span { color: var(--muted); }
.summary-time strong { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.summary-panel .room-tools { margin-top: 12px; }
.rundown-panel { min-height: 390px; }
.rundown-list { gap: 8px; }
.rundown-item { grid-template-columns: 30px minmax(0,1fr) auto; gap: 8px; padding: 11px 9px; border-radius: 10px; background: rgba(255,255,255,.035); }
.rundown-item.selected { border-color: rgba(255,121,125,.52); background: rgba(169,31,37,.72); }
.selected .item-index { background: rgba(255,255,255,.14); color: #fff; }
.item-title { font-size: 12px; }
.item-meta { font-size: 10px; }
.item-duration { font-size: 11px; }
.item-actions .icon-btn { width: 27px; height: 29px; }
.messages-panel { min-height: 300px; }
.messages-panel .section-title-row { margin-bottom: 12px; }
.message-form { display: grid; gap: 10px; }
.message-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  padding: 12px;
  color: var(--text);
  background: #101721;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
}
.message-form textarea::placeholder { color: #738198; }
.message-options { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.field-inline { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.field-inline select {
  max-width: 100px;
  padding: 6px 24px 6px 8px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #202a39;
  font: inherit;
}
.toggle-option { display: inline-flex; align-items: center; gap: 5px; color: #c7d2e2; font-size: 10px; }
.toggle-option input { accent-color: var(--lime); }
.add-message { justify-self: center; min-height: 34px; border-radius: 8px; font-size: 11px; }
.message-list { display: grid; gap: 8px; margin-top: 14px; }
.message-card { padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); }
.message-card.is-showing { border-color: rgba(200,241,105,.45); background: rgba(200,241,105,.06); }
.message-card-copy { display: flex; align-items: flex-start; gap: 8px; }
.message-swatch { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #fff; }
.message-text { flex: 1; margin: 0; color: #e8edf6; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.message-text.is-bold, .preview-message.is-bold, .viewer-message.is-bold { font-weight: 800; }
.message-text.is-uppercase, .preview-message.is-uppercase, .viewer-message.is-uppercase { text-transform: uppercase; }
.message-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.message-state { margin-right: auto; color: var(--muted); font-size: 9px; }
.message-card-actions .btn { min-height: 28px; border-radius: 7px; font-size: 10px; }
.message-card-actions .icon-btn { width: 28px; height: 28px; }
.empty-messages { padding: 14px 10px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.swatch-white { color: #fff; }
.swatch-green { color: #5fefaa; }
.swatch-red { color: #ff7078; }
.swatch-amber { color: #ffd166; }
.swatch-blue { color: #72b7ff; }
.message-swatch.swatch-green { background: #5fefaa; }
.message-swatch.swatch-red { background: #ff7078; }
.message-swatch.swatch-amber { background: #ffd166; }
.message-swatch.swatch-blue { background: #72b7ff; }
.viewer-message {
  width: min(1000px, 92%);
  margin: -2vh auto 3vh;
  padding: 14px 22px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  font-size: clamp(20px, 4vw, 42px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: minmax(260px,.8fr) minmax(360px,1.2fr); }
  .messages-panel { grid-column: 1 / -1; }
  .message-list { grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); }
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .messages-panel { grid-column: auto; }
  .message-list { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page-shell { width: min(100% - 24px, 1760px); }
  .control-panel, .rundown-panel, .messages-panel, .summary-panel { padding: 14px; }
  .rundown-item { grid-template-columns: 26px minmax(0,1fr) auto; }
  .rundown-item .item-actions { gap: 0; }
  .message-options { gap: 8px; }
}
/* Subtle motion throughout CueClock */
@keyframes cueclock-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cueclock-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .62; transform: scale(.84); }
}
.page-shell { animation: cueclock-enter 360ms cubic-bezier(.2,.7,.25,1) both; }
.landing-nav, .landing-hero > *, .landing-footer { animation: cueclock-enter 420ms cubic-bezier(.2,.7,.25,1) both; }
.landing-hero > *:nth-child(2) { animation-delay: 70ms; }
.hero-mini, .stage-preview { transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease; }
.hero-mini:hover, .stage-preview:hover { border-color: rgba(200,241,105,.23); box-shadow: 0 16px 42px rgba(0,0,0,.18); }
.panel { transition: border-color 220ms ease, box-shadow 220ms ease, background-color 220ms ease; }
.panel:hover { border-color: rgba(214,225,241,.19); }
.dashboard-grid > * { animation: cueclock-enter 380ms cubic-bezier(.2,.7,.25,1) both; }
.dashboard-grid > :nth-child(2) { animation-delay: 55ms; }
.dashboard-grid > :nth-child(3) { animation-delay: 100ms; }
.left-rail > :nth-child(2) { animation: cueclock-enter 420ms cubic-bezier(.2,.7,.25,1) 80ms both; }
.rundown-item {
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
  animation: cueclock-enter 300ms ease both;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.rundown-item:nth-child(2) { animation-delay: 35ms; }
.rundown-item:nth-child(3) { animation-delay: 70ms; }
.rundown-item:nth-child(4) { animation-delay: 105ms; }
.rundown-item:hover { transform: translateY(-1px); border-color: rgba(214,225,241,.25); }
.rundown-item.selected { box-shadow: inset 3px 0 rgba(255,255,255,.45), 0 5px 16px rgba(169,31,37,.12); }
.rundown-item.is-dragging { pointer-events: none; cursor: grabbing; opacity: .24; border-style: dashed; border-color: rgba(200,241,105,.58); background: rgba(200,241,105,.045); box-shadow: none; transform: none; }
.rundown-drag-ghost { position: fixed; z-index: 1000; pointer-events: none; opacity: .98; border-color: rgba(200,241,105,.66); background: #22334f; box-shadow: 0 18px 42px rgba(0,0,0,.38), 0 0 0 1px rgba(200,241,105,.15); will-change: transform; cursor: grabbing; animation: cueclock-drag-lift 150ms ease-out both; }
@keyframes cueclock-drag-lift { from { opacity: .78; filter: brightness(.94); } to { opacity: .98; filter: brightness(1.04); } }
.rundown-item.drop-before { border-top-color: var(--lime); box-shadow: inset 0 2px var(--lime), 0 0 0 1px rgba(200,241,105,.13); }
.rundown-item.drop-after { border-bottom-color: var(--lime); box-shadow: inset 0 -2px var(--lime), 0 0 0 1px rgba(200,241,105,.13); }
.message-card { transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease; animation: cueclock-enter 300ms ease both; }
.message-card:hover { transform: translateY(-1px); }
.message-card.is-showing { box-shadow: 0 0 0 1px rgba(200,241,105,.06); }
.message-card-actions .btn, .icon-btn { transition: transform 140ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
.btn:active, .icon-btn:active { transform: scale(.975); }
.preview-timer, .clock-value, .viewer-clock { transition: color 240ms ease; animation: cueclock-enter 280ms ease both; }
.preview-live-dot.active, .online-status:not(.offline)::before, .state-pill:not(.paused)::before { animation: cueclock-pulse 1.8s ease-in-out infinite; }
.state-pill:not(.paused)::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.viewer-message { animation: cueclock-enter 320ms ease both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
.viewer-message-slot { display: contents; }

@keyframes cueclock-exit {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(.985); }
}
.preview-message.is-hiding, .viewer-message.is-hiding {
  animation: cueclock-exit 220ms cubic-bezier(.35,0,.7,.3) both;
  pointer-events: none;
}
/* The timer owns the center; a message smoothly claims space beneath it when shown. */
.viewer-screen { padding: clamp(8px, 1.7vh, 20px) clamp(20px, 4vw, 56px); }
.viewer-main {
  width: min(1100px, 100%);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: clamp(4px, 1.4vh, 14px) 0;
}
.viewer-clock {
  flex: 0 0 auto;
  margin: clamp(8px, 2vh, 24px) 0;
  font-size: clamp(120px, min(34vw, 56vh), 540px);
  transition: color 240ms ease, font-size 420ms cubic-bezier(.2,.7,.25,1), margin 420ms cubic-bezier(.2,.7,.25,1);
}
.viewer-screen.has-message .viewer-clock {
  font-size: clamp(100px, min(25vw, 42vh), 360px);
}
.viewer-message-slot {
  display: grid;
  grid-template-rows: 0fr;
  width: min(1000px, 92vw);
  margin: 0 auto;
  opacity: 0;
  overflow: hidden;
  transition: grid-template-rows 420ms cubic-bezier(.2,.7,.25,1), margin 420ms cubic-bezier(.2,.7,.25,1), opacity 220ms ease;
}
.viewer-screen.has-message .viewer-message-slot {
  grid-template-rows: 1fr;
  margin: clamp(10px, 1.8vh, 18px) auto 0;
  opacity: 1;
}
.viewer-message-slot .viewer-message {
  width: 100%;
  min-height: 0;
  margin: 0;
  align-self: center;
  font-size: clamp(20px, 4vw, 42px);
  padding: 14px 22px;
}
.viewer-next { flex: 0 0 auto; }
@media (max-height: 520px) {
  .viewer-screen { padding-top: 8px; padding-bottom: 8px; }
  .viewer-main { padding-top: 2px; padding-bottom: 2px; }
  .viewer-clock { margin: clamp(4px, 1.2vh, 10px) 0; font-size: clamp(96px, min(34vw, 44vh), 400px); }
  .viewer-screen.has-message .viewer-clock { font-size: clamp(80px, min(25vw, 31vh), 300px); }
  .viewer-screen.has-message .viewer-message-slot { margin-top: 8px; }
  .viewer-screen.has-message .viewer-message { font-size: clamp(20px, min(4vw, 7vh), 34px); padding: 10px 18px; }
  .viewer-next { min-height: 46px; }
  .viewer-next-label { margin-bottom: 4px; }
}
.events-dialog { width: min(560px, calc(100% - 28px)); height: min(88vh, 720px); max-height: min(88vh, 720px); overflow: hidden; }
.events-dialog > .dialog-body { display: flex; height: 100%; min-height: 0; flex-direction: column; overflow: hidden; }
.events-dialog .dialog-head, .events-dialog .event-tabs, .events-dialog .dialog-actions { flex: 0 0 auto; }
.events-dialog .saved-event-list { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 0; max-height: none; overflow: auto; }
.event-tabs { display: flex; gap: 5px; margin: 0 0 12px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(3,10,20,.22); }
.event-tab { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 7px; min-height: 34px; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; }
.event-tab span { display: grid; min-width: 19px; height: 19px; place-items: center; border-radius: 7px; background: rgba(255,255,255,.06); font-size: 10px; }
.event-tab.is-active { background: rgba(255,255,255,.08); color: var(--text); }
.event-tab.is-active span { background: rgba(200,241,105,.14); color: var(--lime); }
.saved-event-list { display: grid; gap: 8px; max-height: min(54vh, 440px); overflow: auto; padding: 1px 3px 1px 1px; }
.saved-event-card { position: relative; display: flex; flex-direction: column; gap: 10px; width: 100%; min-width: 0; min-height: 140px; padding: 12px 52px 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.035); text-align: left; transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease; }
.saved-event-content { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 0 13px; width: 100%; min-width: 0; }
.saved-event-card.is-archived { background: rgba(255,255,255,.018); }
.saved-event-card:hover { transform: translateY(-1px); border-color: rgba(200,241,105,.4); background: rgba(200,241,105,.055); }
.saved-event-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(200,241,105,.22); border-radius: 12px; color: var(--lime); background: rgba(200,241,105,.07); font-size: 19px; }
.saved-event-copy { display: grid; width: 100%; min-width: 0; gap: 5px; }
.saved-event-copy strong { overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.saved-event-copy small { color: var(--muted); font-size: 11px; }
.saved-event-last-used { color: #8090a8; font-size: 10px; }
.saved-event-preview { display: -webkit-box; overflow: hidden; color: #c4cfdf; font-size: 10px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.saved-event-actions { display: flex; width: auto; min-width: 0; min-height: 42px; flex-wrap: wrap; align-items: center; gap: 5px; margin-left: 51px; }
.saved-event-actions .btn { min-height: 30px; padding: 0 9px; white-space: nowrap; font-size: 11px; }
.event-options-trigger { position: absolute; z-index: 1; top: 8px; right: 8px; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.045); color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease; }
.event-options-trigger:hover, .event-options-trigger[aria-expanded="true"] { border-color: rgba(200,241,105,.3); background: rgba(200,241,105,.08); color: var(--lime); }
.event-options-trigger:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.saved-event-options-menu { position: fixed; inset: auto; z-index: 100; min-width: 150px; max-width: min(220px, calc(100vw - 16px)); max-height: min(70vh, 280px); overflow: auto; margin: 0; padding: 6px; border: 1px solid rgba(214,225,241,.16); border-radius: 12px; background: #1b2b46; color: var(--text); box-shadow: 0 14px 38px rgba(0,0,0,.38); opacity: 0; transform: translateY(-5px) scale(.985); transform-origin: top right; transition: opacity 150ms ease, transform 150ms cubic-bezier(.2,.7,.25,1), display 150ms allow-discrete, overlay 150ms allow-discrete; }
.saved-event-options-menu:popover-open { display: grid; gap: 3px; opacity: 1; transform: translateY(0) scale(1); }
@starting-style {
  .saved-event-options-menu:popover-open { opacity: 0; transform: translateY(-5px) scale(.985); }
}
.saved-event-options-menu button { display: flex; width: 100%; min-height: 36px; align-items: center; justify-content: flex-start; padding: 0 10px; border-radius: 8px; background: transparent; color: #dce5f1; font-size: 12px; text-align: left; }
.saved-event-options-menu button:hover { background: rgba(255,255,255,.07); color: var(--text); }
.events-loading { padding: 28px 12px; color: var(--muted); text-align: center; font-size: 12px; }
.events-empty { display: grid; justify-items: center; gap: 10px; padding: 24px 14px 12px; text-align: center; }
.events-empty-mark { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 16px; color: var(--lime); background: rgba(200,241,105,.08); font-size: 23px; }
.events-empty strong { font-size: 14px; }
.events-empty p { max-width: 330px; margin: 0 0 4px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.template-dialog { width: min(760px, calc(100% - 28px)); max-height: min(90vh, 780px); overflow: auto; }
.optional-label { color: var(--muted); font-weight: 500; }
.template-field .field-label { color: #c5d0df; font-size: 11px; font-weight: 680; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.template-option { position: relative; min-width: 0; }
.template-option input { position: absolute; inset: 12px auto auto 12px; opacity: 0; }
.template-option-card {
  display: flex;
  min-height: 94px;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
.template-option:hover .template-option-card { transform: translateY(-1px); border-color: rgba(214,225,241,.25); }
.template-option input:checked + .template-option-card { border-color: rgba(200,241,105,.72); background: rgba(200,241,105,.075); box-shadow: inset 0 0 0 1px rgba(200,241,105,.18); }
.template-option input:focus-visible + .template-option-card { outline: 2px solid var(--lime); outline-offset: 3px; }
.template-option-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.template-option-head strong { font-size: 13px; }
.template-option-head small { color: var(--lime); font-size: 10px; white-space: nowrap; }
.template-option-description { color: var(--muted); font-size: 11px; line-height: 1.45; }
@media (max-width: 600px) {
  .template-grid { grid-template-columns: 1fr; }
  .template-option-card { min-height: 72px; }
}
@media (max-width: 520px) {
  .saved-event-card { gap: 9px; min-height: 148px; padding: 11px 48px 11px 11px; }
  .saved-event-content { grid-template-columns: 32px minmax(0,1fr); column-gap: 9px; }
  .saved-event-copy, .saved-event-actions { min-width: 0; }
  .saved-event-actions { margin-left: 41px; }
  .saved-event-icon { width: 32px; height: 32px; }
  .saved-event-actions .btn { flex: 1 1 90px; min-width: 0; max-width: 100%; }
}

/* Polished timer progress: clear state, soft depth, and a restrained live shimmer. */
.viewer-progress,
.preview-progress {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(220,232,249,.14);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.105), rgba(255,255,255,.045));
  box-shadow: inset 0 1px 2px rgba(0,0,0,.42), 0 0 0 1px rgba(0,0,0,.08);
}
.viewer-progress { height: 8px; }
.preview-progress { position: absolute; left: 14px; right: 14px; bottom: 10px; height: 6px; }
.viewer-progress span,
.preview-progress span {
  position: relative;
  display: block;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, #94d746, var(--lime));
  box-shadow: 0 0 12px rgba(200,241,105,.34);
  transition: width 110ms linear, background 220ms ease, box-shadow 220ms ease;
  will-change: width;
}
.viewer-progress span::after,
.preview-progress span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.36) 50%, transparent 65%);
  background-size: 220% 100%;
  background-position: 100% 0;
  opacity: 0;
}
.viewer-progress.is-running span::after,
.preview-progress.is-running span::after { opacity: .8; animation: cueclock-progress-sheen 2.4s ease-in-out infinite; }
.viewer-progress span.warn,
.preview-progress span.warn { background: linear-gradient(90deg, #e7a93e, var(--amber)); box-shadow: 0 0 13px rgba(255,198,109,.35); }
.viewer-progress span.over,
.preview-progress span.over { background: linear-gradient(90deg, #ee686f, var(--coral)); box-shadow: 0 0 14px rgba(255,121,125,.42); }
.viewer-progress.is-over,
.preview-progress.is-over { border-color: rgba(255,121,125,.34); }
@keyframes cueclock-progress-sheen {
  0%, 18% { background-position: 100% 0; }
  78%, 100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .viewer-progress span::after,
  .preview-progress span::after { animation: none !important; }
}

@keyframes cueclock-mobile-enter { from { opacity: 0; } to { opacity: 1; } }

/* Focused, single-screen controller opened from a mobile control link. */
.mobile-reset-action { display: none; }
.mobile-controller {
  position: relative;
  display: flex;
  width: min(680px, calc(100% - 24px));
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  padding: max(8px, env(safe-area-inset-top)) 0 calc(92px + env(safe-area-inset-bottom));
  animation: cueclock-mobile-enter 360ms ease both;
}
body.mobile-controller-active { overflow: hidden; overscroll-behavior: none; }
.mobile-controller .topbar {
  flex: 0 0 auto;
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
  padding: 0 0 10px;
}
.mobile-controller .topbar-left { gap: 9px; min-width: 0; }
.mobile-controller .topbar-left .brand-word { display: none; }
.mobile-controller .dashboard-title { max-width: 100%; font-size: 17px; overflow-wrap: anywhere; }
.mobile-controller .topbar-actions { width: 100%; justify-content: space-between; }
.mobile-controller .connection-notice { flex: 0 0 auto; margin: 0 0 7px; padding: 8px 10px; border-radius: 10px; font-size: 10px; }
.mobile-controller [data-action="copy-mobile-control"] { display: none; }
.mobile-controller .dashboard-grid {
  flex: 1 1 auto;
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  overflow: hidden;
}
.mobile-controller .left-rail { display: contents; }
.mobile-controller .summary-panel,
.mobile-controller .rundown-panel,
.mobile-controller .messages-panel { display: none; }
.mobile-controller .control-panel {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  padding: 12px;
  border-radius: 18px;
}
.mobile-controller .panel-heading { display: none; }
.mobile-controller .stage-preview {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  flex-direction: column;
  justify-content: center;
  margin: 0 0 10px;
  padding: 18px 12px 24px;
  border-radius: 15px;
}
.mobile-controller .preview-topline { position: absolute; top: 14px; left: 14px; }
.mobile-controller .preview-timer {
  max-width: 100%;
  margin: 14px auto 12px;
  font-size: clamp(58px, 18vw, 136px);
  letter-spacing: -.075em;
}
.mobile-controller .preview-segment { font-size: clamp(15px, 4.4vw, 22px); }
.mobile-controller .preview-speaker { font-size: 12px; }
.mobile-controller .preview-message { font-size: 13px; }
.mobile-controller .control-buttons { display: none; }
.mobile-controller .time-adjust {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 0;
}
.mobile-controller .time-adjust .btn {
  min-width: 0;
  min-height: 60px;
  padding: 0 6px;
  border-radius: 13px;
  font-size: 15px;
}
.mobile-controller .time-adjust .mobile-reset-action { display: inline-flex; }
.mobile-controller .control-footnote { display: none; }
.mobile-controller .mobile-action-dock {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(120px, 1.3fr) minmax(0, .9fr);
  gap: 8px;
  width: min(680px, calc(100% - 16px));
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border: 1px solid rgba(214,225,241,.14);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: rgba(16,26,46,.96);
  box-shadow: 0 -12px 36px rgba(0,0,0,.3);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.mobile-controller .mobile-action-dock .btn {
  min-width: 0;
  min-height: 64px;
  padding: 0 8px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 760;
  touch-action: manipulation;
}
.mobile-controller .mobile-action-dock .mobile-dock-main {
  min-height: 70px;
  font-size: 20px;
  letter-spacing: .01em;
  box-shadow: 0 8px 24px rgba(200,241,105,.2);
}
.mobile-controller .mobile-action-dock .btn:active,
.mobile-controller .time-adjust .btn:active { transform: scale(.97); }
@media (max-width: 380px) {
  .mobile-controller { width: calc(100% - 18px); }
  .mobile-controller .mobile-action-dock { width: calc(100% - 12px); gap: 6px; padding-right: 7px; padding-left: 7px; }
  .mobile-controller .mobile-action-dock .btn { font-size: 12px; }
  .mobile-controller .mobile-action-dock .mobile-dock-main { font-size: 18px; }
  .mobile-controller .time-adjust { gap: 6px; }
  .mobile-controller .time-adjust .btn { min-height: 54px; font-size: 12px; }
}
@media (max-height: 560px) {
  .mobile-controller { padding-top: 4px; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .mobile-controller .topbar { gap: 4px; padding-bottom: 6px; }
  .mobile-controller .dashboard-title { font-size: 14px; }
  .mobile-controller .control-panel { padding: 8px; }
  .mobile-controller .stage-preview { margin-bottom: 6px; padding: 12px 8px 18px; }
  .mobile-controller .preview-timer { margin: 8px auto; font-size: clamp(42px, 15vh, 76px); }
  .mobile-controller .preview-segment { font-size: 14px; }
  .mobile-controller .time-adjust .btn { min-height: 44px; }
  .mobile-controller .mobile-action-dock { gap: 6px; padding: 6px 7px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-controller .mobile-action-dock .btn { min-height: 48px; font-size: 12px; }
  .mobile-controller .mobile-action-dock .mobile-dock-main { min-height: 52px; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-controller .mobile-action-dock .btn,
  .mobile-controller .time-adjust .btn { transition: none; }
}

/* Stable character slots keep the clock centered through every digit roll. */
.preview-timer,
.viewer-clock {
  display: grid;
  height: 1em;
  place-items: center;
  overflow: visible;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.clock-visual {
  display: inline-flex;
  width: max-content;
  height: 100%;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: inherit;
  letter-spacing: 0;
  white-space: nowrap;
}
.clock-glyph {
  box-sizing: border-box;
  display: inline-flex;
  width: 1ch;
  height: 100%;
  flex: 0 0 1ch;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  line-height: inherit;
  letter-spacing: 0;
  white-space: pre;
}
.clock-glyph-digit,
.clock-glyph-sign { width: 1ch; flex-basis: 1ch; }
.clock-glyph-colon { width: .52ch; flex-basis: .52ch; }
.clock-digit-roll {
  position: relative;
  display: grid;
  overflow: hidden;
  grid-template-areas: "digit";
  grid-template-columns: minmax(0, 1fr);
}
.clock-digit-old,
.clock-digit-new {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  place-items: center;
  grid-area: digit;
  line-height: inherit;
  will-change: transform, opacity;
}
.clock-digit-old { animation: cueclock-digit-up 220ms cubic-bezier(.22,.61,.36,1) both; }
.clock-digit-new { animation: cueclock-digit-in 260ms cubic-bezier(.22,.61,.36,1) var(--digit-delay, 0ms) both; }
.clock-line-rolling { animation: cueclock-clock-fade 160ms ease-out both; }
@keyframes cueclock-digit-up {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-64%); opacity: 0; }
}
@keyframes cueclock-digit-in {
  from { transform: translateY(64%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes cueclock-clock-fade {
  from { opacity: .82; }
  to { opacity: 1; }
}
.viewer-screen { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.viewer-clock { font-size: clamp(120px, min(34vw, 56vh), 540px); }
.viewer-screen.has-message .viewer-clock { font-size: clamp(100px, min(25vw, 42vh), 360px); }
@media (max-width: 800px) {
  .viewer-clock { font-size: clamp(50px, min(34vw, 44vh), 260px); }
  .viewer-screen.has-message .viewer-clock { font-size: clamp(42px, min(25vw, 31vh), 200px); }
  .mobile-controller .preview-timer { font-size: clamp(40px, 14vw, 112px); }
}
@media (max-width: 400px) {
  .viewer-clock { font-size: clamp(40px, min(34vw, 35vh), 180px); }
  .viewer-screen.has-message .viewer-clock { font-size: clamp(36px, min(24vw, 25vh), 144px); }
  .mobile-controller .preview-timer { font-size: clamp(38px, 14vw, 56px); }
}
@media (prefers-reduced-motion: reduce) {
  .clock-digit-old,
  .clock-digit-new,
  .clock-line-rolling { animation: none; }
}
/* Keep the mobile controller fixed like an app while the timer list scrolls inside its own panel. */
.mobile-controller .dashboard-grid {
  grid-template-rows: minmax(0, 1fr) minmax(120px, .9fr);
  gap: 8px;
}
.mobile-controller .rundown-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  overflow: hidden;
  padding: 10px;
}
.mobile-controller .rundown-panel .section-title-row {
  flex: 0 0 auto;
  margin-bottom: 7px;
}
.mobile-controller .rundown-panel .section-title-row h2 { font-size: 13px; }
.mobile-controller .rundown-panel .section-title-row .item-count { font-size: 10px; }
.mobile-controller .rundown-panel .section-title-row .btn { min-height: 32px; padding: 0 9px; font-size: 11px; }
.mobile-controller .rundown-list {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1px 3px 3px 1px;
}
.mobile-controller .rundown-item {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 2px 6px;
  min-height: 46px;
  flex: 0 0 auto;
  padding: 3px 6px;
  touch-action: pan-y;
  cursor: pointer;
}
.mobile-controller .rundown-item .item-index {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 23px;
  height: 23px;
}
.mobile-controller .rundown-item .item-main {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 0;
}
.mobile-controller .rundown-item .item-title,
.mobile-controller .rundown-item .item-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-controller .rundown-item .item-title { font-size: 12px; }
.mobile-controller .rundown-item .item-meta { margin-top: 2px; font-size: 10px; }
.mobile-controller .rundown-item .item-duration { grid-column: 3; grid-row: 1; font-size: 10px; }
.mobile-controller .rundown-item .item-actions {
  grid-column: 3;
  grid-row: 2;
  align-self: center;
  justify-content: flex-end;
  margin: 0;
}
.mobile-controller .rundown-item .item-actions .icon-btn { width: 22px; height: 22px; }
.mobile-controller .rundown-panel .rundown-footer {
  flex: 0 0 auto;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  font-size: 9px;
}
.mobile-controller .rundown-panel .room-tools { display: none; }
@media (max-height: 560px) {
  .mobile-controller .dashboard-grid { grid-template-rows: minmax(0, 1fr) minmax(92px, .72fr); gap: 6px; }
  .mobile-controller .rundown-panel { padding: 7px; }
  .mobile-controller .rundown-panel .section-title-row { margin-bottom: 4px; }
  .mobile-controller .rundown-item { min-height: 44px; padding: 4px 6px; }
  .mobile-controller .rundown-item .item-index { width: 22px; height: 22px; }
  .mobile-controller .rundown-item .item-actions .icon-btn { width: 21px; height: 21px; }
  .mobile-controller .rundown-panel .rundown-footer { display: none; }
}@media (max-height: 560px) and (orientation: landscape) {
  .mobile-controller .topbar {
    align-items: center;
    flex-direction: row;
    gap: 6px;
    padding-bottom: 4px;
  }
  .mobile-controller .topbar-left { flex: 1 1 auto; }
  .mobile-controller .topbar-actions { width: auto; gap: 7px; }
  .mobile-controller .dashboard-grid { grid-template-rows: minmax(0, 1fr) minmax(100px, 1fr); }
  .mobile-controller .control-panel { padding: 6px; }
  .mobile-controller .stage-preview { margin-bottom: 4px; padding: 4px 8px 12px; }
  .mobile-controller .preview-topline,
  .mobile-controller .preview-speaker { display: none; }
  .mobile-controller .preview-timer { margin: 2px auto 4px; font-size: clamp(28px, 9vh, 46px); }
  .mobile-controller .preview-segment { font-size: 12px; }
  .mobile-controller .rundown-panel .section-title-row { margin-bottom: 3px; }
  .mobile-controller .rundown-panel .section-title-row h2 { font-size: 12px; }
  .mobile-controller .rundown-panel .section-title-row .btn { min-height: 27px; }
  .mobile-controller .rundown-item { min-height: 40px; padding: 2px 5px; }
  .mobile-controller .rundown-item .item-index { width: 21px; height: 21px; }
  .mobile-controller .rundown-item .item-actions .icon-btn { width: 19px; height: 19px; }
}@media (max-height: 560px) and (orientation: landscape) {
  .mobile-controller .preview-segment { font-size: 10px; }
  .mobile-controller .preview-progress { right: 8px; bottom: 2px; left: 8px; height: 4px; }
}
/* Mobile controller: keep the preview compact and give the rundown room to breathe. */
.mobile-controller .dashboard-grid {
  grid-template-rows: minmax(0, .82fr) minmax(190px, 1fr);
}
.mobile-controller .stage-preview {
  flex: 1 1 148px;
  min-height: 0;
  max-height: clamp(145px, 22vh, 188px);
  margin-bottom: 8px;
  padding: 14px 12px 20px;
}
.mobile-controller .preview-timer {
  margin: 8px auto 7px;
  font-size: clamp(48px, 14vw, 88px);
}
.mobile-controller .rundown-panel .section-title-row {
  justify-content: flex-end;
  margin-bottom: 6px;
}
.mobile-controller .rundown-panel .section-title-row > div { display: none; }
.mobile-controller .rundown-list {
  padding: 7px;
  border: 1px solid rgba(214,225,241,.15);
  border-radius: 15px;
  background: rgba(8,14,25,.34);
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
.mobile-controller .rundown-item {
  border-radius: 10px;
  background: rgba(255,255,255,.045);
}
.mobile-controller .rundown-item.selected {
  border-color: rgba(200,241,105,.56);
  background: linear-gradient(105deg, rgba(200,241,105,.16), rgba(200,241,105,.07));
  box-shadow: inset 3px 0 var(--lime), 0 4px 14px rgba(0,0,0,.14);
}
.mobile-controller .rundown-panel .rundown-footer { display: none; }
.mobile-controller .time-adjust .btn {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .01em;
}
.mobile-controller .time-adjust [data-command="minus30"] {
  color: #fff;
  border: 1px solid rgba(255,121,125,.55);
  background: linear-gradient(145deg, #a82f3a, #7f202c);
  box-shadow: 0 6px 18px rgba(255,75,85,.18);
}
.mobile-controller .time-adjust [data-command="minus30"]:hover {
  background: linear-gradient(145deg, #bd3945, #922734);
}
.mobile-controller .time-adjust [data-command="plus30"] {
  color: #1c2a10;
  border: 1px solid rgba(200,241,105,.7);
  background: linear-gradient(145deg, #d9fa91, #b8e955);
  box-shadow: 0 6px 18px rgba(200,241,105,.17);
}
.mobile-controller .time-adjust [data-command="plus30"]:hover {
  background: linear-gradient(145deg, #e3ffa5, #c8f169);
}
.mobile-controller .time-adjust .mobile-reset-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  text-align: center;
  line-height: 1.15;
  white-space: normal;
}
@media (max-height: 560px) {
  .mobile-controller .dashboard-grid {
    grid-template-rows: minmax(0, 1fr) minmax(130px, .9fr);
  }
}
@media (max-height: 560px) and (orientation: landscape) {
  .mobile-controller .stage-preview {
    flex-basis: 110px;
    max-height: clamp(105px, 30vh, 138px);
  }
}

.mobile-controller .rundown-list::after {
  content: "";
  flex: 0 0 var(--mobile-active-tail, 0px);
  pointer-events: none;
}

@media (max-height: 560px) and (orientation: landscape) {
  .mobile-controller .dashboard-grid {
    grid-template-columns: minmax(0, .84fr) minmax(0, 1.16fr);
    grid-template-rows: minmax(0, 1fr);
  }
}

/* Touch-first rundown: scroll with a swipe, lift a card with a press-and-hold. */
.mobile-controller .rundown-item {
  min-height: 82px;
  padding: 10px;
  gap: 5px 8px;
  cursor: pointer;
  touch-action: pan-y;
}
.mobile-controller .rundown-item .item-index {
  width: 38px;
  height: 38px;
  font-size: 12px;
  touch-action: pan-y;
}
.mobile-controller .rundown-item .item-title { font-size: 15px; }
.mobile-controller .rundown-item .item-meta { margin-top: 4px; font-size: 12px; }
.mobile-controller .rundown-item .item-duration { font-size: 13px; }
.mobile-controller .rundown-item .item-actions { gap: 5px; }
.mobile-controller .rundown-item .item-actions .icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 18px;
}
.mobile-controller .rundown-list.is-reordering .rundown-item,
.mobile-controller .rundown-list.is-settled .rundown-item { animation: none; }
.mobile-controller .rundown-item.is-dragging { opacity: .14; transform: scale(.985); }
.rundown-drag-ghost {
  transform-origin: top left;
  border-color: rgba(200,241,105,.82);
  box-shadow: 0 22px 48px rgba(0,0,0,.46), 0 0 0 2px rgba(200,241,105,.2);
}
@media (max-height: 560px) and (orientation: landscape) {
  .mobile-controller .rundown-item { min-height: 64px; padding: 7px 8px; }
  .mobile-controller .rundown-item .item-index { width: 32px; height: 32px; }
  .mobile-controller .rundown-item .item-actions .icon-btn { width: 30px; height: 30px; }
  .mobile-controller .preview-timer { font-size: clamp(28px, 9vh, 46px); }
  .mobile-controller .time-adjust .btn { min-height: 42px; padding: 0 3px; font-size: 13px; }
  .mobile-controller .time-adjust .mobile-reset-action { font-size: 12px; white-space: nowrap; }
}

.mobile-controller .rundown-item { animation: none; }
@media (max-height: 560px) and (orientation: landscape) {
  .mobile-controller .rundown-item { grid-template-columns: 28px minmax(0, 1fr) auto; min-height: 58px; padding: 4px 6px; gap: 3px 6px; }
  .mobile-controller .rundown-item .item-index { width: 28px; height: 28px; }
  .mobile-controller .rundown-item .item-title { font-size: 14px; }
  .mobile-controller .rundown-item .item-meta { font-size: 11px; }
  .mobile-controller .rundown-item .item-duration { font-size: 11px; }
  .mobile-controller .rundown-item .item-actions { gap: 3px; }
  .mobile-controller .rundown-item .item-actions .icon-btn { width: 26px; height: 26px; }
}

/* Mobile controller keeps a preview selection separate from the live countdown. */
.mobile-controller .mobile-active-timer {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: -2px 6px 7px;
  padding: 5px 9px;
  border: 1px solid rgba(255,121,125,.34);
  border-radius: 10px;
  background: rgba(123,31,40,.22);
}
.mobile-controller .mobile-active-timer[hidden] { display: none; }
.mobile-controller .mobile-active-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff797d;
  box-shadow: 0 0 10px rgba(255,121,125,.55);
  animation: mobile-live-pulse 1.8s ease-in-out infinite;
}
.mobile-controller .mobile-active-copy { display: flex; min-width: 0; flex-direction: column; gap: 1px; }
.mobile-controller .mobile-active-copy small { color: #ff9699; font-size: 8px; font-weight: 800; letter-spacing: .09em; }
.mobile-controller .mobile-active-copy strong { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.mobile-controller .mobile-active-timer time { color: #ff898d; font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 800; }
.mobile-controller .rundown-item.is-running,
.mobile-controller .rundown-item.is-running.selected {
  border-color: rgba(255,121,125,.65);
  background: linear-gradient(105deg, rgba(169,31,37,.82), rgba(120,26,35,.68));
  box-shadow: inset 3px 0 #ff797d, 0 5px 16px rgba(169,31,37,.24);
}
.mobile-controller .rundown-item.is-running .item-index { border-color: rgba(255,121,125,.5); background: rgba(255,121,125,.22); color: #fff; }
@keyframes mobile-live-pulse { 50% { opacity: .52; box-shadow: 0 0 3px rgba(255,121,125,.3); } }
.preview-topline .alert-settings-trigger {
  min-height: 24px;
  margin-left: auto;
  padding: 0 8px;
  border: 1px solid rgba(214,225,241,.14);
  border-radius: 8px;
  background: rgba(255,255,255,.045);
  color: #b8c6d9;
  font-size: 9px;
  letter-spacing: 0;
}
.alert-settings-trigger.is-enabled { border-color: rgba(200,241,105,.35); color: var(--lime); }
.mobile-controller .preview-topline { right: 14px; width: auto; }
.timer-alerts-dialog .dialog-body { max-height: min(88vh, 520px); overflow-y: auto; }
.alert-settings-list { display: grid; gap: 7px; }
.alert-setting {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  border: 1px solid rgba(214,225,241,.11);
  border-radius: 11px;
  background: rgba(255,255,255,.035);
  color: var(--text);
}
.alert-setting > span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.alert-setting strong { font-size: 12px; font-weight: 700; }
.alert-setting small { color: var(--muted); font-size: 10px; }
.alert-setting input { width: 19px; height: 19px; flex: 0 0 auto; accent-color: var(--lime); }
.alert-warning-title { margin: 15px 0 7px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.stage-display-heading { margin-top: 18px; padding-top: 13px; border-top: 1px solid rgba(214,225,241,.11); }
.stage-display-settings .alert-setting { min-height: 42px; }
.alert-warning-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.alert-warning-options .alert-setting { min-height: 39px; justify-content: flex-start; gap: 6px; padding: 6px 8px; }
.alert-warning-options .alert-setting strong { font-size: 10px; white-space: nowrap; }
.alert-warning-options .alert-setting input { width: 16px; height: 16px; }
.alert-test-actions { display: flex; gap: 8px; margin-top: 12px; }
.alert-test-actions .btn { flex: 1; min-height: 36px; }
.timer-alerts-dialog .dialog-actions { margin-top: 12px; }
.keyboard-shortcuts-trigger { margin-left: 5px; padding: 0; border: 0; background: transparent; color: #b9c9df; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.keyboard-shortcuts-trigger:hover { color: var(--lime); }
.shortcuts-dialog .dialog-body { max-height: min(88vh, 480px); overflow-y: auto; }
.keyboard-shortcut-list { display: grid; gap: 7px; }
.keyboard-shortcut { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 11px; border: 1px solid rgba(214,225,241,.11); border-radius: 10px; background: rgba(255,255,255,.035); color: var(--text); font-size: 12px; }
.keyboard-shortcut kbd { min-width: 48px; padding: 4px 8px; border: 1px solid rgba(214,225,241,.2); border-bottom-width: 2px; border-radius: 7px; background: rgba(9,16,28,.48); color: #e6edf7; font-family: inherit; font-size: 11px; font-weight: 700; line-height: 1.2; text-align: center; }
.keyboard-shortcut-note { margin: 12px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.shortcuts-dialog .dialog-actions { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) {
  .mobile-controller .mobile-active-dot { animation: none; }
}
