﻿:root {
  color-scheme: light;
  --bg: #f2f5f9;
  --surface: #ffffff;
  --surface-strong: #f8fbff;
  --border: #d7e2ee;
  --text: #122033;
  --muted: #5d6b7c;
  --primary: #0f6cbd;
  --primary-strong: #0a5a9e;
  --success: #137333;
  --danger: #b3261e;
  --shadow: 0 18px 40px rgba(18, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, #e7f1ff 0, transparent 28%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 100%);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
  gap: 20px;
  padding: 20px;
}

.control-panel,
.content-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card,
.video-card,
.log-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.panel-card {
  padding: 18px;
}

.panel-card h1,
.panel-card h2,
.video-card h2,
.log-card h2 {
  margin: 0 0 10px;
}

.panel-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.embedded-demo-note {
  margin-top: 12px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #edf5ff 0%, #f7fbff 100%);
  border: 1px solid #cfe0f5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.embedded-demo-note strong {
  font-size: 13px;
  color: var(--primary);
}

.embedded-demo-note span {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.embedded-demo-note code {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 108, 189, 0.08);
  color: var(--primary-strong);
}

.tuning-note {
  gap: 10px;
}

.toggle-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.toggle-field input {
  margin-top: 2px;
}

.toggle-hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover:not(:disabled) {
  background: var(--primary-strong);
}

.secondary-btn,
.ghost-btn {
  background: #eef4fb;
  color: var(--text);
}

.status-grid,

.status-item,

.status-label,

.status-value,

.video-card,
.log-card {
  padding: 18px;
}

.video-header,
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.log-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-hint {
  font-size: 13px;
  color: var(--muted);
}

.video-container {
  position: relative;
  min-height: 420px;
  border-radius: 18px;
  border: 1px dashed #b7c7d9;
  background:
    linear-gradient(135deg, rgba(15, 108, 189, 0.1), rgba(15, 108, 189, 0.03)),
    #eff6fd;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
}

.video-placeholder {
  color: var(--muted);
  font-size: 15px;
}

.video-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.remote-video-host {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 100%;
  background: #000;
  overflow: hidden;
}

.remote-video-host > * {
  flex: 1 1 auto;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  min-height: 0;
}

.remote-video-host video {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  object-position: center center;
  background: #000;
}

/* 远程控制输入覆盖层 */
.input-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  cursor: default;
  background: transparent;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.input-overlay.active {
  border-color: rgba(46, 107, 255, 0.6);
}

.input-overlay:hover {
  border-color: rgba(46, 107, 255, 0.9);
  background: rgba(46, 107, 255, 0.03);
}

.input-overlay::after {
  content: "远程控制已启用 | 按 ESC 退出 | 点击/拖拽将发送到 PC";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(46, 107, 255, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.input-overlay.active::after {
  opacity: 1;
}

.log-output {

  margin: 0;
  min-height: 240px;
  max-height: 320px;
  overflow: auto;
  padding: 14px;
  border-radius: 14px;
  background: #0d1726;
  color: #d6e6ff;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .video-container {
    min-height: 280px;
  }
}

/* 管线延迟面板 */
.pipe-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 12px;
}
.pipe-table tr {
  border-bottom: 1px solid rgba(215, 226, 238, 0.5);
}
.pipe-table tr.pipe-sep {
  border-bottom: 2px solid var(--border);
}
.pipe-table td {
  padding: 3px 6px;
  vertical-align: middle;
}
.pipe-num {
  width: 20px;
  color: var(--muted);
  text-align: right;
  font-weight: 600;
}
.pipe-val {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 90px;
}
.pipe-ok { color: #137333; }
.pipe-warn { color: #e67e00; }
.pipe-bad { color: #b3261e; }

.latency-export-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.latency-export-row .primary-btn,
.latency-export-row .ghost-btn {
  width: 100%;
}

.latency-export-hint {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.panel-subhint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.pipe-label {
  cursor: help;
  border-bottom: 1px dotted rgba(93, 107, 124, 0.45);
}

.metric-help-box {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  font-size: 12px;
}

.metric-help-box summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
}

.metric-help-list {
  margin: 10px 0 0;
}

.metric-help-list dt {
  font-weight: 600;
  margin-top: 8px;
}

.metric-help-list dd {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
