:root {
  color-scheme: light;
  --ink: #2b2118;
  --muted: #725f48;
  --paper: #ead8ad;
  --paper-deep: #d5b778;
  --line: rgba(66, 43, 22, 0.38);
  --seal: #7f1d1d;
  --seal-dark: #4a1212;
  --green: #204f3a;
  --cream: #fbf3dc;
  --shadow: rgba(31, 21, 11, 0.28);
  --map-bg: url("https://pub-e7ab4b87b1c04f3db834d161959746b3.r2.dev/sites/mapadomaroto/mapa.webp");
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 44%, rgba(247, 213, 132, 0.18), transparent 28rem),
    linear-gradient(rgba(28, 17, 11, 0.28), rgba(9, 18, 14, 0.58)),
    var(--map-bg) center / cover fixed,
    radial-gradient(circle at 18% 14%, rgba(127, 29, 29, 0.18), transparent 24rem),
    linear-gradient(135deg, #241914 0%, #3b2b20 42%, #17261f 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: -24px;
  z-index: -2;
  background: var(--map-bg) center / cover fixed;
  filter: blur(1.5px) saturate(0.92) contrast(1.25);
  transform: scale(1.025);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% 38%, rgba(250, 225, 157, 0.16), transparent 24rem),
    radial-gradient(circle at 18% 88%, rgba(20, 62, 46, 0.24), transparent 24rem),
    linear-gradient(rgba(28, 17, 12, 0.3), rgba(7, 15, 12, 0.58));
  pointer-events: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.portal-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: clamp(18px, 4vw, 44px);
  overflow: hidden;
}

.portal-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 980px);
  perspective: 1200px;
}

.map-panel,
.auth-panel,
.conversation-view {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 252, 230, 0.5), transparent 23rem),
    linear-gradient(rgba(255, 246, 219, 0.78), rgba(232, 207, 146, 0.78)),
    repeating-linear-gradient(92deg, rgba(68, 41, 15, 0.08) 0 1px, transparent 1px 14px),
    var(--paper);
  backdrop-filter: blur(2px);
  box-shadow:
    0 34px 90px rgba(7, 4, 2, 0.46),
    0 0 0 8px rgba(228, 197, 126, 0.12),
    inset 0 0 46px rgba(100, 62, 25, 0.16);
}

.map-panel {
  min-height: clamp(560px, 78vh, 720px);
  display: grid;
  align-content: center;
  justify-items: center;
  padding: clamp(34px, 8vw, 92px);
  text-align: center;
  transform: rotateX(1.3deg) rotateZ(-0.4deg);
}

.marauder-scroll {
  border: 0;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 247, 213, 0.72), transparent 20rem),
    radial-gradient(circle at 72% 72%, rgba(159, 118, 49, 0.22), transparent 18rem),
    linear-gradient(90deg, rgba(105, 68, 25, 0.24), transparent 8%, transparent 92%, rgba(105, 68, 25, 0.24)),
    linear-gradient(rgba(245, 223, 164, 0.86), rgba(210, 171, 88, 0.74)),
    var(--map-bg) center / cover;
  backdrop-filter: blur(1px);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(82, 48, 18, 0.38),
    inset 0 0 0 12px rgba(88, 54, 22, 0.14),
    inset 0 0 70px rgba(65, 39, 14, 0.34);
  clip-path: polygon(
    1.4% 4%,
    7% 2.1%,
    14% 3.4%,
    23% 1.6%,
    36% 2.8%,
    48% 1.2%,
    61% 2.9%,
    73% 1.7%,
    84% 3%,
    97.8% 2.2%,
    98.8% 13%,
    97.2% 24%,
    99% 37%,
    97.8% 48%,
    98.9% 61%,
    97.1% 74%,
    98.3% 88%,
    96.7% 97.4%,
    84% 96.1%,
    73% 98.2%,
    60% 96.8%,
    48% 98.6%,
    35% 97%,
    22% 98%,
    11% 96.6%,
    2.3% 97.8%,
    1.2% 86%,
    2.8% 73%,
    1.3% 61%,
    2.7% 48%,
    1.1% 34%,
    2.6% 22%
  );
}

.map-panel::before,
.map-panel::after,
.conversation-view::before,
.auth-panel::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid var(--line);
  pointer-events: none;
}

.marauder-scroll::before {
  inset: 22px;
  border: 1px solid rgba(59, 36, 15, 0.52);
  box-shadow:
    inset 0 0 0 8px rgba(255, 238, 183, 0.08),
    0 0 22px rgba(58, 35, 14, 0.16);
}

.map-panel::after {
  inset: 28px;
  border-style: dashed;
  opacity: 0.58;
}

.marauder-scroll::after {
  inset: 38px;
  border-color: rgba(69, 43, 19, 0.36);
  opacity: 0.78;
}

.ambient-map {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-map::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    linear-gradient(100deg, transparent 0 34%, rgba(255, 236, 178, 0.1) 42%, transparent 52% 100%),
    repeating-linear-gradient(90deg, rgba(255, 232, 171, 0.05) 0 1px, transparent 1px 17vw);
  mix-blend-mode: screen;
  opacity: 0.58;
  animation: lantern-sweep 13s ease-in-out infinite alternate;
}

.mist {
  position: absolute;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(238, 213, 154, 0.14), transparent 62%);
  filter: blur(24px);
  opacity: 0.75;
  animation: drift 18s ease-in-out infinite alternate;
}

.mist-a {
  left: -13vw;
  top: 8vh;
}

.mist-b {
  right: -16vw;
  bottom: -11vw;
  animation-duration: 22s;
  animation-direction: alternate-reverse;
}

.roaming-steps {
  position: absolute;
  inset: 0;
}

.roaming-track {
  position: absolute;
  width: calc(34px * var(--size, 1));
  height: calc(58px * var(--size, 1));
  left: var(--start-x);
  top: var(--start-y);
  opacity: 0;
  transform: rotate(var(--angle));
  animation: roam var(--duration) linear var(--delay) infinite;
}

.roaming-track .step {
  left: 0;
  top: 0;
  width: calc(13px * var(--size, 1));
  height: calc(24px * var(--size, 1));
  background: rgba(32, 20, 11, var(--step-opacity, 0.36));
  filter: blur(0.15px);
}

.roaming-track .step::after {
  width: calc(13px * var(--size, 1));
  height: calc(24px * var(--size, 1));
  left: calc(18px * var(--size, 1));
  top: calc(18px * var(--size, 1));
  background: rgba(32, 20, 11, var(--step-opacity, 0.36));
}

.map-lines {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.38;
}

.route {
  position: absolute;
  border: 1px dashed rgba(60, 36, 16, 0.5);
  border-color: rgba(60, 36, 16, 0.5) transparent transparent rgba(60, 36, 16, 0.5);
}

.route-a {
  width: 44%;
  height: 30%;
  left: 7%;
  top: 11%;
  border-radius: 52% 48% 42% 58%;
  transform: rotate(-19deg);
}

.route-b {
  width: 38%;
  height: 34%;
  right: 6%;
  bottom: 8%;
  border-radius: 44% 56% 50% 50%;
  transform: rotate(23deg);
}

.route-c {
  width: 36%;
  height: 54%;
  left: 31%;
  top: 24%;
  border-radius: 48%;
  transform: rotate(7deg);
}

.room {
  position: absolute;
  color: rgba(57, 35, 16, 0.5);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.room-a {
  left: 13%;
  top: 24%;
  transform: rotate(-18deg);
}

.room-b {
  right: 16%;
  top: 22%;
  transform: rotate(16deg);
}

.room-c {
  left: 18%;
  bottom: 19%;
  transform: rotate(9deg);
}

.portal-content {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  padding: clamp(20px, 5vw, 54px);
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 244, 208, 0.5), transparent 14rem),
    radial-gradient(circle at 50% 50%, rgba(218, 177, 91, 0.2), transparent 20rem);
  border-radius: 999px;
}

.kicker {
  margin: 0 0 12px;
  color: var(--seal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.7rem, 7vw, 5.6rem);
  line-height: 0.95;
  font-weight: 700;
  text-shadow:
    0 1px 0 rgba(255, 246, 219, 0.5),
    0 12px 28px rgba(75, 43, 17, 0.16);
}

.oath {
  width: min(100%, 420px);
  margin: 24px 0 36px;
  color: var(--muted);
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  line-height: 1.4;
}

.portal-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: min(100%, 520px);
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(52, 35, 18, 0.48);
  border-radius: 2px;
  background: rgba(255, 246, 219, 0.58);
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 0 18px rgba(78, 48, 18, 0.08);
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 48px;
  max-height: 160px;
  resize: vertical;
  padding: 13px 14px;
  line-height: 1.35;
}

input:focus,
textarea:focus {
  border-color: var(--seal);
  box-shadow: 0 0 0 3px rgba(127, 29, 29, 0.16);
}

button {
  min-height: 48px;
  border-radius: 2px;
  padding: 0 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08), transparent),
    var(--seal);
  color: var(--cream);
  font-weight: 700;
  box-shadow:
    0 8px 22px rgba(63, 15, 15, 0.22),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

button:hover {
  background: var(--seal-dark);
}

.button-link,
.quiet-link {
  display: inline-grid;
  min-height: 48px;
  align-items: center;
  border-radius: 4px;
  padding: 0 18px;
  text-decoration: none;
  font-weight: 700;
}

.button-link {
  background: var(--seal);
  color: var(--cream);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.button-link:hover {
  background: var(--seal-dark);
}

.quiet-link {
  color: var(--seal);
}

.result-panel {
  min-height: clamp(500px, 72vh, 640px);
}

.result-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.map-trails {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
}

.map-panel > .kicker,
.map-panel > h1,
.map-panel > .oath,
.portal-form {
  position: relative;
  z-index: 1;
}

.step {
  position: absolute;
  width: 13px;
  height: 24px;
  border-radius: 50% 50% 45% 45%;
  background: rgba(61, 39, 20, 0.42);
  transform: rotate(var(--r));
}

.step::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 24px;
  left: 18px;
  top: 18px;
  border-radius: 50% 50% 45% 45%;
  background: rgba(61, 39, 20, 0.42);
}

.step-a { --r: -24deg; left: 10%; top: 18%; }
.step-b { --r: 31deg; right: 16%; top: 14%; }
.step-c { --r: 9deg; left: 20%; bottom: 18%; }
.step-d { --r: -42deg; right: 26%; bottom: 19%; }
.step-e { --r: 61deg; left: 42%; top: 9%; }
.step-f { --r: -8deg; right: 9%; bottom: 34%; }

.form-status {
  min-height: 1.3em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

@media (max-width: 620px) {
  .portal-page {
    align-items: center;
    padding: 16px;
  }

  .portal-shell {
    width: min(100%, 390px);
  }

  .map-panel {
    min-height: min(720px, calc(100vh - 56px));
    padding: 28px 18px;
    background:
      radial-gradient(circle at 50% 35%, rgba(255, 245, 211, 0.58), transparent 14rem),
      linear-gradient(rgba(245, 223, 164, 0.72), rgba(197, 152, 68, 0.62)),
      var(--map-bg) center / cover;
    backdrop-filter: blur(1px);
  }

  .portal-form {
    grid-template-columns: 1fr;
  }

  body::before {
    filter: blur(1px) saturate(0.9) contrast(1.18);
  }

  .map-panel {
    transform: none;
  }

  .portal-content {
    padding: 18px 6px;
    border-radius: 50%;
  }

  .map-lines {
    opacity: 0.44;
  }
}

@keyframes lantern-sweep {
  from {
    transform: translateX(-10%) rotate(-2deg);
  }

  to {
    transform: translateX(10%) rotate(2deg);
  }
}

@keyframes drift {
  from {
    transform: translate3d(-2vw, -1vh, 0) scale(0.95);
  }

  to {
    transform: translate3d(5vw, 4vh, 0) scale(1.08);
  }
}

@keyframes roam {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(var(--angle)) scale(0.85);
  }

  8%,
  64% {
    opacity: 0.72;
  }

  76%,
  100% {
    opacity: 0;
    transform: translate3d(var(--travel-x), var(--travel-y), 0) rotate(var(--angle)) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-map::before,
  .mist,
  .roaming-track {
    animation: none;
  }

  .roaming-track {
    opacity: 0.28;
  }
}
