:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-strong: #eef2f7;
  --text: #17202a;
  --muted: #637083;
  --line: #d9e0ea;
  --accent: #116dff;
  --accent-dark: #0b55ca;
  --danger: #c7362f;
  --success: #0f8a5f;
  --ink: #ff315f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.secondary {
  color: var(--text);
  background: var(--panel-strong);
}

button.secondary:hover {
  background: #e2e8f2;
}

button.active {
  color: #fff;
  background: var(--success);
}

button.danger {
  background: var(--danger);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}

.app {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  font-size: 17px;
}

.brand span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  background: var(--panel-strong);
  font-size: 13px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.sidebar,
.stage {
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel + .panel {
  margin-top: 14px;
}

.panel-header {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}

.panel-body {
  padding: 14px;
}

.stack {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px dashed #aeb9c8;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
}

.video-shell {
  position: relative;
  display: grid;
  min-height: calc(100vh - 112px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
}

.placeholder {
  place-self: center;
  max-width: 520px;
  padding: 24px;
  color: #cdd6e2;
  text-align: center;
}

.placeholder h1 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 24px;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #101820;
}

.annotation-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.toolbar {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(13, 20, 29, 0.82);
  backdrop-filter: blur(10px);
}

.toolbar button {
  min-width: 42px;
  padding: 9px 10px;
}

.toolbar button.active {
  background: var(--ink);
}

.chat-log {
  display: grid;
  gap: 8px;
  min-height: 190px;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.message {
  display: grid;
  gap: 3px;
}

.message strong {
  font-size: 12px;
}

.message span {
  overflow-wrap: anywhere;
}

.client-main {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 64px);
  padding: 18px;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 18px;
}

.login-panel {
  width: min(420px, 100%);
}

.error-text {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.client-main > .layout {
  width: 100%;
}

.consent {
  width: min(680px, 100%);
}

.consent h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.hidden {
  display: none !important;
}

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

  .video-shell {
    min-height: 56vh;
  }
}
