/* Dialogs share the select menu's pearl surface, plum ink and focus treatment. */
.overlay {
  --dialog-inset: clamp(19px, 3.7vw, 30px);
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  background: rgb(45 36 58 / 33%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
#overlay > .dialog {
  --accent: var(--select-violet);
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  width: min(100%, var(--dialog-width, 500px));
  max-width: 100%;
  max-height: 100%;
  max-height: min(90dvh, 100%);
  overflow: hidden;
  padding: 0;
  border: 1px solid #e2d9e9;
  border-radius: clamp(23px, 3.8vw, 30px);
  background: linear-gradient(155deg, #fff 30%, #fdfbfe 100%);
  color: var(--select-ink);
  box-shadow:
    0 26px 70px -25px rgb(40 26 57 / 38%),
    0 5px 17px -6px rgb(53 37 69 / 19%),
    0 0 0 1px rgb(255 255 255 / 30%),
    inset 0 1px 0 white;
}
.dialog[data-kind="search"],
.dialog[data-kind="account"],
.dialog[data-kind="menu"],
.dialog[data-kind="confirm"] {
  --dialog-width: 454px;
}
.dialog[data-kind="manage"],
.dialog[data-kind="code"] {
  --dialog-width: 624px;
}
.dialog[data-kind="preview"] {
  --dialog-width: 774px;
}
.dialog .dialog-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  margin: 0;
  padding: 19px var(--dialog-inset) 17px;
  border: 0;
  border-bottom: 1px solid #e6deec;
  background:
    linear-gradient(115deg, rgb(255 255 255 / 80%), transparent 46%),
    linear-gradient(178deg, #fcfaff 4%, #f3edf8 100%);
  box-shadow:
    inset 0 1px 0 white,
    inset 0 -1px 0 rgb(255 255 255 / 76%);
}
.dialog .dialog-mark,
.dialog .dialog-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.dialog .dialog-mark {
  width: 45px;
  height: 45px;
  border: 1px solid #ded2ea;
  border-radius: 15px;
  background: linear-gradient(155deg, #fff 12%, #f2eaf8 60%, #e9def3);
  color: var(--select-violet);
  box-shadow:
    inset 0 1px 1px #fff,
    inset 0 -2px 3px #d9cae536,
    0 2px 4px #4530560c;
}
.dialog .dialog-mark svg {
  width: 22px;
  height: 22px;
}
.dialog .dialog-head h2 {
  flex: 1;
  min-width: 0;
  max-height: 22vh;
  max-height: 22dvh;
  margin: 0;
  overflow-y: auto;
  overflow-wrap: anywhere;
  color: #372b42;
  font-size: clamp(1.15rem, 2.4vw, 1.42rem);
  font-weight: 690;
  line-height: 1.42;
  letter-spacing: -0.025em;
}
.dialog .dialog-close {
  width: 37px;
  height: 37px;
  padding: 0;
  border: 1px solid #ded6e5;
  border-radius: 50%;
  background: linear-gradient(#fff, #f7f4f9);
  box-shadow:
    inset 0 1px white,
    0 1px 2px #4530560b;
  color: #74677f;
}
.dialog .dialog-close svg {
  width: 17px;
  height: 17px;
}
.dialog .dialog-body {
  flex: 0 1 auto;
  min-height: 0;
  min-width: 0;
  padding: clamp(20px, 3vw, 26px) var(--dialog-inset) clamp(22px, 3.5vw, 30px);
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 12px;
  scrollbar-width: thin;
  scrollbar-color: #c9bdd4 transparent;
  overflow-wrap: anywhere;
}
.dialog .dialog-body :where(p:last-child) {
  margin-bottom: 0;
}
.dialog :is(.form-stack, .dialog-actions, .art-story, .art-story figure) {
  min-width: 0;
}
.dialog
  .dialog-body
  :is(
    input:not([type]),
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    textarea
  ) {
  border: 1px solid var(--select-border);
  border-radius: 12px;
  background: #fff;
  color: var(--select-ink);
  box-shadow: inset 0 1px 2px rgb(57 38 72 / 3%);
  font-weight: 450;
}
.dialog .dialog-body textarea:not(.g-code-source) {
  max-height: min(50vh, 32rem);
}
.dialog .dialog-body .form-stack > label,
.dialog #account-dialog label.form-stack {
  color: var(--select-ink);
  font-weight: 560;
}
.dialog .dialog-body :is(input[type="checkbox"], input[type="radio"]) {
  accent-color: var(--select-violet);
}
.dialog
  .dialog-body
  :is(.btn, .gm-nav button, .gm-person, .gm-pick, .g-mention-option) {
  border-radius: 12px;
}
.dialog .dialog-body .btn {
  border-color: var(--select-border);
  background: linear-gradient(#fff, #faf8fc);
  color: var(--select-ink);
  box-shadow:
    inset 0 1px 0 #fff,
    0 1px 2px #45305609;
}
.dialog .dialog-body .btn.primary {
  border: 1px solid #75538e;
  background: linear-gradient(180deg, #8e6ba8, #78558f 64%, #714e89);
  color: #fff;
  box-shadow:
    inset 0 1px 0 #ffffff47,
    0 3px 7px #5f40721e;
}
.dialog .dialog-body .btn.g-danger,
.dialog .dialog-body .btn.danger {
  border-color: #e2bfca;
  background: linear-gradient(#fffafa, #faedf1);
  color: #883851;
}
.dialog :is(button, a, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--select-focus);
  outline-offset: 2px;
}
.dialog .dialog-body .btn:disabled {
  opacity: 0.58;
}
.dialog .menu-list {
  gap: 2px;
}
.dialog .menu-list > button,
.dialog .g-mention-option {
  min-height: 42px;
  color: var(--select-ink);
  border-radius: 12px;
}
.dialog .menu-list > button > .ic:first-child {
  color: var(--select-violet);
}
.dialog .menu-list > button > .ic:last-child:not(:first-child) {
  color: #91829c;
}
.dialog .gm-nav {
  padding: 4px;
  border-color: #e1d8e7;
  border-radius: 15px;
  background: #f4f0f7;
}
.dialog .gm-nav button[aria-pressed="true"] {
  color: var(--select-violet);
  background: linear-gradient(#fff, #fcfaff);
  box-shadow: 0 1px 4px #4c35561c;
}
.dialog .gm-person,
.dialog .gm-pick {
  padding-inline: 8px;
}
.dialog .dialog-message {
  margin: 0;
  color: var(--select-ink);
  line-height: 1.75;
}
.dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}
.dialog .dialog-actions .btn {
  min-height: 41px;
  padding-inline: 17px;
}
.dialog .art-story :is(img, video) {
  max-width: 100%;
  height: auto;
}
.dialog .art-story pre {
  max-width: 100%;
  overflow: auto;
}
.dialog .dialog-body [data-account-error]:not([hidden]),
.dialog .gm-error:not(:empty) {
  border: 1px solid #ecd7df;
  border-radius: 11px;
  background: #fcf1f4;
  color: #83354d;
}
#toast {
  bottom: max(22px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: min(32rem, calc(100vw - 28px));
  padding: 10px 17px;
  border: 1px solid var(--select-border);
  border-radius: 16px;
  color: var(--select-ink);
  background: linear-gradient(#fff, #faf7fc);
  box-shadow:
    inset 0 1px white,
    0 6px 24px -7px rgb(54 36 70 / 25%);
  overflow-wrap: anywhere;
  line-height: 1.5;
}
@media (prefers-reduced-motion: reduce) {
  #toast {
    transition: none;
  }
}
@media (hover: hover) {
  .dialog .dialog-close:hover,
  .dialog .menu-list > button:hover,
  .dialog .g-mention-option:hover,
  .dialog .gm-person:hover,
  .dialog .gm-pick:hover,
  .dialog .dialog-body .btn:not(:disabled):hover {
    color: var(--select-violet);
    border-color: #c9b8d5;
    background: #f5f0f8;
  }
  .dialog .dialog-body .btn.primary:not(:disabled):hover {
    border-color: #6e4b87;
    background: linear-gradient(#89659f, #6e4b87);
    color: white;
  }
  .dialog .dialog-body .btn:is(.g-danger, .danger):not(:disabled):hover {
    border-color: #d2a9b7;
    background: #f7e7ed;
    color: #783149;
  }
}
@media (max-width: 600px) {
  .overlay {
    --dialog-inset: clamp(16px, 5vw, 23px);
    padding-inline: max(11px, env(safe-area-inset-left))
      max(11px, env(safe-area-inset-right));
  }
  #overlay > .dialog {
    max-height: 100%;
    border-radius: 24px;
  }
  .dialog .dialog-head {
    gap: 11px;
    padding-block: 13px;
  }
  .dialog .dialog-mark {
    width: 39px;
    height: 39px;
    border-radius: 13px;
  }
  .dialog .dialog-body {
    padding-block: 18px 21px;
  }
  .dialog
    .dialog-body
    :is(
      input:not([type]),
      input[type="text"],
      input[type="email"],
      input[type="password"],
      input[type="number"],
      input[type="search"],
      textarea
    ) {
    font-size: 16px;
  }
}
@media (pointer: coarse) {
  .dialog .dialog-close,
  .dialog
    .dialog-body
    :is(.btn, .gm-nav button, .g-mention-option, .menu-list > button) {
    min-height: 44px;
  }
  .dialog .dialog-close {
    width: 44px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .overlay:not([hidden]) > .dialog:not([hidden]) {
    animation: dialog-appear 160ms ease-out;
  }
  @keyframes dialog-appear {
    from {
      opacity: 0.4;
    }
    to {
      opacity: 1;
    }
  }
}
@media (forced-colors: active) {
  #overlay > .dialog,
  .dialog .dialog-mark,
  .dialog .dialog-close {
    border: 1px solid CanvasText;
  }
  .dialog .dialog-body .btn {
    border: 1px solid ButtonText;
  }
}
