:root {
  --site-dialog-overlay: rgba(15, 15, 14, 0.58);
  --site-dialog-radius: 18px;
  --site-dialog-shadow: 0 24px 76px rgba(0, 0, 0, 0.24);
  --site-dialog-focus: 0 0 0 3px rgba(229, 72, 77, 0.2);
}

/* Shared native dialog used for confirmations and blocking notices. */
.site-dialog {
  width: min(440px, calc(100vw - 32px));
  max-width: 100%;
  max-height: min(86dvh, 720px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line, rgba(0, 0, 0, 0.1));
  border-radius: var(--site-dialog-radius);
  background: var(--paper, #fff);
  color: var(--ink, #171717);
  box-shadow: var(--site-dialog-shadow);
}

.site-dialog::backdrop {
  background: var(--site-dialog-overlay);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.site-dialog-panel { padding: 24px; }
.site-dialog-title { margin: 0; color: var(--ink, #171717); font-size: 18px; font-weight: 700; line-height: 1.35; letter-spacing: -0.02em; }
.site-dialog-message { margin: 11px 0 0; color: var(--muted, #6f6f6f); font-size: 14px; line-height: 1.7; white-space: pre-line; overflow-wrap: anywhere; }
.site-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 23px; }
.site-dialog-button {
  min-width: 84px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.site-dialog-button:active { transform: translateY(1px); }
.site-dialog-button:focus-visible { outline: 0; box-shadow: var(--site-dialog-focus); }
.site-dialog-button.is-secondary { border-color: var(--line-strong, rgba(0, 0, 0, 0.14)); background: var(--paper, #fff); color: var(--ink, #171717); }
.site-dialog-button.is-secondary:hover { background: var(--soft, #f5f5f5); }
.site-dialog-button.is-primary { background: var(--ink, #171717); color: #fff; }
.site-dialog-button.is-primary:hover { background: #333; }
.site-dialog.is-danger .site-dialog-button.is-primary { background: var(--red, #e5484d); }
.site-dialog.is-danger .site-dialog-button.is-primary:hover { background: var(--red-ink, #c93b40); }

/* Keep each page's content and geometry, but normalize modal chrome. */
html body .modal-layer,
html body .login-layer,
html body .overlay.auth-overlay,
html body .qe-overlay,
html body #detailModal.modal-overlay,
html body #shareModal.modal-overlay {
  background: var(--site-dialog-overlay);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

html body .modal,
html body .login-card,
html body .auth-card,
html body .qe-card,
html body .detail-modal {
  border: 1px solid var(--line, rgba(0, 0, 0, 0.08));
  border-radius: var(--site-dialog-radius);
  box-shadow: var(--site-dialog-shadow);
}

html body .modal-head,
html body .detail-modal > h3 {
  border-bottom-color: var(--line, rgba(0, 0, 0, 0.08));
}

html body .modal-head h3,
html body .auth-card h2,
html body .qe-card > h3,
html body .detail-modal > h3 {
  color: var(--ink, #171717);
  font-weight: 700;
  letter-spacing: -0.02em;
}

html body .modal-foot,
html body .share-actions {
  border-top-color: var(--line, rgba(0, 0, 0, 0.08));
}

html body .modal-foot .btn,
html body .share-actions .share-btn,
html body .qe-actions .qe-btn,
html body .auth-submit {
  min-height: 40px;
  border-radius: 10px;
  font-weight: 650;
}

html body .auth-close,
html body .icon-btn,
html body .modal-close,
html body .back-btn {
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
}

html body .qe-card { max-height: min(88dvh, 900px); }
html body .qe-overlay { overflow: auto; }
html body .share-drawer {
  border: 1px solid var(--line, rgba(0, 0, 0, 0.08));
  border-radius: var(--site-dialog-radius) 0 0 var(--site-dialog-radius);
  box-shadow: -16px 0 50px -28px rgba(0, 0, 0, 0.35);
}
html body .share-drawer-head { border-bottom-color: var(--line, rgba(0, 0, 0, 0.08)); }
html body #detailModal .detail-modal,
html body #shareModal .detail-modal { max-height: min(86dvh, 900px); }

@media (max-width: 600px) {
  .site-dialog-panel { padding: 21px 19px 18px; }
  .site-dialog-actions { gap: 8px; margin-top: 20px; }
  .site-dialog-button { flex: 1 1 0; min-width: 0; }
  html body .modal-layer,
  html body .login-layer,
  html body .overlay.auth-overlay,
  html body .qe-overlay,
  html body #detailModal.modal-overlay,
  html body #shareModal.modal-overlay { padding: 16px; }
  html body .modal-foot,
  html body .share-actions { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .site-dialog-button { transition: none; }
}
