:root {
  --bg: #0e1016;
  --bg-2: #141824;
  --bg-3: #1b2130;
  --panel: #12151f;
  --border: #232a3a;
  --text: #e8ebf2;
  --muted: #8a92a6;
  --accent: #6c5ce7;
  --accent-2: #00d2a0;
  --claim: #ff6b6b;
  --rebut: #4dabf7;
  --gold: #f5c518;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; }
.logo { height: 36px; width: auto; border-radius: 6px; display: block; }
.brand-name { font-weight: 800; letter-spacing: -0.02em; }
.badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--accent); color: #fff; padding: 3px 7px; border-radius: 6px;
}
.event-meta { flex: 1; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mode-toggle { display: flex; align-items: center; gap: 8px; }
.mode-label { font-size: 12px; color: var(--muted); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0; background: var(--bg-3);
  border-radius: 22px; transition: .2s; border: 1px solid var(--border);
}
.slider:before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 2px; top: 2px;
  background: var(--muted); border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(18px); background: #fff; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr);
  gap: 18px;
  padding: 18px 22px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

.video-switcher {
  display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.vchip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px 12px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; font-family: inherit; color: var(--text);
  transition: border-color .12s, background .12s; text-align: left;
}
.vchip:hover { border-color: #454f6b; }
.vchip.active { border-color: var(--accent); background: rgba(108,92,231,.14); }
.vchip-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.vchip-title { font-size: 13px; font-weight: 600; }

.node-video { color: var(--accent-2); font-weight: 700; }
.cross-badge {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  background: rgba(108,92,231,.18); color: var(--accent); border-radius: 5px; padding: 1px 6px; margin-left: 4px;
}

.video-wrap {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
#player { width: 100%; height: 100%; }

.panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.hint { font-size: 12px; color: var(--muted); }

.transcript-panel, .threads-col {
  margin-top: 18px;
}

.transcript {
  max-height: 520px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
}
.transcript-line {
  display: flex; gap: 10px; padding: 7px 10px; border-radius: 8px;
  cursor: pointer; transition: background .12s;
}
.transcript-line:hover { background: var(--bg-3); }
.transcript-line.active { background: rgba(108, 92, 231, 0.16); border-left: 3px solid var(--accent); }
.ts { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--accent-2); min-width: 48px; padding-top: 2px; }
.tspeaker { font-weight: 700; font-size: 12px; color: var(--muted); min-width: 72px; padding-top: 2px; }
.ttext { font-size: 13px; line-height: 1.5; }

.threads { display: flex; flex-direction: column; gap: 14px; }

.thread-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; transition: border-color .15s;
}
.thread-card:hover { border-color: #39425a; }

.thread-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.thread-num { font-size: 11px; font-weight: 800; color: var(--muted); }

.node {
  display: block; text-align: left; width: 100%;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; cursor: pointer; transition: transform .08s, border-color .12s;
  color: var(--text); font-family: inherit;
}
.node:hover { transform: translateY(-1px); border-color: #454f6b; }
.node.claim { border-left: 4px solid var(--claim); }
.node.rebut { border-left: 4px solid var(--rebut); }

.node-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 5px; margin-bottom: 6px;
}
.node.claim .node-tag { background: rgba(255,107,107,.16); color: var(--claim); }
.node.rebut .node-tag { background: rgba(77,171,247,.16); color: var(--rebut); }
.approved-mark { color: var(--gold); font-size: 11px; }
.node-speaker { font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.node-time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--accent-2); }
.node-text { font-size: 13px; line-height: 1.45; color: var(--text); margin-top: 4px; }

.connector {
  display: flex; align-items: center; gap: 8px; padding: 6px 0 6px 18px; color: var(--muted);
  font-size: 11px; font-weight: 600;
}
.connector .arrow { color: var(--accent); font-size: 14px; }

.play-btn {
  margin-top: 10px; width: 100%; padding: 9px; font-family: inherit; font-weight: 700; font-size: 13px;
  background: var(--accent); color: #fff; border: none; border-radius: 9px; cursor: pointer;
  transition: filter .12s;
}
.play-btn:hover { filter: brightness(1.1); }
.play-btn.playing { background: var(--accent-2); color: #06281f; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.suggested-pill {
  font-size: 10px; font-weight: 700; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 5px; padding: 1px 6px; margin-left: 6px;
}
.editor-actions { display: none; gap: 8px; margin-top: 8px; }
body.editor .editor-actions { display: flex; }
body.editor .suggested-pill { display: inline; }
.suggested-pill { display: none; }
.editor-btn {
  flex: 1; padding: 7px; font-family: inherit; font-size: 12px; font-weight: 700; border-radius: 7px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text); cursor: pointer;
}
.editor-btn.approve { color: var(--accent-2); border-color: rgba(0,210,160,.4); }
.editor-btn.reject { color: var(--claim); border-color: rgba(255,107,107,.4); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .transcript { max-height: 320px; }
}
