:root{
  --ink:#432840;--text:#483247;--muted:#775e76;--blue:#a3366c;
  --card:#fffaf7f5;--tile:#fffdfc;--edge:#e6c6d4;--line:#e8d1dc;--dialog:#fff9f7;
  --shadow:3px 5px 0 #e6ccd568,0 14px 36px #84536a0a;
  --rose:#a93668;--lilac:#71578e;--accent-soft:#f9e5ed;--paper:#fff6f2;--spot:#d8b8cd;
}
:root[data-theme=dark]{
  --ink:#ffedf3;--text:#f2dfeb;--muted:#d0b4c9;--blue:#ff9abf;--card:#322639f5;--tile:#3b2e42;
  --edge:#60495d;--line:#564257;--dialog:#312536;--shadow:3px 5px 0 #170f1c77,0 14px 36px #120a1726;
  --rose:#b64476;--lilac:#baa5d9;--accent-soft:#4a3043;--paper:#241c2b;--spot:#49394e;
}
body{background-color:var(--paper);background-image:radial-gradient(circle at 1px 1px,color-mix(in srgb,var(--spot) 46%,transparent) .8px,transparent 1px),linear-gradient(120deg,var(--paper),color-mix(in srgb,var(--accent-soft) 70%,var(--paper)));background-size:12px 12px,100% 100%}
.topbar{height:92px;padding:0;max-width:none;width:min(91%,1540px)}.brand{font-family:"Bricolage Grotesque","Segoe UI","Microsoft Yahei",sans-serif;letter-spacing:-1.6px;font-weight:900}.brand small{font-size:10px;letter-spacing:2px;color:var(--blue);margin-top:3px}.brand-icon{background:linear-gradient(145deg,#df86ac,#995180);border:2px solid var(--paper);outline:1px solid #ac7595;box-shadow:3px 4px 0 #ddabc3;border-radius:14px;transform:rotate(-7deg)}.brand-icon svg{transform:rotate(7deg)}
.dark-btn{background:#493144;color:white}.button,.pill,.dark-btn{border-radius:14px}.primary{background:var(--rose);border:1px solid #87274d;box-shadow:2px 4px 0 #742a4b35;color:#fff}.secondary{background:var(--tile);border:1px solid var(--edge);box-shadow:2px 4px 0 #83516b17}.button:hover:not(:disabled),.dark-btn:hover{transform:translateY(-2px)}
.glass,dialog{border:1px solid var(--edge);border-radius:24px}.page{margin-top:12px}.welcome{position:relative;isolation:isolate;overflow:hidden;min-height:185px;background:var(--card)}.welcome:before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(90deg,var(--card) 12%,color-mix(in srgb,var(--card) 65%,transparent) 53%,color-mix(in srgb,var(--card) 70%,transparent)),url('art/moe-radio.webp') center 34% / cover}.welcome h1{color:var(--ink)}.stat{border-top:3px solid #dda1b7}.stat:nth-child(2){border-top-color:#b09ac9}.stat:nth-child(3){border-top-color:#e6b98e}.orange{background:#f9d2b1;color:#8a521e}.blue{background:#f1daeb;color:#964575}.violet{background:#e9dff2;color:#775394}.small-link,.chip.active,.segmented .active,.pill.active{color:var(--blue);background:var(--accent-soft);border-color:var(--edge)}
.room-title h1{color:var(--ink)}.eq b:nth-child(n){background:#c96694}.eq b:nth-child(even){background:#a488c7}.eq b:last-child{background:#e5a877}.metrics>div{border:1px solid var(--line)}.counter{background:#50354c;color:#fff7fa}.avatar{background:#f6dce9;color:#834268}.dock{border:1px solid var(--edge);box-shadow:3px 5px 0 #a5749222,0 12px 28px #71465e1a}.member-label small.route{background:var(--accent-soft);border-color:var(--edge)}meter::-webkit-meter-optimum-value{background:linear-gradient(90deg,#bc638b,#9b87c4)}.range input,.screen-sound input{accent-color:var(--rose)}
.users-card,.registration-card{border-color:var(--edge)}.switch[aria-checked=true]{background:var(--rose)}.quality-grid button.active{border-color:var(--blue);background:var(--accent-soft)}#toast{background:#493047f5}.reconnect-bar{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:12px;border:1px solid var(--edge);border-radius:16px;padding:10px 16px;background:var(--accent-soft);color:var(--ink)}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline-color:var(--blue)}
@media(max-width:640px){
 .topbar{height:72px;width:92%}.brand{font-size:21px}.brand small{font-size:8px}.brand-icon{border-radius:11px}
 .welcome:before{opacity:.76}.welcome{min-height:185px}.page{margin-top:6px}.reconnect-bar{font-size:14px}.reconnect-bar button{flex-shrink:0}
}

/* The public landing is a full-bleed illustration with a separate, legible reading surface. */
body:has(#landing:not([hidden])) {
  --cloud: #e6e5f6;
  --surface: rgba(250,249,255,.88);
  --rim: rgba(255,255,255,.92);
  --card-text: #302f50;
  --description: #535976;
  --starlight: #e6ddff;
  --scene-filter: saturate(.98);
  background: var(--cloud);
}
[data-theme=dark] body:has(#landing:not([hidden])) {
  --cloud: #17182f;
  --surface: rgba(42,41,66,.88);
  --rim: rgba(193,187,239,.25);
  --card-text: #f1efff;
  --description: #c4c3dd;
  --scene-filter: brightness(.78) saturate(.9);
}
body:has(#landing:not([hidden])) .topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  height: 84px;
  width: min(88%, 1320px);
  margin-inline: auto;
  padding: 0;
  color: #fbf9ff;
  border-bottom: 1px solid rgba(222,221,255,.2);
}
body:has(#landing:not([hidden])) .brand,
body:has(#landing:not([hidden])) .nav-login,
body:has(#landing:not([hidden])) #theme { color: #faf7ff; }
body:has(#landing:not([hidden])) .brand small { color: #d5d4ef; }
body:has(#landing:not([hidden])) .brand-icon {
  border-radius: 50%; transform: none;
  border: 1px solid #e7daffab;
  outline: none;
  background: linear-gradient(145deg,#e4d0ff40,#a6bdff16);
  box-shadow: inset 0 0 12px #e2d5ff21, 0 0 16px #c5a7ff24;
}
body:has(#landing:not([hidden])) .brand-icon svg { transform: none; }
body:has(#landing:not([hidden])) #theme:hover { background: #ffffff20; }
body:has(#landing:not([hidden])) .dark-btn { border-radius: 30px; color: #332a52; background: #eee8ff; }
#landing {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  padding-bottom: clamp(32px,5vh,70px);
  background: radial-gradient(ellipse at 83% 100%,#b4ccf126,transparent 54%),var(--cloud);
}
.home-intro {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: clamp(510px,69svh,800px);
  padding: 112px 0 94px;
  background: #202044;
}
.night-scene {
  position: absolute; z-index: -3; inset: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: 53% 39%;
  filter: var(--scene-filter);
}
.home-intro::before,.home-intro::after {
  content: ""; pointer-events: none; position: absolute; inset: 0; z-index: -2;
}
.home-intro::before {
  background:
    linear-gradient(180deg,rgba(16,18,48,.56),transparent 30%),
    linear-gradient(90deg,rgba(19,20,51,.76),rgba(24,27,60,.47) 35%,transparent 63%);
}
.home-intro::after {
  z-index: -1;
  background: linear-gradient(0deg,var(--cloud),transparent 14%);
}
.home-copy {
  position: relative;
  width: min(84%,1240px);
  margin: 0 auto;
  color: #fffaff;
}
.home-copy h1 {
  font-family: "STSong","Songti SC","Noto Serif CJK SC","SimSun",serif;
  font-size: clamp(50px,5.3vw,88px);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: .035em;
  margin: 0;
  text-shadow: 0 3px 20px #1413305e;
}
.home-copy em {
  font-style: normal;
  color: #e8dcff;
  background: linear-gradient(105deg,#fce6f9,#e3d9ff 45%,#c6e9ff);
  background-clip: text; -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}
.home-copy p {
  font-size: clamp(16px,1.27vw,20px); line-height: 1.85;
  margin: 20px 0 27px; color: #f0edf9; text-shadow: 0 2px 9px #12143599;
}
.home-actions { gap:14px; flex-wrap:wrap; }
.registration-card .switch { flex-shrink:0; }
#roomCapacityForm { flex-wrap:wrap; }
#roomCapacityForm label { display:inline; font:inherit; color:inherit; }
.capacity-controls { display:flex; align-items:center; gap:10px; }
.capacity-controls input { width:9em; margin:0; }
#join .guest-option { display:flex; align-items:center; gap:10px; }
#join .guest-option[hidden] { display:none; }
#join .guest-option input { width:18px; height:18px; min-height:0; margin:0; accent-color:var(--rose); }
.guest-option small { display:block; color:var(--muted); font-weight:400; }
.home-actions .button {
  min-height: 49px; padding: 12px 24px; border-radius: 30px; font-size: 16px;
}
.home-actions .primary {
  color: #32284e;
  background: linear-gradient(108deg,#fae8fa,#e2dcff 66%,#d0eafa);
  border: 1px solid #faf3ff; box-shadow: 0 4px 23px #c1a0fc33;
}
.home-actions .secondary {
  color: #fffaff; background: rgba(38,33,67,.46); border: 1px solid #ddd5f67a;
  box-shadow: none; backdrop-filter: blur(10px);
}
.night-lights {
  position:absolute; inset:0; width:100%; height:100%; z-index:-1; pointer-events:none;
  mask-image:radial-gradient(ellipse 33% 47% at 24% 51%,#0005 0%,#000b 67%,#000 100%);
}
@media(max-width:680px) {
  .night-lights { mask-image:linear-gradient(#000 27%,#000e 47%,#0006 72%,#000a 95%); }
}
.welcome-actions { flex-wrap:wrap; }
.welcome-actions .small-link { margin:0; }
.feature-grid {
  position: relative; display: grid; grid-template-columns: repeat(3,minmax(0,1fr));
  width: min(88%,1320px); margin: -40px auto 0; gap: clamp(14px,1.55vw,26px);
}
.feature-card {
  --tint: #a0c4fe; --icon: #496eb3;
  padding: clamp(21px,2vw,32px);
  border: 1px solid var(--rim); border-radius: 23px;
  color: var(--card-text);
  background: radial-gradient(ellipse at 0 0,color-mix(in srgb,var(--tint) 23%,transparent),transparent 63%),var(--surface);
  box-shadow: 0 10px 36px #29203f0e, inset 0 1px 0 #ffffff40;
  backdrop-filter: blur(18px);
}
.feature-sound { --tint: #c7acfc; --icon: #7950a6; }
.feature-private { --tint: #9adcd3; --icon: #347e7c; }
.feature-icon {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 15px;
  background: color-mix(in srgb,var(--tint) 38%,var(--surface)); color: var(--icon);
  border: 1px solid color-mix(in srgb,var(--tint) 65%,transparent);
}
.feature-icon svg { width: 23px; height: 23px; }
[data-theme=dark] .feature-icon { color: var(--tint); }
.feature-card h2 { margin: 18px 0 7px; font-size: clamp(20px,1.55vw,26px); line-height:1.32;letter-spacing:-.02em; }
.feature-card p { margin: 0; font-size: clamp(15px,1.04vw,17px); color: var(--description); line-height: 1.75; }
@media(min-width:681px) and (max-width:960px) {
  .home-copy,.feature-grid,body:has(#landing:not([hidden])) .topbar { width:92%; }
  .home-copy h1 { font-size:clamp(42px,6vw,57px); }
  .feature-grid { gap:12px; }
  .feature-card { padding:19px; }
}
@media(max-width:680px) {
  body:has(#landing:not([hidden])) .topbar { height:62px;width:92%; }
  body:has(#landing:not([hidden])) .brand small {font-size:8px}
  .home-intro {display:block;min-height:0;padding:clamp(220px,66vw,340px) 0 72px;background:#252442; }
  .night-scene {height:80%;object-position:76% 25%;mask-image:linear-gradient(180deg,black 64%,transparent 100%); }
  .home-intro::before {background:linear-gradient(180deg,#17153183,transparent 20%,transparent 37%,#23203bb8 66%,transparent 90%),linear-gradient(90deg,#1a183d65,transparent 75%); }
  .home-intro::after {background:linear-gradient(0deg,var(--cloud),transparent 11%); }
  .home-copy {width:88%}
  .home-copy h1 {font-size:clamp(38px,9.7vw,55px);line-height:1.18}
  .home-copy p {font-size:15px;line-height:1.6;margin:13px 0 18px}
  .home-actions .button {min-height:44px;padding:10px 18px;font-size:15px}
  .feature-grid {width:92%;grid-template-columns:1fr;gap:11px;margin-top:-28px}
  .feature-card {display:grid;grid-template-columns:40px 1fr;gap:5px 13px;padding:18px 17px;border-radius:19px}
  .feature-icon {width:40px;height:40px;grid-row:span 2}
  .feature-card h2 {margin:0;font-size:19px}
  .feature-card p {font-size:15px}
}
#liveTransport {min-height:32px;padding:5px 24px 5px 8px;font-size:13px}
#retryRtc {margin:5px 0 0;font-size:13px}
.latency-tools,.member-latency {display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;color:var(--muted);font-size:13px}
.latency-tools {justify-content:space-between;padding:12px 18px 0}
.latency-tools .pill {font-size:13px;padding:5px 10px}
.member-latency {margin-top:7px;font-variant-numeric:tabular-nums}
.level-history {
  --play-color: #2563eb;
  margin: 20px 0 0;
  padding: 16px;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: 16px;
}
:root[data-theme=dark] .level-history { --play-color: #78b1ff; }
.level-history figcaption, .level-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.level-history figcaption { justify-content: space-between; margin-bottom: 15px; }
.level-history h2 { font-size: 16px; margin: 0; }
.level-legend { font-size: 12px; font-variant-numeric: tabular-nums; }
.level-legend span { display: inline-flex; align-items: center; gap: 5px; }
.level-legend span::before { content: ''; width: 16px; border-top: 2px solid var(--blue); }
.level-legend .play-key::before { border-top: 2px solid var(--play-color); }
.level-legend b { min-width: 6.3ch; font-weight: 600; text-align: right; }
.level-chart { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 5px 8px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.level-scale { display: flex; flex-direction: column; justify-content: space-between; text-align: right; line-height: 1; }
.level-plot { position:relative; min-width:0; height:88px; cursor:crosshair; }
.level-plot canvas { display:block; width:100%; height:100%; background:transparent; border-radius:0; }
.level-cursor { position:absolute; top:0; bottom:0; border-left:1px dashed var(--muted); pointer-events:none; }
.level-tooltip { position:absolute; top:4px; box-sizing:border-box; min-width:min(118px,100%); max-width:100%; padding:5px 8px; border:1px solid var(--line); border-radius:8px; background:var(--paper); color:var(--ink); line-height:1.45; pointer-events:none; }
.level-tooltip span { display:flex; justify-content:space-between; gap:8px; }
.level-tooltip strong { color:var(--muted); }
.level-times { grid-column: 2; display: grid; grid-template-columns: 1fr 1fr 1fr; }
.level-times :nth-child(2) { text-align: center; }
.level-times :last-child { text-align: right; }
.compose input { flex: 1 1 0; min-width: 0; }
.compose button { flex: 0 0 auto; white-space: nowrap; }
.client-update:not([hidden]) { display:flex; align-items:center; justify-content:center; gap:16px; position:sticky; top:0; z-index:5; padding:8px 16px; background:var(--dialog); border-bottom:1px solid var(--line); color:var(--ink); }
.client-update .pill { color:var(--blue); }
#messages .chat-event { margin: 8px 0; color: var(--muted); font-size: 13px; text-align: center; overflow-wrap: anywhere; }
