:root {
  --bg: #f4f6f8;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-border: rgba(12, 78, 110, 0.16);
  --text: #122230;
  --muted: #4a6474;
  --primary: #0f6d8f;
  --primary-strong: #0a5672;
  --accent: #f0963f;
  --danger: #b63f34;
  --success: #1f8f5d;
  --shadow: 0 16px 42px rgba(12, 53, 79, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      circle at 12% 12%,
      rgba(17, 133, 169, 0.24),
      transparent 36%
    ),
    radial-gradient(
      circle at 88% 4%,
      rgba(240, 150, 63, 0.26),
      transparent 31%
    ),
    linear-gradient(160deg, #f6fafb 0%, #edf2f5 100%);
  padding: 32px 18px 56px;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.42;
  pointer-events: none;
  z-index: -1;
}

.shape-a {
  width: 240px;
  height: 240px;
  background: #5dc1bf;
  top: -48px;
  left: -22px;
}

.shape-b {
  width: 320px;
  height: 320px;
  background: #f6aa5c;
  right: -80px;
  bottom: -90px;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.hero {
  margin-bottom: 22px;
  animation: heroIn 520ms ease;
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0;
}

.hero h1 {
  margin: 8px 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
}

.view {
  animation: panelIn 320ms ease;
}

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

.panel-head h2 {
  margin: 0;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.row-between {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

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

.feature-card {
  background: #ffffff;
  border: 1px solid rgba(15, 109, 143, 0.14);
  border-radius: 14px;
  padding: 16px;
}

.feature-card h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--muted);
}

label {
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #1a3a4b;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  border: 1px solid rgba(17, 109, 140, 0.34);
  border-radius: 10px;
  padding: 11px 12px;
  background: #f8fdff;
  color: var(--text);
  font: inherit;
}

input:focus {
  outline: 2px solid rgba(16, 124, 157, 0.32);
  border-color: transparent;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.auth-toggle {
  display: inline-flex;
  background: rgba(15, 109, 143, 0.12);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 14px;
}

.toggle-btn {
  border: 0;
  background: transparent;
  color: #1f4f67;
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}

.toggle-btn.active {
  background: #ffffff;
}

.mode-pills {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f4f9fc;
  border: 1px solid rgba(16, 115, 148, 0.2);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}

.inline-controls {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.grow {
  flex: 1;
  min-width: 260px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.text-btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  transition:
    transform 120ms ease,
    opacity 120ms ease,
    background 120ms ease;
}

.primary-btn {
  background: linear-gradient(130deg, var(--primary) 0%, #2292ba 100%);
  color: #ffffff;
  font-weight: 600;
}

.secondary-btn {
  background: #e8f3f8;
  color: #114f68;
  border: 1px solid rgba(17, 84, 110, 0.18);
}

.ghost-btn {
  background: transparent;
  border: 1px solid rgba(14, 87, 116, 0.2);
  color: #0f4f69;
}

.text-btn {
  padding: 0;
  color: var(--primary);
  text-decoration: underline;
  background: transparent;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.text-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

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

.iframe-stage {
  margin-top: 12px;
  height: min(64vh, 640px);
  border: 1px solid rgba(15, 95, 123, 0.18);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: #ffffff;
}

#sharedFrame {
  width: 100%;
  height: 100%;
  border: 0;
}

.frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.click-marker {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid #e45d46;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  animation: ripple 650ms ease forwards;
}

.warning {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
  background: rgba(234, 97, 78, 0.12);
  border: 1px solid rgba(234, 97, 78, 0.25);
  border-radius: 10px;
  padding: 10px;
}

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

.video-grid.single-video {
  grid-template-columns: 1fr;
}

.video-grid article {
  background: #f6fbfd;
  border: 1px solid rgba(13, 94, 122, 0.2);
  border-radius: 12px;
  padding: 10px;
}

.stream-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.stream-head h4 {
  margin: 0;
}

.mini-btn {
  padding: 6px 10px;
  font-size: 0.84rem;
}

.share-source-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: #1f4f67;
  min-width: 190px;
}

.share-source-wrap select {
  padding: 8px 10px;
  background: #f9fdff;
}

.compat-hint {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: #1f5670;
  background: rgba(16, 121, 153, 0.1);
  border: 1px solid rgba(16, 121, 153, 0.22);
  border-radius: 10px;
  padding: 8px 10px;
}

.stream-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.video-grid h4 {
  margin: 0 0 8px;
}

video {
  width: 100%;
  height: min(42vh, 340px);
  border-radius: 10px;
  background: #0a1622;
  object-fit: contain;
}

.video-grid.single-video video {
  height: min(68vh, 620px);
}

.status-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 107, 137, 0.13);
  color: #10556f;
}

.toast {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  border: 1px solid transparent;
}

.toast.info {
  background: rgba(40, 134, 165, 0.13);
  border-color: rgba(40, 134, 165, 0.3);
}

.toast.success {
  background: rgba(31, 143, 93, 0.14);
  border-color: rgba(31, 143, 93, 0.3);
}

.toast.error {
  background: rgba(182, 63, 52, 0.14);
  border-color: rgba(182, 63, 52, 0.34);
}

.hidden {
  display: none !important;
}

@keyframes ripple {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.4);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.9);
  }
}

@keyframes panelIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes heroIn {
  from {
    transform: translateY(6px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

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

  .panel {
    padding: 14px;
  }

  .inline-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .grow {
    min-width: 100%;
  }

  .share-source-wrap {
    min-width: 100%;
  }

  .stream-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}
