:root {
  color-scheme: dark;
  --background: #090a0d;
  --surface: #121419;
  --surface-raised: #191c22;
  --surface-soft: #0e1014;
  --border: #292d36;
  --border-bright: #3a404c;
  --text: #f6f2eb;
  --muted: #9ba0aa;
  --accent: #f2a65a;
  --accent-strong: #ffb86c;
  --sync: #62d6b2;
  --danger: #ff7a7a;
  --radius-large: 22px;
  --radius-medium: 14px;
  --shadow: 0 28px 90px rgb(0 0 0 / 35%);
  --plyr-color-main: var(--accent);
  --plyr-video-background: #050608;
  --plyr-menu-background: #17191f;
  --plyr-menu-color: var(--text);
  --plyr-video-control-color: var(--text);
  --plyr-video-control-background-hover: rgb(242 166 90 / 20%);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgb(242 166 90 / 10%), transparent 34rem),
    radial-gradient(circle at 90% 20%, rgb(98 214 178 / 7%), transparent 28rem),
    var(--background);
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 22rem;
  height: 22rem;
  border: 1px solid rgb(255 255 255 / 4%);
  border-radius: 50%;
  opacity: 0.6;
  pointer-events: none;
}

.ambient-one {
  top: 9rem;
  right: -15rem;
}

.ambient-two {
  bottom: -17rem;
  left: -9rem;
  width: 30rem;
  height: 30rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  height: 82px;
  margin: 0 auto;
  border-bottom: 1px solid rgb(255 255 255 / 7%);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--text);
  font-weight: 720;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: #17100a;
  font-size: 13px;
  font-weight: 850;
  background: var(--accent);
  border-radius: 9px 9px 9px 3px;
  box-shadow: 0 8px 28px rgb(242 166 90 / 18%);
}

.connection-badge,
.drift-readout {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #747983;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(116 121 131 / 10%);
}

.connection-badge[data-state="online"] .status-dot,
.drift-readout[data-state="synced"] .status-dot {
  background: var(--sync);
  box-shadow: 0 0 0 4px rgb(98 214 178 / 10%);
}

.connection-badge[data-state="offline"] .status-dot,
.drift-readout[data-state="seek"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgb(255 122 122 / 10%);
}

.drift-readout[data-state="correcting"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgb(242 166 90 / 10%);
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.landing {
  max-width: 920px;
  margin: 2vh auto 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.landing h1 {
  max-width: 790px;
  margin: 20px 0 24px;
  font-size: clamp(48px, 8vw, 94px);
  font-weight: 720;
  letter-spacing: -0.065em;
  line-height: 0.95;
}

.landing h1 span {
  color: var(--muted);
}

.lead {
  max-width: 680px;
  margin: 0;
  color: #b8bbc3;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.58;
}

.create-card {
  margin-top: 48px;
  padding: 22px;
  background: rgb(18 20 25 / 88%);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.create-card label,
.source-form label {
  display: block;
  margin: 0 0 10px;
  color: #c8cbd1;
  font-size: 13px;
  font-weight: 650;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  color: var(--text);
  background: #0c0e12;
  border: 1px solid var(--border-bright);
  border-radius: 11px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input {
  min-height: 50px;
  padding: 0 15px;
}

textarea {
  min-height: 86px;
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.45;
}

input:hover,
textarea:hover {
  border-color: #4a505c;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgb(242 166 90 / 10%);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  border-radius: 11px;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.primary-button {
  color: #18110a;
  font-weight: 760;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.secondary-button {
  color: var(--text);
  font-size: 13px;
  font-weight: 680;
  background: var(--surface-raised);
  border: 1px solid var(--border-bright);
}

.secondary-button:hover {
  background: #20242b;
  border-color: #525966;
  transform: translateY(-1px);
}

.field-note,
.panel-note,
.form-error {
  margin: 11px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.permission-choice {
  display: flex !important;
  gap: 11px;
  align-items: flex-start;
  margin: 15px 2px 0 !important;
  padding: 13px 14px;
  cursor: pointer;
  background: rgb(255 255 255 / 2%);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.permission-choice input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--accent);
  box-shadow: none;
}

.permission-choice span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.permission-choice strong {
  color: var(--text);
  font-size: 13px;
}

.permission-choice small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.threshold-choice {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin: 15px 2px 0;
  padding: 13px 14px;
  background: rgb(255 255 255 / 2%);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.threshold-choice > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.threshold-choice strong {
  color: var(--text);
  font-size: 13px;
}

.threshold-choice small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.threshold-input {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.threshold-input input {
  width: 96px;
  min-height: 40px;
  height: 40px;
  padding: 0 10px;
  text-align: right;
}

.field-note code {
  color: #d7d9de;
}

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

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 48px;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
}

.feature-strip > div {
  display: flex;
  min-height: 104px;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  background: var(--surface-soft);
}

.feature-strip strong {
  margin-bottom: 6px;
  font-size: 14px;
}

.feature-strip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.room {
  width: 100%;
}

.room-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.room-heading h1 {
  margin: 7px 0 0;
  font-size: clamp(30px, 5vw, 47px);
  letter-spacing: -0.045em;
}

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

.role-badge,
.live-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.role-badge {
  min-height: 34px;
  padding: 0 13px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
  background: rgb(242 166 90 / 9%);
  border: 1px solid rgb(242 166 90 / 24%);
}

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 294px;
  gap: 18px;
  align-items: start;
}

.video-column,
.side-panel {
  min-width: 0;
}

.video-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #050608;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow);
}

.video-frame .plyr,
.video-frame video {
  width: 100%;
  height: 100%;
}

.video-frame video {
  object-fit: contain;
}

.video-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px;
  text-align: center;
  background: rgb(7 8 11 / 88%);
  backdrop-filter: blur(10px);
}

.video-overlay strong {
  margin-bottom: 8px;
  font-size: 18px;
}

.video-overlay span {
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.video-overlay .primary-button {
  margin-top: 20px;
}

.overlay-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  place-items: center;
  color: var(--accent);
  background: rgb(242 166 90 / 10%);
  border: 1px solid rgb(242 166 90 / 20%);
  border-radius: 15px;
}

.now-row {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 6px;
  border-bottom: 1px solid var(--border);
}

.now-row > div:first-child {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.micro-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.now-row strong {
  font-size: 14px;
}

.side-panel {
  overflow: hidden;
  background: rgb(18 20 25 / 80%);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
}

.panel-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.panel-section:last-child {
  border-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 17px;
  color: #dfe1e5;
  font-size: 12px;
  font-weight: 740;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.live-label {
  height: 21px;
  padding: 0 7px;
  color: var(--sync);
  font-size: 9px;
  letter-spacing: 0.09em;
  background: rgb(98 214 178 / 8%);
  border: 1px solid rgb(98 214 178 / 20%);
}

.status-list {
  margin: 0;
}

.status-list > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgb(255 255 255 / 5%);
}

.status-list > div:last-child {
  padding-bottom: 0;
  border: 0;
}

.status-list dt,
.status-list dd {
  margin: 0;
  font-size: 12px;
}

.status-list dt {
  color: var(--muted);
}

.status-list dd {
  color: #dfe1e5;
  font-weight: 650;
  text-align: right;
}

.source-form .secondary-button {
  margin-top: 10px;
}

.full-width {
  width: 100%;
}

.quiet-section p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.fatal-card {
  display: flex;
  max-width: 660px;
  gap: 18px;
  align-items: flex-start;
  margin-top: 50px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid rgb(255 122 122 / 25%);
  border-radius: var(--radius-large);
}

.fatal-symbol {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--danger);
  font-weight: 800;
  border: 1px solid rgb(255 122 122 / 30%);
  border-radius: 50%;
}

.fatal-card h2 {
  margin: 1px 0 8px;
  font-size: 20px;
}

.fatal-card p {
  margin: 0 0 13px;
  color: var(--muted);
  line-height: 1.55;
}

.text-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 680;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100% - 44px));
  padding: 13px 16px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  background: #22262e;
  border: 1px solid #3c424e;
  border-radius: 12px;
  box-shadow: 0 16px 50px rgb(0 0 0 / 40%);
}

.plyr--video {
  height: 100%;
}

.plyr__control--overlaid {
  background: var(--accent);
}

.plyr__controls {
  padding: clamp(10px, 2.4vw, 20px) !important;
  background: linear-gradient(transparent, rgb(0 0 0 / 76%)) !important;
}

@media (max-width: 900px) {
  .shell {
    padding-top: 48px;
  }

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

  .side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .panel-section {
    border-right: 1px solid var(--border);
  }
}

@media (max-width: 660px) {
  .topbar,
  .shell {
    width: min(100% - 26px, 1180px);
  }

  .topbar {
    height: 70px;
  }

  .shell {
    padding: 38px 0 64px;
  }

  .landing h1 {
    font-size: clamp(45px, 15vw, 68px);
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .primary-button {
    min-height: 50px;
  }

  .feature-strip {
    grid-template-columns: 1fr;
  }

  .feature-strip > div {
    min-height: 82px;
  }

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

  .room-actions {
    width: 100%;
  }

  .room-actions .secondary-button {
    flex: 1;
  }

  .video-frame {
    border-radius: 14px;
  }

  .plyr__controls [data-plyr="pip"],
  .plyr__time--duration {
    display: none !important;
  }

  .now-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
  }

  .side-panel {
    display: block;
  }

  .panel-section {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
