/* V1.1.158: chat atmosphere applies to the conversation canvas only.
   Interactive dialogs, validation notices and login are deliberately OPAQUE. */
:root:not([data-chat-theme="dark"]) .ui-dialog,
:root:not([data-chat-theme="dark"]) .chat-operation-dialog,
:root:not([data-chat-theme="dark"]) .appearance-dialog,
:root:not([data-chat-theme="dark"]) #member-app .group-discovery-dialog,
:root:not([data-chat-theme="dark"]) #member-app .native-group-modal,
:root:not([data-chat-theme="dark"]) .group-role-dialog,
:root:not([data-chat-theme="dark"]) .member-password-dialog,
:root:not([data-chat-theme="dark"]) .member-profile-edit,
:root:not([data-chat-theme="dark"]) #member-app .member-profile-edit{
  background:#fff!important;
  background-image:none!important;
  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;
  color:#263248;
  border:1px solid #e1e6f0;
  box-shadow:0 20px 60px rgba(33,43,76,.2);
}
:root[data-chat-theme="dark"] .ui-dialog,
:root[data-chat-theme="dark"] .chat-operation-dialog,
:root[data-chat-theme="dark"] .member-password-dialog,
:root[data-chat-theme="dark"] .member-profile-edit{
  background:#222b3a!important;background-image:none!important;
  backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
}
/* Dialogs created by member.js are appended to body, outside #member-app.
   Earlier #member-app-only selectors could never style them, exposing a stray × button. */
.member-profile-edit{
  width:min(460px,calc(100vw - 24px));
  max-height:min(92dvh,680px);padding:0!important;
  overflow:auto;border-radius:16px!important;
}
.member-profile-edit .member-profile-edit-head{
  display:flex;align-items:center;justify-content:space-between;
  min-height:58px;gap:12px;padding:12px 20px;
  border-bottom:1px solid #edf0f6;
}
.member-profile-edit .member-profile-edit-head h2{margin:0;font-size:17px;font-weight:650;color:#27334a;line-height:1.35}
.member-profile-edit .member-profile-edit-close{
  display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;
  padding:0;margin:0;background:transparent;border:0;border-radius:10px;
  color:#68768e;font-size:23px;line-height:1;cursor:pointer;
}
.member-profile-edit .member-profile-edit-close:hover{background:#f0f3f9}
.member-profile-edit form{display:flex;flex-direction:column;gap:0!important}
.member-profile-edit .member-profile-edit-body{display:grid;gap:17px;padding:20px 22px 18px}
.member-profile-edit .member-profile-edit-field{display:grid;gap:8px;margin:0}
.member-profile-edit .member-profile-edit-field>span{font-size:13px;font-weight:600;color:#3b485d}
.member-profile-edit .member-profile-edit-input{
  display:block;width:100%;min-height:44px;margin:0;padding:10px 12px;
  background:#fff;border:1px solid #dbe3ef;border-radius:10px;
  color:#2d3a51;font:inherit;font-size:15px;
}
.member-profile-edit .member-profile-edit-input:focus{outline:0;border-color:#738cc5;box-shadow:0 0 0 3px rgba(105,126,185,.12)}
.member-profile-edit .chat-operation-buttons{
  display:flex;justify-content:flex-end;gap:10px;
  margin:0;padding:13px 20px 16px;border-top:1px solid #edf0f6;
}
.member-profile-edit .chat-operation-buttons button{min-width:86px;min-height:39px;border-radius:9px;font-size:13px}
.member-password-overlay{z-index:14000}
/* Errors are always above editors, settings and other overlays. */
.chat-operation-mask.v158-feedback-overlay{z-index:25000;isolation:isolate}
.chat-operation-mask.v158-feedback-overlay .chat-operation-dialog{max-width:min(390px,100%)}
/* Keep the dark mode functional instead of bleaching dialogs. */
:root[data-chat-theme="dark"] .member-profile-edit .member-profile-edit-head{border-color:#46536b}
:root[data-chat-theme="dark"] .member-profile-edit .member-profile-edit-head h2,
:root[data-chat-theme="dark"] .member-profile-edit .member-profile-edit-field>span{color:#edf1f8}
:root[data-chat-theme="dark"] .member-profile-edit .member-profile-edit-input{background:#293649;color:#f1f4fc;border-color:#46536b}
:root[data-chat-theme="dark"] .member-profile-edit .chat-operation-buttons{border-color:#46536b}
/* Login screen: an actual opaque card, not transparent over other letters. */
:root:not([data-chat-theme="dark"]) .login-box{
  background:#fff!important;border:1px solid #e2e6f0!important;
  box-shadow:0 14px 42px rgba(69,77,126,.1)!important;
  backdrop-filter:none!important;-webkit-backdrop-filter:none!important;
  border-radius:20px!important;
}
:root:not([data-chat-theme="dark"]) .login-box .login-field input{
  background:#fff!important;border-color:#dce3ef!important;
}
:root:not([data-chat-theme="dark"]) .login-box .login-field input:focus{border-color:#7288bb!important}
/* Uploaded wallpaper is per-account and per-device. The file is not sent to the server. */
#member-app.chat-wallpaper-on #chat-messages,
#member-app.chat-wallpaper-on .group-dm-panel .dm-message-list{
  background-image:linear-gradient(rgba(246,247,255,.13),rgba(246,247,255,.13)),var(--chat-wallpaper-image)!important;
  background-color:#e8f0ff!important;
  background-position:center center!important;
  background-size:cover!important;
  background-repeat:no-repeat!important;
}
#member-app.chat-wallpaper-on .group-dm-panel.is-conversation .dm-message-list{background-attachment:local!important}
.wallpaper-dialog{width:min(460px,calc(100vw - 24px));max-height:90dvh;overflow:auto;padding:22px;border-radius:16px}
.wallpaper-dialog h2{margin:0 0 13px;font-size:17px}
.wallpaper-preview{min-height:150px;border:1px solid #dce2ef;border-radius:12px;background:linear-gradient(125deg,#e8f0ff,#f3e8ff);background-size:cover;background-position:center;display:grid;place-items:center;color:#647392;font-size:13px}
.wallpaper-dialog p{margin:12px 0 14px;line-height:1.6;font-size:12px;color:#65748a}
.wallpaper-dialog .wallpaper-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px;margin:18px 0 0}
.wallpaper-dialog .wallpaper-actions button{min-height:40px;padding:8px 14px;border:1px solid #dce3ef;border-radius:9px;background:#fff;color:#33445f;cursor:pointer}
.wallpaper-dialog .wallpaper-actions button.primary{background:#7388bc;color:#fff;border-color:#7388bc}
.wallpaper-dialog .wallpaper-actions button:disabled{opacity:.5;cursor:default}
:root[data-chat-theme="dark"] .wallpaper-preview{border-color:#59647c}
:root[data-chat-theme="dark"] .wallpaper-dialog .wallpaper-actions button{background:#293649;color:#f2f5fc;border-color:#46536b}
:root[data-chat-theme="dark"] .wallpaper-dialog .wallpaper-actions button.primary{background:#6379b1}
@media(max-width:760px){
  :root:not([data-chat-theme="dark"]) .login-screen{padding:48px 18px calc(24px + env(safe-area-inset-bottom))!important;align-items:center!important}
  :root:not([data-chat-theme="dark"]) .login-box{padding:28px 22px 24px!important;max-width:420px;margin:auto!important}
  :root:not([data-chat-theme="dark"]) .login-box h1{margin-bottom:26px!important}
  .member-profile-edit .member-profile-edit-head{padding:12px 16px}
  .member-profile-edit .member-profile-edit-body{padding:16px;gap:16px}
  .member-profile-edit .chat-operation-buttons{padding:13px 16px calc(13px + env(safe-area-inset-bottom))}
  .member-profile-edit .chat-operation-buttons button{flex:1}
}
@media(prefers-reduced-transparency:reduce){#member-app.chat-wallpaper-on #chat-messages,#member-app.chat-wallpaper-on .dm-message-list{background-image:var(--chat-wallpaper-image)!important}}
