:root {
  color-scheme: dark;
  font-family: Tahoma, "Segoe UI", sans-serif;
  background: #07111f;
  color: #f5f7fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(39, 178, 154, 0.2), transparent 34rem),
    radial-gradient(circle at 100% 80%, rgba(62, 94, 174, 0.18), transparent 30rem),
    #07111f;
}

button, input { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.8fr);
  gap: 18px;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  color: #4ed7bb;
  direction: ltr;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  margin: 0 0 6px;
}

h1, h2 { margin: 0; }
h1 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h2 { font-size: 1rem; }

.status-badge {
  border: 1px solid #3b4a60;
  border-radius: 999px;
  padding: 9px 14px;
  color: #cbd5e1;
  background: rgba(11, 24, 42, 0.9);
}

.status-badge[data-state="working"] { color: #fbbf24; border-color: #8a651d; }
.status-badge[data-state="connected"],
.status-badge[data-state="live"] { color: #63e6be; border-color: #237f6c; }
.status-badge[data-state="error"] { color: #ff9191; border-color: #8f3232; }

.stage, .control-card, .diagnostics {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(10, 23, 40, 0.88);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.24);
  border-radius: 20px;
}

.stage { grid-row: span 2; overflow: hidden; min-height: 620px; }
.media-stage { position: relative; width: 100%; height: 100%; min-height: 620px; background: #030911; }
.avatar-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.placeholder {
  min-height: 620px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  color: #94a3b8;
  padding: 28px;
}
.placeholder strong { color: #dbe4ee; }
.avatar-mark {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin-bottom: 12px;
  border: 1px solid #3cc7aa;
  border-radius: 50%;
  color: #63e6be;
  font: 600 2.2rem/1 Georgia, serif;
  box-shadow: 0 0 45px rgba(61, 209, 178, 0.16);
}

.control-card, .diagnostics { padding: 20px; }
.control-card { display: grid; gap: 9px; align-content: start; }
label { color: #dbe4ee; font-size: 0.86rem; margin-top: 4px; }
input {
  width: 100%;
  border: 1px solid #34455d;
  border-radius: 10px;
  padding: 12px;
  direction: ltr;
  color: #fff;
  background: #07111f;
  outline: none;
}
input:focus { border-color: #4ed7bb; box-shadow: 0 0 0 3px rgba(78, 215, 187, 0.12); }
input:disabled { opacity: 0.62; }
.security-note { color: #7890aa; margin: 0 0 8px; font-size: 0.75rem; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 8px; }
button {
  min-height: 44px;
  border: 1px solid #42536b;
  border-radius: 10px;
  padding: 9px 12px;
  color: #e8eef5;
  background: #142237;
  cursor: pointer;
}
button.primary { grid-column: 1 / -1; color: #04120f; border-color: #56e1c3; background: #56e1c3; font-weight: 700; }
button:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.diagnostics { align-self: start; }
.developer-diagnostics { grid-column: 1 / -1; }
.diagnostic-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.diagnostic-heading button { min-height: 36px; }
.debug-log-note { color: #7890aa; direction: ltr; font-size: 0.72rem; }
.debug-log-output {
  min-height: 180px;
  max-height: 360px;
  margin: 14px 0 0;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  padding: 14px;
  direction: ltr;
  color: #b9f6e9;
  background: #030911;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 0.78rem/1.65 Consolas, "Courier New", monospace;
}
.diagnostics dl { margin: 14px 0 0; display: grid; gap: 10px; }
.diagnostics dl > div { border-top: 1px solid rgba(148, 163, 184, 0.12); padding-top: 9px; }
dt { color: #7890aa; font-size: 0.73rem; }
dd { margin: 4px 0 0; color: #dbe4ee; overflow-wrap: anywhere; font-size: 0.85rem; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .stage { grid-row: auto; min-height: 55vh; }
  .media-stage, .placeholder { min-height: 55vh; }
}

@media (display-mode: fullscreen) {
  .shell { width: min(1500px, calc(100% - 40px)); }
}
