:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #eef3f8;
  --text: #172033;
  --muted: #657086;
  --line: #dce3ed;
  --accent: #1266f1;
  --accent-strong: #0d4fc4;
  --danger: #c93535;
  --success: #18845c;
  --warning: #986f13;
  --shadow: 0 18px 55px rgba(32, 44, 68, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 760;
  letter-spacing: 0;
}

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #172033;
  box-shadow: 0 10px 24px rgba(23, 32, 51, 0.18);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #9aa4b5;
}

.dot.ok {
  background: var(--success);
}

.dot.warn {
  background: var(--warning);
}

.dot.live {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(201, 53, 53, 0.13);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 24px;
  align-items: stretch;
}

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

.intro {
  padding: 30px;
}

.intro h1 {
  max-width: 680px;
  margin: 0 0 14px;
  font-size: clamp(32px, 5vw, 60px);
  line-height: 0.98;
  letter-spacing: 0;
}

.intro p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.notice {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding: 16px;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid #d7e2ef;
}

.notice strong {
  font-size: 14px;
}

.notice span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.card {
  padding: 24px;
}

.field-grid {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: #465166;
  font-size: 13px;
  font-weight: 720;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid #cfd8e5;
  border-radius: 8px;
  outline: none;
  background: #fff;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(18, 102, 241, 0.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 760;
}

.button.primary {
  color: #fff;
  background: var(--accent);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary {
  color: var(--text);
  background: #fff;
  border-color: #cfd8e5;
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.session-box {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  padding: 18px;
  border-radius: 8px;
  border: 1px dashed #b9c7d9;
  background: #fbfdff;
}

.session-code {
  font-variant-numeric: tabular-nums;
  font-size: clamp(38px, 8vw, 72px);
  line-height: 1;
  font-weight: 820;
  letter-spacing: 0.08em;
}

.small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.viewer {
  display: grid;
  gap: 18px;
}

.video-frame {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  background: #101621;
  border: 1px solid #1d2736;
  border-radius: 8px;
}

.video-frame video {
  width: 100%;
  height: 100%;
  min-height: 520px;
  display: block;
  object-fit: contain;
  background: #101621;
}

.empty-video {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  color: #c2cbda;
}

.empty-video strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-size: 20px;
}

.log {
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  color: #dbe5f3;
  background: #131b29;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

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

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

.compact-fields {
  margin-top: 0;
}

.divider {
  height: 1px;
  margin: 22px 0;
  background: #edf1f6;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head > div {
  display: grid;
  gap: 5px;
}

.devices-list {
  display: grid;
  gap: 12px;
}

.empty-list {
  padding: 18px;
  color: var(--muted);
  border: 1px dashed #b9c7d9;
  border-radius: 8px;
  background: #fbfdff;
}

.device-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dce3ed;
  border-radius: 8px;
  background: #fbfdff;
}

.device-main,
.device-sub {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.device-main strong,
.device-main span {
  display: block;
}

.device-main span,
.device-sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.device-status {
  flex: 0 0 auto;
  min-width: 86px;
  padding: 4px 8px;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 760;
}

.device-status.online {
  color: #116345;
  background: #e9f7f1;
}

.device-status.pending {
  color: #7f5c0c;
  background: #fff5d9;
}

.device-status.live {
  color: #9d2424;
  background: #fdeaea;
}

.device-action {
  width: 100%;
}

.request-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
}

.device-id {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 760;
}

.meta-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f6;
}

.meta-row span:first-child {
  color: var(--muted);
}

.meta-row span:last-child {
  text-align: right;
  font-weight: 680;
}

@media (max-width: 880px) {
  .hero,
  .split,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .request-panel,
  .device-main,
  .device-sub {
    flex-direction: column;
  }

  .shell {
    width: min(100vw - 24px, 1180px);
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .video-frame,
  .video-frame video {
    min-height: 320px;
  }
}
