/* ============================================================
   تیتانو گیم — کارت گفت‌وگو
   ظاهر کادر تأیید/ورودی که جای confirm و prompt مرورگر را می‌گیرد.
   سه حال‌وهوا دارد: accent (خنثی)، warn (هشدار)، bad (کار خطرناک).
   ============================================================ */

.dlg {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  pointer-events: none;
}
.dlg.is-open { visibility: visible; pointer-events: auto; }

.dlg__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 42%, rgba(6, 2, 14, 0.42), rgba(4, 1, 10, 0.86) 72%),
    linear-gradient(rgba(5, 2, 12, 0.5), rgba(5, 2, 12, 0.8));
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  opacity: 0;
  transition: opacity 0.34s ease;
}
.dlg.is-open .dlg__veil { opacity: 1; }

.dlg__card {
  position: relative;
  z-index: 1;
  width: min(432px, 92vw);
  padding: 26px 26px 20px;
  border-radius: var(--r-lg, 22px);
  border: 1px solid var(--edge, rgba(255, 255, 255, 0.11));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    var(--glass-strong, rgba(10, 6, 20, 0.72));
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.62),
    0 0 0 1px color-mix(in srgb, var(--dlg-tone, #ff5d9e) 26%, transparent) inset,
    0 0 52px color-mix(in srgb, var(--dlg-tone, #ff5d9e) 16%, transparent);
  color: var(--ink, #f3efff);
  overflow: hidden;
  transform: translateY(14px) scale(0.955);
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.06), opacity 0.32s ease;
}
.dlg.is-open .dlg__card { transform: none; opacity: 1; }

.dlg__card.is-warn { --dlg-tone: #ffb057; }
.dlg__card.is-bad { --dlg-tone: #ff5d6b; }
.dlg__card { --dlg-tone: var(--accent, #ff5d9e); }

/* نوار نور بالای کارت */
.dlg__beam {
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 2px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, transparent, var(--dlg-tone), transparent);
  opacity: 0.85;
}
/* حلقهٔ چرخان پشت کارت */
.dlg__ring {
  position: absolute;
  inset: -40% -30% auto;
  height: 200px;
  background: conic-gradient(from 0deg, transparent 0 62%, color-mix(in srgb, var(--dlg-tone) 42%, transparent) 74%, transparent 86%);
  filter: blur(26px);
  opacity: 0.5;
  animation: dlg-spin 16s linear infinite;
  pointer-events: none;
}
@keyframes dlg-spin { to { transform: rotate(360deg); } }

.dlg__kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--dlg-tone) 78%, #fff);
}
.dlg__kicker span { font-size: 13px; }

.dlg__title {
  margin: 0 0 10px;
  font-size: 19px;
  line-height: 1.5;
  font-weight: 700;
}
.dlg__body {
  margin: 0 0 18px;
  font-size: 13.4px;
  line-height: 2;
  color: var(--ink-dim, rgba(243, 239, 255, 0.62));
}
.dlg__body[hidden] { display: none; }

.dlg__field { margin: 0 0 4px; }
.dlg__field[hidden] { display: none; }
.dlg__label {
  display: block;
  margin-bottom: 7px;
  font-size: 11.5px;
  color: var(--ink-faint, rgba(243, 239, 255, 0.34));
}
.dlg__label[hidden] { display: none; }
.dlg__box { position: relative; display: flex; align-items: center; }
.dlg__input {
  width: 100%;
  padding-inline-end: 42px;
  font-family: var(--mono, monospace);
  letter-spacing: 0.06em;
}
.dlg__eye {
  position: absolute;
  inset-inline-end: 6px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-dim, rgba(243, 239, 255, 0.62));
  cursor: pointer;
  font-size: 12px;
  transition: color 0.2s, background 0.2s;
}
.dlg__eye:hover { color: var(--ink, #f3efff); background: rgba(255, 255, 255, 0.12); }
.dlg__eye[hidden] { display: none; }

.dlg__hint {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.9;
  color: var(--ink-faint, rgba(243, 239, 255, 0.34));
}
.dlg__hint[hidden] { display: none; }

.dlg__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}
.dlg__acts .btn { flex: 1 1 auto; justify-content: center; }

.dlg__seal {
  display: block;
  margin-top: 16px;
  text-align: center;
  font-size: 9px;
  letter-spacing: 0.5em;
  color: color-mix(in srgb, var(--dlg-tone) 40%, transparent);
}

/* ---------- حالت‌های کم‌حرکت ---------- */
@media (prefers-reduced-motion: reduce) {
  .dlg__veil, .dlg__card { transition: opacity 0.18s ease; }
  .dlg__card { transform: none; }
  .dlg__ring { animation: none; opacity: 0.28; }
}

/* ---------- موبایل ---------- */
@media (max-width: 520px) {
  .dlg__card { padding: 22px 18px 16px; }
  .dlg__title { font-size: 17px; }
  .dlg__acts { flex-direction: column-reverse; }
  .dlg__acts .btn { width: 100%; }
}

/* بهینه‌سازی موبایل: پردهٔ پشت پنجره روی گوشی سبک‌تر محو می‌شود */
@media (max-width: 900px) {
  .dlg__veil { backdrop-filter: blur(8px) saturate(1.05); -webkit-backdrop-filter: blur(8px) saturate(1.05); }
}
