:root {
  --bg: #0e0f13;
  --panel: #16181f;
  --panel-2: #1d2029;
  --line: #2a2e3a;
  --text: #e8eaf0;
  --muted: #8b91a3;
  --accent: #ffc83d;
  --accent-ink: #1a1400;
  --danger: #ff6b6b;
  --ok: #4cd694;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
.btn:hover { border-color: #3b4050; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 4px 9px; font-size: 12px; }

input[type=text], input[type=password], textarea, select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; min-height: 64px; }
label.row { display: flex; align-items: center; gap: 8px; color: var(--muted); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 700; letter-spacing: .02em; }
.brand span { color: var(--accent); }
.spacer { flex: 1; }

.center-card {
  width: 100%; max-width: 360px; margin: 14vh auto; padding: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; gap: 12px;
}
.center-card h1 { margin: 0 0 4px; font-size: 18px; }
.error { color: var(--danger); min-height: 1.2em; }
.muted { color: var(--muted); }

/* Dashboard */
.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 24px 20px 80px; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.head h2 { margin: 0; font-size: 18px; }
.list { display: grid; gap: 10px; }
.asset {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.asset h3 { margin: 0 0 4px; font-size: 15px; }
.asset .meta { color: var(--muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.pill { background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.pill.hot { color: var(--accent); border-color: var(--accent); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty { text-align: center; padding: 60px 0; color: var(--muted); }

.progress { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; width: min(520px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { margin: 0 0 12px; }
.stack { display: grid; gap: 10px; }
.share-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.share-row code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

/* Watch page */
#root { height: 100%; display: flex; flex-direction: column; }
.watch { display: grid; grid-template-columns: 1fr 360px; flex: 1; min-height: 0; }
.stage { display: flex; flex-direction: column; min-width: 0; background: #000; }
.video-box { flex: 1; min-height: 0; display: grid; place-items: center; }
video { width: 100%; height: 100%; max-height: 100%; background: #000; }
.controls { background: var(--panel); border-top: 1px solid var(--line); padding: 10px 14px 12px; display: grid; gap: 8px; }
.timeline { position: relative; height: 26px; cursor: pointer; touch-action: none; }
.timeline .track { position: absolute; left: 0; right: 0; top: 11px; height: 4px; background: var(--panel-2); border-radius: 4px; }
.timeline .fill { position: absolute; left: 0; top: 11px; height: 4px; background: var(--accent); border-radius: 4px; width: 0; }
.timeline .head-dot { position: absolute; top: 6px; width: 14px; height: 14px; margin-left: -7px; background: #fff; border-radius: 50%; }
.marker {
  position: absolute; top: 0; width: 10px; height: 10px; margin-left: -5px;
  background: var(--accent); border: 1px solid var(--bg); border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
}
.marker.resolved { background: var(--ok); opacity: .7; }
.row-controls { display: flex; align-items: center; gap: 10px; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.side-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.side-head h1 { margin: 0; font-size: 15px; }
.filters { display: flex; gap: 6px; }
.comments { flex: 1; overflow: auto; padding: 8px 10px; display: grid; gap: 8px; align-content: start; }
.comment {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  display: grid; gap: 6px;
}
.comment.resolved { opacity: .55; }
.comment.active { border-color: var(--accent); }
.c-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.c-head b { color: var(--text); }
.tc {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px;
  padding: 1px 7px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums;
}
.badge-admin { color: var(--accent); }
.c-body { white-space: pre-wrap; word-break: break-word; }
.c-actions { display: flex; gap: 8px; }
.c-actions button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 12px; }
.c-actions button:hover { color: var(--text); }
.replies { display: grid; gap: 6px; margin-left: 10px; padding-left: 10px; border-left: 2px solid var(--line); }
.reply-box { display: grid; gap: 6px; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; }
.composer .line { display: flex; gap: 8px; align-items: center; }
.composer .name { max-width: 150px; }
.at { color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .watch { grid-template-columns: 1fr; grid-template-rows: auto 1fr; flex: none; }
  .stage { height: 56vh; }
  .side { border-left: 0; border-top: 1px solid var(--line); max-height: 60vh; }
}
