[hidden] { display:none!important; }
.auth-shell { position:relative; z-index:2; height:calc(100dvh - 80px); overflow:auto; display:grid; place-items:center; padding:20px; }
.auth-card { width:min(420px,100%); padding:32px; background:var(--panel); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow); }
.auth-card h2 { font:26px/1.5 var(--display-font); }
.auth-card label,.account-form label { display:block; font:13px/1.6 var(--ui-font); margin:13px 0; }
.auth-card input,.account-form input,.account-form select { display:block; width:100%; margin-top:5px; padding:11px 12px; border:1px solid var(--line); border-radius:7px; background:var(--paper); color:var(--ink); font:14px var(--ui-font); }
.auth-card .sendbtn { width:100%; justify-content:center; min-height:42px; margin-top:22px; }
.auth-links { display:flex; gap:16px; justify-content:center; margin-top:20px; font-size:13px; }
.auth-links button { color:var(--accent); }
.form-error { color:var(--error); white-space:pre-wrap; font:13px/1.7 var(--ui-font); min-height:22px; margin-top:12px; }
.auth-server { overflow-wrap:anywhere; text-align:center; font:11px var(--ui-font); color:var(--muted); margin-top:22px; }
.live-empty { display:grid; place-content:center; text-align:center; min-height:180px; padding:30px; color:var(--muted); font:14px/1.9 var(--ui-font); }
.live-empty strong { color:var(--ink); font-size:18px; font-weight:500; margin-bottom:8px; }
.load-earlier { display:block; margin:0 auto 24px; background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:7px 16px; font:12px var(--ui-font); }
.file-download { color:inherit; text-decoration:none; display:block; }
.file-download:hover strong { text-decoration:underline; }
.filecaption svg { width:18px; height:18px; vertical-align:middle; margin-right:7px; }
.msgstate.failed { max-width:330px; overflow-wrap:anywhere; }
.message-image { display:block; max-width:min(300px,100%); max-height:240px; object-fit:contain; border-radius:6px; margin-bottom:8px; }
.choice-users { max-height:280px; overflow:auto; margin:15px 0; }
.choice-user { display:flex; align-items:center; gap:12px; padding:10px 8px; border-bottom:1px solid var(--line); cursor:pointer; }
.choice-user input { width:17px; height:17px; accent-color:var(--accent); }
.choice-user .avatar { width:34px; height:34px; font-size:15px; }
.choice-user span { flex:1; font-size:13px; }
.choice-user small { display:block; color:var(--muted); font-size:11px; margin-top:3px; }
.inline-check { display:flex!important; align-items:center; gap:8px; margin:15px 0; font-size:13px; }
.inline-check input { width:17px!important; margin:0!important; }
.admin-code { padding:13px; margin:10px 0; border:1px solid var(--line); border-radius:8px; font:13px/1.8 var(--ui-font); }
.admin-code code { display:block; font:16px/1.8 ui-monospace,monospace; word-break:break-all; user-select:all; color:var(--ink); }
.admin-code small { color:var(--muted); }
.account-form .sendbtn { margin-top:18px; }
.spacefoot #reconnect { margin-left:auto; color:var(--accent); font-size:11px; }
.avatar { overflow:hidden; flex-shrink:0; }
.avatar-image { width:100%; height:100%; object-fit:cover; }
.dialogbusy { color:var(--muted); font:13px/1.8 var(--ui-font); }
.settingsrow span { min-width:0; overflow-wrap:anywhere; }
.settingsrow strong { max-width:65%; text-align:right; overflow-wrap:anywhere; }
.detailsection h4 { display:flex; justify-content:space-between; gap:8px; }
.detailsection h4 button { color:var(--accent); }
.auth-card input:focus-visible,.account-form input:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.errorblock { color:var(--error); font:13px/1.8 var(--ui-font); padding:16px; }
.security-dialog { width:560px; max-width:calc(100vw - 28px); }
.security-dialog h2 { font:600 21px/1.5 var(--ui-font); margin-bottom:14px; }
.security-code { padding:13px 15px; margin:14px 0; border:1px solid var(--line); border-radius:9px; background:var(--bg); }
.security-code strong { display:block; font:600 13px/1.5 var(--ui-font); margin-bottom:8px; }
.security-code code { font:14px/1.9 ui-monospace,monospace; overflow-wrap:anywhere; user-select:all; color:var(--ink); }
.security-code small { display:block; color:var(--muted); overflow-wrap:anywhere; font:11px/1.5 var(--ui-font); }
.recovery-code { width:100%; min-height:100px; resize:none; border:1px solid var(--line); border-radius:8px; padding:12px; background:var(--bg); color:var(--ink); font:16px/1.9 ui-monospace,monospace; overflow-wrap:anywhere; }
.legacy-tag { background:#fff2df; color:#896020; }
body.dark .legacy-tag { background:#544633; color:#efd29d; }
.decrypt-error { color:var(--error); font:13px/1.8 var(--ui-font); }
.ai-share-current,.ai-share-preview { padding:12px; margin:15px 0; border:1px solid var(--line); border-radius:8px; background:var(--bg); }
.ai-share-current strong,.ai-share-preview strong { font-size:13px; }
.ai-share-current pre,.ai-share-preview pre { font:14px/1.8 var(--ui-font); white-space:pre-wrap; overflow-wrap:anywhere; max-height:210px; overflow:auto; margin-top:7px; }
.ai-history summary { cursor:pointer; font:13px/1.7 var(--ui-font); color:var(--accent); margin:14px 0; }
.ai-context-choice { display:flex; align-items:flex-start; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); }
.ai-context-choice input { flex:none; width:17px; height:17px; accent-color:var(--accent); margin-top:3px; }
.ai-context-choice span { white-space:pre-wrap; overflow-wrap:anywhere; font:13px/1.8 var(--ui-font); max-height:150px; overflow:auto; }
.ai-context-choice strong { display:block; }
#security-dialog .inline-check,#trust-dialog .inline-check { align-items:flex-start; line-height:1.7; }
#security-dialog .inline-check input,#trust-dialog .inline-check input { flex:none; margin-top:3px!important; }
.live-empty .secondarybtn { justify-self:center; margin-top:18px; }
#search-progress { min-height:22px; }
.file-download { text-align:left; }
@media(max-width:720px) { .security-dialog { padding:20px 17px; } .security-dialog .profile-avatar-tools { flex-wrap:wrap; } .dialogactions { flex-wrap:wrap; } .security-code code { font-size:12px; } }
@media(max-width:720px) { .auth-shell { height:calc(100dvh - 56px); padding:15px; } .auth-card { padding:25px 22px; } .auth-card h2 { font-size:24px; } .choice-users { max-height:230px; } .msgactions { flex-wrap:wrap; } }
/* Keep editing controls inside the resized viewport when a phone keyboard opens. */
@media (max-width:720px) and (max-height:500px) {
  .world-header { display:none; }
  .app,.app.no-details,.app:not(.no-details) { height:calc(100dvh - 12px); margin:6px auto; min-height:0; }
  .app.mobile-chat .conversation { min-height:0; overflow:hidden; }
  .chathead { flex:0 0 auto; min-height:44px; padding:5px 10px; }
  .chathead .avatar { width:30px; height:30px; }
  .headtext h2 { font-size:16px; line-height:1.4; }
  .headtext p { display:none; }
  .chatpolicy { flex:0 0 auto; min-height:0; max-height:56px; overflow:auto; padding:4px 10px; font-size:11px; line-height:1.4; }
  .chatpolicy button { font-size:11px; }
  .networknotice { max-height:38px; overflow:auto; padding:4px 10px; font-size:11px; }
  .messages { flex:1 1 0; min-height:0; padding:8px 10px; }
  .composearea { flex:0 0 auto; min-height:0; padding:5px 8px 6px; }
  .quickactions { display:none; }
  .composer { padding:6px 8px; }
  .composer textarea { min-height:32px; max-height:54px; line-height:1.5; }
  .composertools { min-height:36px; flex-shrink:0; }
  .quotebar,.attachment { padding:4px 6px; margin-bottom:4px; font-size:12px; line-height:1.3; }
  .quotebar .iconbtn { width:20px; height:20px; }
  .auth-shell { height:100dvh; padding:10px; }
  .app.show-details .details { top:6px; bottom:6px; }
}
@media (max-width:720px) and (max-height:280px) {
  .chathead { min-height:38px; padding-block:2px; }
  .chathead .avatar { width:28px; height:28px; }
  .chatpolicy { padding-block:2px; max-height:24px; }
  .messages { padding-block:4px; }
  .composer textarea { max-height:32px; }
}
