/* Operator panel. Same materials as the broadcast package: warm paper,
   charcoal, one blue accent. Light, because it is read on a laptop next to a
   lit mall stage; big targets, because it is operated for 24 hours. */

:root {
  --paper: #eef1f4;
  --paper-2: #ffffff;
  --line: #d3d9df;
  --text: #1a1d21;
  --muted: #5a5f66;
  --focus: #ffd23f;
  --danger: #c8102e;
  --ok: #0f8a4b;
  --ink: #1a1d21;
  --sky: #06a7ff;
  --sky-tint: #cfe9f8;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
  color: var(--text);
  font-size: 17px;
  line-height: 1.4;
}
body {
  min-height: 100vh;
}
::selection {
  background: var(--sky);
  color: var(--ink);
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- top bar: an ink block, like the heading tag on the screens ---- */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  background: var(--ink);
  color: #f3eee4;
  border-bottom: 6px solid var(--sky);
}
.top-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.top-brand img {
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--sky);
}
.top-title {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.conn {
  font-size: 14px;
  color: var(--sky-tint);
  display: flex;
  align-items: center;
  gap: 8px;
}
.conn::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--sky-tint);
}
.conn[data-status='live'] {
  color: #7ff0b0;
}
.conn[data-status='live']::before {
  background: #7ff0b0;
}
.conn[data-status='offline'] {
  color: #ff8a8a;
  font-weight: 700;
}
.conn[data-status='offline']::before {
  background: #ff8a8a;
}
.top-clock {
  display: flex;
  align-items: center;
  gap: 18px;
}
.big-clock {
  font-size: 46px;
  font-weight: 900;
}
.big-clock .unit {
  display: none;
}
.big-clock .ss .dg {
  color: var(--sky);
}
.chip {
  padding: 6px 14px;
  font-weight: 800;
  font-size: 15px;
  background: var(--white);
  color: var(--ink);
}
.chip[data-status='running'] {
  background: var(--sky);
}
.chip[data-status='paused'] {
  background: var(--focus);
}
.chip[data-status='scheduled'] {
  background: var(--sky-tint);
}
.chip[data-status='finished'] {
  background: var(--paper);
}
.top-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
  color: var(--sky-tint);
  min-width: 220px;
}

/* ---- password gate (only when the server requires one) ---- */
.gate {
  min-height: calc(100vh - 90px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(520px, 100%);
  padding: 28px 28px 30px;
  background: var(--paper-2);
  border-top: 6px solid var(--sky);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.gate-card h2 {
  margin: 0;
}
.messages-card {
  width: min(720px, 100%);
  align-self: start;
  margin-top: 8px;
}
.gate-card .hint {
  margin: 0;
}
.gate-error {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}
.gate-error[hidden] {
  display: none;
}
.top-meta .who {
  color: var(--sky-tint);
}
.linkbtn {
  font: inherit;
  font-size: 13px;
  color: var(--sky-tint);
  background: none;
  border: 0;
  padding: 0 4px;
  text-decoration: underline;
  cursor: pointer;
}

/* ---- layout: sections, not floating cards ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 20px;
  padding: 24px 28px 96px;
  max-width: 1500px;
  margin: 0 auto;
}
.card {
  background: var(--paper-2);
  border-top: 6px solid var(--ink);
  padding: 20px 22px 24px;
}
.card-timer {
  grid-column: 1 / -1;
  border-top-color: var(--sky);
}
.card-urls {
  grid-column: 1 / -1;
}
h2 {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.01em;
}
h2.mt {
  margin-top: 32px;
}
h3 {
  margin: 28px 0 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--muted);
}
.hint {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 70ch;
}

.row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.row + .row {
  margin-top: 12px;
}
.row.wrap {
  flex-wrap: wrap;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- fields ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 200px;
  min-width: 0;
}
.field.narrow,
.field.time {
  flex: 0 1 300px;
}
.stack .field {
  flex: none;
}
.field > span {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
input[type='text'],
input[type='number'],
input[type='datetime-local'],
textarea {
  font: inherit;
  color: var(--text);
  background: var(--white);
  border: 2px solid var(--line);
  padding: 10px 12px;
  width: 100%;
  min-height: 48px;
}
input::placeholder,
textarea::placeholder {
  color: #7a8fa3;
}
input:focus,
textarea:focus {
  border-color: var(--ink);
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}
textarea {
  resize: vertical;
  line-height: 1.4;
}

/* ---- buttons: flat blocks ---- */
.btn {
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--ink);
  padding: 0 18px;
  min-height: 48px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition:
    transform 80ms ease,
    background 120ms ease;
}
.btn:hover {
  background: var(--paper);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--sky);
  border-color: var(--sky);
}
.btn.primary:hover {
  background: #33b8ff;
}
.btn.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn.danger[data-armed='true'] {
  background: var(--danger);
  color: var(--white);
}
.btn.ghost {
  background: transparent;
  border-color: var(--line);
}
.btn.small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 15px;
}
.btn.xl {
  min-height: 64px;
  padding: 0 30px;
  font-size: 21px;
}
.adjust .btn {
  min-width: 96px;
}
.presets {
  margin: 8px 0 14px;
}

/* ---- toggles ---- */
.toggles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px 16px;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--paper);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}
.toggle input {
  appearance: none;
  width: 44px;
  height: 24px;
  background: #b7c7d6;
  position: relative;
  flex: none;
  margin: 0;
  transition: background 120ms ease;
}
.toggle input::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  background: var(--white);
  transition: transform 120ms ease;
}
.toggle input:checked {
  background: var(--sky);
}
.toggle input:checked::after {
  transform: translateX(-20px);
  background: var(--ink);
}

/* ---- announcement state ---- */
.state {
  padding: 10px 14px;
  font-weight: 800;
  background: var(--paper);
  color: var(--muted);
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}
.state[data-visible='true'] {
  background: var(--sky);
  color: var(--ink);
}

/* ---- assets ---- */
.assets {
  display: grid;
  gap: 14px;
}
.asset {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  align-items: center;
  padding: 12px;
  background: var(--paper);
}
.asset > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.asset small {
  color: var(--muted);
}
.asset img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  background: var(--sky);
}
.asset-avatar {
  border-radius: 50%;
}

/* ---- layout editor ---- */
.card-layout {
  grid-column: 1 / -1;
}
.layouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 14px;
}
.layout-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--paper);
}
.anchor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-width: 320px;
  padding: 4px;
  background: var(--ink);
  direction: ltr; /* the grid is a picture of the screen: left is left */
}
.anchor-grid button {
  border: 0;
  background: #3b4149;
  cursor: pointer;
  transition: background 100ms ease;
}
.anchor-grid button:hover {
  background: #5a626c;
}
.anchor-grid button[aria-checked='true'] {
  background: var(--sky);
}
input[type='range'] {
  width: 100%;
  accent-color: var(--sky);
}

/* ---- urls ---- */
.urls {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.urls li {
  display: grid;
  grid-template-columns: 300px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--paper);
  font-weight: 600;
}
.urls code {
  direction: ltr;
  text-align: left;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 15px;
  color: var(--sky-deep);
  user-select: all;
  overflow-wrap: anywhere;
}

/* ---- toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 50%;
  transform: translate(50%, 16px);
  padding: 12px 20px;
  background: var(--ink);
  color: var(--white);
  font-weight: 800;
  box-shadow: 0 10px 30px -10px rgba(10, 22, 38, 0.5);
  opacity: 0;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  max-width: min(90vw, 640px);
}
.toast[data-shown='true'] {
  opacity: 1;
  transform: translate(50%, 0);
}
.toast[data-kind='err'] {
  background: var(--danger);
}

@media (max-width: 720px) {
  .top {
    flex-direction: column;
    align-items: flex-start;
  }
  .grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .urls li {
    grid-template-columns: 1fr;
  }
}
