:root {
  --bg: #070b12;
  --panel: #0d1420;
  --panel-2: #111b2a;
  --line: #233146;
  --text: #f4f7fb;
  --muted: #91a0b5;
  --blue: #28a9ff;
  --blue-2: #127bd4;
  --good: #47d69c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 70% 0%, #102844 0, transparent 32rem), var(--bg); }
button, input { font: inherit; }
.shell { width: min(1100px, calc(100% - 40px)); margin: 0 auto; }
.landing { min-height: 100vh; display: flex; flex-direction: column; padding: 34px 0 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; letter-spacing: .15em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; color: var(--blue); border: 2px solid var(--blue); border-radius: 50%; font-weight: 900; }
.brand div { display: grid; font-size: .8rem; line-height: 1.15; }
.brand span { color: var(--blue); font-size: .65rem; }
.hero { padding: 10vh 0 7vh; max-width: 700px; }
.eyebrow, .label { margin: 0 0 10px; color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .18em; }
h1, h2, p { margin-top: 0; }
.hero h1 { margin-bottom: 22px; font-size: clamp(3.4rem, 9vw, 7rem); line-height: .88; letter-spacing: -.06em; text-transform: uppercase; }
.hero h1 em { color: var(--blue); font-style: normal; }
.lede { max-width: 570px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.55; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { position: relative; padding: 30px; background: linear-gradient(145deg, rgba(17,27,42,.96), rgba(10,16,26,.96)); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.24); }
.panel h2 { margin-bottom: 6px; font-size: 1.5rem; text-transform: uppercase; }
.panel > p:not(.form-status) { color: var(--muted); }
.step { position: absolute; top: 25px; right: 28px; color: #526177; font-weight: 800; }
label { display: block; margin: 18px 0 7px; color: #c4cedc; font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
input { width: 100%; padding: 13px 14px; color: var(--text); background: #080e17; border: 1px solid #2b3b52; border-radius: 8px; outline: none; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40,169,255,.18); }
button { cursor: pointer; border: 0; border-radius: 8px; }
.panel button { width: 100%; margin-top: 22px; padding: 14px 16px; color: #001321; background: var(--blue); font-weight: 900; letter-spacing: .08em; }
.panel button:hover { background: #60c2ff; }
button:focus-visible, a:focus-visible { outline: 3px solid white; outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .65; }
.form-status, .room-error { min-height: 1.25em; margin: 12px 0 0; color: #ff9d9d; font-size: .9rem; }
footer { margin-top: auto; padding-top: 36px; color: #64748a; text-align: center; font-size: .7rem; letter-spacing: .14em; }
.console-entry { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 20px 24px; color: var(--text); background: rgba(13,20,32,.7); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.console-entry:hover { border-color: var(--blue); }
.console-entry span:first-child { display: grid; gap: 3px; }
.console-entry small { color: var(--muted); }

.room-shell { padding: 30px 0 60px; }
.room-header, .room-identity, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.room-actions { display: flex; align-items: center; gap: 18px; }
.connection { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .85rem; }
.connection > span:first-child { width: 9px; height: 9px; background: #59687c; border-radius: 50%; box-shadow: 0 0 0 4px rgba(89,104,124,.15); }
.connection.live > span:first-child { background: var(--good); box-shadow: 0 0 0 4px rgba(71,214,156,.15); }
.leave-button { min-height: 42px; padding: 9px 12px; color: var(--muted); background: transparent; border: 1px solid var(--line); font-size: .7rem; font-weight: 800; letter-spacing: .08em; }
.leave-button:hover { color: var(--text); border-color: #64748a; }
.room-identity { margin: 9vh 0 32px; }
.room-identity h1 { margin: 0; font-size: clamp(3rem, 10vw, 6rem); letter-spacing: .1em; line-height: .9; }
.secondary { padding: 12px 18px; color: var(--text); background: transparent; border: 1px solid var(--line); font-weight: 800; letter-spacing: .08em; }
.secondary:hover { border-color: var(--blue); }
.format-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 26px; background: linear-gradient(90deg, #10233a, var(--panel)); border: 1px solid #1b4f77; border-radius: 14px; }
.format-card div { display: grid; gap: 4px; }
.format-card strong { font-size: clamp(1.35rem, 4vw, 2rem); }
.format-state { padding: 7px 10px; color: var(--blue); background: rgba(40,169,255,.1); border-radius: 5px; font-size: .7rem; font-weight: 900; letter-spacing: .12em; }
.lineup { margin-top: 42px; }
.section-heading { border-bottom: 1px solid var(--line); }
.section-heading h2 { margin-bottom: 18px; }
.section-heading > strong { color: var(--muted); font-size: 1.1rem; }
.participant-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.participant { display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 12px 16px; background: var(--panel); border: 1px solid #1a2637; border-radius: 10px; }
.participant-number { color: #526177; width: 24px; font-variant-numeric: tabular-nums; }
.participant-name { flex: 1; font-weight: 700; overflow-wrap: anywhere; }
.badge { padding: 5px 8px; color: var(--blue); background: rgba(40,169,255,.1); border-radius: 4px; font-size: .65rem; font-weight: 900; letter-spacing: .1em; }
.presence { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; }
.presence::before { content: ""; width: 7px; height: 7px; background: #59687c; border-radius: 50%; }
.presence.online::before { background: var(--good); }
.notice { display: flex; gap: 14px; margin-top: 30px; padding: 18px; color: var(--muted); background: rgba(17,27,42,.55); border: 1px dashed #314158; border-radius: 10px; }
.notice > span { display: grid; flex: 0 0 25px; place-items: center; width: 25px; height: 25px; color: var(--blue); border: 1px solid var(--blue); border-radius: 50%; font-weight: 900; }
.notice strong { color: var(--text); }
.notice p { margin: 5px 0 0; line-height: 1.45; }

.console-shell { padding: 30px 0 60px; }
.link-button { text-decoration: none; font-size: .75rem; }
.console-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .72fr); align-items: end; gap: 32px; margin: 9vh 0 42px; }
.console-heading h1 { margin-bottom: 16px; font-size: clamp(2.8rem, 7vw, 5rem); letter-spacing: -.05em; text-transform: uppercase; }
.add-console { padding: 22px; }
.add-console label { margin-top: 0; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.inline-form button { padding: 0 18px; color: #001321; background: var(--blue); font-weight: 900; font-size: .75rem; letter-spacing: .06em; }
.console-list { display: grid; gap: 16px; }
.console-card { padding: 26px; background: linear-gradient(145deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 16px; }
.console-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.console-card h2 { margin-bottom: 9px; overflow-wrap: anywhere; }
.state-pill { display: inline-block; padding: 5px 8px; color: var(--muted); background: rgba(145,160,181,.12); border-radius: 4px; font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.state-connected { color: var(--good); background: rgba(71,214,156,.1); }
.state-pairing { color: var(--blue); background: rgba(40,169,255,.1); }
.state-conflict-source-mismatch, .state-listener-error { color: #ff9d9d; background: rgba(255,80,80,.1); }
.state-reconnecting { color: #ffd38a; background: rgba(255,180,70,.1); }
.service-connection { display: block; margin-top: 8px; color: var(--muted); font-size: .72rem; }
.service-connected { color: var(--good); }
.service-lost { color: #ffd38a; }
.realtime-unavailable .telemetry-grid { opacity: .62; }
.console-controls { display: flex; gap: 10px; }
.console-controls button { min-height: 40px; padding: 9px 12px; font-size: .7rem; font-weight: 800; letter-spacing: .06em; }
.console-controls .remove { color: #ff9d9d; background: transparent; border: 1px solid #643b46; }
.destination { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 24px 0; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 10px; }
.destination > div { padding: 18px; background: #09111c; }
.destination span, .telemetry-grid span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .1em; }
.destination strong { font-size: clamp(1.3rem, 4vw, 2rem); font-variant-numeric: tabular-nums; }
.telemetry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.telemetry-grid > div { min-width: 0; padding: 14px; background: rgba(7,11,18,.55); border: 1px solid #1a2637; border-radius: 8px; }
.telemetry-grid strong { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.listener-error { margin: 14px 0 0; color: #ff9d9d; }
.listener-error:empty { display: none; }
.empty-card { padding: 50px 24px; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; text-align: center; }
.empty-card strong { color: var(--text); font-size: 1.2rem; }
.empty-card p { margin: 8px 0 0; }
.console-note { margin-top: 22px; }

@media (max-width: 680px) {
  .shell { width: min(100% - 28px, 1100px); }
  .landing { padding-top: 22px; }
  .hero { padding: 10vh 0 6vh; }
  .action-grid { grid-template-columns: 1fr; }
  .panel { padding: 24px 20px; }
  .room-header { align-items: flex-start; }
  .room-actions { align-items: flex-end; flex-direction: column-reverse; gap: 10px; }
  .room-identity { align-items: flex-end; margin-top: 8vh; }
  .room-identity h1 { font-size: 2.7rem; }
  .format-card { align-items: flex-start; padding: 20px; }
  .format-state { margin-top: 2px; }
  .participant { flex-wrap: wrap; }
  .participant-name { min-width: 55%; }
  .presence { margin-left: 38px; }
  .console-heading { grid-template-columns: 1fr; margin-top: 7vh; }
  .inline-form { grid-template-columns: 1fr; }
  .inline-form button { min-height: 45px; }
  .console-card { padding: 20px; }
  .console-card-head { align-items: stretch; flex-direction: column; }
  .console-controls { display: grid; grid-template-columns: 1fr auto; }
  .destination { grid-template-columns: 1fr; }
  .telemetry-grid { grid-template-columns: 1fr 1fr; }
}
