@font-face {
  font-family: "Go Connect Sans";
  src: url("/fonts/GoConnectSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Go Connect Sans";
  src: url("/fonts/GoConnectSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #070b13;
  --panel: rgba(14, 22, 36, 0.72);
  --text: #e8eef8;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.14);
  --accent: #5eead4;
  --accent-2: #38bdf8;
  --danger: #fb7185;
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html, body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Go Connect Sans", "Inter", "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input, select, textarea {
  -webkit-user-select: text;
  user-select: text;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(56, 189, 248, 0.16), transparent 65%),
    radial-gradient(800px 500px at 92% 8%, rgba(94, 234, 212, 0.10), transparent 60%),
    linear-gradient(180deg, #070b13 0%, #080e18 60%, #060a12 100%);
}
a { color: inherit; }
button, input, select { font: inherit; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.22);
}
.brand-mark span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #04121a;
  box-shadow: 0 0 0 3px rgba(4, 18, 26, 0.22);
}
.brand-name { font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.net {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
body.at-landing .app {
  justify-content: center;
  padding-bottom: 32px;
}
body.at-landing .topbar {
  justify-content: center;
  padding: 0 0 26px;
}
body.at-landing main { flex: 0 0 auto; }
body.at-landing .landing { flex: 0 0 auto; padding: 0; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.status[data-state="connected"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.8);
}
.status[data-state="connecting"] .status-dot,
.status[data-state="reconnecting"] .status-dot {
  background: #fbbf24;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.55);
}
.status[data-state="disconnected"] .status-dot { background: var(--danger); }

main {
  display: flex;
  flex: 1;
  flex-direction: column;
}
.landing {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0 72px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.eyebrow-line {
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.card {
  background: linear-gradient(180deg, rgba(18, 28, 44, 0.88), rgba(11, 18, 30, 0.9));
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(22px);
}
.join-card { width: 100%; max-width: 400px; }
.join-card h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.card-sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}
input, select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
input::placeholder { color: rgba(148, 163, 184, 0.55); }
input:focus, select:focus {
  border-color: rgba(94, 234, 212, 0.55);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.08);
}
select option { background: #0d1524; color: var(--text); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.btn.primary {
  margin-top: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.18);
}
.btn.primary:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn.primary:active { transform: translateY(0); }
.btn.text {
  margin-top: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.btn.text:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.btn.ghost {
  width: auto;
  min-height: 38px;
  padding: 8px 13px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 13px;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.07); }
.fine {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 20px;
  color: var(--text);
  font-size: 13px;
}
.check-row input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
.field input[type="range"] {
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}
.app-version {
  margin: 18px 0 0;
  color: rgba(148, 163, 184, 0.5);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-align: center;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

.room {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 0 0;
}
.room-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 2px;
}
.room-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 2px 2px 6px;
  -webkit-overflow-scrolling: touch;
}
.room-head h2 {
  margin: 6px 0 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.participants {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 62vh;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  touch-action: none;
}
.stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  transform-origin: center center;
  will-change: transform;
}
.mic-warning {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.1);
  color: #fcd34d;
  font-size: 13px;
  cursor: pointer;
}
.stage-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(0deg, rgba(4, 8, 15, 0.88), rgba(4, 8, 15, 0));
}
.stage-title { font-size: 13px; color: var(--text); }
.stage-actions { display: flex; align-items: center; gap: 8px; }
html.in-room { height: 100%; overflow: hidden; }
body.in-room {
  position: fixed;
  inset: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body.in-room .app {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body.in-room main { min-height: 0; }
body.is-sharing .stage { flex: 0 0 auto; height: min(42vh, 420px); }
.stage.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
}
body.stage-fullscreen { overflow: hidden; }
.stage.is-fullscreen .stage-bar {
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
body.is-sharing .participants {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}
body.is-sharing .participant {
  flex: 0 0 auto;
  width: 200px;
  min-height: 78px;
  padding: 12px;
}
body.is-sharing .participant .avatar { width: 44px; height: 44px; font-size: 18px; border-radius: 14px; }
.participant {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 94px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(20, 31, 48, 0.75), rgba(11, 18, 30, 0.85));
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.participant[data-speaking="true"] {
  border-color: rgba(94, 234, 212, 0.48);
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.12), 0 12px 34px rgba(34, 211, 238, 0.08);
}
.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  border: 1px solid rgba(94, 234, 212, 0.16);
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.2), rgba(56, 189, 248, 0.16));
  color: #d9fff9;
  font-size: 21px;
  font-weight: 700;
}
.participant[data-speaking="true"] .avatar {
  animation: speak-pulse 1.5s ease-in-out infinite;
}
@keyframes speak-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.3); }
  50% { box-shadow: 0 0 0 7px rgba(94, 234, 212, 0); }
}
.meta { min-width: 0; flex: 1; }
.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sub { margin-top: 5px; color: var(--muted); font-size: 12px; }
.badge { color: var(--muted); opacity: 0.8; }
.badge.off { color: var(--danger); }
.empty-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 94px;
  padding: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 19px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.empty-tile strong { color: var(--text); font-size: 14px; }
.controls {
  flex: 0 0 auto;
  position: static;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(10, 16, 28, 0.84);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px);
}
.ctrl {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 160px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.ctrl:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.ctrl:disabled { opacity: 0.45; cursor: not-allowed; }
.ctrl:active { transform: scale(0.98); }
.ctrl.off { color: var(--danger); background: rgba(251, 113, 133, 0.08); }
.ctrl.active {
  color: #04121a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 600;
}
.ctrl.danger:hover { color: #ffe4e6; background: rgba(251, 113, 133, 0.12); }
.sound-hint {
  position: fixed;
  left: 50%;
  bottom: 108px;
  z-index: 40;
  padding: 11px 20px;
  transform: translateX(-50%);
  border: 1px solid rgba(94, 234, 212, 0.5);
  border-radius: 999px;
  background: rgba(10, 18, 30, 0.96);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: hint-pulse 1.8s ease-in-out infinite;
}
@keyframes hint-pulse {
  0%, 100% { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(94, 234, 212, 0.28); }
  50% { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 0 8px rgba(94, 234, 212, 0); }
}

.overlay, .modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 15, 0.7);
  backdrop-filter: blur(9px);
}
.overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(14, 22, 36, 0.92);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(94, 234, 212, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.modal { z-index: 60; }
.modal-card {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18, 28, 44, 0.98), rgba(10, 16, 28, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
.meter { margin: 6px 0 4px; }
.meter > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.meter-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}
.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.08s linear;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  z-index: 70;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 18px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f1a2b;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] { display: none !important; }

@media (max-width: 860px) {
  .app { padding: 16px 18px 32px; }
  .landing { padding: 12px 0 40px; }
  .participants { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (orientation: landscape) and (max-height: 540px) {
  body.in-room .app { padding: 8px 14px 10px; }
  .topbar { padding-bottom: 6px; }
  .room { gap: 8px; padding-top: 0; }
  .room-head { align-items: center; }
  .room-head .eyebrow { display: none; }
  .room-head h2 { margin: 0; font-size: 20px; }
  .room-head .btn.ghost { min-height: 32px; padding: 6px 10px; font-size: 12px; }
  .controls { padding: 6px; border-radius: 16px; }
  .ctrl { padding: 6px 8px; font-size: 11px; }
  body.is-sharing .room-body {
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
  }
  body.is-sharing .stage {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: none;
  }
  body.is-sharing .participants {
    flex: 0 0 168px;
    flex-direction: column;
    overflow-y: auto;
    gap: 8px;
  }
  body.is-sharing .participant { width: 100%; }
  body.is-sharing .participant .avatar { width: 34px; height: 34px; font-size: 14px; }
}

@media (max-width: 560px) {
  .topbar { padding-bottom: 18px; flex-wrap: wrap; }
  .topbar-right { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .card { padding: 22px; border-radius: 22px; }
  .stage { max-height: 46vh; min-height: 180px; }
  body.is-sharing .stage { height: min(42vh, 420px); min-height: 160px; }
  .stage-bar { padding: 10px 12px; }
  .room-head { align-items: flex-start; flex-direction: column; }
  .room-head .btn.ghost { width: 100%; justify-content: center; }
  .participants { grid-template-columns: 1fr; }
  body.is-sharing .participants { gap: 8px; }
  body.is-sharing .participant { width: 150px; min-height: 62px; padding: 10px; gap: 10px; }
  body.is-sharing .participant .avatar { width: 36px; height: 36px; font-size: 15px; border-radius: 12px; }
  body.is-sharing .participant .name { font-size: 13px; }
  body.is-sharing .participant .sub { font-size: 11px; }
  .net { font-size: 11px; }
  .controls { gap: 2px; padding: 8px; bottom: 8px; }
  .ctrl { padding: 9px 6px; font-size: 11px; }
  .ctrl span { white-space: nowrap; }
  .toast { bottom: 100px; }
}
