.dice-gods-page {
  position: relative;
  overflow-x: hidden;
}

.module-shell {
  padding: 20px 0 72px;
}

.module-hero {
  max-width: 860px;
  margin-bottom: 26px;
  padding: 28px 0 12px;
}

.module-hero h1 {
  font-size: clamp(4rem, 11vw, 7rem);
  line-height: 0.88;
}

.module-hero__text {
  max-width: 56ch;
  margin-top: 18px;
  font-size: 1.06rem;
  line-height: 1.8;
  color: var(--muted);
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.prayer-form-card,
.stage-card,
.history-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(9, 18, 32, 0.84), rgba(7, 14, 26, 0.78));
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.prayer-form-card {
  padding: 28px;
  position: sticky;
  top: 22px;
}

.card-heading {
  margin-bottom: 22px;
}

.card-heading__eyebrow {
  margin: 0 0 12px;
  color: var(--accent-warm);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.prayer-form-card h2,
.history-card h2,
.stage-title,
.dialog-panel h2 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 0.95;
}

.field-shell {
  margin-bottom: 16px;
}

.field-shell label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(237, 242, 255, 0.9);
}

.field-shell input,
.field-shell textarea {
  width: 100%;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 232, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  resize: vertical;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.field-shell input::placeholder,
.field-shell textarea::placeholder {
  color: rgba(157, 172, 204, 0.72);
}

.field-shell input:hover,
.field-shell textarea:hover {
  border-color: rgba(220, 232, 255, 0.24);
}

.field-shell input:focus-visible,
.field-shell textarea:focus-visible {
  border-color: rgba(121, 231, 255, 0.48);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(121, 231, 255, 0.08);
}

.validation-message {
  min-height: 24px;
  margin: 4px 0 0;
  color: var(--accent-warm);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.result-column {
  display: grid;
  gap: 24px;
}

.stage-card {
  position: relative;
  padding: 28px;
  overflow: hidden;
}

.stage-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(121, 231, 255, 0.15), transparent 30%),
    radial-gradient(circle at 50% 80%, rgba(255, 191, 125, 0.08), transparent 32%);
  pointer-events: none;
}

.stage-card__header {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  z-index: 1;
}

.roll-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(220, 232, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.oracle-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  margin: 12px 0 6px;
  perspective: 1200px;
  transform-style: preserve-3d;
}

.oracle-stage__ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(220, 232, 255, 0.12);
}

.oracle-stage__ring--outer {
  width: min(56vw, 290px);
  aspect-ratio: 1;
  box-shadow:
    inset 0 0 0 1px rgba(121, 231, 255, 0.06),
    0 0 70px rgba(121, 231, 255, 0.15);
}

.oracle-stage__ring--outer::before,
.oracle-stage__ring--outer::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  border: 1px dashed rgba(121, 231, 255, 0.24);
}

.oracle-stage__ring--outer::after {
  inset: 60px;
  border-style: solid;
  border-color: rgba(255, 191, 125, 0.22);
}

.oracle-stage__ring--inner {
  width: min(34vw, 176px);
  aspect-ratio: 1;
  border-color: rgba(255, 255, 255, 0.08);
}

.die-shadow {
  position: absolute;
  width: clamp(108px, 18vw, 164px);
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(4, 9, 16, 0.62) 0%, rgba(4, 9, 16, 0.26) 46%, rgba(4, 9, 16, 0) 76%);
  transform: translateY(96px) translateZ(-26px);
  filter: blur(8px);
  opacity: 0.72;
}

.die-core {
  position: relative;
  width: clamp(176px, 30vw, 248px);
  height: clamp(176px, 30vw, 248px);
  z-index: 1;
  pointer-events: none;
}

.die-core__number {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(3rem, 6vw, 4.6rem);
  font-weight: 700;
  color: #091425;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 18px rgba(5, 10, 18, 0.14);
  transition: opacity 200ms ease, filter 200ms ease;
  pointer-events: none;
}

.die-core.is-rolling .die-core__number {
  opacity: 0;
  filter: blur(5px);
}

.die-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.impact-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.stage-sigil {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(7rem, 16vw, 11rem);
  color: rgba(121, 231, 255, 0.08);
  pointer-events: none;
}

.stage-readout {
  position: relative;
  z-index: 1;
  padding-top: 4px;
  color: rgba(237, 242, 255, 0.86);
  font-size: 1.02rem;
}

.stage-verdict,
.stage-flavor {
  margin: 0;
  line-height: 1.75;
}

.stage-verdict:empty,
.stage-flavor:empty {
  display: none;
}

.stage-verdict {
  margin-top: 12px;
  font-size: 1.08rem;
  color: rgba(237, 242, 255, 0.94);
}

.stage-flavor {
  margin-top: 10px;
  color: var(--muted);
}

.stage-actions {
  margin-top: 18px;
}

.history-card {
  padding: 24px 26px;
}

.history-card__header {
  margin-bottom: 18px;
}

.history-empty {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(220, 232, 255, 0.14);
  color: var(--muted);
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 232, 255, 0.1);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  text-align: left;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.history-item:hover,
.history-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(121, 231, 255, 0.32);
  background: rgba(255, 255, 255, 0.04);
}

.history-item__label {
  font-weight: 800;
}

.history-item__summary {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__roll {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(121, 231, 255, 0.08);
  color: rgba(237, 242, 255, 0.92);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.storm-flash,
.duplicate-overlay,
.impact-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.storm-flash {
  opacity: 0;
  background:
    radial-gradient(circle at 48% 16%, rgba(255, 255, 255, 0.8), transparent 16%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(121, 231, 255, 0.25));
  mix-blend-mode: screen;
  z-index: 70;
}

.duplicate-overlay {
  display: grid;
  place-items: center;
  opacity: 0;
  background: rgba(2, 5, 10, 0.72);
  z-index: 60;
}

.duplicate-overlay__message {
  padding: 18px 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 10, 20, 0.82);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.45);
  color: #fff5ef;
  font-size: clamp(1.3rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  text-align: center;
}

.impact-field {
  overflow: hidden;
  perspective: 1500px;
  transform-style: preserve-3d;
  z-index: 65;
}

.impact-die {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  clip-path: polygon(50% 0%, 88% 20%, 100% 58%, 76% 100%, 24% 100%, 0% 58%, 12% 20%);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(124, 170, 228, 0.85));
  color: #06101e;
  font-size: calc(var(--size) * 0.33);
  font-weight: 800;
  box-shadow:
    0 22px 36px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
}

.impact-die::before,
.impact-die::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0%, 88% 20%, 100% 58%, 76% 100%, 24% 100%, 0% 58%, 12% 20%);
}

.impact-die::before {
  inset: 4px;
  transform: translateZ(12px);
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, 0.84), transparent 34%),
    linear-gradient(180deg, rgba(235, 247, 255, 0.96), rgba(128, 179, 239, 0.84));
}

.impact-die::after {
  inset: 10px;
  transform: translateZ(-10px) scale(0.88);
  background: linear-gradient(180deg, rgba(19, 32, 52, 0.92), rgba(6, 13, 24, 0.96));
  opacity: 0.8;
}

.impact-crater {
  position: absolute;
  left: var(--impact-x);
  top: var(--impact-y);
  width: var(--impact-size);
  height: var(--impact-size);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.impact-crater__core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 46%, rgba(3, 8, 14, 0.96) 0 18%, rgba(10, 18, 31, 0.92) 19% 28%, rgba(94, 116, 145, 0.36) 29% 34%, rgba(15, 26, 41, 0.12) 35% 52%, transparent 53%);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.72),
    0 0 24px rgba(0, 0, 0, 0.22);
}

.impact-crater__ring {
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  border: 2px solid rgba(169, 188, 212, 0.2);
  opacity: 0.42;
  filter: blur(0.4px);
}

.impact-crater__burst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 54%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(173, 194, 219, 0.42), rgba(18, 28, 43, 0));
  transform-origin: center calc(100% - 4px);
  opacity: 0.7;
}

.impact-crater__burst--a {
  transform: translate(-50%, -100%) rotate(18deg);
}

.impact-crater__burst--b {
  transform: translate(-50%, -100%) rotate(74deg);
}

.impact-crater__burst--c {
  transform: translate(-50%, -100%) rotate(136deg);
}

.impact-crater__burst--d {
  transform: translate(-50%, -100%) rotate(214deg);
}

.impact-crater__burst--e {
  transform: translate(-50%, -100%) rotate(282deg);
}

.impact-crater__dust {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 170%;
  height: 170%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(163, 178, 197, 0.24) 0 12%, rgba(19, 29, 44, 0.16) 36%, transparent 66%);
  filter: blur(8px);
  opacity: 0.72;
}

.history-dialog {
  width: min(640px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  color: var(--text);
}

.history-dialog::backdrop {
  background: rgba(3, 6, 12, 0.66);
  backdrop-filter: blur(10px);
}

.dialog-panel {
  position: relative;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(11, 22, 38, 0.96), rgba(7, 14, 26, 0.92));
  box-shadow: var(--shadow-lg);
}

.close-modal {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.4rem;
}

.dialog-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.dialog-grid h3 {
  margin: 0 0 8px;
  font-size: 0.84rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.dialog-grid p {
  margin: 0;
  color: rgba(237, 242, 255, 0.92);
  line-height: 1.7;
}

.dialog-actions {
  margin-top: 22px;
}

@media (max-width: 1024px) {
  .module-grid {
    grid-template-columns: 1fr;
  }

  .prayer-form-card {
    position: static;
  }
}

@media (max-width: 720px) {
  .module-shell {
    padding-bottom: 48px;
  }

  .module-hero {
    padding-top: 10px;
  }

  .prayer-form-card,
  .stage-card,
  .history-card,
  .dialog-panel {
    padding: 22px;
    border-radius: 24px;
  }

  .oracle-stage {
    min-height: 290px;
  }

  .stage-card__header {
    flex-direction: column;
  }

  .history-item {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .history-item__summary {
    white-space: normal;
  }
}
