:root {
  color-scheme: dark;
  --bg: #071012;
  --bg-2: #0d171a;
  --panel: rgba(11, 18, 21, 0.88);
  --panel-strong: rgba(8, 12, 14, 0.96);
  --border: rgba(179, 205, 193, 0.16);
  --text: #f1f8f4;
  --muted: #a7bfba;
  --accent: #7ce4bf;
  --accent-2: #c7ff86;
  --danger: #ff8e7b;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.38);
  --radius: 24px;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 228, 191, 0.16), transparent 34%),
    radial-gradient(circle at bottom right, rgba(199, 255, 134, 0.12), transparent 28%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black, transparent 86%);
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  padding: 40px;
}

.hero-card,
.form-card,
.stage-shell,
.input-panel {
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-card {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: end;
}

.hero-card h1,
.topbar h1 {
  margin: 0;
  letter-spacing: -0.04em;
  line-height: 0.95;
  font-size: clamp(2.4rem, 6vw, 5rem);
}

.lede {
  margin-top: 20px;
  max-width: 42rem;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 18px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.76rem;
  color: var(--accent);
}

.feature-list {
  margin: 26px 0 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 10px;
}

.form-card {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-form {
  width: min(100%, 420px);
  padding: 30px;
  border-radius: 20px;
  background: var(--panel-strong);
}

.auth-form label,
.text-field {
  display: grid;
  gap: 8px;
}

.auth-form label + label {
  margin-top: 16px;
}

.auth-form span,
.text-field span {
  color: var(--muted);
  font-size: 0.92rem;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.auth-form button,
.input-panel button,
.toolbar button {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #061013;
  font-weight: 700;
}

.ghost {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text) !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: var(--muted);
}

.status.error,
.state.error {
  color: var(--danger);
}

.remote-shell {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  gap: 20px;
}

.topbar,
.input-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.topbar {
  padding: 18px 20px;
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.card {
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.subtle {
  color: var(--muted);
  margin: 10px 0 0;
}

.remote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.stage-shell {
  position: relative;
  overflow: hidden;
  padding: 14px;
}

#remote-video {
  display: block;
  width: 100%;
  min-height: 66vh;
  max-height: 78vh;
  background: #040607;
  object-fit: contain;
}

.overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}

.state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.status-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  position: sticky;
  top: 18px;
}

.panel-section {
  display: grid;
  gap: 14px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(124, 228, 191, 0.16);
  color: var(--accent);
  border: 1px solid rgba(124, 228, 191, 0.28);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.08);
}

.status-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.status-grid .wide {
  grid-column: 1 / -1;
}

.status-grid dt {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-grid dd {
  margin: 0;
  min-height: 1.2em;
  word-break: break-word;
}

.status-value {
  font-size: 0.98rem;
}

.status-value.ok {
  color: var(--accent);
}

.status-value.warn {
  color: var(--caution, #ffd27d);
}

.status-value.error {
  color: var(--danger);
}

.empty-state {
  color: var(--muted);
  font-size: 0.92rem;
}

.activity-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 38vh;
  overflow: auto;
}

.activity-feed:empty {
  display: none;
}

.activity-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: grid;
  gap: 4px;
}

.activity-item .meta {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.activity-item .summary {
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
}

.input-panel {
  padding: 18px;
}

.input-panel button {
  padding: 12px 16px;
}

.text-field {
  min-width: min(100%, 320px);
}

@media (max-width: 960px) {
  .login-shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .hero-card,
  .auth-form,
  .remote-shell {
    padding: 24px;
  }

  .remote-shell {
    padding: 16px;
  }

  .remote-layout {
    grid-template-columns: 1fr;
  }

  .status-panel {
    position: static;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  #remote-video {
    min-height: 58vh;
  }
}
