@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  color: #f4f7f5;
  background: #080b0d;
  color-scheme: dark;
  --lime: #c7ff4a;
  --lime-soft: #d8ff80;
  --surface: #101416;
  --surface-raised: #171c1f;
  --border: rgba(255, 255, 255, .09);
  --muted: #8f9994;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 72% 18%, rgba(199, 255, 74, .055), transparent 28rem),
    #080b0d;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

button, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.site-header {
  position: relative;
  z-index: 20;
  width: min(1320px, calc(100% - 56px));
  height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font: 800 19px/1 'Manrope', sans-serif;
  letter-spacing: -.04em;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 7px;
  color: #080b0d;
  background: var(--lime);
}

.brand-mark i {
  width: 2px;
  border-radius: 4px;
  background: currentColor;
  animation: bars 1.35s ease-in-out infinite;
}
.brand-mark i:nth-child(1) { height: 7px; animation-delay: -.3s; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 9px; animation-delay: -.6s; }
.brand-mark.large { width: 76px; height: 76px; border-radius: 23px; gap: 5px; }
.brand-mark.large i { width: 5px; }
.brand-mark.large i:nth-child(1) { height: 22px; }
.brand-mark.large i:nth-child(2) { height: 38px; }
.brand-mark.large i:nth-child(3) { height: 28px; }

@keyframes bars {
  0%, 100% { transform: scaleY(.72); }
  50% { transform: scaleY(1.08); }
}

.connection-pill, .live-label, .viewer-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  font-weight: 700;
}

.connection-pill i, .live-label i, .viewer-live-badge i, .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(199, 255, 74, .09), 0 0 16px rgba(199, 255, 74, .65);
}

.admin-view { min-height: calc(100vh - 88px); }

.welcome-view {
  position: relative;
  width: min(1320px, calc(100% - 56px));
  min-height: calc(100vh - 88px);
  margin: 0 auto;
  padding: 11vh 0 18vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .8fr);
  align-items: center;
  gap: 8vw;
}

.welcome-copy { position: relative; z-index: 2; }
.kicker, .step-label {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.welcome-copy h1, .setup-card h1, .studio-topbar h1 {
  font-family: 'Manrope', sans-serif;
  letter-spacing: -.065em;
}

.welcome-copy h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(52px, 7.1vw, 112px);
  font-weight: 700;
  line-height: .93;
}

.welcome-copy h1 em {
  color: var(--lime);
  font-style: normal;
}

.welcome-copy p {
  max-width: 550px;
  margin: 30px 0 36px;
  color: #9da6a1;
  font-size: clamp(16px, 1.25vw, 19px);
  line-height: 1.65;
}

.button {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 12px 18px;
  cursor: pointer;
  background: #22282b;
  font-weight: 700;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--lime); color: #0a0d0d; }
.button.primary:hover { background: var(--lime-soft); }
.button.large { display: inline-flex; align-items: center; gap: 42px; padding: 17px 22px; font-size: 15px; }
.button.large span { font-size: 21px; font-weight: 400; }
.button.danger { border-color: rgba(255, 94, 94, .22); background: rgba(255, 68, 68, .09); color: #ff8585; }
.button.danger:hover { background: rgba(255, 68, 68, .16); }
.button:disabled { opacity: .55; cursor: wait; }

.welcome-art {
  position: relative;
  min-height: 480px;
  display: grid;
  place-items: center;
}

.signal-core {
  position: relative;
  z-index: 3;
  width: 154px;
  height: 154px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(199, 255, 74, .16);
  border-radius: 50%;
  background: rgba(13, 17, 18, .8);
  box-shadow: 0 0 80px rgba(199, 255, 74, .1);
}

.signal-orbit {
  position: absolute;
  border: 1px solid rgba(199, 255, 74, .13);
  border-radius: 50%;
}
.signal-orbit::before, .signal-orbit::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 16px var(--lime);
}
.orbit-one { width: 300px; height: 300px; animation: spin 17s linear infinite; }
.orbit-one::before { top: 19%; left: 8%; }
.orbit-one::after { right: 0; bottom: 42%; }
.orbit-two { width: 460px; height: 460px; opacity: .55; animation: spin 27s linear infinite reverse; }
.orbit-two::before { top: 6%; right: 26%; }
.orbit-two::after { left: 4%; bottom: 28%; }
@keyframes spin { to { transform: rotate(360deg); } }

.setup-view {
  min-height: calc(100vh - 88px);
  padding: 8vh 24px 14vh;
  display: grid;
  place-items: center;
}

.setup-card {
  position: relative;
  width: min(590px, 100%);
  padding: 50px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(17, 22, 24, .94);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .3);
}
.setup-card .step-label { margin-bottom: 11px; }
.setup-card h1 { margin: 0; font-size: clamp(34px, 5vw, 52px); line-height: 1.05; }
.setup-intro { margin: 18px 0 30px; color: var(--muted); line-height: 1.6; }
.icon-button { border: 0; background: transparent; cursor: pointer; }
.back-button { position: absolute; top: 20px; right: 20px; color: #9aa39e; font-size: 24px; }

.source-option {
  width: 100%;
  min-height: 100px;
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  text-align: left;
  cursor: pointer;
  border: 1px solid rgba(199, 255, 74, .25);
  border-radius: 15px;
  background: rgba(199, 255, 74, .055);
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.source-option:hover { transform: translateY(-2px); border-color: rgba(199, 255, 74, .62); background: rgba(199, 255, 74, .085); }
.source-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 12px; background: var(--lime); color: #0a0d0d; }
.source-icon svg { width: 27px; stroke: currentColor; stroke-width: 1.7; }
.source-copy { display: grid; gap: 6px; }
.source-copy strong { font-size: 16px; }
.source-copy small, .audio-setting small, .quality-setting small { color: var(--muted); font-size: 13px; }
.source-arrow { color: var(--lime); font-size: 24px; }

.quality-setting {
  margin-top: 18px;
  display: grid;
  gap: 11px;
}
.quality-setting > span { display: grid; gap: 5px; }
.quality-setting select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  padding: 12px 38px 12px 12px;
  color: #eef2ef;
  background: #090c0d;
  cursor: pointer;
}
.quality-setting select:focus { border-color: rgba(199, 255, 74, .45); }

.audio-setting {
  margin-top: 16px;
  padding: 17px 4px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  cursor: pointer;
}
.audio-setting > span:first-child { display: grid; gap: 5px; }
.audio-setting input { position: absolute; opacity: 0; pointer-events: none; }
.toggle { position: relative; width: 44px; height: 25px; border-radius: 20px; background: #31383a; transition: background .2s ease; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform .2s ease; }
.audio-setting input:checked + .toggle { background: var(--lime); }
.audio-setting input:checked + .toggle::after { transform: translateX(19px); background: #0b0e0e; }
.form-error { min-height: 20px; margin: 8px 0 0; color: #ff8d8d; font-size: 13px; line-height: 1.5; }

.studio-view { width: min(1420px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 70px; }
.studio-topbar { margin-bottom: 20px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.studio-topbar h1 { margin: 7px 0 0; font-size: 38px; }
.live-label { color: var(--lime); }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: stretch; }
.video-surface { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: #030404; }
.video-surface video { width: 100%; height: 100%; display: block; object-fit: contain; }
.host-video-surface { min-height: 0; aspect-ratio: 16 / 9; }
.video-corner-label { position: absolute; top: 16px; left: 16px; padding: 7px 10px; border-radius: 8px; background: rgba(5, 7, 8, .72); backdrop-filter: blur(10px); color: #b8c0bc; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.host-controls { position: absolute; inset: auto 0 18px; display: flex; justify-content: center; }
.round-control { width: 45px; height: 45px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; background: rgba(14,18,20,.82); backdrop-filter: blur(12px); cursor: pointer; }
.round-control:hover { background: rgba(32,38,40,.92); }
.round-control.muted { border-color: rgba(255, 94, 94, .28); background: rgba(80, 22, 22, .82); }
.round-control svg { width: 19px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.host-sidebar { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 18px; }
.host-sidebar .chat-panel, #hostChatMount { min-height: 0; }
.share-card { padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.share-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.share-heading div { display: grid; gap: 5px; }
.share-heading span { color: var(--muted); font-size: 12px; }
.share-heading strong { font-size: 18px; }
.link-field { margin-top: 18px; display: flex; align-items: center; min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: #090c0d; }
.link-field > span { min-width: 0; flex: 1; padding: 11px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #b5beb9; font-size: 12px; }
.link-field button { align-self: stretch; border: 0; border-left: 1px solid var(--border); padding: 0 13px; cursor: pointer; background: transparent; color: var(--lime); font-size: 12px; font-weight: 700; }
.share-card > p { margin: 10px 1px 0; color: #67706c; font-size: 11px; }

.chat-panel { height: 100%; min-height: 410px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.chat-header { min-height: 70px; padding: 17px 19px; display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.chat-header h2 { margin: 0 0 3px; font: 700 15px/1.2 'Manrope', sans-serif; }
.chat-header span { color: var(--muted); font-size: 11px; }
.chat-messages { min-height: 0; overflow-y: auto; padding: 18px; scrollbar-width: thin; scrollbar-color: #303638 transparent; }
.chat-empty { height: 100%; min-height: 180px; display: grid; place-content: center; justify-items: center; text-align: center; color: #69716d; }
.chat-empty span { color: var(--lime); font-size: 21px; }
.chat-empty p { font-size: 12px; line-height: 1.55; }
.chat-message { margin-bottom: 17px; }
.chat-message > div { margin-bottom: 5px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-message strong { color: var(--lime-soft); font-size: 11px; }
.chat-message.own strong { color: #fff; }
.chat-message time { color: #5e6762; font-size: 10px; }
.chat-message p { margin: 0; color: #c1c8c4; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-form { margin: 0; padding: 13px; display: grid; grid-template-columns: 1fr auto; gap: 8px; border-top: 1px solid var(--border); }
.chat-form input { min-width: 0; border: 1px solid var(--border); border-radius: 10px; outline: 0; padding: 11px 12px; background: #090c0d; color: #f4f7f5; font-size: 12px; }
.chat-form input:focus { border-color: rgba(199, 255, 74, .4); }
.chat-form input::placeholder { color: #5d6561; }
.chat-form button { width: 40px; border: 0; border-radius: 10px; cursor: pointer; background: var(--lime); color: #090c0d; font-size: 19px; }

body.viewer-mode { overflow: hidden; background: #020303; }
body.viewer-mode::before { display: none; }
.viewer-view { width: 100vw; height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 340px; background: #020303; }
.viewer-video-wrap { position: relative; min-width: 0; overflow: hidden; display: grid; place-items: center; background: #020303; }
.viewer-video-wrap video { width: 100%; height: 100%; display: block; object-fit: contain; }
.viewer-gradient { position: absolute; inset: 0 0 auto; height: 130px; pointer-events: none; background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent); }
.viewer-brand { position: absolute; top: 24px; left: 26px; display: flex; align-items: center; gap: 10px; font: 800 16px/1 'Manrope', sans-serif; letter-spacing: -.04em; }
.viewer-live-badge { position: absolute; top: 25px; right: 26px; padding: 8px 11px; border-radius: 8px; background: rgba(8, 12, 13, .7); backdrop-filter: blur(12px); }
.viewer-empty-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; padding: 28px; }
.viewer-empty-state strong { margin-top: 20px; font: 700 clamp(20px, 3vw, 30px)/1.2 'Manrope', sans-serif; }
.viewer-empty-state p { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.loader-ring { width: 42px; height: 42px; border: 2px solid rgba(199, 255, 74, .16); border-top-color: var(--lime); border-radius: 50%; animation: spin .9s linear infinite; }
.viewer-audio-button { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); border: 1px solid rgba(255,255,255,.16); border-radius: 999px; padding: 10px 16px; cursor: pointer; background: rgba(8,11,12,.8); backdrop-filter: blur(12px); font-size: 12px; }
.viewer-chat-mount { min-width: 0; height: 100vh; padding: 10px 10px 10px 0; background: #020303; }
.viewer-chat-mount .chat-panel { border-radius: 14px; background: #0c1011; }

@media (max-width: 980px) {
  .welcome-view { grid-template-columns: 1fr; padding-top: 8vh; }
  .welcome-art { position: absolute; z-index: 0; right: -130px; top: 4vh; opacity: .36; }
  .studio-grid { grid-template-columns: 1fr; }
  .host-video-surface { min-height: 0; }
  .host-sidebar { grid-template-columns: minmax(260px, .65fr) 1fr; grid-template-rows: 480px; }
  .host-sidebar .share-card { align-self: start; }
}

@media (max-width: 760px) {
  .site-header { width: calc(100% - 32px); height: 72px; }
  .welcome-view { width: calc(100% - 32px); min-height: calc(100vh - 72px); padding: 10vh 0; }
  .welcome-copy h1 { font-size: clamp(46px, 14vw, 70px); }
  .welcome-copy p { margin-top: 24px; }
  .welcome-art { display: none; }
  .setup-view { min-height: calc(100vh - 72px); padding: 30px 16px 70px; }
  .setup-card { padding: 34px 22px 26px; }
  .source-option { grid-template-columns: auto 1fr; }
  .source-arrow { display: none; }
  .studio-view { width: calc(100% - 24px); padding-top: 14px; }
  .studio-topbar h1 { font-size: 30px; }
  .host-sidebar { display: grid; grid-template-columns: 1fr; grid-template-rows: auto 460px; }
  .viewer-view { height: 100dvh; grid-template-columns: 1fr; grid-template-rows: minmax(0, 56vh) minmax(0, 44vh); }
  .viewer-chat-mount { height: auto; min-height: 0; padding: 0 8px 8px; }
  .viewer-chat-mount .chat-panel { min-height: 0; border-radius: 12px; }
  .viewer-brand { top: 17px; left: 18px; }
  .viewer-live-badge { top: 16px; right: 18px; }
}
