/* Zvonilka: common surfaces, navigation and friends dashboard. */
:root{--line:#ffffff1c;--blue:#77bdf0}
#app{grid-template-columns:72px 250px minmax(0,1fr) 210px}
#rail{background:var(--rail);border-right:1px solid var(--line)}
.srv{flex:none;background:#252b49;border:1px solid var(--line);border-radius:16px}.srv.active,.srv:hover{background:var(--accent);border-color:#a9b5ff}.srv.add{font-size:25px;color:#88d4bb}.dm-rail{background:#282466;padding:8px}.dm-rail img{width:100%;height:100%;object-fit:contain}
#side{border-right:1px solid var(--line)}#side header,#chat header{border-color:var(--line)}
#sideLinks{gap:3px;padding:12px 10px}#sideLinks a,#sideLinks button{display:flex;align-items:center;gap:12px;border:0;background:transparent;color:var(--muted);padding:10px;border-radius:8px;text-decoration:none;text-align:left;min-height:44px;font:inherit}#sideLinks a:hover,#sideLinks button:hover,.home-mode #homeLink{background:var(--input);color:var(--text)}#sideLinks img{width:22px;height:22px;object-fit:contain}
#app:not(.home-mode):not(.dm-mode) #sideLinks{display:none}
#homeSideLabel{color:var(--muted);font-size:12px;font-weight:700;letter-spacing:.07em;padding:20px 18px 0}#dmList{padding:8px 10px}.dm-list-btn{min-height:44px;border-radius:8px}.dm-list-btn .ava{width:32px;height:32px}
#me{background:#151729;border-top:1px solid var(--line);padding:12px;gap:4px}#who{flex:1}#me button{min-height:44px}#settingsBtn img{width:20px;height:20px;object-fit:contain}#me #logout{font-size:12px}#who .ava{width:34px;height:34px}
.voice-heading{margin-top:18px}.voice-unavailable{font-size:13px;color:var(--muted);padding:0 8px}
#composer,.dm-bottom form{background:#1b1f35;border-color:var(--line)}#chat,#dmView{background:var(--main)}#members{border-left:1px solid var(--line)}.ch,.dm-btn{border-radius:8px}.grp{font-weight:650;letter-spacing:.03em}
#app.home-mode{grid-template-columns:72px 250px minmax(0,1fr)}#app.home-mode #members{display:none}
#homeView[hidden]{display:none!important}#homeView{position:absolute;inset:0;z-index:4;display:flex;flex-direction:column;background:var(--main);min-width:0}
#chat #homeView .home-header{height:auto;min-height:64px;display:flex;justify-content:flex-start;gap:18px;padding:8px 24px;background:#17192d;border-bottom:1px solid var(--line)}.home-title{display:flex;align-items:center;gap:10px;white-space:nowrap}.home-title img{width:25px;height:25px;object-fit:contain}#homeTabs{display:flex;gap:4px;align-items:center;border-left:1px solid var(--line);padding-left:16px}#homeTabs button{border:0;border-radius:8px;background:transparent;color:var(--muted);padding:9px 12px;min-height:44px;white-space:nowrap}#homeTabs button:hover,#homeTabs button[aria-selected=true]{background:#303653;color:var(--text)}.home-add{border:0;border-radius:8px;background:var(--accent);color:white;padding:10px 16px;min-height:44px;font-weight:650;white-space:nowrap}.home-add:hover{background:#6c5ce7}
.home-scroll{overflow:auto;padding:24px;flex:1}.home-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.home-card{min-width:0;min-height:94px;display:flex;align-items:center;gap:16px;padding:18px;background:#1e213a;border:1px solid var(--line);border-radius:10px;text-decoration:none;color:var(--text);font:inherit;text-align:left}.home-card:not(.unavailable):hover{border-color:#7786e8;background:#252b4b}.home-card img{width:42px;height:42px;object-fit:contain;flex:none}.home-card span{font-weight:650;font-size:18px}.home-card small{margin-left:auto;color:var(--muted);font-size:12px}.home-card.unavailable{opacity:.78}
.home-columns{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:24px;margin-top:32px}.home-list{min-width:0}.list-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}.list-heading h2,.active-contacts h2{font-size:15px;line-height:1.3;margin:0;color:var(--muted);font-weight:700}.home-search{display:flex;align-items:center;gap:8px;width:min(220px,50%);background:#1e213a;border:1px solid var(--line);border-radius:8px;padding:0 10px}.home-search img{width:16px;height:16px;object-fit:contain}.home-search input{min-width:0;background:transparent;padding:8px 0;height:40px;border:0}.home-rows{background:#1e213a;border:1px solid var(--line);border-radius:10px;padding:0 16px}.home-friend{display:flex;align-items:center;gap:12px;padding:16px 0;min-height:72px}.home-friend+.home-friend{border-top:1px solid var(--line)}.home-avatar{width:42px;height:42px;position:relative;cursor:default}.presence{position:absolute;right:-2px;bottom:-2px;width:13px;height:13px;border:2px solid #1e213a;border-radius:50%;background:#858da2}.presence.online{background:#39c988}.friend-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.friend-info strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.friend-info span{font-size:13px;color:var(--muted)}.friend-actions{display:flex;gap:6px}.friend-message,.friend-action{border:0;background:#2c314d;color:var(--text);border-radius:8px;min-width:44px;min-height:44px;padding:8px}.friend-message img{display:block;width:21px;height:21px;object-fit:contain}.friend-action.primary{background:var(--accent)}.friend-message:hover,.friend-action:hover{background:var(--accent)}.home-empty{padding:32px 8px;color:var(--muted)}#homeError{color:#ff9caa}.active-contacts{border-left:1px solid var(--line);padding-left:24px}.active-contacts p,.active-empty{font-size:13px;color:var(--muted);line-height:1.5}.active-empty{border:1px solid var(--line);border-radius:10px;padding:16px}.active-friend{display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:10px;background:#1e213a;color:var(--text);width:100%;margin:8px 0;padding:10px;text-align:left}.active-friend .ava{width:32px;height:32px;font-size:13px;cursor:default}
#createServerDialog,#addFriendDialog{background:#1e213a;color:var(--text);border:1px solid #ffffff30;border-radius:12px;width:min(440px,92vw);padding:24px}#createServerDialog::backdrop,#addFriendDialog::backdrop{background:#080a14bb}#createServerDialog h2,#addFriendDialog h2{margin:0 0 8px}#createServerDialog p,#addFriendDialog p{color:var(--muted)}#createServerDialog label,#addFriendDialog label{display:grid;gap:8px;margin-top:20px}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.dialog-actions button{min-height:44px}
#auth form{background:#1e213a;padding:32px;border:1px solid var(--line);border-radius:12px}#auth h1{color:#dfe6ff}
@media(max-width:1100px){.home-columns{grid-template-columns:minmax(0,1fr)}.active-contacts{border-left:0;border-top:1px solid var(--line);padding:20px 0 0}.active-contacts #homeActive{display:flex;flex-wrap:wrap;gap:8px}.active-friend{width:auto;min-width:140px}.home-card{gap:10px;padding:14px}.home-card span{font-size:16px}}
@media(max-width:700px){#app,#app.home-mode{grid-template-columns:minmax(0,1fr)}#chat #homeView .home-header{gap:6px;padding:6px 12px;flex-wrap:wrap}.home-title{flex:1}.home-title img{width:20px;height:20px}#homeTabs{order:3;width:100%;border:0;border-top:1px solid var(--line);padding:4px 0 0;justify-content:space-between}#homeTabs button{flex:1;padding:7px 4px}.home-add{font-size:13px;padding:7px 9px}.home-scroll{padding:16px}.home-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.home-card{min-height:72px;padding:12px;gap:10px}.home-card img{width:32px;height:32px}.home-card span{font-size:15px}.home-card small{font-size:11px}.home-columns{margin-top:24px;gap:20px}.home-rows{padding:0 12px}.home-friend{gap:8px}.friend-action{font-size:12px;padding:6px}.friend-actions{gap:4px}.active-contacts{padding-top:16px}.list-heading h2{font-size:14px}#homeView{padding-top:env(safe-area-inset-top)}}

#app.dm-mode{grid-template-columns:72px 250px minmax(0,1fr)}#app.dm-mode #members{display:none}.dm-rail img{filter:brightness(1.45)}@media(max-width:700px){#app.dm-mode{grid-template-columns:minmax(0,1fr)}}

.friend-manage{display:inline-block;color:#aabaf6;font-size:13px;margin:16px 0;text-decoration:none}.friend-manage:hover{text-decoration:underline}

.auth-logo{width:38px;height:38px;object-fit:contain;vertical-align:middle;margin-right:10px;filter:brightness(1.4)}#serverSettings img{width:18px;height:18px;object-fit:contain;vertical-align:middle}
/* Invite forms and compact layouts remain usable with the mobile keyboard. */
#joinDialog{background:#1e213a;color:var(--text);border:1px solid #ffffff30;border-radius:12px;width:min(440px,92vw);max-height:min(90dvh,700px);overflow:auto;padding:24px}#joinDialog::backdrop{background:#080a14bb}#joinDialog h2{margin:0 0 8px}#joinDialog p{color:var(--muted)}#joinDialog label,.invite-label{display:grid;gap:8px;margin-top:20px;color:var(--muted)}.invite-label input{min-width:0}.invite-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}.invite-actions button{min-height:44px}.server-tabs button{min-height:44px}
@media(max-width:700px){#joinDialog,#createServerDialog,#addFriendDialog,#serverDialog,#settings,#profile{max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain}#joinDialog input,#createServerDialog input,#addFriendDialog input,#serverDialog input,#serverDialog textarea,#settings input,#profile input{font-size:16px}.dialog-actions{flex-wrap:wrap}.dialog-actions button{flex:1 1 auto}.invite-actions button{flex:1 1 150px}.server-tabs{gap:6px}.server-tabs button{flex:1 1 auto}#chat>header,#dmView>.dm-header{min-height:52px}.dm-header .dm-btn{min-height:44px}.ch{min-height:44px}.grp button{min-width:44px;min-height:44px}.home-rows{overflow:hidden}.friend-actions{flex-wrap:wrap;justify-content:flex-end}.friend-info{overflow:hidden}.friend-info span{overflow-wrap:anywhere}}
@media(max-width:360px){.home-card{gap:6px}.home-card img{width:27px;height:27px}.home-card span{font-size:14px}.home-card small{font-size:10px}.home-add{max-width:145px;white-space:normal;line-height:1.2}.friend-action{min-width:40px}.server-tabs button{font-size:13px;padding:8px}}
@media(max-width:700px){#serverDialog .server-banner-preview{height:64px;margin-bottom:12px}#serverDialog .server-status:empty{margin:0;min-height:0}#serverDialog .close{min-height:44px;margin-top:16px}}
/* Phones in landscape must keep the drawer rather than squeezing the chat
   between two desktop sidebars. */
@media (max-height:500px) and (orientation:landscape) and (pointer:coarse){
 html,body{height:100%;overflow:hidden}#app,#app.home-mode,#app.dm-mode{height:100dvh;grid-template-columns:minmax(0,1fr);position:relative}#chat{grid-column:1;min-width:0;width:100%;height:100%;padding-top:env(safe-area-inset-top)}#members,#rail,#side{display:none}
 #app.mobile-menu-open #rail{display:flex;position:fixed;z-index:22;top:0;bottom:0;left:0;width:64px;padding-top:calc(12px + env(safe-area-inset-top));padding-bottom:env(safe-area-inset-bottom)}
 #app.mobile-menu-open #side{display:flex;position:fixed;z-index:22;top:0;bottom:0;left:64px;width:min(320px,calc(100vw - 64px));padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);box-shadow:8px 0 28px #0008}
 #app.mobile-menu-open #mobileBackdrop{display:block;position:fixed;inset:0;z-index:21;border:0;background:#0009}.mobile-nav-toggle{display:inline-grid;place-items:center;flex:none;width:44px;height:44px;margin-left:-8px;border:0;border-radius:7px;background:transparent;color:var(--text);font-size:21px}.mobile-menu-icon{display:block;width:20px;height:2px;border-radius:2px;background:currentColor;box-shadow:0 -6px 0 currentColor,0 6px 0 currentColor}
 #chat>header,#dmView>.dm-header{justify-content:flex-start;gap:8px;min-height:52px}#chat>header #chName,#dmTitle{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#dmView{padding-top:env(safe-area-inset-top)}#msgs,.dm-messages{overscroll-behavior:contain}#bottom,.dm-bottom{padding-bottom:calc(8px + env(safe-area-inset-bottom))}
 #joinDialog,#createServerDialog,#addFriendDialog,#serverDialog,#settings,#profile{max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain}#serverDialog .server-banner-preview{height:50px;margin-bottom:8px}#serverDialog input,#serverDialog textarea,#joinDialog input{font-size:16px}.call-stage{max-height:45%}
}
@media (max-height:500px) and (orientation:landscape) and (pointer:coarse){#msg,#dmInput,#joinDialog input,#createServerDialog input,#addFriendDialog input,#settings input,#profile input{font-size:16px}.dm-header .dm-btn,#attach,#emojiToggle{min-height:44px}.ch{min-height:44px}}
/* The friends view starts with the list rather than shortcut cards. */
.home-columns{margin-top:0}
@media(max-width:700px){.home-columns{margin-top:0}}
