@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
  --ink: #0b0f14;
  --panel: #11161e;
  --panel-2: #161c25;
  --panel-3: #1c2430;
  --line: rgba(255,255,255,.075);
  --text: #f4f6f8;
  --muted: #8f9aaa;
  --faint: #626d7c;
  --coral: #ff765f;
  --coral-soft: rgba(255,118,95,.14);
  --mint: #70d7b7;
  --shadow: 0 24px 70px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
button, input, textarea { font: inherit; }
button { color: inherit; }
body { margin: 0; min-height: 100vh; overflow: hidden; background: var(--ink); color: var(--text); font-family: "DM Sans", sans-serif; }
button { border: 0; background: none; cursor: pointer; }

.join-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 70% 20%, #202634 0, #0c1118 48%, #090d12 100%); transition: opacity .4s, visibility .4s; }
.join-screen::before { content: ""; position: absolute; width: 560px; height: 560px; border: 1px solid rgba(255,255,255,.05); border-radius: 50%; right: -80px; top: -110px; box-shadow: 0 0 0 90px rgba(255,255,255,.012), 0 0 0 180px rgba(255,255,255,.008); }
.join-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.join-glow { position: absolute; width: 340px; height: 340px; border-radius: 50%; filter: blur(80px); background: rgba(255,118,95,.18); left: 8%; bottom: -13%; }
.join-card { position: relative; width: min(660px, calc(100% - 32px)); padding: 54px; background: rgba(18,24,32,.78); border: 1px solid rgba(255,255,255,.09); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.brand { display: flex; align-items: center; gap: 10px; font: 800 20px "Manrope", sans-serif; letter-spacing: -.5px; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px 10px 10px 3px; color: #10141a; background: var(--coral); }
.brand-large { margin-bottom: 46px; font-size: 24px; }
.brand-large .brand-mark { width: 40px; height: 40px; border-radius: 13px 13px 13px 4px; }
.eyebrow { color: var(--mint); font-size: 11px; font-weight: 700; letter-spacing: 2.3px; }
.join-card h1 { margin: 12px 0 18px; max-width: 520px; font: 800 clamp(38px, 6vw, 62px)/.98 "Manrope", sans-serif; letter-spacing: -3px; }
.join-card h1 em { color: var(--coral); font-style: normal; }
.join-copy { max-width: 490px; margin: 0 0 34px; color: #9aa4b1; font-size: 16px; line-height: 1.6; }
.join-card label { display: block; margin-bottom: 10px; color: #cfd5dd; font-size: 13px; font-weight: 600; }
.join-input-row { display: flex; gap: 10px; }
.join-input-row input { min-width: 0; flex: 1; padding: 15px 18px; border: 1px solid rgba(255,255,255,.11); border-radius: 12px; outline: none; color: var(--text); background: #0d1218; transition: border .2s, box-shadow .2s; }
.join-input-row input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.primary-button { padding: 0 20px; border-radius: 12px; color: #101419; background: var(--coral); font-weight: 700; transition: transform .2s, filter .2s; }
.primary-button:hover { transform: translateY(-2px); filter: brightness(1.06); }
.primary-button:disabled { cursor: wait; filter: saturate(.55); opacity: .78; transform: none; }
.primary-button span { margin-left: 7px; }
.mic-permission-note { margin: 10px 2px 0; color: #778391; font-size: 11px; line-height: 1.45; }
.mic-permission-note strong { color: var(--mint); }
.mic-permission-note.denied { color: #ff9b89; }
.privacy-note { display: flex; align-items: center; gap: 8px; margin-top: 20px; color: var(--faint); font-size: 12px; }
.status-dot, .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(112,215,183,.1); }

.app-shell { display: grid; grid-template-columns: 70px 254px minmax(460px, 1fr) 236px; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; background: var(--ink); opacity: 1; transition: opacity .35s; }
.app-shell[aria-hidden="true"] { opacity: 0; }
.server-rail { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 0; border-right: 1px solid var(--line); background: #090d12; }
.server-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: #9ea8b5; background: #171d25; font-weight: 800; transition: .2s; }
.server-icon:hover, .server-icon.active { color: #11151a; background: var(--coral); border-radius: 14px 14px 14px 5px; }
.server-icon.active { position: relative; }
.server-icon.active::before { content: ""; position: absolute; left: -15px; width: 3px; height: 24px; border-radius: 3px; background: var(--coral); }
.server-icon.soft { font-size: 20px; }
.rail-divider { width: 26px; height: 1px; background: var(--line); }
.rail-spacer { flex: 1; }

.sidebar { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel); }
.server-title, .chat-header { height: 62px; flex: 0 0 62px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.server-title { padding: 0 16px 0 18px; }
.server-title > div { display: flex; align-items: center; gap: 10px; }
.server-title strong { font: 700 14px "Manrope"; }
.live-dot { width: 6px; height: 6px; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--muted); font-size: 18px; transition: .2s; }
.icon-button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.channel-list { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 10px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 7px; color: #687382; font-size: 10px; font-weight: 700; letter-spacing: 1.25px; }
.section-heading button { color: #7a8492; font-size: 17px; }
.voice-heading { margin-top: 28px; }
.channel { width: 100%; display: flex; align-items: center; gap: 9px; min-height: 39px; padding: 0 10px; border-radius: 9px; color: #909aa8; text-align: left; font-size: 14px; font-weight: 500; transition: .16s; }
.channel > span { color: #596473; font-size: 18px; font-weight: 400; }
.channel small { margin-left: auto; min-width: 18px; padding: 2px 6px; border-radius: 9px; color: #ffad9f; background: var(--coral-soft); text-align: center; }
.channel:hover { color: #d4d9df; background: rgba(255,255,255,.035); }
.channel.active { color: white; background: rgba(255,255,255,.07); }
.channel.active > span { color: var(--coral); }
.voice-room { margin-bottom: 4px; }
.voice-room-button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 5px 9px; color: #8f99a7; border-radius: 9px; text-align: left; }
.voice-room-button:hover { background: rgba(255,255,255,.035); color: #dce1e6; }
.voice-room-button > span:first-child { color: #6c7684; font-size: 13px; }
.voice-room-button > span:last-child { display: grid; gap: 2px; }
.voice-room-button strong { font-size: 13px; font-weight: 600; }
.voice-room-button small { color: #5f6a79; font-size: 10px; }
.voice-members { padding-left: 34px; }
.voice-member { display: flex; align-items: center; gap: 8px; min-height: 32px; color: #aab3be; font-size: 12px; }
.voice-member-name { max-width: 140px; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tiny-avatar { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 7px; color: #10141a; font-size: 9px; font-weight: 800; }
.voice-member i { margin-left: auto; margin-right: 10px; color: #65707e; font-style: normal; }
.connection-card { margin: 0 10px 8px; padding: 11px 10px; border: 1px solid rgba(112,215,183,.15); border-radius: 11px; background: rgba(112,215,183,.08); }
.connection-card, .connection-card > div { display: flex; align-items: center; }
.connection-card { justify-content: space-between; }
.connection-card > div { gap: 8px; }
.connection-card > div > span:last-child { display: grid; }
.connection-card strong { color: var(--mint); font-size: 9px; letter-spacing: .8px; }
.connection-card small { margin-top: 2px; color: #98a3b0; font-size: 10px; }
.connection-card button { color: #7e8996; font-size: 20px; }
.signal-bars { color: var(--mint); font-size: 11px; }
.profile-bar { min-height: 62px; display: flex; align-items: center; gap: 9px; padding: 10px; background: #0d1218; }
.avatar { position: relative; display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 11px; color: #101419; background: var(--coral); font-weight: 800; font-size: 12px; }
.presence-badge { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border: 2px solid #0d1218; border-radius: 50%; background: var(--mint); }
.profile-copy { min-width: 0; flex: 1; display: grid; }
.profile-copy strong { overflow: hidden; color: #e3e7eb; font-size: 12px; text-overflow: ellipsis; }
.profile-copy small { color: #65717f; font-size: 9px; }
.mini-control { width: 27px; height: 27px; border-radius: 7px; color: #707b89; }
.mini-control:hover, .mini-control.active { color: var(--coral); background: var(--coral-soft); }

.chat-panel { position: relative; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--panel-2); }
.chat-header { padding: 0 18px 0 22px; }
.chat-heading { min-width: 0; display: flex; align-items: center; gap: 8px; }
.mobile-nav-button, .mobile-backdrop { display: none; }
.channel-name { min-width: 0; display: flex; align-items: center; gap: 9px; }
.channel-name > span { color: #677382; font-size: 23px; }
.channel-name strong { font: 700 14px "Manrope"; }
.channel-name i { width: 1px; height: 18px; margin: 0 3px; background: var(--line); }
.channel-name small { overflow: hidden; color: #6f7a88; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.members-toggle { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 9px; color: #7d8895; }
.members-toggle:hover { color: white; background: rgba(255,255,255,.05); }
.stage { flex: 0 0 min(44vh, 360px); min-height: 230px; padding: 14px 18px 18px; border-bottom: 1px solid var(--line); background: #0d1218; }
.stage.compact { flex-basis: 44px; min-height: 44px; padding-bottom: 8px; overflow: hidden; }
.stage-header { min-height: 42px; display: flex; align-items: center; gap: 14px; color: #8e99a6; font-size: 11px; }
.stage-identity { flex: 0 0 auto; display: grid; gap: 2px; min-width: 112px; }
.stage-identity > span { display: flex; align-items: center; gap: 7px; }
.stage-identity small { padding-left: 14px; color: #65717f; font-size: 9px; }
.stage-participants { min-width: 0; flex: 1; display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.stage-participants::-webkit-scrollbar { display: none; }
.participant-chip { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; max-width: 180px; height: 30px; padding: 4px 8px 4px 4px; border: 1px solid rgba(255,255,255,.075); border-radius: 10px; background: #171e27; }
.participant-avatar { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; color: #101419; font-size: 8px; font-weight: 800; }
.participant-chip strong { max-width: 110px; overflow: hidden; color: #dce1e6; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.participant-chip i { margin-left: 1px; font-size: 8px; font-style: normal; }
.participant-chip i.live { color: var(--mint); }
.participant-chip i.muted { color: #788391; }
.participant-chip i.sharing { color: var(--coral); }
.stage-header button { color: #697583; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(112,215,183,.09); }
.video-grid { height: calc(100% - 42px); display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.video-tile { position: relative; min-height: 150px; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 15px; background: radial-gradient(circle at 50% 35%, #27303d, #161c24 65%); }
.video-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #090d11; }
.remote-audio { display: none; }
.video-avatar { width: 64px; height: 64px; border-radius: 22px; font-size: 22px; }
.mic-picker { position: absolute; z-index: 3; top: 10px; right: 10px; max-width: calc(100% - 20px); display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.08); border-radius: 9px; background: rgba(8,11,15,.82); backdrop-filter: blur(8px); }
.mic-picker select { min-width: 0; max-width: 185px; border: 0; outline: 0; color: #b7c0ca; background: transparent; font: 600 10px "DM Sans", sans-serif; text-overflow: ellipsis; }
.mic-picker select option { color: #dce1e6; background: #171e27; }
.mic-meter { height: 15px; display: flex; align-items: flex-end; gap: 2px; }
.mic-meter i { width: 3px; height: 5px; border-radius: 3px; background: #596574; transition: height .08s, background .15s; }
.mic-meter i:nth-child(2) { height: 9px; }
.mic-meter i:nth-child(3) { height: 13px; }
.mic-meter.hearing i { background: var(--mint); animation: mic-bounce .45s ease-in-out infinite alternate; }
.mic-meter.hearing i:nth-child(2) { animation-delay: -.18s; }
.mic-meter.hearing i:nth-child(3) { animation-delay: -.32s; }
@keyframes mic-bounce { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
.media-unlock { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 150px; padding: 11px 14px; border: 1px solid rgba(255,255,255,.18); border-radius: 11px; color: #101419; background: var(--mint); box-shadow: 0 12px 32px rgba(0,0,0,.35); font-size: 11px; font-weight: 800; }
.media-unlock:hover { filter: brightness(1.06); }
.tile-label, .tile-state { position: absolute; bottom: 10px; padding: 6px 9px; border-radius: 8px; color: #f4f6f8; background: rgba(8,11,15,.82); font-size: 11px; font-weight: 700; backdrop-filter: blur(8px); }
.tile-label { left: 10px; }
.tile-state { right: 10px; color: #939daa; }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px 8px; scroll-behavior: smooth; }
.channel-intro { padding: 56px 2px 30px; }
.intro-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; color: #11161d; background: #6f7a88; font-size: 25px; font-weight: 700; }
.channel-intro h2 { margin: 14px 0 7px; font: 800 25px "Manrope"; letter-spacing: -1px; }
.channel-intro p { margin: 0; color: #778391; font-size: 13px; }
.message { display: grid; grid-template-columns: 38px 1fr; column-gap: 11px; padding: 8px 4px; border-radius: 9px; }
.message:hover { background: rgba(255,255,255,.018); }
.message .avatar { grid-row: span 2; width: 38px; height: 38px; border-radius: 12px; }
.message-meta { display: flex; align-items: baseline; gap: 8px; }
.message-meta strong { color: #dfe3e8; font-size: 13px; }
.message-meta time { color: #596574; font-size: 9px; }
.message p { margin: 3px 0 0; color: #aeb7c2; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.system-message { display: flex; align-items: center; gap: 8px; padding: 7px 4px; color: #64707d; font-size: 10px; }
.system-message::before { content: "✦"; color: var(--mint); }
.composer { flex: 0 0 auto; display: flex; align-items: flex-end; gap: 7px; margin: 8px 18px 18px; padding: 9px 10px; border: 1px solid rgba(255,255,255,.075); border-radius: 13px; background: var(--panel-3); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.composer > button:first-child { flex: 0 0 29px; height: 29px; border-radius: 9px; color: #96a1ae; background: rgba(255,255,255,.06); font-size: 18px; }
.composer textarea { min-height: 29px; max-height: 120px; flex: 1; resize: none; padding: 6px 5px 3px; border: 0; outline: none; color: #dfe3e8; background: transparent; font-size: 13px; line-height: 1.4; }
.composer textarea::placeholder { color: #687382; }
.composer-hint { align-self: center; color: #525d6a; font-size: 9px; white-space: nowrap; }
.send-button { flex: 0 0 32px; height: 32px; border-radius: 10px; color: #101419; background: var(--coral); font-weight: 800; }

.members-panel { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); transition: width .25s, transform .25s; }
.members-panel > header { height: 62px; display: flex; align-items: center; padding: 0 17px; border-bottom: 1px solid var(--line); color: #697482; font-size: 9px; letter-spacing: 1.1px; }
.member-list { flex: 1; overflow-y: auto; padding: 14px 10px; }
.member { display: flex; align-items: center; gap: 9px; padding: 7px; border-radius: 9px; }
.member:hover { background: rgba(255,255,255,.03); }
.member .avatar { flex-basis: 31px; height: 31px; border-radius: 10px; }
.member-info { min-width: 0; display: grid; }
.member-info strong { overflow: hidden; color: #abb3be; font-size: 11px; text-overflow: ellipsis; }
.member-info small { color: #586371; font-size: 9px; }
.invite-card { margin: 12px; padding: 20px 16px; border: 1px solid rgba(255,118,95,.13); border-radius: 15px; background: linear-gradient(145deg, rgba(255,118,95,.11), rgba(255,118,95,.025)); }
.invite-card > span { color: var(--coral); }
.invite-card h3 { margin: 9px 0 6px; font: 700 13px "Manrope"; }
.invite-card p { margin: 0 0 13px; color: #737e8c; font-size: 10px; line-height: 1.5; }
.invite-card button { width: 100%; padding: 8px; border-radius: 8px; color: #ffad9f; background: var(--coral-soft); font-size: 10px; font-weight: 700; }
.call-dock { position: fixed; z-index: 30; left: calc(70px + 254px + (100vw - 70px - 254px - 236px)/2); bottom: 18px; transform: translateX(-50%); display: flex; gap: 7px; padding: 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(13,18,24,.92); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.dock-button { min-width: 60px; display: grid; place-items: center; gap: 3px; padding: 7px 9px; border-radius: 11px; color: #929ca8; }
.dock-button:hover, .dock-button.active { color: white; background: rgba(255,255,255,.07); }
.dock-button span { font-size: 17px; }
.dock-button small { font-size: 8px; }
.dock-button.share { color: var(--mint); }
.dock-button.share.active { color: #101419; background: var(--mint); }
.dock-button.danger { color: #ff8571; }
.dock-button.danger:hover { color: white; background: #d94f4f; }
.toast { position: fixed; z-index: 200; top: 18px; left: 50%; transform: translate(-50%, -20px); padding: 11px 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; color: #dce1e6; background: #202833; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { border-radius: 8px; background: #29323e; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 62px 230px minmax(420px, 1fr); }
  .members-panel { position: fixed; z-index: 40; top: 62px; right: 0; bottom: 0; width: 236px; box-shadow: -20px 0 50px rgba(0,0,0,.3); transform: translateX(100%); }
  .members-panel.open { transform: translateX(0); }
  .call-dock { left: calc(62px + 230px + (100vw - 62px - 230px)/2); }
}

@media (max-width: 740px) {
  body { overflow: hidden; }
  .app-shell { grid-template-columns: 1fr; min-height: 0; }
  .server-rail { display: none; }
  .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 270px; transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0,0,0,.4); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .mobile-backdrop { position: fixed; z-index: 45; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(5,8,12,.62); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .mobile-backdrop.open { display: block; opacity: 1; pointer-events: auto; }
  .mobile-nav-button { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px; color: #f4f6f8; background: rgba(255,255,255,.07); font-size: 19px; }
  .chat-panel { min-height: 0; }
  .chat-header { padding-left: 14px; }
  .channel, .voice-room-button { min-height: 50px; }
  .voice-room-button small { font-size: 11px; }
  .channel-name small, .channel-name i, .composer-hint { display: none; }
  .join-card { padding: 34px 24px; }
  .brand-large { margin-bottom: 34px; }
  .join-input-row { flex-direction: column; }
  .primary-button { min-height: 50px; }
  .stage { flex-basis: 310px; }
  .video-grid { grid-template-columns: 1fr 1fr; }
  .mic-picker select { max-width: 115px; }
  .call-dock { left: 50%; bottom: 10px; width: calc(100% - 20px); justify-content: center; }
  .dock-button { min-width: 58px; }
}
