:root {
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #152342;
  background: #f3f6fd;
  --line: #d4def0;
  --muted: #4f5f78;
  --blue: #213fbe;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
.top { min-height: 4.6rem; background: #111b35; display: flex; align-items: center; justify-content: space-between; gap: .55rem; padding: .8rem max(1rem, calc((100% - 70rem)/2)); }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; font-size: 1.65rem; letter-spacing: -.07em; font-weight: 750; }
.brand-suffix { color: #a6b8ff; margin-left: -.60rem; }
.top .sound-toggle { min-height: 2.25rem; padding: .38rem .65rem; color: #f1f4ff; background: #202e54; border-color: #53658d; font-size: .875rem; white-space: nowrap; }
.top .sound-toggle:hover { background: #2b3e6c; }
.brand-mark { width: 2.05rem; height: 2.05rem; display: inline-block; position: relative; }
.brand-mark i { position: absolute; border-radius: 42% 42% 42% 16%; width: 1.25rem; height: 1rem; background: #bdcbff; left: .13rem; top: .35rem; transform: rotate(-8deg); }
.brand-mark i + i { background: #697ff5; left: .77rem; top: .78rem; transform: scaleX(-1) rotate(-10deg); }
main { width: min(70rem, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.2rem, 5vw, 4.4rem) 0; }
.landing { display: grid; grid-template-columns: 1.25fr 1fr; box-shadow: 0 22px 65px #17295116; border: 1px solid var(--line); border-radius: 1.55rem; overflow: hidden; }
.hero { position: relative; isolation: isolate; display: flex; justify-content: flex-end; flex-direction: column; padding: clamp(1.55rem, 5vw, 4.4rem); min-height: 33rem; color: #fff; background: radial-gradient(ellipse at 84% 0%, #3659cb, transparent 70%), linear-gradient(145deg, #152959, #101a38); overflow: hidden; }
.hero-art { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.hero-art span { position: absolute; border: 1px solid #b0c2ff30; width: 25rem; height: 25rem; border-radius: 50%; right: -8rem; top: -9rem; }
.hero-art span:nth-child(2) { width: 29rem; height: 29rem; right: -10rem; top: -11rem; }
.hero-art span:nth-child(3) { width: 33rem; height: 33rem; right: -12rem; top: -13rem; }
.hero-art i, .hero-art b { position: absolute; right: 6rem; top: 4rem; width: 7rem; height: 4.8rem; border-radius: 1.35rem 1.35rem 1.35rem .3rem; background: #b9c9ff; box-shadow: 0 1rem 2.5rem #111b3550; transform: rotate(-13deg); }
.hero-art b { right: 2.6rem; top: 7.6rem; width: 6.1rem; height: 4.2rem; background: #6c85ff; transform: scaleX(-1) rotate(-12deg); }
.hero-art i::before, .hero-art b::before { content: ''; position: absolute; left: 27%; top: 43%; width: 2.75rem; height: .5rem; background: radial-gradient(circle closest-side, #233a8e 94%, transparent) left center / .9rem .5rem repeat-x; }
h1, h2, p, figure { margin: 0; }
.hero h1 { font-size: clamp(2.55rem, 5.5vw, 4.45rem); font-weight: 760; letter-spacing: -.055em; line-height: .98; }
.hero h1 em { color: #b7c7ff; font-style: normal; }
.hero p { margin-top: 1.5rem; max-width: 26rem; line-height: 1.6; color: #e1e8ff; }
.join { min-width: 0; background: #fff; padding: clamp(1.5rem, 4vw, 3.5rem); display: flex; flex-direction: column; justify-content: center; }
h2 { font-size: 1.75rem; letter-spacing: -.045em; }
.input-label { margin: 1.45rem 0 .45rem; font-weight: 680; display: flex; justify-content: space-between; gap: .5rem; }
.input-label span, .help { color: var(--muted); font-weight: 450; font-size: .9rem; }
input:not([type="checkbox"]):not([type="range"]) { width: 100%; min-width: 0; font: inherit; color: inherit; min-height: 3rem; padding: .6rem .8rem; border: 1px solid #aebdda; border-radius: .55rem; background: #fff; }
input::placeholder { color: #596681; }
.help { margin-top: .55rem; line-height: 1.45; }
.notice { margin: 1.35rem 0 1.05rem; padding: .9rem; background: #eef3ff; border: 1px solid #dbe4fa; border-radius: .7rem; line-height: 1.4; }
.notice p { color: #354663; margin-bottom: .6rem; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 650; }
.check input { margin: .17rem .1rem 0 0; width: 1.12rem; height: 1.12rem; flex: 0 0 auto; accent-color: var(--blue); }
button { cursor: pointer; min-height: 2.7rem; border: 1px solid #aebdda; border-radius: .55rem; background: #fff; color: #1d3877; padding: .58rem .9rem; font: 650 1rem 'Segoe UI', system-ui, sans-serif; }
button:hover:enabled { background: #ebf0ff; }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover:enabled { background: #152e9b; }
button:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 2px solid #556de8; outline-offset: 3px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.join-status { margin-top: .65rem; line-height: 1.4; color: #96342b; }
.join-status:empty { display: none; }
.session-head, .status-bar, .send-form, .chat-actions, .device-controls { display: flex; align-items: center; gap: .65rem; }
.session-head { justify-content: space-between; margin-bottom: 1rem; }
.session-head p, #typing { color: var(--muted); }
.chat-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.chat-grid.has-video { grid-template-columns: minmax(0, var(--video-share, 45%)) minmax(0, 1fr); }
.chat-panel { min-width: 0; min-height: 22rem; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: .85rem; background: #fff; overflow: hidden; }
.status-bar { align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: .85rem 1rem; background: #eaf0ff; border-bottom: 1px solid var(--line); min-height: 3rem; font-size: .95rem; }
#chat-status { font-weight: 650; }
.chat-transcript { position: relative; flex: 1 0 auto; }
.messages { height: clamp(14rem, 46vh, 31rem); overflow: auto; padding: 1rem; display: flex; flex-direction: column; gap: .67rem; }
.disconnect-notice { position: absolute; inset: 0; display: grid; place-items: center; padding: .75rem; pointer-events: none; }
.disconnect-notice strong { padding: .75rem 1rem; background: #111b35; color: #fff; border-radius: .65rem; box-shadow: 0 5px 20px #111b3550; text-align: center; }
.network-badge img { width: 1.1em; height: 1.1em; vertical-align: -.18em; margin-left: .28em; }
.network-badge .network-detection { margin-left: .32em; padding: .12em .38em; border-radius: .28em; background: #ffe5bc; color: #633400; font-size: .83em; white-space: nowrap; }
.message { max-width: min(39rem, 88%); align-self: flex-start; background: #eff3fb; border-radius: .75rem; padding: .53rem .7rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.mine { align-self: flex-end; background: #e4ebff; }
.message b { display: block; color: #2d4471; margin-bottom: .18rem; font-size: .9rem; }
.send-form, .chat-actions { padding: .75rem; border-top: 1px solid var(--line); }
.chat-actions, .next-actions { justify-content: space-between; flex-wrap: wrap; }
.next-actions { display: flex; justify-content: flex-start; align-items: center; gap: .6rem; }
.auto-search { align-items: center; font-size: .9rem; }
.auto-search input { margin-top: 0; }
.video-panel { display: grid; gap: .65rem; min-width: 0; }
.video-panel figure { position: relative; aspect-ratio: 16/9; overflow: hidden; background: #0d1730; border-radius: .85rem; }
#local-preview { width: min(46%, 14rem); }
.video-panel canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
#local { transform: scaleX(-1); }
.video-panel figcaption { position: absolute; bottom: .58rem; left: .66rem; padding: .15rem .4rem; background: #111b35e6; color: #fff; border-radius: .22rem; font-size: .9rem; }
.device-controls { flex-wrap: wrap; }
.video-size { display: flex; gap: .5rem; align-items: center; color: var(--muted); font-weight: 650; font-size: .9rem; }
.video-size input { width: 5.8rem; accent-color: var(--blue); }
.video-fullscreen { position: absolute; top: .55rem; right: .55rem; padding: .35rem .55rem; min-height: 2.2rem; font-size: .875rem; }
.video-fullscreen:disabled { visibility: hidden; }
.capture-source { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
html.video-expanded { overflow: hidden; }
.video-panel #remote-figure:fullscreen, .video-panel #remote-figure.video-expanded {
  width: 100%; height: 100%; aspect-ratio: auto; background: #000; border-radius: 0;
}
#remote-figure.video-expanded { position: fixed; inset: 0; z-index: 10; }
@media (max-width: 750px) {
  .landing { grid-template-columns: 1fr; }
  .hero { min-height: 17rem; padding-top: 6.2rem; }
  .hero h1 { position: relative; }
  .hero-art i { top: 1.05rem; right: 4.5rem; transform: scale(.65) rotate(-13deg); }
  .hero-art b { top: 2.75rem; right: 2.3rem; transform: scale(-.65,.65) rotate(-12deg); }
  .chat-grid.has-video { grid-template-columns: minmax(0, 1fr); }
  .video-panel { display: flex; flex-wrap: wrap; align-items: flex-start; }
  #remote-figure { flex: 0 0 var(--mobile-video-width, 64%); }
  #local-preview { width: min(31%, 10rem); }
  .device-controls { flex-basis: 100%; }
  .messages { height: clamp(9rem, 32vh, 20rem); }
}
@media (max-width: 375px) {
  .hero h1 { font-size: 2.38rem; }
  .choices { grid-template-columns: 1fr; }
}
