:root {
  --bg: #0f1114;
  --panel: #16191e;
  --line: #272c33;
  --text: #e6e8eb;
  --muted: #8b929c;
  --accent: #4c8dff;
  --on: #3ddc84;
  --off: #6b7280;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

/* -- sidebar ------------------------------------------------------------ */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.sidebar-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--muted);
}

.session-label {
  margin-top: 4px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--off);
  display: inline-block;
  flex: 0 0 auto;
}

.dot.on { background: var(--on); }
.dot.off { background: var(--off); }

.tabs-head {
  padding: 10px 16px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tab-mode {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 4px;
  cursor: pointer;
}

.tab-mode:hover { color: var(--text); border-color: var(--accent); }

.tab.live-active { border-left: 3px solid var(--on); }

.tab-badge {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on);
  margin-left: 6px;
}

.count {
  color: var(--text);
  background: var(--line);
  border-radius: 8px;
  padding: 0 6px;
  margin-left: 4px;
}

.tab-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.tab {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}

.tab:hover { background: #1c2027; }

.tab.active {
  background: #1c2431;
  border-color: var(--accent);
}

.tab.pending .tab-title { color: var(--muted); }

.tab-title {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-url {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.muted { color: var(--muted); }

/* -- stage -------------------------------------------------------------- */

.stage-area {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.urlbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  min-height: 0;
}

.urlbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.switch-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
}

.switch-btn:hover:not(:disabled) { background: #1c2027; color: var(--text); }
.switch-btn.active { background: var(--accent); color: #fff; }

.switch-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}

.ghost-btn:hover { color: var(--text); border-color: var(--accent); }

.stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0b0d10;
}

.notice {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: 80%;
  padding: 8px 14px;
  border-radius: 8px;
  background: #23282f;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  text-align: center;
}

.page-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}

.page-url {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0b0d10;
}

.stage iframe {
  border: none;
  background: #fff;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: rgba(11, 13, 16, 0.86);
  pointer-events: none;
}

.overlay.visible { display: flex; }

/* -- index -------------------------------------------------------------- */

.index-shell {
  max-width: 720px;
  margin: 48px auto;
  padding: 0 20px;
}

.index-list {
  list-style: none;
  padding: 0;
}

.index-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
}

.index-list a:hover { border-color: var(--accent); }

.index-label { font-weight: 600; }

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { max-height: 38vh; }
}
