:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --panel: #16191d;
  --border: #262b31;
  --text: #e8eaed;
  --muted: #8a919b;
  --accent: #3399ff;
  --accent-tint: rgba(51, 153, 255, 0.16);
  --done: #4a5057;
  --row-hover: #1b1f24;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #dde1e6;
  --text: #14171a;
  --muted: #6b7280;
  --accent: #0a6ed8;
  --accent-tint: rgba(10, 110, 216, 0.12);
  --done: #b8bec7;
  --row-hover: #eef1f4;
}

* { box-sizing: border-box; }

/* Author styles always beat the UA stylesheet's default `[hidden] {
   display: none}` — without this, `.gate`/`#app`'s own `display: flex`
   rules below win over the `hidden` attribute entirely, so both the
   passcode gate and the app would render at once regardless of what the
   JS toggles. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
}

.titleRow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.titleRow h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jumpButton,
.themeToggle {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.jumpButton:active,
.themeToggle:active {
  background: var(--accent);
  color: #fff;
}

.themeToggle {
  border-color: var(--border);
  color: var(--text);
  font-size: 15px;
  padding: 4px 8px;
}

.statusDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666;
  flex-shrink: 0;
}
.statusDot.connected { background: #34c759; }
.statusDot.disconnected { background: #ff453a; }

.filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-top: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 40px;
}

.siteFooter {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.footerLogo {
  height: 18px;
  width: auto;
}
/* The source file is solid black on a transparent background — inverting
   it for dark mode is simpler and more reliable than maintaining a
   second light-on-transparent export that could fall out of sync with
   the real logo. */
:root:not([data-theme="light"]) .footerLogo {
  filter: invert(1);
}

.footerContact {
  display: flex;
  gap: 12px;
  font-size: 11px;
}
.footerContact a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.footerContact a:hover {
  color: var(--text);
}

/* A shared grid template across every row (including section markers,
   which show full details now too) is what actually keeps columns
   aligned down the page — the previous flexbox version let each row
   size its own children independently, so a long cuepoint string had
   nothing stopping it from visually running into the label next to it.
   Grid cells strictly clip wrapped content to their own column. */
.row {
  display: grid;
  grid-template-columns: 34px 62px 46px 96px 1fr;
  align-items: baseline;
  column-gap: 10px;
  padding: 10px 14px;
  border-left: 4px solid transparent;
  border-bottom: 1px solid var(--border);
  scroll-margin: 90px;
}

.row.section {
  background: var(--row-hover);
  font-weight: 700;
  border-left-color: transparent;
}

.row.current {
  background: var(--accent-tint);
  border-left-color: var(--accent);
}

.row.done {
  opacity: 0.45;
}

.row .cueNumber {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
}

.row .time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
}

.row .duration {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
}

.row .cuepoint {
  font-size: 13px;
  color: var(--muted);
  word-break: break-word;
}

.row .label {
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

/* Several joined cues firing together share one Number/Time/Duration/
   Cuepoint (already rendered from the anchor row) — each member's own
   Action shows here instead, as a light inline list rather than a row
   of buttons, same reasoning the app's own `.joined` cluster strip
   follows. */
.chipStrip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 4px;
  min-width: 0;
}

.chip2 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.chip2:not(:first-child)::before {
  content: "· ";
  color: var(--muted);
  font-weight: 400;
}

.emptyState {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

.gate {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gate form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(280px, 100%);
  text-align: center;
}
.gate h1 { font-size: 18px; margin: 0 0 4px; }
.gate input {
  font-size: 20px;
  text-align: center;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}
.gate button {
  font-size: 15px;
  font-weight: 700;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
}
.gate .error { color: #ff453a; font-size: 13px; }
