/* =========================================================
   Digi Idle — Intro Yggdrasill (Host Computer → 3 iniciais)
   ========================================================= */

body.intro-ygg-active .stage.onboarding .viewport,
body.intro-ygg-active .stage.onboarding .game-canvas,
body.intro-ygg-active .stage.onboarding .viewport-vignette,
body.intro-ygg-active .stage.onboarding .onboarding-skip,
body.intro-ygg-active .stage.onboarding .onboarding-choice {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.intro-ygg {
  --iy-cyan: #4fd6ff;
  --iy-cyan-2: #1aa7d6;
  --iy-mint: #7dffd2;
  --iy-orange: #ff9a2e;
  --iy-text: #eaf2ff;
  --iy-muted: #8b9bb3;
  --iy-bg: #04070e;
  --iy-font: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --iy-display: "Orbitron", "Rajdhani", system-ui, sans-serif;

  position: fixed;
  inset: 0;
  z-index: 120000;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--iy-text);
  font-family: var(--iy-font);
  background: var(--iy-bg);
  isolation: isolate;
}

.intro-ygg-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(55% 45% at 50% 38%, rgba(79, 214, 255, 0.18), transparent 62%),
    radial-gradient(40% 35% at 70% 70%, rgba(255, 154, 46, 0.1), transparent 65%),
    radial-gradient(35% 30% at 22% 75%, rgba(125, 255, 210, 0.08), transparent 60%),
    linear-gradient(180deg, #0a1220 0%, #04070e 55%, #02040a 100%);
  opacity: 0;
  transition: opacity 0.7s ease;
}

.intro-ygg[data-phase="void"] .intro-ygg-bg,
.intro-ygg[data-phase="arrive"] .intro-ygg-bg,
.intro-ygg[data-phase="speak"] .intro-ygg-bg,
.intro-ygg[data-phase="offer"] .intro-ygg-bg {
  opacity: 1;
}

.intro-ygg-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background-image:
    linear-gradient(rgba(79, 214, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 214, 255, 0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 42%, #000 18%, transparent 78%);
  transition: opacity 0.9s ease;
}

.intro-ygg[data-phase="arrive"] .intro-ygg-grid,
.intro-ygg[data-phase="speak"] .intro-ygg-grid,
.intro-ygg[data-phase="offer"] .intro-ygg-grid {
  opacity: 0.55;
}

.intro-ygg-core {
  position: absolute;
  top: 10%;
  left: 50%;
  z-index: 1;
  width: min(220px, 58vw);
  height: min(300px, 72vw);
  transform: translate(-50%, 28px) scale(0.78);
  opacity: 0;
  transition:
    opacity 0.85s ease,
    transform 0.95s cubic-bezier(0.2, 0.85, 0.25, 1);
  pointer-events: none;
}

.intro-ygg[data-phase="arrive"] .intro-ygg-core,
.intro-ygg[data-phase="speak"] .intro-ygg-core {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  animation: iy-float 4.2s ease-in-out infinite;
}

.intro-ygg[data-phase="offer"] .intro-ygg-core {
  opacity: 0.42;
  transform: translate(-50%, -14%) scale(0.58);
  animation: none;
}

.intro-ygg-aura {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 78%;
  height: 42%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(120, 220, 255, 0.45), transparent 70%);
  filter: blur(10px);
  opacity: 0.85;
  animation: iy-pulse 2.8s ease-in-out infinite;
}

.intro-ygg-ring {
  position: absolute;
  left: 50%;
  top: 58%;
  width: 92%;
  height: 34%;
  border-radius: 50%;
  border: 1px solid rgba(160, 230, 255, 0.28);
  transform: translate(-50%, -50%) rotateX(68deg);
  box-shadow: 0 0 18px rgba(79, 214, 255, 0.12);
  pointer-events: none;
}

.intro-ygg-ring--a {
  animation: iy-orbit 16s linear infinite;
}

.intro-ygg-ring--b {
  width: 68%;
  height: 24%;
  top: 42%;
  border-color: rgba(255, 255, 255, 0.22);
  animation: iy-orbit 11s linear infinite reverse;
}

.intro-ygg-figure {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  filter:
    drop-shadow(0 0 12px rgba(160, 230, 255, 0.45))
    drop-shadow(0 14px 30px rgba(0, 120, 200, 0.35));
}

.intro-ygg-illust,
.intro-ygg-figure .ygg-illust {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.intro-ygg-orb,
.intro-ygg-figure .ygg-illust-orb {
  transform-origin: 100px 48px;
  animation: iy-orb-bob 3.4s ease-in-out infinite;
}

.intro-ygg-body,
.intro-ygg-figure .ygg-illust-body {
  transform-origin: 100px 180px;
  animation: iy-body-breathe 4.2s ease-in-out infinite;
}

.intro-ygg-skip {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 5;
  border: 1px solid rgba(79, 214, 255, 0.28);
  background: rgba(8, 16, 28, 0.72);
  color: var(--iy-muted);
  font: 700 12px var(--iy-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.intro-ygg-skip:hover {
  color: var(--iy-text);
  border-color: rgba(79, 214, 255, 0.55);
}

.intro-ygg-dialog {
  position: relative;
  z-index: 4;
  width: min(560px, calc(100vw - 28px));
  margin-top: min(38vh, 320px);
  padding: 16px 18px 14px;
  border-radius: 14px;
  border: 1px solid rgba(79, 214, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(14, 24, 40, 0.94), rgba(6, 12, 22, 0.96));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  animation: iy-fade-up 0.45s ease both;
}

.intro-ygg-dialog-name {
  font: 700 11px var(--iy-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--iy-orange);
  margin-bottom: 8px;
}

.intro-ygg-dialog-text {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--iy-text);
  min-height: 3.1em;
}

.intro-ygg-next {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  background: linear-gradient(180deg, #ffb04a, #ff7a1a);
  color: #1a0e04;
  font: 700 13px var(--iy-display);
  letter-spacing: 0.04em;
  cursor: pointer;
}

.intro-ygg-next:hover {
  filter: brightness(1.06);
}

.intro-ygg-offer {
  position: relative;
  z-index: 4;
  width: min(920px, calc(100vw - 24px));
  max-height: min(92vh, 860px);
  overflow: auto;
  padding: 8px 4px 18px;
  animation: iy-fade-up 0.5s ease both;
  scrollbar-width: thin;
}

.intro-ygg-offer-head {
  text-align: center;
  margin: 0 auto 18px;
  max-width: 520px;
}

.intro-ygg-kicker {
  margin: 0 0 6px;
  font: 700 11px var(--iy-display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--iy-cyan);
}

.intro-ygg-title {
  margin: 0 0 8px;
  font: 700 clamp(22px, 4vw, 30px) var(--iy-display);
  letter-spacing: 0.04em;
  color: var(--iy-text);
}

.intro-ygg-sub {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--iy-muted);
}

.intro-ygg-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.intro-ygg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(79, 214, 255, 0.22);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(79, 214, 255, 0.12), transparent 55%),
    linear-gradient(180deg, #101a2c 0%, #0a1220 100%);
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.intro-ygg-card:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: rgba(79, 214, 255, 0.55);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.intro-ygg-card:disabled {
  opacity: 0.55;
  cursor: wait;
}

.intro-ygg-card--fire {
  --iy-accent: #ff7a3a;
}
.intro-ygg-card--grass {
  --iy-accent: #5adf7a;
}
.intro-ygg-card--water {
  --iy-accent: #4fd6ff;
}

.intro-ygg-pillar {
  position: absolute;
  left: 50%;
  bottom: -20%;
  width: 48%;
  height: 70%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--iy-accent) 55%, transparent), transparent);
  filter: blur(18px);
  opacity: 0.55;
  pointer-events: none;
}

.intro-ygg-art {
  position: relative;
  z-index: 1;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  image-rendering: pixelated;
}

.intro-ygg-art img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

.intro-ygg-card-name {
  position: relative;
  z-index: 1;
  font: 700 16px var(--iy-display);
  letter-spacing: 0.04em;
}

.intro-ygg-card-el {
  position: relative;
  z-index: 1;
  font: 700 11px var(--iy-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--iy-accent, var(--iy-cyan));
}

.intro-ygg-card-blurb {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--iy-muted);
  text-align: center;
}

.intro-ygg-error {
  margin: 14px auto 0;
  max-width: 480px;
  text-align: center;
  color: #ff8b7a;
  font-weight: 700;
}

@keyframes iy-orbit {
  to {
    transform: translate(-50%, -50%) rotateX(68deg) rotate(360deg);
  }
}

@keyframes iy-float {
  0%,
  100% {
    transform: translate(-50%, 0) scale(1);
  }
  50% {
    transform: translate(-50%, -10px) scale(1.02);
  }
}

@keyframes iy-orb-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes iy-body-breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.015);
    opacity: 0.96;
  }
}

@keyframes iy-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@keyframes iy-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .intro-ygg-core {
    top: 6%;
    width: min(150px, 46vw);
    height: min(210px, 58vw);
  }

  .intro-ygg[data-phase="offer"] .intro-ygg-core {
    opacity: 0.28;
    transform: translate(-50%, -22%) scale(0.48);
  }

  .intro-ygg-dialog {
    margin-top: min(34vh, 260px);
  }

  .intro-ygg-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .intro-ygg-card {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 12px;
    padding: 12px 14px;
  }

  .intro-ygg-art {
    width: 72px;
    height: 72px;
    flex: 0 0 auto;
  }

  .intro-ygg-card-name,
  .intro-ygg-card-el,
  .intro-ygg-card-blurb {
    align-self: flex-start;
    text-align: left;
  }

  .intro-ygg-card-blurb {
    display: none;
  }
}
