/* HTDYM-inspired dark palette and compact typography. */
@font-face {
  font-family: Geist;
  src: url("/geist-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --text: #e8eaed;
  --secondary: #a8b0bd;
  --muted: #788494;
  --border: #30363f;
  --surface: #14171c;
  --blue: #8ab4f8;
  --primary: #31528f;
  font-family: Geist, system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button,
textarea {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
[hidden] {
  display: none !important;
}
.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;
}
.topbar {
  min-height: 56px;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand h1 {
  margin: 0;
  color: var(--blue);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.6px;
}
.sail-logo {
  display: block;
  width: 76px;
  height: auto;
}
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}
.btn.info-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border-color: transparent;
  color: var(--secondary);
}
.agent-info {
  position: fixed;
  inset: 68px 22px auto auto;
  margin: 0;
  width: min(340px, calc(100vw - 44px));
  max-height: calc(100dvh - 90px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 28px #0006;
}
.agent-info h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 500;
}
.agent-info p,
.agent-info a {
  font-size: 12.5px;
  line-height: 1.6;
}
.agent-info p {
  margin: 0 0 14px;
  color: var(--secondary);
}
.agent-info a {
  color: var(--blue);
  text-underline-offset: 3px;
}
.conn {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--secondary);
  font-size: 12px;
}
.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.is-live .conn-dot {
  background: #6fd093;
}
.is-reconnecting .conn-dot {
  background: #e8a817;
}
.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  flex: 1;
  min-height: 0;
}
.watch-stage {
  position: relative;
  background: #080808;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 320px;
}
.watch-video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 57px);
  object-fit: contain;
  background: #080808;
}
.watch-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  color: #e8eaed;
  background: #101114ee;
  pointer-events: none;
}
.watch-overlay.is-hidden {
  display: none;
}
.watch-overlay .btn {
  pointer-events: auto;
}
.watch-overlay.needs-play .spinner {
  display: none;
}
.watch-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #5f6368;
  border-top-color: #e8eaed;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  background: #252b35;
}
.btn:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#fork-open,
#fork-send {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
#fork-open:hover,
#fork-send:hover {
  filter: brightness(1.08);
}
.command-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 25px;
  padding: 20px;
  border-left: 1px solid var(--border);
}
.command-eyebrow {
  margin: 0 0 10px;
  color: var(--secondary);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
}
#command-status {
  color: var(--blue);
}
.command-current h2 {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 500;
  letter-spacing: -0.4px;
  overflow-wrap: anywhere;
}
#command-progress {
  margin: 0;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.command-activity {
  min-height: 0;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}
.command-activity h3 {
  font-size: 12px;
  font-weight: 500;
  margin: 0 0 8px;
}
#command-events {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: calc(100dvh - 320px);
  overflow: auto;
}
#command-events li {
  padding: 11px 0;
  border-bottom: 1px solid #252b35;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.fork-dialog {
  width: calc(100% - 40px);
  max-width: 420px;
  padding: 22px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 28px #0006;
}
.fork-dialog::backdrop {
  background: #0009;
  backdrop-filter: blur(2px);
}
.fork-dialog h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 500;
}
.fork-dialog p {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--secondary);
}
.fork-dialog label {
  display: block;
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 500;
}
.fork-dialog textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
}
.command-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
#fork-feedback:empty,
#fork-access:empty {
  display: none;
}
@media (max-width: 850px) {
  .watch-layout {
    grid-template-columns: 1fr;
  }
  .watch-stage {
    min-height: 0;
    aspect-ratio: 16/9;
  }
  .watch-video {
    max-height: none;
  }
  .command-panel {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  #command-events {
    max-height: 360px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

#viewer-count {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
