:root {
  --bg: #000000;
  --panel: #040704;
  --panel-2: #080d09;
  --line: #1d3a27;
  --line-soft: #122416;
  --accent: #00ff41;
  --text: #d8f5e2;
  --muted: #6f9c7d;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 14px;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.harness,
.harness-body,
.john-doe,
.workbench {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.harness {
  height: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
}

.harness-head,
.john-head,
.title-panel,
.left-panel > .directory-nav > .head,
.left-panel > .panels > .head,
.center-split > section > span,
.right-panel > section > span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.harness-head,
.john-head {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.harness-head {
  height: 1px;
  min-height: 1px;
  padding: 0;
}

.harness-head span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.harness-body {
  flex: 1;
  gap: 8px;
  padding: 8px;
}

.title-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 46px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.brand,
.main-nav,
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg);
}

.business-name {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.main-nav {
  gap: 14px;
}

.nav-item {
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
}

.nav-link {
  text-decoration: none;
}

.call-btn {
  padding: 3px 9px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
}

.call-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

select {
  max-width: 130px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 5px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 10px;
}

select:focus {
  border-color: var(--accent);
  outline: none;
}

.john-doe {
  flex: 1;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.workbench {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) minmax(260px, 320px);
  gap: 8px;
  padding: 8px;
}

.left-panel,
.center-panel,
.right-panel {
  min-height: 0;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
}

.left-panel,
.center-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.featured {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.featured-label {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.qr-panel {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.qr-panel > span:first-child {
  align-self: flex-start;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.qr-panel canvas {
  width: 120px;
  height: 120px;
  border: 1px solid var(--line);
  background: #fff;
  image-rendering: pixelated;
}

.qr-caption {
  color: var(--muted);
  font-size: 9px;
  overflow-wrap: anywhere;
  text-align: center;
}

.featured-viewer {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: var(--bg);
}

.featured-viewer img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.center-split > section,
.right-panel > section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.center-split {
  --top-size: 52%;
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: var(--top-size) 8px minmax(0, 1fr);
  gap: 6px;
  min-height: 0;
}

.center-split > .top-row,
.center-split > .viewers {
  min-height: 0;
  overflow: auto;
}

.center-split > .viewers {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.center-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  cursor: row-resize;
}

.center-divider span {
  width: 48px;
  height: 2px;
  background: var(--accent);
  opacity: 0.7;
}

.center-divider:hover,
.center-divider:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.viewer-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(3 * ((100cqw - 18px) / 4 * 9 / 16 + 54px) + 18px);
  overflow-y: auto;
}

.viewer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  min-height: 0;
  padding: 3px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
}

.cell-label {
  color: var(--muted);
  font-size: 8px;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell.active .cell-label {
  color: var(--accent);
}

.cell .media-stage {
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
}

.cell .media-source {
  flex: 0 0 auto;
  padding: 1px 3px;
  font-size: 8px;
}

.cell .media-volume {
  flex: 0 0 auto;
}

.right-panel {
  gap: 6px;
  padding: 6px;
}

.right-panel > section {
  flex: 0 0 auto;
  gap: 6px;
  padding: 6px;
}

.right-panel > .main-output .media-stage {
  height: 120px;
  aspect-ratio: auto;
}

.right-panel > .telemetry .stats div {
  padding: 4px;
}

.right-panel > .notepad textarea {
  min-height: 52px;
}

.right-panel > .controls .joystick {
  width: 48px;
  height: 48px;
}

.right-panel > .controls .joystick .knob {
  width: 14px;
  height: 14px;
}

.right-panel > .chat-composer {
  flex: 1 1 160px;
  min-height: 140px;
  position: relative;
}

.right-panel > .telemetry,
.right-panel > .notepad,
.right-panel > .controls {
  min-height: 64px;
}

.directory-nav {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.panels {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.directory-nav.collapsed,
.panels.collapsed {
  flex: 0 0 auto;
}

.head,
.add,
.item,
.head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.head-actions {
  gap: 3px;
}

.nav-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.nav-body[hidden] {
  display: none;
}

.panels > .nav-body {
  flex: 1 1 auto;
  overflow: auto;
}

.directory-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.directory-list a {
  display: block;
  padding: 5px 7px;
  border: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 11px;
  text-decoration: none;
}

.directory-list a:hover,
.directory-list a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.head {
  justify-content: space-between;
}

.title {
  color: var(--accent);
}

button {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 7px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 11px;
}

input:focus {
  border-color: var(--accent);
  outline: none;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  justify-content: space-between;
  padding: 6px 7px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
}

.item.active {
  border-color: var(--line);
}

.name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 11px;
}

.item.active .name {
  color: var(--accent);
}

.count {
  color: var(--muted);
  font-size: 9px;
}

.actions {
  display: flex;
  gap: 3px;
}

.actions button {
  padding: 2px 5px;
  font-size: 9px;
}

@media (max-width: 1000px) {
  .workbench {
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  }

  .right-panel {
    grid-column: 1 / -1;
    display: grid;
    align-content: start;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .right-panel > .chat-composer {
    grid-column: span 2;
    min-height: 200px;
  }
}

@media (max-width: 680px) {
  html,
  body {
    height: auto;
    min-height: 100%;
  }

  body {
    padding: 8px;
  }

  .harness {
    height: auto;
    min-height: 100%;
  }

  .workbench {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }

  .left-panel,
  .center-panel,
  .right-panel {
    overflow: visible;
  }

  .center-panel {
    min-height: 620px;
  }

  .center-split > .top-row {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 4px;
  }

  .center-split > .top-row .top-note {
    grid-column: 1;
    grid-row: 1;
    min-height: 56px;
    font-size: 9px;
  }

  .center-split > .top-row .featured-center {
    grid-column: 2;
    grid-row: 1;
  }

  .right-panel {
    grid-column: auto;
  }

  .right-panel > .chat-composer {
    position: static;
    max-height: none;
  }
}

.settings {
  width: min(520px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.settings-body-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg);
}

.settings-field {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
}

.settings-field input,
.settings-field select {
  width: 100%;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.settings-camera {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.settings-camera-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.settings-camera-status {
  color: var(--muted);
  letter-spacing: 0;
}

.settings-camera-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
}

.settings-camera-stage video,
.settings-camera-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-camera-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.connectivity-code {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
}

body.video-control-page {
  padding: 12px;
}

.video-control-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(1100px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
}

.video-control-shell > .featured {
  margin: 10px;
}

.video-control-shell .media-viewer {
  width: min(100%, 960px);
}

.video-control-shell .video-control-panel {
  flex: 0 0 auto;
  margin: 0 10px 10px;
}

.video-control-shell .vc-body {
  grid-template-columns: 140px 180px minmax(0, 1fr) auto;
  gap: 10px;
}

.video-control-shell .vc-pad button {
  font-size: 10px;
}

.video-control-shell .vc-slider {
  grid-template-columns: 50px minmax(80px, 1fr) 44px;
}

.directory-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--panel);
}

.directory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.folder-card:hover {
  border-color: var(--accent);
}

.folder-image {
  width: 120px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg);
}

.folder-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.folder-meta strong {
  color: var(--accent);
  font-size: 14px;
}

.folder-meta small,
.folder-count {
  color: var(--muted);
  font-size: 10px;
}

.folder-count {
  margin-left: auto;
}

.home-intro {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.home-intro h1 {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 18px;
}

.home-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.add-card {
  border-style: dashed;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.add-mark {
  display: grid;
  place-items: center;
  width: 120px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 28px;
}

.home-add {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto auto;
  gap: 8px;
  padding: 0 14px 14px;
}

.home-add label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.home-add input {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.home-add button {
  align-self: end;
  padding: 6px 10px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.id-sheet {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.id-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.id-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg);
}

.id-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 2px 2px;
}

.id-name {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

.id-meta {
  color: var(--muted);
  font-size: 10px;
}

.id-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.id-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
}

.id-form input {
  width: 100%;
}

.id-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.page-directory {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.page-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.page-card:hover {
  border-color: var(--accent);
}

.page-card img,
.page-card video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg);
}

.page-label {
  color: var(--accent);
  font-size: 10px;
}

.center-split > .top-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(96px, 120px) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.center-split > .top-row.duo-mode {
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 6px;
}

.center-split > .top-row.duo-mode .top-note {
  min-height: 56px;
  padding: 4px;
  font-size: 9px;
}

.top-note {
  align-self: start;
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 6px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 11px;
}

.top-note:focus {
  border-color: var(--accent);
  outline: none;
}

.top-row .featured-center {
  width: 100%;
  min-height: 0;
  max-width: none;
  margin: 0;
}

.featured-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.view-toggle {
  display: flex;
  gap: 4px;
}

.view-toggle button {
  padding: 2px 8px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.view-toggle button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.duo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.duo-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel);
}

.duo-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.duo-cell .media-stage {
  position: relative;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.duo-cell.preview .media-stage::after,
.duo-cell.program .media-stage::after {
  position: absolute;
  bottom: 6px;
  padding: 2px 6px;
  color: var(--bg);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.duo-cell.preview .media-stage::after {
  content: "PREVIEW";
  left: 6px;
  background: var(--muted);
}

.duo-cell.program .media-stage::after {
  content: "PROGRAM";
  right: 6px;
  background: var(--accent);
}

.duo-view[data-mode="solo"] .duo-grid {
  grid-template-columns: minmax(0, 1fr);
  max-width: none;
  margin: 0;
}

.duo-view[data-mode="solo"] .duo-cell:first-child {
  display: none;
}

.media-stage {
  --vc-pan-x: 0px;
  --vc-pan-y: 0px;
  --vc-zoom: 1;
  --vc-rotate: 0deg;
  --vc-flip-x: 1;
  --vc-flip-y: 1;
}

.media-stage > .media-img,
.media-stage > .media-video,
.media-stage > .media-frame {
  transform-origin: center;
  transform: translate(var(--vc-pan-x), var(--vc-pan-y)) rotate(var(--vc-rotate)) scale(var(--vc-zoom)) scaleX(var(--vc-flip-x)) scaleY(var(--vc-flip-y));
}

.video-control-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.vc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.vc-head .nav-link {
  font-size: 9px;
}

.vc-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 84px 96px minmax(0, 1fr) auto;
  gap: 4px 6px;
  align-items: start;
}

.vc-field,
.vc-pad-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 9px;
}

.vc-field select {
  width: 100%;
  height: 20px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 0 4px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 9px;
}

.vc-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.vc-pad button {
  padding: 1px 0;
  font-size: 8px;
  line-height: 1.1;
  letter-spacing: 0;
}

.vc-sliders {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.vc-slider {
  display: grid;
  grid-template-columns: 36px minmax(48px, 1fr) 36px;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
}

.vc-slider input {
  width: 100%;
  height: 12px;
  accent-color: var(--accent);
}

.vc-slider output {
  color: var(--text);
  text-align: right;
}

.vc-toggles {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 9px;
}

.vc-toggles label {
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.vc-reset {
  align-self: end;
  padding: 2px 6px;
  font-size: 9px;
}

.vc-status {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.center-panel .video-control-panel .vc-slider:nth-of-type(n + 2),
.center-panel .video-control-panel .vc-toggles,
.center-panel .video-control-panel .vc-pad-wrap > span,
.center-panel .video-control-panel .vc-status {
  display: none;
}

.center-panel .video-control-panel .vc-pad {
  gap: 1px;
}

.center-panel .video-control-panel .vc-pad button {
  height: 12px;
  padding: 0;
  font-size: 7px;
  line-height: 12px;
}

.viewer-page {
  padding: 14px;
}

.single-viewer {
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--panel);
}

.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.viewer-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 14px;
}

.viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid var(--line);
  background: var(--bg);
}

.split-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 12px;
}

.doc-panel,
.viewer-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 0;
}

.doc-label {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.doc-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--bg);
}

.viewer-panel .viewer-stage {
  align-items: stretch;
  padding: 0;
}

.viewer-panel .media-viewer {
  width: 100%;
  flex: 1;
  min-height: 0;
}

.viewer-panel .media-stage {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
}

.viewer-grid .cell.active {
  border-color: var(--accent);
  background: rgba(0, 255, 65, 0.07);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
}

.stats b {
  color: var(--accent);
  font-size: 14px;
}

.stats small {
  color: var(--muted);
  font-size: 9px;
}

textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 7px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 11px;
}

textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.mode-row {
  display: flex;
  gap: 5px;
}

.mode-row button.active {
  border-color: var(--accent);
}

.joystick {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg);
  cursor: crosshair;
}

.joystick .knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--panel-2);
}

.preview-stepper {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 6px;
}

.preview-stepper > button {
  padding: 4px 2px;
  font-size: 9px;
}

.joystick:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.control-status {
  color: var(--accent);
  font-size: 9px;
  text-align: center;
}

.slider,
.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.slider input {
  flex: 1;
  padding: 0;
  accent-color: var(--accent);
}

.toggle input {
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.chat-composer {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat-log {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
  max-height: 160px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
}

.chat-msg {
  max-width: 92%;
  padding: 5px 7px;
  border: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.chat-msg.user {
  align-self: flex-end;
  border-color: var(--accent);
  background: var(--panel-2);
}

.chat-msg.bot {
  align-self: flex-start;
  color: var(--muted);
}

.chat-welcome {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  padding: 5px;
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--panel-2), var(--bg));
}

.chat-welcome .media-stage {
  position: relative;
  max-height: 124px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}

.chat-welcome .media-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-welcome .media-stage-copy {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 14px 6px 5px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
}

.chat-welcome .media-stage-copy strong {
  display: block;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-welcome .media-stage-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.chat-msg small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 48px;
  overflow-y: auto;
}

.chat-attachments.has-viewer {
  max-height: 180px;
}

.chat-viewer {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.chat-viewer .media-stage {
  max-height: 180px;
  border-radius: 4px;
}

.chat-viewer .media-stage video {
  object-fit: contain;
}

.chat-viewer span {
  color: var(--muted);
  font-size: 8px;
  overflow-wrap: anywhere;
}

.chat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 4px;
  border: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 9px;
}

.chat-chip button {
  padding: 0 3px;
  font-size: 9px;
}

.composer-form {
  display: flex;
  gap: 5px;
}

.composer-form input {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-tool {
  flex: 0 0 auto;
  min-width: 38px;
}

.chat-tool.listening {
  border-color: var(--accent);
  color: var(--bg);
  background: var(--accent);
}

.chat-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
}

.chat-upload:hover,
.chat-upload:focus-within {
  border-color: var(--accent);
}

.chat-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

[hidden] {
  display: none !important;
}

.media-viewer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.media-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}

.media-stage img,
.media-stage video,
.media-stage iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  object-fit: contain;
}

.media-stage audio {
  width: 100%;
  height: 100%;
  padding: 8px;
  box-sizing: border-box;
}

.media-source {
  width: 100%;
  max-width: none;
  font-size: 9px;
}

.media-volume {
  width: 100%;
  height: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  appearance: none;
  background: var(--line-soft);
  accent-color: var(--accent);
  box-sizing: border-box;
}

.media-volume::-webkit-slider-thumb {
  appearance: none;
  width: 8px;
  height: 10px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
}

.media-volume::-moz-range-thumb {
  width: 8px;
  height: 10px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
}

.cell .media-volume {
  height: 6px;
}

.cell .media-volume::-webkit-slider-thumb {
  width: 6px;
  height: 6px;
}

.cell .media-volume::-moz-range-thumb {
  width: 6px;
  height: 6px;
}

.main-output .media-stage {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 255, 65, 0.18);
}

.viewer-stage .media-viewer {
  width: min(100%, 1100px);
}

.center-panel .featured-center .media-stage {
  aspect-ratio: 16 / 9;
}

@media (max-height: 720px) {
  .center-split {
    --top-size: 48%;
  }

  .center-panel .top-row {
    gap: 2px;
  }

  .center-panel .center-split > .top-row .top-note {
    min-height: 36px;
    height: 36px;
    resize: none;
    padding: 3px 5px;
    font-size: 9px;
    line-height: 1.2;
  }

  .center-panel .video-control-panel {
    gap: 3px;
    padding: 3px;
  }

  .center-panel .featured-center {
    gap: 2px;
    padding: 2px;
  }

  .center-panel .featured-center .featured-label,
  .center-panel .viewers > span {
    font-size: 8px;
  }

  .center-panel .featured-center .media-source,
  .cell .media-source {
    height: 13px;
    padding: 0 2px;
    font-size: 7px;
    line-height: 13px;
  }

  .center-panel .featured-center .media-volume,
  .cell .media-volume {
    height: 4px;
  }

  .center-split > .viewers {
    padding: 0;
  }

  .right-panel {
    gap: 4px;
    padding: 4px;
  }

  .right-panel > section {
    gap: 4px;
    padding: 4px;
  }

  .right-panel > .main-output .media-stage {
    height: 96px;
    aspect-ratio: auto;
  }

  .right-panel > .main-output .media-source {
    height: 13px;
    padding: 0 2px;
    font-size: 7px;
    line-height: 13px;
  }

  .right-panel > .telemetry .stats div {
    padding: 3px;
  }

  .right-panel > .notepad textarea {
    min-height: 36px;
    height: 36px;
    resize: none;
    padding: 3px 5px;
    font-size: 9px;
  }

  .right-panel > .controls .joystick {
    width: 40px;
    height: 40px;
  }

  .right-panel > .controls .joystick .knob {
    width: 12px;
    height: 12px;
  }

  .right-panel > .controls .preview-stepper {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: 3px;
  }

  .right-panel > .chat-composer {
    min-height: 132px;
  }

  .chat-log {
    min-height: 44px;
    max-height: 14vh;
  }

  .composer-form input {
    min-height: 22px;
    padding: 2px 4px;
    font-size: 9px;
  }

  .cell {
    gap: 3px;
    padding: 3px;
  }
}

@media (max-height: 620px) {
  .right-panel > .telemetry {
    display: none;
  }

  .right-panel > .main-output .media-stage {
    height: 72px;
  }

  .right-panel > .notepad textarea {
    min-height: 28px;
    height: 28px;
  }

  .right-panel > .controls .control-status {
    display: none;
  }

  .right-panel > .chat-composer {
    min-height: 120px;
  }

  .chat-log {
    min-height: 36px;
    max-height: 10vh;
  }
}

@media (max-width: 900px) {
  .title-panel {
    flex: 0 0 auto;
    min-height: 46px;
  }

  .main-nav {
    min-width: 0;
    flex-wrap: wrap;
    gap: 8px 10px;
  }
}

@media (max-width: 720px) {
  .title-panel {
    height: auto;
    min-height: 46px;
  }

  .main-nav,
  .settings-head,
  .directory-head,
  .viewer-head > span {
    flex-wrap: wrap;
  }

  .video-control-shell .vc-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .viewer-page {
    padding: 8px;
  }

  .split-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .folder-grid,
  .id-sheet,
  .id-form,
  .home-add {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .folder-image {
    width: 100px;
  }

  .id-actions {
    flex-direction: column;
  }
}
