:root {
  --void: #05070d;
  --night: #0c1220;
  --night-soft: #10192b;
  --ink: #ecedf0;
  --ink-dim: #b8c0cc;
  --gold: #deb56d;
  --gold-soft: #f3d79c;
  --ice: #7dc6d6;
  --line: rgba(188, 202, 222, 0.26);
  --panel: rgba(10, 16, 30, 0.84);
  --panel-strong: rgba(7, 11, 22, 0.92);
  --ok: #70df9f;
  --error: #ff758a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Sora", sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 130% at 50% 0%, #1c2945 0%, var(--night) 35%, var(--void) 80%);
  overflow-x: hidden;
}

.sky {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 22%, rgba(131, 171, 237, 0.25), transparent 42%),
    radial-gradient(circle at 82% 16%, rgba(163, 127, 214, 0.16), transparent 34%),
    radial-gradient(2px 2px at 20% 30%, rgba(230, 240, 255, 0.75), transparent 45%),
    radial-gradient(2px 2px at 60% 15%, rgba(230, 240, 255, 0.7), transparent 45%),
    radial-gradient(2px 2px at 76% 56%, rgba(230, 240, 255, 0.62), transparent 45%),
    radial-gradient(1px 1px at 36% 72%, rgba(230, 240, 255, 0.52), transparent 45%);
  pointer-events: none;
  z-index: -4;
}

.moon {
  position: fixed;
  top: 7vh;
  right: 10vw;
  width: clamp(4.4rem, 10vw, 7.4rem);
  height: clamp(4.4rem, 10vw, 7.4rem);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6f2de 0%, #e8dcbc 35%, #9f8a63 100%);
  box-shadow: 0 0 70px rgba(226, 206, 147, 0.2);
  opacity: 0.9;
  z-index: -3;
}

.fog {
  position: fixed;
  width: 65vw;
  height: 24vh;
  background: radial-gradient(ellipse at center, rgba(113, 142, 181, 0.2) 0%, rgba(113, 142, 181, 0) 70%);
  filter: blur(12px);
  pointer-events: none;
  z-index: -2;
}

.fog-a {
  left: -6vw;
  top: 18vh;
  animation: drift-a 16s ease-in-out infinite alternate;
}

.fog-b {
  right: -8vw;
  bottom: 10vh;
  animation: drift-b 19s ease-in-out infinite alternate;
}

.character-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.character-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(70% 55% at 50% 52%, rgba(10, 16, 30, 0) 0%, rgba(7, 10, 18, 0.32) 78%, rgba(5, 7, 13, 0.54) 100%);
}

.char {
  position: absolute;
  max-width: none;
  user-select: none;
  opacity: 0.9;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.55));
  mix-blend-mode: screen;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.98) 14%, rgba(0, 0, 0, 0.98) 84%, rgba(0, 0, 0, 0.32));
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.98) 14%, rgba(0, 0, 0, 0.98) 84%, rgba(0, 0, 0, 0.32));
  animation: character-float 11s ease-in-out infinite alternate;
}

.char-wizard {
  width: clamp(20rem, 33vw, 36rem);
  left: clamp(-2rem, -1.5vw, 0rem);
  bottom: clamp(1.5rem, 8vh, 7rem);
  opacity: 0.5;
}

.char-party {
  width: clamp(22rem, 35vw, 37rem);
  right: clamp(-3rem, -1.7vw, 0rem);
  bottom: clamp(1.5rem, 8vh, 7rem);
  opacity: 0.47;
  animation-delay: 1.2s;
}

.char-hunter {
  width: clamp(14rem, 20vw, 22rem);
  left: clamp(0.2rem, 2.6vw, 3.2rem);
  top: clamp(8rem, 16vh, 13rem);
  opacity: 0.38;
  animation-delay: 0.8s;
}

.char-orc {
  width: clamp(14rem, 20vw, 22rem);
  right: clamp(0.2rem, 2.6vw, 3.2rem);
  top: clamp(8rem, 16vh, 13rem);
  opacity: 0.38;
  animation-delay: 1.8s;
}

.embers {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.ember {
  position: absolute;
  bottom: -20px;
  border-radius: 50%;
  opacity: 0;
  animation: ember-rise linear infinite;
  background: radial-gradient(circle at 30% 30%, var(--gold-soft), rgba(222, 181, 109, 0.6) 60%, rgba(222, 181, 109, 0) 100%);
}

.portal-shell {
  position: relative;
  z-index: 2;
  width: min(1120px, 94vw);
  margin: clamp(4.8rem, 15vh, 10.5rem) auto clamp(1.6rem, 5vh, 3.2rem);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(1rem, 2.8vw, 2.2rem);
}

.lore-panel,
.form-panel {
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: linear-gradient(170deg, rgba(16, 25, 44, 0.88), var(--panel));
  box-shadow:
    0 16px 45px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.lore-panel {
  padding: clamp(1.1rem, 4vw, 2.6rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: panel-in 0.85s ease-out both;
}

.realm-tag {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

.lore-panel h1 {
  margin: 0.5rem 0 0;
  font-family: "Cinzel", serif;
  font-weight: 900;
  line-height: 1.02;
  font-size: clamp(2rem, 5.5vw, 4rem);
  text-shadow: 0 0 24px rgba(226, 196, 126, 0.2);
}

.lead {
  margin: 1rem 0 0;
  max-width: 42ch;
  color: var(--ink-dim);
  line-height: 1.62;
}

.realmlist-card {
  margin-top: 1.4rem;
  width: fit-content;
  max-width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(222, 181, 109, 0.35);
  border-radius: 0.86rem;
  background: linear-gradient(160deg, rgba(31, 27, 17, 0.8), rgba(19, 22, 34, 0.72));
}

.realmlist-card span {
  display: block;
  margin-bottom: 0.26rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #bda171;
}

.realmlist-card code {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Marcellus", serif;
  color: #f0e0ba;
}

.micro-note {
  margin-top: 1.15rem;
  color: #95a4b8;
  font-size: 0.86rem;
}

.form-panel {
  position: relative;
  padding: clamp(1.1rem, 3.2vw, 2rem);
  background: linear-gradient(170deg, rgba(12, 18, 35, 0.95), var(--panel-strong));
  animation: panel-in 0.95s ease-out 0.07s both;
}

.sigil {
  display: grid;
  place-items: center;
  margin: 0 auto 0.75rem;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(221, 180, 110, 0.26), rgba(221, 180, 110, 0) 70%);
}

.sigil-ring {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  border: 2px solid rgba(222, 181, 109, 0.72);
  box-shadow: 0 0 18px rgba(222, 181, 109, 0.3);
  animation: pulse 2.2s ease-in-out infinite;
}

.form-panel h2 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  text-align: center;
}

.hint {
  margin: 0.45rem 0 1.15rem;
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.92rem;
}

form {
  display: grid;
  gap: 0.75rem;
}

label span {
  display: block;
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  color: #c9d1dd;
  margin-bottom: 0.34rem;
}

input {
  width: 100%;
  border: 1px solid rgba(161, 178, 204, 0.33);
  background: rgba(16, 25, 42, 0.9);
  border-radius: 0.7rem;
  padding: 0.72rem 0.82rem;
  color: #edf1f8;
  font-size: 0.96rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.16s ease;
}

input::placeholder {
  color: #7f8da4;
}

input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(222, 181, 109, 0.18);
  transform: translateY(-1px);
}

button {
  margin-top: 0.35rem;
  border: 1px solid rgba(246, 215, 156, 0.42);
  border-radius: 0.76rem;
  padding: 0.78rem 1rem;
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.96rem;
  color: #f5ead2;
  background: linear-gradient(110deg, #594423, #7a5a2a 50%, #91662b);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(176, 130, 49, 0.24);
}

button:disabled {
  cursor: wait;
  opacity: 0.76;
}

.status {
  min-height: 1.2rem;
  margin: 0.15rem 0 0;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-dim);
}

.status.ok {
  color: var(--ok);
}

.status.error {
  color: var(--error);
}

@keyframes drift-a {
  from {
    transform: translateX(0) translateY(0);
  }
  to {
    transform: translateX(32px) translateY(-10px);
  }
}

@keyframes drift-b {
  from {
    transform: translateX(0) translateY(0);
  }
  to {
    transform: translateX(-34px) translateY(12px);
  }
}

@keyframes ember-rise {
  0% {
    transform: translateY(0) scale(0.7);
    opacity: 0;
  }
  15% {
    opacity: 0.85;
  }
  100% {
    transform: translateY(-110vh) scale(1.15);
    opacity: 0;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes panel-in {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes character-float {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-9px);
  }
}

@media (max-width: 950px) {
  .portal-shell {
    grid-template-columns: 1fr;
    margin: clamp(3.4rem, 11vh, 6.8rem) auto clamp(1.2rem, 3.6vh, 2.3rem);
  }

  .lore-panel h1 {
    max-width: 13ch;
  }

  .char-hunter,
  .char-orc {
    opacity: 0.26;
    width: clamp(11rem, 26vw, 16rem);
  }

  .char-wizard,
  .char-party {
    width: clamp(17rem, 48vw, 26rem);
    opacity: 0.3;
    bottom: clamp(0.7rem, 6vh, 4rem);
  }
}

@media (max-width: 760px) {
  .char-hunter,
  .char-orc {
    display: none;
  }

  .char-wizard,
  .char-party {
    width: clamp(16rem, 62vw, 22rem);
    opacity: 0.22;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fog,
  .char,
  .sigil-ring,
  .ember,
  .lore-panel,
  .form-panel {
    animation: none;
  }
}
