*{box-sizing:border-box}
/* Modern Theme - Warm & Clear */
:root {
  --primary: #f59e0b;
  --primary-light: #fbbf24;
  --primary-dark: #d97706;
  --bg-start: #fffbeb;
  --bg-end: #fef3c7;
  --glass: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --text-main: #451a03;
  --text-sub: #78350f;
  --shadow-sm: 0 4px 6px rgba(217, 119, 6, 0.05);
  --shadow-lg: 0 10px 25px rgba(217, 119, 6, 0.12);
}

body {
  font-family: 'Fredoka', system-ui, sans-serif;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text-main);
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

.bg-decoration {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: -1;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(251, 191, 36, 0.15) 0%, transparent 25%),
    radial-gradient(circle at 85% 85%, rgba(245, 158, 11, 0.12) 0%, transparent 30%);
  animation: bg-pulse 10s ease-in-out infinite;
}

@keyframes bg-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
}

.logo-title {
  font-family: 'Zcool KuaiLe', cursive;
  font-size: 3.2rem;
  background: linear-gradient(135deg, #d97706, #b45309);
  -webkit-background-clip: text;
  color: transparent;
  text-shadow: 2px 4px 12px rgba(217, 119, 6, 0.15);
  margin: 40px 0 24px;
  animation: float 4s ease-in-out infinite;
  letter-spacing: 2px;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.glass-panel {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-input {
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid transparent;
  border-radius: 20px;
  padding: 18px;
  font-size: 1.15rem;
  width: 100%;
  transition: all 0.3s;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
  margin-bottom: 24px;
  text-align: center;
  letter-spacing: 2px;
  color: var(--text-main);
}
.glass-input:focus {
  background: #fff;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.25);
  outline: none;
  transform: translateY(-2px);
}

.big-btn {
  border-radius: 20px;
  font-size: 1.15rem;
  padding: 20px;
  letter-spacing: 1px;
  width: 100%;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: white;
  margin-bottom: 16px;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}
.big-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: 0.5s;
}
.big-btn:hover::after {
  left: 100%;
}

.glow-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
}
.glow-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.45);
}
.glow-btn:active {
  transform: scale(0.98);
}

.glass-btn {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-sub);
  border: 1px solid rgba(245, 158, 11, 0.2);
  font-weight: 500;
}
.glass-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.fun-font {
  font-family: 'Zcool KuaiLe', cursive;
  color: var(--primary-dark);
}

/* 覆盖旧样式 */
.panel {
  padding: 40px 32px;
}
.wizard-box {
  background: rgba(255, 255, 255, 0.95);
  padding: 32px;
  border-radius: 28px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
  backdrop-filter: blur(20px);
}
h1{font-size:26px;margin:0 0 6px;color:#c05621}
.subtitle{margin:0;color:#dd6b20}
h2{font-size:18px;margin:16px 0 8px;color:#c05621}
h3{font-size:14px;margin:12px 0 8px;color:#718096}
.step-badge{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;margin-right:8px;background:var(--warm-500);color:#fff;border-radius:50%;font-size:14px;font-weight:700}
.desc{margin:0 0 12px;color:var(--ink);font-size:14px;line-height:1.5}
.container{max-width:960px;margin:24px auto;padding:16px}
.hero{display:flex;align-items:center;justify-content:space-between;background:var(--card);border:1px solid var(--line);border-radius:18px;padding:12px 16px;box-shadow:0 6px 20px rgba(237,137,54,.08)}
.hero-text{display:flex;flex-direction:column;gap:4px}
.hero-art{opacity:.95}
@media (max-width:700px){.hero{flex-direction:column;gap:6px}}
.toolbar{display:flex;gap:12px;margin:8px 0 16px}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start}
@media (max-width: 900px){.grid{grid-template-columns:1fr}}
.role-btn{padding:10px 14px;border:1px solid var(--rose-200);background:var(--rose-100);color:#9f1239;border-radius:999px;cursor:pointer}
.role-btn.secondary{background:var(--rose-50);color:#b91c1c;border-color:#fecaca}
.role-btn:hover{background:#ffdfe3}
.panel{border:1px solid var(--line);background:var(--card);border-radius:16px;padding:16px;box-shadow:0 6px 20px rgba(190,24,93,.08)}
.hidden{display:none}
.controls{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.primary{background:var(--rose-600);border:1px solid #be123c}
.danger{background:#b91c1c;border:1px solid #991b1b}
.primary,.danger{color:#fff;border-radius:999px;padding:8px 14px;cursor:pointer}
.checkbox{display:flex;align-items:center;gap:8px;color:var(--ink)}
.section{margin-top:14px}
.mono{width:100%;min-height:96px;background:var(--card);border:1px solid var(--line);border-radius:12px;color:var(--ink);padding:12px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}
.actions{display:flex;gap:8px;align-items:center;margin-top:8px}
.small{font-size:13px;padding:6px 10px}
.tip{font-size:12px;color:var(--muted)}
.preview{margin-top:16px}
video{width:100%;height:auto;max-height:85vh;background:#000;border-radius:12px;border:2px solid var(--rose-200);image-rendering:auto;object-fit:contain}
.video-box{position:relative;width:100%}
.tap-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.25);border-radius:12px}
.tap-overlay.hidden{display:none}
.text{width:100%;padding:10px;border:1px solid var(--line);background:var(--card);color:var(--ink);border-radius:12px}
.smallarea{min-height:64px}
.net-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px;margin-top:8px}
.modal{position:fixed;inset:0;background:rgba(190,24,93,.12);display:flex;align-items:center;justify-content:center;z-index:50}
.modal.hidden{display:none}
.modal-box{width:min(92vw,560px);background:var(--card);border:1px solid var(--line);border-radius:16px;overflow:hidden;box-shadow:0 10px 32px rgba(190,24,93,.12)}
.modal-bar{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid #ffe4e6}
.modal-body{padding:12px;display:flex;flex-direction:column;align-items:center;gap:12px}
.modal-tip{font-size:12px;color:var(--muted)}
.locked .advanced-control{display:none}
.simple .modal-tip,.simple .tip{font-size:14px}
.viewer-only #sharer-panel{display:none}
.viewer-only.viewer-receive-only .return-section{display:none}
.wizard{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(255,240,245,.8);z-index:60}
.wizard.hidden{display:none}
.wizard-box{width:min(92vw,520px);background:#fff;border:1px solid #fed7d7;border-radius:16px;box-shadow:0 10px 32px rgba(190,24,93,.12);padding:20px;text-align:center}
.wizard-input{margin:12px 0;font-size:18px}
.wizard-btn{font-size:18px;padding:12px 18px;border-radius:999px}
.wizard-tip{color:#a0aec0;font-size:14px;margin-top:8px}

/* ... existing styles ... */
.big-btn {
  font-size: 16px;
  padding: 12px 24px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2);
  transition: all 0.2s;
  border: none; /* 清除默认边框 */
  color: white; /* 确保文字颜色 */
}
.big-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.35);
}
.big-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.2);
}

.portal-actions button {
  border-radius: 16px;
  text-align: center;
  line-height: 1.4;
  border: 1px solid transparent;
}
#btn-portal-host {
  background: linear-gradient(135deg, var(--rose-600), #e11d48);
}
#btn-portal-guest {
  background: #fff;
  border: 2px solid var(--rose-200);
  color: var(--rose-600);
}
#btn-portal-guest:hover {
  background: var(--rose-50);
  border-color: var(--rose-300);
}

/* iOS Install Guide */
.ios-guide {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  z-index: 100;
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ios-guide.visible {
  transform: translateY(0);
}
.ios-guide-arrow {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--rose-500);
  animation: bounce 1.5s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* Security Tip Bar */
.security-tip-bar {
  background: #fff7ed;
  border: 1px solid #ffedd5;
  color: #c05621;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  cursor: pointer;
}
.security-tip-bar:hover {
  background: #ffedd5;
}


.settings-panel {
  border: 1px solid var(--rose-200);
  border-radius: 12px;
  background: var(--rose-50);
  overflow: hidden;
}
.settings-panel summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 500;
  color: var(--rose-600);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings-panel summary::after {
  content: '+';
  font-size: 18px;
  font-weight: 300;
}
.settings-panel[open] summary::after {
  content: '-';
}
.settings-content {
  padding: 16px;
  border-top: 1px solid var(--rose-200);
  background: #fff;
  display: grid;
  gap: 20px;
}
.setting-group h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invite-section {
  background: var(--rose-50);
  border: 1px dashed var(--rose-300);
  border-radius: 12px;
  padding: 16px;
}
.invite-section h3 {
  margin-top: 0;
  color: var(--rose-600);
}
.invite-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.invite-actions {
  display: flex;
  gap: 8px;
}
.invite-actions .text {
  flex: 1;
}

@media (min-width: 900px) {
  .container {
    padding: 32px;
  }
  .grid {
    gap: 32px;
  }
  .panel {
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .panel:hover {
    box-shadow: 0 12px 30px rgba(190,24,93,.12);
  }
  .big-btn {
    font-size: 18px;
    padding: 14px 32px;
  }
  h1 {
    font-size: 36px;
  }
}

.controls {
  margin-top: 16px;
  padding: 16px;
  background: var(--rose-50);
  border-radius: 12px;
  border: 1px solid var(--rose-100);
}

.settings-panel summary:hover {
  background: var(--rose-100);
}

.video-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 240px;
  background: #f8fafc;
  color: #94a3b8;
  border-radius: 12px;
  border: 2px dashed #e2e8f0;
  margin-bottom: 16px;
}

.manual-content {
  margin-top: 16px;
  border-top: 1px solid var(--rose-200);
  padding-top: 12px;
}
.manual-mode summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  width: fit-content;
}

@media (min-width: 600px) {
  .invite-box {
    flex-direction: row;
    align-items: center;
  }
  .invite-box input {
    width: auto;
    flex: 1;
  }
}

/* Guest Theme - Freedom Sky Blue */
body.guest-mode {
  --primary: #0ea5e9;       /* Sky Blue 500 */
  --primary-light: #38bdf8; /* Sky Blue 400 */
  --primary-dark: #0284c7;  /* Sky Blue 600 */
  --bg-start: #f0f9ff;      /* Sky Blue 50 */
  --bg-end: #e0f2fe;        /* Sky Blue 100 */
  --text-main: #0c4a6e;     /* Sky Blue 900 */
  --text-sub: #075985;      /* Sky Blue 800 */
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
}

body.guest-mode .bg-decoration {
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(14, 165, 233, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(56, 189, 248, 0.15) 0%, transparent 40%);
  animation: float-clouds 20s infinite linear;
}

@keyframes float-clouds {
  0% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0); }
}

body.guest-mode .logo-title {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 2px 4px 12px rgba(14, 165, 233, 0.2);
  font-family: 'Zcool KuaiLe', cursive;
  letter-spacing: 4px;
}

body.guest-mode .glass-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 20px 50px rgba(14, 165, 233, 0.15);
}

body.guest-mode .glow-btn {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
}

/* Red Dot Overlay */
#floating-stop-btn {
  position: fixed;
  top: 50%;
  right: 20px;
  width: 48px;
  height: 48px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
  z-index: 9999;
  cursor: pointer;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 12px;
  border: 2px solid white;
  opacity: 0.8;
  transition: opacity 0.3s;
  animation: pulse-red 2s infinite;
}
#floating-stop-btn:active {
  opacity: 1;
  transform: scale(0.95);
}
@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Guide Tabs */
.guide-tabs {
  background: rgba(0,0,0,0.05);
  padding: 4px;
  border-radius: 12px;
  display: inline-flex;
}
.tab-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
}
.tab-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.step-card {
  background: rgba(255,255,255,0.5);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.6);
}
.step-num {
  background: var(--primary-light);
  color: white;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Input Error Shake */
.input-error {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2) !important;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Mobile Responsive for Host */
@media (max-width: 600px) {
  .panel {
    padding: 24px 20px;
    margin: 16px;
    width: auto;
  }
  .glass-input {
    padding: 14px;
    font-size: 1rem;
  }
  .big-btn {
    padding: 16px;
    font-size: 1rem;
  }
  .logo-title {
    font-size: 2.4rem;
    margin: 24px 0 16px;
  }
  .net-grid {
    grid-template-columns: 1fr !important;
  }
  .invite-box {
    flex-direction: column;
  }
  .invite-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* 视频浮层控件样式 */
.video-controls-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 10;
  transition: opacity 0.3s;
}

/* 鼠标悬停时显示控件，或者移动端一直显示(可调整) */
.video-box:hover .video-controls-overlay {
  opacity: 1;
}

.icon-btn {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.network-status {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 20px;
  color: white;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.signal-icon {
  font-size: 14px;
}

.rtt-text {
  font-family: monospace;
  font-weight: bold;
}

/* 全屏样式调整 */
video:fullscreen {
  object-fit: contain;
  background: black;
}

/* 画中画时的占位提示（可选，浏览器通常会自己处理） */
