:root {
  --message-accent: #b8aaff;
  --message-text: #ece7f8;
  --message-muted: #b7aec9;
  --message-border: rgba(157,138,255,.24);
  --message-surface: rgba(22,21,43,.97);
  --message-soft: rgba(157,138,255,.1);
}
#custom-toast.toast {
  bottom: max(88px,calc(var(--safe-bottom) + 88px));
  width: min(420px,calc(100vw - 32px));
  max-width: none;
  max-height: 38vh;
  background: var(--message-surface);
  border: 1px solid var(--message-border);
  color: var(--message-text);
  border-radius: 20px;
  padding: 14px;
  gap: 12px;
  align-items: flex-start;
  box-shadow: 0 14px 40px rgba(0,0,0,.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
  transition: opacity .18s ease,transform .18s ease,visibility .18s ease;
}
#custom-toast.toast.show { opacity:1; visibility:visible; pointer-events:auto; transform:translateX(-50%) translateY(0); }
.toast-symbol,.notice-symbol {
  width:36px;
  height:36px;
  flex-shrink:0;
  display:grid;
  place-items:center;
  background:var(--message-soft);
  border:1px solid var(--message-border);
  border-radius:12px;
  color:var(--message-accent);
  font-size:16px;
}
#custom-toast .toast-icon { color:var(--message-accent); font-size:16px; animation:none; }
.toast-copy,.notice-copy { display:flex; flex-direction:column; gap:5px; min-width:0; flex:1; }
#toast-title,.notice-title { color:var(--message-text); font-size:13px; font-weight:650; line-height:1.4; }
#toast-message,.notice-body { color:var(--message-muted); font-size:12px; font-weight:400; line-height:1.65; overflow-wrap:anywhere; white-space:pre-line; margin:0; }
.toast-copy { max-height:calc(38vh - 28px); overflow:auto; }
#toast-close { flex-shrink:0; width:32px; height:36px; border:0; background:transparent; color:var(--message-muted); cursor:pointer; border-radius:10px; }
#toast-close:hover { background:var(--message-soft); color:var(--message-accent); }
#toast-close:focus-visible { outline:2px solid var(--message-accent); outline-offset:2px; }
.notice-card { display:flex; align-items:flex-start; gap:12px; padding:18px; border:1px solid var(--message-border); border-radius:20px; background:var(--message-surface); color:var(--message-text); width:100%; box-sizing:border-box; }
.notice-card .notice-action { align-self:flex-start; margin-top:10px; min-height:44px; white-space:normal; }
.notice-inline { padding:14px !important; border:1px solid var(--message-border) !important; border-radius:16px !important; background:var(--message-soft) !important; color:var(--message-muted); gap:10px !important; line-height:1.65; }
.notice-inline>i { color:var(--message-accent) !important; }
.error-message { padding:18px; border:1px solid var(--message-border); border-radius:20px; background:var(--message-surface); color:var(--message-muted); line-height:1.65; }
.notice-screen { position:fixed; inset:0; z-index:9999; display:flex; align-items:center; justify-content:center; padding:24px; background:#0a0e27; }
.notice-screen .notice-card { max-width:420px; }
#loading-overlay { position:fixed; inset:0; z-index:9999; background:rgba(7,9,22,.75); display:flex; align-items:center; justify-content:center; padding:24px; opacity:0; transition:opacity .18s ease; }
#loading-overlay.visible { opacity:1; }
.loading-notice { display:flex; flex-direction:column; align-items:center; gap:12px; width:min(320px,100%); padding:28px 24px; border-radius:24px; background:var(--message-surface); border:1px solid var(--message-border); box-shadow:0 14px 40px rgba(0,0,0,.3); text-align:center; color:var(--message-text); }
.loading-notice strong { font-size:15px; }
.loading-notice .lo-msg { font-size:12px; line-height:1.65; color:var(--message-muted); overflow-wrap:anywhere; }
.lo-spinner { width:36px; height:36px; border-radius:50%; border:3px solid var(--message-soft); border-top-color:var(--message-accent); animation:message-spin .8s linear infinite; }
@keyframes message-spin { to { transform:rotate(360deg); } }
@media(max-height:500px) { #custom-toast.toast { bottom:66px; max-height:50vh; } .toast-copy { max-height:calc(50vh - 28px); } }
@media(prefers-reduced-motion:reduce) { #custom-toast.toast,#loading-overlay { transition:none; } .lo-spinner { animation:none; border-color:var(--message-accent); } }

.notice-action { background:linear-gradient(135deg,#8a6dd5,#6c52b2); color:#fff; border:0; padding:12px 18px; border-radius:14px; font:inherit; font-size:12px; cursor:pointer; }
#custom-modal .modal-btn:not(.modal-btn-primary) { background:var(--message-soft); border:1px solid var(--message-border); color:var(--message-text); }
.auth-card #auth-status:not(:empty) { padding:12px; border-radius:14px; border:1px solid var(--message-border); background:var(--message-soft); color:var(--message-muted); line-height:1.65; }
.subscription-notifications:empty { display:none; }
.subscription-notice { margin:10px 0; border:1px solid var(--message-border,rgba(157,138,255,.25)); border-radius:16px; background:var(--message-bg,rgba(157,138,255,.07)); overflow:hidden; }
.subscription-notice summary { cursor:pointer; padding:14px 16px; color:var(--text-primary); overflow-wrap:anywhere; }
.subscription-notice summary strong { font-size:14px; }
.subscription-notice summary span { display:block; margin-top:6px; color:var(--text-secondary); font-size:11px; }
.subscription-notice .notice-card { margin:0; border:0; border-radius:0; }
.subscription-notice-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.subscription-notice-actions .btn { width:auto; min-height:44px; flex:1 1 130px; padding:10px; font-size:12px; }

#custom-toast.toast{width:min(360px,calc(100vw - 24px));max-height:180px;padding:10px 11px;gap:9px;border-radius:14px;align-items:center;box-sizing:border-box}
#custom-toast .toast-symbol{width:26px;height:26px;min-width:26px;border-radius:9px;font-size:13px}
#custom-toast .toast-copy{min-width:0;max-height:none;overflow:visible;gap:3px}
#custom-toast #toast-title{display:none}
#custom-toast #toast-message{font-size:12px;line-height:18px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;max-height:36px;overflow:hidden;overflow-wrap:anywhere}
#custom-toast.expanded #toast-message{display:block;max-height:108px;overflow:auto;-webkit-line-clamp:unset;overscroll-behavior:contain}
#custom-toast #toast-details{border:0;background:transparent;color:var(--accent-bright);padding:3px 0;font:inherit;font-size:11px;cursor:pointer;text-align:left}
#custom-toast #toast-details[hidden]{display:none}
#custom-toast .toast-close{width:32px;min-width:32px;height:36px;align-self:center}
.notice-card{padding:12px;border-radius:14px;gap:10px}
.loading-notice{padding:18px;width:min(280px,calc(100vw - 32px));gap:10px}
@media(max-height:500px){#custom-toast.toast{max-height:130px}#custom-toast.expanded #toast-message{max-height:72px}}
