/* modal.css — shared custom confirmation / alert dialog. Replaces native window.confirm. */
.salt-modal,
.salt-modal *,
.salt-modal *::before,
.salt-modal *::after { box-sizing: border-box; }

.salt-modal {
  --sm-accent: #5fd0ff;
  --sm-accent-soft: rgba(95, 208, 255, .13);
  --sm-accent-line: rgba(95, 208, 255, .5);
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 32px);
}

.salt-modal[hidden] { display: none; }

.salt-modal[data-tone="warning"] {
  --sm-accent: #ffb347;
  --sm-accent-soft: rgba(255, 179, 71, .14);
  --sm-accent-line: rgba(255, 179, 71, .52);
}

.salt-modal[data-tone="danger"] {
  --sm-accent: #ff7a55;
  --sm-accent-soft: rgba(255, 122, 85, .13);
  --sm-accent-line: rgba(255, 122, 85, .5);
}

.salt-modal__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 50% 44%, rgba(21, 29, 35, .5), transparent 70%),
    rgba(3, 5, 7, .82);
  opacity: 0;
  transition: opacity .2s ease;
  backdrop-filter: blur(9px) saturate(.9);
  -webkit-backdrop-filter: blur(9px) saturate(.9);
}

.salt-modal__dialog {
  position: relative;
  width: min(500px, 100%);
  max-height: min(720px, calc(100dvh - 32px));
  overflow: auto;
  border: 1px solid rgba(232, 228, 218, .18);
  border-radius: 18px;
  background:
    radial-gradient(90% 70% at 94% 0%, var(--sm-accent-soft), transparent 58%),
    linear-gradient(155deg, rgba(24, 30, 35, .99), rgba(9, 12, 15, .995) 62%);
  color: #eee9de;
  box-shadow:
    0 40px 120px rgba(0, 0, 0, .74),
    0 0 0 1px rgba(255, 255, 255, .025) inset;
  opacity: 0;
  transform: translateY(16px) scale(.972);
  transition: opacity .2s ease, transform .22s cubic-bezier(.22, .8, .28, 1);
  -webkit-overflow-scrolling: touch;
}

.salt-modal__dialog::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent 4%, var(--sm-accent) 50%, transparent 96%);
  opacity: .86;
  pointer-events: none;
}

.salt-modal.is-open .salt-modal__backdrop { opacity: 1; }
.salt-modal.is-open .salt-modal__dialog { opacity: 1; transform: none; }

.salt-modal__handle { display: none; }

.salt-modal__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 23px 64px 0 24px;
}

.salt-modal__badge {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--sm-accent-line);
  border-radius: 11px;
  background: var(--sm-accent-soft);
  color: var(--sm-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.salt-modal__badge svg { width: 21px; height: 21px; }

.salt-modal__kicker {
  min-width: 0;
  overflow: hidden;
  color: var(--sm-accent);
  font: 600 9px/1.4 var(--f-mono, "IBM Plex Mono", monospace);
  letter-spacing: .2em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.salt-modal__kicker[hidden] { display: none; }

.salt-modal__close {
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(232, 228, 218, .17);
  border-radius: 50%;
  background: rgba(8, 11, 13, .55);
  color: rgba(232, 228, 218, .68);
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.salt-modal__close[hidden] { display: none; }
.salt-modal__close svg { width: 15px; height: 15px; }
.salt-modal__close:hover { border-color: var(--sm-accent-line); background: var(--sm-accent-soft); color: #fff; }

.salt-modal__title {
  margin: 17px 24px 0;
  color: #f3efe6;
  font: 900 clamp(29px, 4.6vw, 40px)/.98 var(--f-display, "Big Shoulders Display", sans-serif);
  letter-spacing: .035em;
  overflow-wrap: anywhere;
}

.salt-modal__title[hidden] { display: none; }

.salt-modal__message {
  margin: 12px 24px 0;
  color: rgba(232, 228, 218, .68);
  font: 500 13px/1.75 "Noto Sans SC", var(--f-mono, "IBM Plex Mono", monospace);
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.salt-modal__message[hidden] { display: none; }

.salt-modal__actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr);
  gap: 10px;
  padding: 23px 24px 24px;
}

.salt-modal[data-single="1"] .salt-modal__actions { grid-template-columns: minmax(0, 1fr); }

.salt-modal__btn {
  -webkit-appearance: none;
  appearance: none;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 10px;
  font: 700 11px/1.2 var(--f-mono, "IBM Plex Mono", monospace);
  letter-spacing: .11em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}

.salt-modal__btn--ghost {
  border: 1px solid rgba(232, 228, 218, .19);
  background: rgba(232, 228, 218, .035);
  color: rgba(232, 228, 218, .76);
}

.salt-modal__btn--ghost:hover {
  border-color: rgba(232, 228, 218, .36);
  background: rgba(232, 228, 218, .075);
  color: #fff;
}

.salt-modal__btn--primary {
  border: 1px solid var(--sm-accent);
  background: var(--sm-accent);
  color: #0a0d0f;
  box-shadow: 0 10px 30px var(--sm-accent-soft);
}

.salt-modal__btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px var(--sm-accent-soft), 0 0 0 3px var(--sm-accent-soft);
}

.salt-modal__btn:active { transform: translateY(0) scale(.985); }

.salt-modal__btn:focus-visible,
.salt-modal__close:focus-visible {
  outline: 2px solid var(--sm-accent);
  outline-offset: 2px;
}

.salt-modal__btn[hidden] { display: none; }

body.salt-modal-open { overflow: hidden; }

@keyframes salt-modal-in {
  from { opacity: 0; transform: translateY(16px) scale(.972); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .salt-modal {
    place-items: end center;
    padding: 0;
  }

  .salt-modal__dialog {
    width: 100%;
    max-height: 90dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(30px);
  }

  .salt-modal__handle {
    display: block;
    width: 42px;
    height: 4px;
    margin: 10px auto 0;
    border-radius: 999px;
    background: rgba(232, 228, 218, .22);
  }

  .salt-modal__head { padding: 16px 60px 0 20px; }
  .salt-modal__badge { width: 38px; height: 38px; border-radius: 10px; }
  .salt-modal__badge svg { width: 19px; height: 19px; }
  .salt-modal__kicker { font-size: 8.5px; letter-spacing: .16em; }
  .salt-modal__title { margin: 14px 20px 0; font-size: 32px; }
  .salt-modal__message { margin: 10px 20px 0; font-size: 12px; line-height: 1.72; }
  .salt-modal__actions { padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .salt-modal__btn { min-height: 48px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .salt-modal__backdrop,
  .salt-modal__dialog,
  .salt-modal__btn,
  .salt-modal__close { transition: none; }
}
