:root {
  color-scheme: dark;
  --ink: #080b10;
  --panel: #11161e;
  --panel2: #171e28;
  --line: #293342;
  --paper: #f1eee5;
  --muted: #8b98a9;
  --cyan: #3ee2d0;
  --coral: #ff685f;
  --amber: #e9bd5a;
  font-family: "Segoe UI Variable", Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 20% 10%, #122a2d 0, transparent 30%), radial-gradient(circle at 80% 90%, #2a1715 0, transparent 32%), var(--ink); color: var(--paper); min-height: 100vh; }
.home-link { width: 30px; height: 30px; display: grid; place-items: center; background: var(--coral); color: var(--ink); font-size: 10px; font-weight: 950; text-decoration: none; }
.hidden { display: none !important; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
input, textarea, select { width: 100%; background: #090d12; border: 1px solid var(--line); border-radius: 10px; color: var(--paper); padding: 12px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #3ee2d018; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(560px, 100%); background: rgba(13,17,23,.96); border: 1px solid var(--line); border-radius: 24px; padding: 38px; box-shadow: 0 30px 90px #000a; }
.auth-top { display:flex;align-items:center;justify-content:space-between;margin-bottom:24px; }
.back-home,.library-link { color:var(--cyan);font-size:10px;font-weight:850;letter-spacing:.08em;text-decoration:none;text-transform:uppercase; }
.beta-badge { padding:6px 9px;border:1px solid #3ee2d055;background:#3ee2d00d;color:var(--cyan);font-size:8px;font-weight:900;letter-spacing:.15em; }
.sigil { width: 52px; height: 52px; border-radius: 17px; background: var(--coral); color: var(--ink); display: grid; place-items: center; font-weight: 950; font-size: 18px; }
.eyebrow { color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .16em; margin: 18px 0 6px; }
.auth-card h1 { font-size: clamp(42px,7vw,70px);line-height:.9;letter-spacing:-.055em;margin: 0;text-transform:uppercase; }
.lede { color: var(--muted); line-height: 1.5; }
.invite-card { display: grid; gap: 5px; margin: 18px 0; padding: 13px 14px; border: 1px solid #3ee2d066; border-radius: 12px; background: #102124; color: var(--cyan); font-size: 12px; }
.invite-card span { color: #a9b7c6; font-size: 10px; line-height: 1.4; }
.auth-tabs { display: flex; background: #090c11; border-radius: 12px; padding: 4px; margin: 24px 0 18px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 9px; }
.auth-tabs button.active { background: var(--paper); color: var(--ink); font-weight: 750; }
form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; margin: 12px 0; }
.primary, .provider, .ghost, .danger, .ptt { border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-weight: 800; color: var(--paper); background: var(--panel2); }
.primary { background: var(--coral); border-color: var(--coral); color: var(--ink); }
form .primary { width: 100%; margin-top: 8px; }
.provider { width: 100%; background: #5865f2; border-color: #5865f2; }
.download-link { display: block; text-align: center; margin-top: 12px; padding: 10px; color: var(--cyan); font-size: 11px; font-weight: 800; text-decoration: none; }
.divider { display: flex; align-items: center; color: #5d6774; font-size: 9px; margin: 22px 0; }
.divider:before, .divider:after { content: ""; height: 1px; background: var(--line); flex: 1; }
.divider span { padding: 0 10px; }
.provider-slot { display: grid; place-items: center; margin-bottom: 10px; }
.error { color: var(--coral); font-size: 12px; min-height: 18px; }

.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr) 270px; grid-template-rows: 64px 1fr; grid-template-areas: "head head head" "nav room voice"; height: 100vh; overflow: hidden; }
.app-shell header { grid-area: head; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); background: #0c1016; }
.app-shell header > div { display: flex; align-items: center; gap: 10px; }
.app-shell header small { color: var(--muted); font-size: 9px; }
.live-dot { width: 8px; height: 8px; background: var(--coral); border-radius: 50%; box-shadow: 0 0 16px var(--coral); }
aside { grid-area: nav; border-right: 1px solid var(--line); background: #0d1218; padding: 18px; overflow: auto; }
.room { grid-area: room; display: grid; grid-template-rows: auto 1fr auto; min-width: 0; }
.voice { grid-area: voice; border-left: 1px solid var(--line); border-right: 0; }
.identity { font-size: 12px; }
.ghost { background: transparent; }
.wide { width: 100%; margin: 5px 0; }
.invite-primary { margin-top:14px;box-shadow:0 9px 28px #ff685f2b; }
.library-link { display:flex;align-items:center;min-height:42px;margin-top:18px;padding:0 2px;border-top:1px solid var(--line); }
#room-list button { width: 100%; text-align: left; border: 0; border-radius: 10px; background: transparent; color: var(--muted); padding: 11px; margin: 2px 0; }
#room-list button.active { background: #172029; color: var(--paper); box-shadow: inset 3px 0 var(--cyan); }
.privacy-note, .fineprint { color: #697687; font-size: 10px; line-height: 1.5; margin-top: 24px; }
.room-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.room-head .eyebrow { margin: 0 0 4px; }
.room-head h2 { margin: 0; font-size: 22px; }
.text-button { border: 0; background: transparent; color: var(--muted); font-size: 10px; padding: 4px 0; }
.ai-switch { display: flex; gap: 8px; align-items: center; color: var(--amber); font-size: 10px; font-weight: 800; }
.ai-switch input, .check input { width: auto; }
.messages { overflow: auto; padding: 20px 22px; }
.empty { color: #5f6b78; text-align: center; margin-top: 15vh; }
.message { display: grid; grid-template-columns: 38px 1fr; gap: 10px; margin: 0 0 18px; max-width: 780px; }
.avatar { width: 34px; height: 34px; border-radius: 11px; background: #202a36; display: grid; place-items: center; color: var(--cyan); font-size: 11px; font-weight: 900; background-size: cover; }
.message-head { display: flex; gap: 9px; align-items: baseline; }
.message-head strong { font-size: 12px; }
.message-head time { font-size: 9px; color: #627080; }
.message p { margin: 4px 0 0; line-height: 1.45; color: #d9d9d3; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.system .avatar { background: var(--amber); color: var(--ink); }
.message.system strong { color: var(--amber); }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.composer textarea { resize: none; min-height: 44px; max-height: 130px; }
.voice button:disabled, .composer button:disabled { opacity: .4; cursor: not-allowed; }
.danger { color: var(--coral); background: transparent; border-color: #633; }
.ptt { border-color: var(--cyan); color: var(--cyan); background: #0d1718; user-select: none; }
.ptt.talking { background: var(--cyan); color: var(--ink); }
.check { display: flex; gap: 8px; font-size: 11px; color: var(--muted); margin: 10px 0; }
.voice-field { display: grid; grid-template-columns: 1fr auto; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; margin: 10px 0; }
.voice-field select, .voice-field input { grid-column: 1 / -1; padding: 9px; }
.voice-options { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 12px 0; padding: 9px 0; }
.voice-options summary { cursor: pointer; color: var(--muted); font-size: 10px; font-weight: 800; }
.peer-list { margin-top: 16px; color: var(--muted); font-size: 11px; }
#toast { position: fixed; right: 18px; bottom: 18px; background: var(--paper); color: var(--ink); padding: 11px 14px; border-radius: 10px; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 180px minmax(0, 1fr); grid-template-rows: 60px 1fr 1fr; grid-template-areas: "head head" "nav room" "voice room"; }
  .voice { border-top: 1px solid var(--line); border-left: 0; }
  .app-shell header small { display: none; }
}
@media (max-width: 650px) {
  .app-shell { display: block; height: auto; min-height: 100vh; }
  .app-shell header { height: 60px; }
  .app-shell aside { border: 0; }
  .room { min-height: 70vh; }
  .voice { min-height: 260px; }
}
