.overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--shadow-rgb), 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background-color: var(--bg-modal);
  background-image: var(--texture-surface), var(--texture-speckle);
  background-size: 256px 256px, 128px 128px;
  background-repeat: repeat, repeat;
  border: 2px solid rgba(var(--gold-rgb), 0.3);
  border-radius: 6px;
  padding: 2rem 2.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 12px 48px rgba(var(--shadow-rgb), 0.8),
    0 4px 12px rgba(var(--shadow-rgb), 0.5),
    inset 0 1px 0 rgba(var(--gold-rgb), 0.1);
  animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.spellName {
  font-family: var(--font-display, "Cinzel", Georgia, serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.roll {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.dc {
  color: var(--text-tertiary);
}

/* ── Result label variants ── */

.resultLabel {
  font-family: var(--font-display, "Cinzel", Georgia, serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0.75rem 0;
  text-transform: uppercase;
}

.success {
  color: var(--gold);
  text-shadow: 0 0 16px rgba(var(--gold-rgb), 0.45);
}

.failure {
  color: var(--text-secondary);
}

.critSuccess {
  color: var(--crit);
  text-shadow:
    0 0 20px rgba(var(--crit-rgb), 0.6),
    0 0 40px rgba(var(--crit-rgb), 0.3);
  animation: critGlow 1s ease-in-out infinite alternate;
}

@keyframes critGlow {
  from { text-shadow: 0 0 16px rgba(var(--crit-rgb), 0.5), 0 0 32px rgba(var(--crit-rgb), 0.2); }
  to   { text-shadow: 0 0 28px rgba(var(--crit-rgb), 0.8), 0 0 56px rgba(var(--crit-rgb), 0.4); }
}

.critFail {
  color: var(--danger);
  text-shadow: 0 0 16px rgba(var(--danger-rgb), 0.5);
}

/* ── Notes ── */

.note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0.5rem 0 0;
}

/* ── Mishap block ── */

.mishap {
  margin-top: 1rem;
  background: rgba(var(--danger-rgb), 0.08);
  border: 1px solid rgba(var(--danger-rgb), 0.3);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  text-align: left;
}

.mishapTitle {
  font-family: var(--font-display, "Cinzel", Georgia, serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
}

.mishapDesc {
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.45;
  margin: 0 0 0.4rem;
}

.mishapEffect {
  font-size: 0.78rem;
  color: var(--danger);
  font-weight: 600;
  margin: 0;
}

/* ── Dismiss button ── */

.closeBtn {
  font-family: var(--font-display, "Cinzel", Georgia, serif);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.5rem 1.5rem;
  margin-top: 1.25rem;
  background: var(--btn-gold-bg);
  border: none;
  border-radius: 3px;
  color: var(--btn-active-text);
  cursor: pointer;
  transition: filter 0.15s;
}

.closeBtn:hover {
  filter: brightness(1.1);
}
