:root {
  --bg-dark: #0f172a;
  --bg-panel: #1e293b;
  --bg-input: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --success: #10b981;
  --live: #e11d48;
  --live-hover: #be123c;
  --border: #475569;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.app-container { display: flex; height: 100vh; width: 100vw; }

.controls-panel {
  width: 360px; min-width: 360px;
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px; gap: 15px; overflow-y: auto;
}

.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.panel-header h1 { font-size: 1.2rem; font-weight: 600; }

.badge {
  background-color: var(--primary); color: white;
  font-size: 0.75rem; padding: 4px 8px; border-radius: 9999px; font-weight: bold;
}
.badge.is-live { background-color: var(--live); animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }

.control-group {
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(0, 0, 0, 0.15); padding: 12px;
  border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.05);
}
.control-group h3 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 3px; }
label { font-size: 0.8rem; color: var(--text-main); }

select, input[type="text"] {
  width: 100%; padding: 8px 12px; background-color: var(--bg-input);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-main); font-size: 0.85rem; outline: none; transition: 0.2s;
}
select:focus, input[type="text"]:focus { border-color: var(--primary); }
select:disabled, input:disabled { opacity: 0.6; cursor: not-allowed; }

.row { display: flex; gap: 10px; }
.col { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.btn {
  width: 100%; padding: 10px; border: none; border-radius: 6px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: 0.2s; margin-top: 4px;
}
.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background-color: var(--primary-hover); }
.btn-primary:disabled { background-color: var(--bg-input); color: var(--text-muted); cursor: not-allowed; }
.btn-toggle { background-color: var(--success); color: white; }
.btn-toggle.is-off { background-color: var(--danger); }

/* 开播大红按钮 */
.btn-live {
  background-color: var(--live); color: white; font-size: 1rem; padding: 12px; margin-top: 8px;
}
.btn-live:hover:not(:disabled) { background-color: var(--live-hover); }
.btn-live:disabled { background-color: #475569; cursor: not-allowed; }

.share-box { margin-top: 6px; }
.panel-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.status-text { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }

.preview-panel {
  flex: 1; background-color: #000; display: flex;
  align-items: center; justify-content: center; position: relative; overflow: hidden; padding: 20px;
}
.video-wrapper { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; }

video {
  width: 100%; height: 100%; object-fit: contain !important;
  max-width: 100%; max-height: 100%; border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5); background-color: #111; transition: all 0.3s ease;
}

.empty-state {
  position: absolute; display: flex; flex-direction: column;
  align-items: center; gap: 12px; color: var(--text-muted); pointer-events: none;
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.is-hidden { display: none !important; }

/* ==========================================
   【核心修改】观众端特化样式：隐藏控制台，绝对黑屏纯净看画面
   ========================================== */
body.viewer-mode .controls-panel { display: none !important; }
body.viewer-mode .preview-panel { padding: 0 !important; background-color: #000; }
body.viewer-mode video { border-radius: 0 !important; box-shadow: none !important; }

@media (max-width: 768px) {
  .app-container { flex-direction: column-reverse; }
  .controls-panel { width: 100%; height: 45vh; }
  .preview-panel { height: 55vh; }
}