:root {
  --bg-0: #080b10;
  --bg-1: #111722;
  --bg-2: #1c2636;
  --panel: rgba(16, 22, 32, 0.9);
  --panel-soft: rgba(23, 31, 43, 0.84);
  --surface: rgba(255, 255, 255, 0.04);
  --line: rgba(173, 206, 242, 0.12);
  --line-strong: rgba(173, 206, 242, 0.22);
  --text: #f5f7fb;
  --muted: #95a8c1;
  --accent: #d7ba84;
  --accent-2: #8fb0da;
  --accent-3: #f3e1bc;
  --danger: #ff758f;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.2);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--text);
  font-family:
    "PingFang SC",
    "Hiragino Sans GB",
    "MiSans",
    "HarmonyOS Sans SC",
    "Noto Sans SC",
    "Microsoft YaHei UI",
    "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at top left, rgba(143, 176, 218, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(215, 186, 132, 0.08), transparent 24%),
    radial-gradient(circle at bottom center, rgba(243, 225, 188, 0.06), transparent 24%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 52%, #0a0f16 100%);
}

.host-page,
.viewer-page {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

img {
  max-width: 100%;
}

h1,
h2,
p {
  margin: 0;
}

.card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  pointer-events: none;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hint,
.field-label {
  color: var(--muted);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  min-height: 46px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button.primary {
  color: #08111b;
  background: linear-gradient(135deg, var(--accent-3) 0%, var(--accent) 48%, #c69355 100%);
  box-shadow: 0 14px 28px rgba(215, 186, 132, 0.18);
}

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

.text-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 14px;
  font-size: 15px;
  outline: none;
}

.text-input:focus {
  border-color: rgba(118, 183, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(118, 183, 255, 0.12);
}

.hidden {
  display: none !important;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.pill.live::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 12px rgba(255, 117, 143, 0.86);
}

.video-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top, rgba(118, 183, 255, 0.08), transparent 36%),
    linear-gradient(180deg, #0a121c 0%, #060b12 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

video {
  width: 100%;
  height: 100%;
  display: block;
  background: #05080e;
}

.video-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(5, 11, 19, 0.18), rgba(5, 11, 19, 0.84));
}

.message {
  padding: 11px 12px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.message p {
  line-height: 1.55;
  font-size: 13px;
}

.message strong {
  color: #c5e3ff;
}

.host-message {
  background: rgba(142, 227, 209, 0.08);
  border-color: rgba(142, 227, 209, 0.14);
}

.host-message strong {
  color: #97f1df;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 12, 0.78);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  padding: 24px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    rgba(12, 19, 30, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.modal-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.join-card {
  width: min(100%, 420px);
}

.host-password-card {
  width: min(100%, 420px);
}

.host-password-error {
  color: #ff9aa8;
  font-size: 13px;
  line-height: 1.6;
}

.join-form,
.host-config-grid {
  display: grid;
  gap: 14px;
}

.home-page {
  min-height: 100vh;
}

.home-shell {
  width: min(1360px, calc(100% - 48px));
  margin: 0 auto;
  padding: 38px 0 44px;
  display: grid;
  gap: 24px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 470px);
  gap: 30px;
  padding: 36px;
}

.home-hero h1 {
  font-size: clamp(40px, 4.8vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.home-lead {
  margin-top: 16px;
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.72;
}

.home-actions {
  margin-top: 28px;
}

.home-preview-panel {
  display: grid;
  gap: 18px;
}

.home-preview-stage {
  position: relative;
  min-height: 350px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top, rgba(118, 183, 255, 0.16), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, #0c1623 0%, #0a111b 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.home-preview-screen {
  position: absolute;
  left: 22px;
  top: 28px;
  width: calc(100% - 112px);
  height: 226px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(142, 227, 209, 0.16), transparent 40%),
    linear-gradient(180deg, rgba(118, 183, 255, 0.12), rgba(255, 255, 255, 0.02)),
    #101b28;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.home-preview-phone {
  position: absolute;
  right: 24px;
  bottom: 18px;
  width: 170px;
  height: 306px;
  padding: 14px;
  border-radius: 30px;
  background: linear-gradient(180deg, #0f1b2a 0%, #0b1320 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.28);
}

.home-preview-header {
  width: 92px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.home-preview-video {
  margin-top: 16px;
  height: 136px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(118, 183, 255, 0.24), rgba(142, 227, 209, 0.14));
}

.home-preview-comments {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.home-preview-comments span {
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.home-preview-comments span:nth-child(1) {
  width: 88%;
}

.home-preview-comments span:nth-child(2) {
  width: 70%;
}

.home-preview-comments span:nth-child(3) {
  width: 56%;
}

.home-preview-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.home-preview-notes > div,
.home-result-item {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.home-preview-notes strong {
  display: block;
  margin-bottom: 8px;
}

.home-preview-notes p {
  color: var(--muted);
  line-height: 1.6;
}

.home-result {
  padding: 28px;
}

.home-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.home-result-head h2 {
  font-size: 28px;
}

.home-result-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  margin-top: 24px;
}

.home-result-qr {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.home-qr-frame {
  width: 100%;
  max-width: 260px;
  padding: 14px;
  border-radius: 28px;
  background: #fff;
}

.home-result-meta {
  display: grid;
  gap: 14px;
}

.result-link {
  display: block;
  color: var(--text);
  line-height: 1.6;
  text-decoration: none;
  word-break: break-all;
}

.host-page {
  min-height: 100vh;
}

.host-shell {
  width: min(1520px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) 420px;
  gap: 20px;
  height: 100vh;
}

.host-main,
.host-share-card,
.host-side-card {
  padding: 24px;
}

.host-network-card {
  padding: 24px;
}

.host-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  min-height: calc(100vh - 40px);
}

.host-main-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 2px 0;
}

.host-main-head h1 {
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.host-identity {
  min-width: 0;
}

.host-subtitle {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.72;
}

.host-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.host-summary-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e9eef8;
  font-size: 13px;
}

.host-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.host-preview-panel {
  min-height: 0;
}

.host-video-wrap {
  aspect-ratio: 16 / 9;
  height: 100%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.host-video-wrap .preview-hidden {
  visibility: hidden;
}

.host-preview-panel video {
  object-fit: contain;
}

.host-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.host-toolbar-left {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  min-width: 0;
}

.host-select-group {
  width: 220px;
}

.source-select {
  min-height: 48px;
}

.host-toolbar-tip {
  max-width: 380px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  padding-bottom: 4px;
}

.controls {
  display: flex;
  gap: 12px;
}

.host-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 40px);
}

.host-share-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.host-qr-frame {
  width: 150px;
  height: 150px;
  padding: 10px;
  border-radius: 22px;
  background: #fff;
}

.host-side-card {
  display: grid;
  grid-template-rows: minmax(0, 1.08fr) minmax(220px, 0.92fr);
  gap: 18px;
  min-height: 0;
}

.host-network-summary {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.host-network-summary[data-tone="ok"] {
  color: #97f1df;
}

.host-network-summary[data-tone="warn"] {
  color: #ffd38c;
}

.host-network-summary[data-tone="pending"] {
  color: #c5e3ff;
}

.host-network-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.host-network-actions .button {
  min-height: 38px;
  padding-inline: 16px;
  font-size: 13px;
}

.host-network-log {
  min-height: 220px;
  max-height: 320px;
  margin-top: 14px;
  padding: 14px;
  overflow: auto;
  border-radius: 18px;
  background: rgba(6, 10, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #cfe5ff;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.host-side-block {
  min-height: 0;
}

.host-chat-block {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.host-viewer-block {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.messages,
.host-viewer-list,
.viewer-messages {
  overflow: auto;
  min-height: 0;
  padding-right: 6px;
}

.host-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 100%;
}

.host-viewer-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.inline-chat-form,
.viewer-inputbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.viewer-inputbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px 30px 98px;
  align-items: center;
  gap: 6px;
}

.chat-compose {
  position: relative;
  min-width: 0;
}

.chat-compose .text-input {
  padding-right: 58px;
}

.emoji-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  z-index: 2;
  min-height: 34px;
  min-width: 34px;
  width: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: none;
}

.emoji-toggle:hover {
  transform: translateY(-50%);
}

.viewer-compose .viewer-input {
  padding-right: 16px;
}

.viewer-icon-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
  justify-self: center;
}

.emoji-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 62px;
  z-index: 6;
  padding: 10px;
  border-radius: 20px;
  background: rgba(10, 15, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.emoji-panel-shell {
  display: grid;
  gap: 10px;
}

.emoji-panel-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.emoji-tab {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.emoji-tab.is-active {
  background: rgba(224, 186, 108, 0.18);
  border-color: rgba(224, 186, 108, 0.38);
  color: var(--accent);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.emoji-item {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.emoji-item:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.emoji-panel-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.emoji-page-button {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.emoji-page-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.emoji-page-indicator {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.share-card {
  width: min(100%, 360px);
}

.share-card-body {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin-top: 8px;
}

.share-qr-frame {
  width: 220px;
  height: 220px;
  padding: 12px;
  border-radius: 28px;
  background: #fff;
}

.share-room-title {
  font-size: 18px;
  font-weight: 700;
}

.share-card-body .text-input {
  font-size: 14px;
}

.share-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.settings-card {
  width: min(100%, 320px);
}

.browser-tip-card {
  width: min(100%, 420px);
}

.browser-tip-body {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}

.browser-tip-note {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e7edf7;
  line-height: 1.7;
}

.browser-tip-steps {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.8;
}

.browser-tip-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.settings-actions {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.settings-action {
  width: 100%;
  min-height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.inline-chat-form .button,
.viewer-inputbar .button {
  min-width: 86px;
}

.viewer-inputbar > .button {
  min-width: 0;
  flex: 0 0 auto;
}

.viewer-compose {
  flex: 1 1 auto;
  min-width: 0;
}

.host-viewer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.host-viewer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #071019;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-3), var(--accent));
}

.host-viewer-meta strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.host-viewer-meta p,
.host-viewer-empty {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.host-config-modal {
  width: min(100%, 620px);
}

.viewer-page {
  background:
    radial-gradient(circle at top center, rgba(143, 176, 218, 0.12), transparent 30%),
    radial-gradient(circle at bottom center, rgba(215, 186, 132, 0.08), transparent 28%),
    linear-gradient(180deg, #0b1014 0%, #111722 56%, #080b10 100%);
}

.viewer-shell {
  width: min(1120px, calc(100% - 2px));
  min-height: 100%;
  height: 100%;
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + 16px)
    calc(var(--safe-right) + 6px)
    calc(var(--safe-bottom) + 8px)
    calc(var(--safe-left) + 6px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px;
}

.viewer-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px 7px;
}

.viewer-host-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1 1 auto;
}

.viewer-host-avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #09111b;
  font-weight: 800;
  font-size: 14px;
  background: linear-gradient(135deg, var(--accent-3), var(--accent));
  box-shadow: var(--shadow-soft);
}

.viewer-room-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
  flex: 1 1 auto;
}

.viewer-room-meta strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.viewer-room-support {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-all;
}

.viewer-room-id {
  display: block;
  color: rgba(255, 255, 255, 0.28);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.viewer-top-pills {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: flex-start;
  flex: 0 0 auto;
  padding-top: 1px;
}

.viewer-settings-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.viewer-settings-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.viewer-live-pill,
.viewer-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.viewer-count-button {
  cursor: pointer;
  color: var(--text);
}

.viewer-count-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.viewer-stage,
.viewer-chat {
  padding: 8px;
}

.viewer-stage {
  border-color: rgba(255, 255, 255, 0.05);
}

.viewer-stage::before {
  display: none;
}

.viewer-stage-inner {
  position: relative;
}

.viewer-video {
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 18px;
  background: #05080e;
}

.viewer-empty {
  border-radius: 18px;
}

.viewer-play-button {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 3;
  min-width: 188px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.viewer-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.viewer-chat-head {
  margin-bottom: 6px;
  flex: 0 0 auto;
}

.viewer-pinned-messages {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.viewer-pinned-messages .message {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(13, 23, 35, 0.92);
  border: 1px solid rgba(143, 176, 218, 0.18);
}

.viewer-pinned-messages .message strong {
  color: #8df0dc;
}

.viewer-messages {
  display: grid;
  align-content: start;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.viewer-messages .message {
  padding: 9px 11px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.viewer-messages .message p {
  font-size: 13px;
}

.viewer-messages .message strong {
  color: #a8dcff;
}

.viewer-messages .host-message strong {
  color: #8df0dc;
}

.viewer-input {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.viewer-input::placeholder {
  color: rgba(255, 255, 255, 0.54);
}

.viewer-send-button {
  min-width: 98px;
  min-height: 44px;
  padding-inline: 24px;
}

.viewer-remember-login {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.viewer-captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 12px;
  align-items: stretch;
}

.viewer-captcha-input {
  text-align: center;
  letter-spacing: 0.28em;
  font-size: 18px;
}

.viewer-captcha-display {
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    linear-gradient(135deg, rgba(227, 194, 120, 0.16), rgba(118, 183, 255, 0.08));
  color: #f6e3ad;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.22em;
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.viewer-captcha-display:hover {
  transform: translateY(-1px);
  border-color: rgba(227, 194, 120, 0.36);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.viewer-captcha-display:active {
  transform: translateY(0);
}

@media (max-width: 540px) {
  .viewer-captcha-row {
    grid-template-columns: minmax(0, 1fr) 116px;
    gap: 10px;
  }

  .viewer-captcha-display {
    font-size: 24px;
  }
}

.viewer-login-status {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 117, 143, 0.12);
  border: 1px solid rgba(255, 117, 143, 0.18);
  color: #ffd7df;
  line-height: 1.6;
}

.viewer-list-card {
  width: min(100%, 420px);
}

.viewer-list-body {
  margin-top: 10px;
}

.viewer-list-content {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.viewer-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.viewer-list-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #071019;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-3), var(--accent));
  flex: 0 0 auto;
}

.viewer-list-text {
  min-width: 0;
}

.viewer-list-text strong {
  display: block;
  font-size: 14px;
}

.viewer-list-text span,
.viewer-list-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.viewer-list-empty {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

.viewer-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.viewer-list-pagination {
  display: flex;
  gap: 8px;
}

.viewer-list-page-button {
  min-height: 38px;
  padding: 0 16px;
}

.admin-page {
  min-height: 100vh;
}

.admin-login-shell,
.admin-shell {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.admin-shell-v2 {
  display: grid;
  gap: 20px;
}

.admin-login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.admin-login-card {
  width: min(100%, 460px);
  padding: 28px;
}

.admin-page-title {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.1;
}

.admin-subtitle {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
}

.admin-header-card,
.admin-panel {
  padding: 22px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
}

.admin-sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 18px;
}

.admin-sidebar-head {
  margin-bottom: 14px;
}

.admin-sidebar-title {
  font-size: 20px;
  line-height: 1.2;
}

.admin-tab-nav {
  display: grid;
  gap: 8px;
}

.admin-tab-button {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.admin-tab-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.12);
}

.admin-tab-button.active {
  border-color: rgba(215, 186, 132, 0.5);
  background:
    linear-gradient(135deg, rgba(215, 186, 132, 0.18), rgba(143, 176, 218, 0.08)),
    rgba(255, 255, 255, 0.03);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
}

.admin-tab-button strong {
  display: block;
  font-size: 14px;
}

.admin-tab-button span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 12px;
}

.admin-content {
  display: grid;
}

.admin-tab-panel {
  min-height: 560px;
}

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

.admin-stats-grid,
.admin-room-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.admin-stat-box {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-stat-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.admin-stat-box strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.admin-inline-action {
  display: flex !important;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px !important;
}

.admin-inline-number-input {
  width: 120px;
  min-width: 0;
}

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

.admin-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.admin-section-gap {
  margin-top: 18px;
}

.admin-inline-message,
.admin-muted-tip {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.admin-room-list,
.admin-room-viewers,
.admin-room-messages,
.admin-rows-list {
  display: grid;
  gap: 12px;
}

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

.admin-overview-card {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-overview-card strong {
  display: block;
  font-size: 16px;
}

.admin-overview-card p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 14px;
}

.admin-room-viewers,
.admin-room-messages,
.admin-rows-list {
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.admin-viewer-card,
.admin-message-card,
.admin-room-card,
.admin-row-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-viewer-card-compact,
.admin-message-card-compact {
  padding: 10px 12px;
  border-radius: 14px;
}

.admin-room-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.admin-room-card.active {
  border-color: rgba(215, 186, 132, 0.48);
  background: rgba(215, 186, 132, 0.1);
}

.admin-room-card strong,
.admin-user-head strong {
  display: block;
  font-size: 15px;
}

.admin-room-card span,
.admin-user-head p,
.admin-user-meta span {
  display: block;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.admin-user-head,
.admin-user-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.admin-user-head-compact {
  align-items: center;
  gap: 10px;
}

.admin-user-title {
  min-width: 0;
}

.admin-user-title p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-all;
}

.admin-user-meta {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.admin-user-meta-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 6px;
}

.admin-user-meta-inline span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.admin-user-actions {
  margin-top: 14px;
  flex-wrap: wrap;
}

.admin-user-actions-compact {
  margin-top: 8px;
  gap: 8px;
}

.admin-toolbar-row {
  justify-content: flex-end;
}

.admin-search-input {
  max-width: 260px;
  min-width: 180px;
}

.admin-message-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-action,
.admin-room-action,
.admin-blocked-word-action {
  min-height: 40px;
}

.admin-user-badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  white-space: nowrap;
}

.admin-user-badge.success {
  color: #8df0dc;
}

.admin-user-badge.danger {
  color: #ffb4c1;
}

.admin-shadow-badge {
  color: #fff3f5;
  background: linear-gradient(135deg, rgba(255, 74, 110, 0.88), rgba(255, 124, 79, 0.88));
  border: 1px solid rgba(255, 153, 153, 0.65);
  box-shadow: 0 0 0 1px rgba(255, 80, 80, 0.18) inset;
}

.admin-empty-state {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  color: var(--muted);
  line-height: 1.7;
}

.admin-message-text {
  margin-top: 6px;
  line-height: 1.55;
  word-break: break-word;
  font-size: 13px;
}

.admin-message-card.shadow-blocked {
  border-color: rgba(255, 88, 88, 0.72);
  background:
    linear-gradient(90deg, rgba(255, 76, 76, 0.2), rgba(255, 76, 76, 0.05) 18%, rgba(255, 255, 255, 0.04) 18%),
    rgba(255, 255, 255, 0.04);
  box-shadow: inset 4px 0 0 #ff4d5a;
}

.admin-room-viewers::-webkit-scrollbar,
.admin-room-messages::-webkit-scrollbar,
.admin-rows-list::-webkit-scrollbar {
  width: 8px;
}

.admin-room-viewers::-webkit-scrollbar-thumb,
.admin-room-messages::-webkit-scrollbar-thumb,
.admin-rows-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.admin-row-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 100px minmax(140px, 1fr) minmax(140px, 1fr) auto;
  gap: 10px 14px;
  align-items: center;
}

.admin-user-row {
  grid-template-columns: minmax(160px, 1.2fr) 90px minmax(120px, 0.9fr) minmax(120px, 0.9fr) minmax(120px, 0.9fr) auto;
}

.admin-word-row {
  grid-template-columns: minmax(220px, 1.6fr) 100px minmax(160px, 1fr) auto;
}

.admin-row-cell {
  min-width: 0;
}

.admin-row-primary strong {
  display: block;
  font-size: 14px;
}

.admin-row-primary p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.admin-row-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.admin-row-cell span:last-child {
  display: block;
  font-size: 13px;
  line-height: 1.45;
}

.admin-password-text {
  font-family: Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
  letter-spacing: 0.02em;
}

.admin-row-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.admin-pagination-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.admin-pagination-actions {
  display: flex;
  gap: 8px;
}

.admin-page-button {
  min-height: 38px;
  padding: 0 16px;
}

.admin-word-row.is-inactive {
  opacity: 0.72;
}

@media (max-width: 1180px) {
  .home-hero,
  .host-shell {
    grid-template-columns: 1fr;
  }

  .host-main,
  .host-sidebar {
    min-height: auto;
  }

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

  .admin-sidebar {
    position: static;
  }

  .admin-row-card,
  .admin-word-row {
    grid-template-columns: 1fr;
  }

  .admin-row-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .home-shell {
    width: min(100%, calc(100% - 28px));
    padding-top: 18px;
  }

  .home-hero,
  .home-result,
  .host-main,
  .host-share-card,
  .host-side-card,
  .viewer-stage,
  .viewer-chat {
    padding: 18px;
    border-radius: 24px;
  }

  .home-preview-notes,
  .home-result-grid,
  .host-share-layout {
    grid-template-columns: 1fr;
  }

  .host-main-head,
  .host-toolbar,
  .host-toolbar-left,
  .home-result-head {
    flex-direction: column;
    align-items: stretch;
  }

  .host-head-actions {
    justify-content: flex-start;
  }

  .host-select-group {
    width: 100%;
  }

  .host-toolbar-tip {
    max-width: none;
  }

  .admin-header-row,
  .admin-actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-stats-grid,
  .admin-room-meta,
  .admin-overview-grid {
    grid-template-columns: 1fr;
  }

  .admin-tab-button {
    padding: 14px;
  }

  .admin-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-pagination-actions {
    justify-content: stretch;
  }

  .admin-page-button {
    flex: 1;
  }
}

@media (max-width: 640px) {
  .home-shell,
  .host-shell {
    width: min(100%, calc(100% - 20px));
  }

  .viewer-shell {
    width: 100%;
    padding-top: calc(var(--safe-top) + 14px);
    padding-right: var(--safe-right);
    padding-left: var(--safe-left);
    gap: 4px;
  }

  .viewer-stage {
    padding: 2px;
    border-radius: 18px;
  }

  .viewer-stage-inner {
    border-radius: 14px;
    overflow: hidden;
  }

  .viewer-video,
  .viewer-empty {
    border-radius: 14px;
  }

  .viewer-chat {
    padding: 8px 6px 6px;
    border-radius: 22px;
  }

  .home-preview-stage {
    min-height: 280px;
  }

  .home-preview-screen {
    width: calc(100% - 56px);
    left: 16px;
    top: 18px;
    height: 170px;
  }

  .home-preview-phone {
    width: 134px;
    height: 248px;
    right: 12px;
    bottom: 12px;
  }

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

  .inline-chat-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .viewer-inputbar {
    grid-template-columns: minmax(0, 1fr) 28px 28px 88px;
    align-items: center;
    gap: 5px;
  }

  .inline-chat-form .button,
  .viewer-inputbar .button {
    min-width: 74px;
    padding-inline: 16px;
  }

  .viewer-inputbar > .button {
    min-width: 0;
    padding-inline: 0;
  }

  .viewer-icon-button {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    font-size: 12px;
  }

  .viewer-top-pills {
    gap: 4px;
  }

  .viewer-settings-button {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    font-size: 13px;
  }

  .emoji-panel {
    left: 6px;
    right: 6px;
    bottom: 58px;
    padding: 8px;
  }

  .emoji-panel-tabs {
    gap: 5px;
  }

  .emoji-tab {
    min-height: 30px;
    font-size: 11px;
  }

  .emoji-grid {
    gap: 7px;
  }

  .emoji-item {
    min-height: 38px;
    font-size: 20px;
  }

  .emoji-panel-footer {
    gap: 6px;
  }

  .emoji-page-button {
    min-height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }

  .emoji-page-indicator {
    font-size: 11px;
  }

  .browser-tip-actions {
    grid-template-columns: 1fr;
  }
}
