/* ==================================================================
   Portal para as Terras de Laluno (src/ui/world-portal.js) e o botão
   do portal no palco.
   ================================================================== */

/* ---------- botão no palco (coluna da esquerda, embaixo) ---------- */
.world-gate {
  position: absolute; z-index: 3; left: 0; bottom: 6px; width: var(--rail-w);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 0; border: 0; background: none; color: var(--text-primary); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.world-gate__orb {
  position: relative; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.6rem;
  background: radial-gradient(circle at 35% 28%, #f2fcff, #8fd3ff 42%, #4b4fd8 78%, #2a1f6b);
  box-shadow: 0 0 18px rgba(124, 201, 255, .65), inset 0 -6px 12px rgba(40, 20, 110, .45);
  transition: transform var(--t-fast, .12s) var(--ease-liquid, ease);
}
.world-gate__orb::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  background: conic-gradient(#7cf0ff, #b06bff, #ff7ad9, #ffd34d, #7cf0ff);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: world-gate-spin 3.2s linear infinite;
}
.world-gate__emoji { position: relative; animation: world-gate-bob 2.6s ease-in-out infinite; }
.world-gate:active .world-gate__orb { transform: scale(.92); }
.world-gate:focus-visible { outline: none; }
.world-gate:focus-visible .world-gate__orb { outline: 2px solid #7cf0ff; outline-offset: 6px; }
.world-gate__title {
  font-family: var(--font-display); font-size: .66rem; font-weight: 700; line-height: 1.05; text-align: center;
  text-shadow: 0 0 6px var(--bg-deep), 0 0 2px var(--bg-deep);
}
@keyframes world-gate-spin { to { transform: rotate(360deg); } }
@keyframes world-gate-bob { 50% { transform: translateY(-3px) rotate(-6deg); } }
@media (max-height: 600px) {
  .world-gate__title { display: none; }
  .world-gate__orb { width: 46px; height: 46px; font-size: 1.3rem; }
}

/* ---------- o portal (sobre tudo) ---------- */
.world-portal { position: fixed; inset: 0; z-index: 3000; pointer-events: auto; }
.world-portal__view {
  position: absolute; inset: 0;
  background: #9fdcff center / cover no-repeat;
  clip-path: circle(var(--r) at var(--x) var(--y));
}
/* Redemoinho de magia dentro do portal (some quando o mundo cobre a tela). */
.world-portal__swirl {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at var(--x) var(--y), rgba(255, 255, 255, .0) 0, rgba(176, 107, 255, .0) calc(var(--r) * .55), rgba(176, 107, 255, .55) calc(var(--r) * .92), rgba(255, 255, 255, .85) var(--r));
  transition: opacity .45s ease;
}
.world-portal__ring {
  position: absolute; left: var(--x); top: var(--y);
  width: calc(var(--r) * 2 + 18px); height: calc(var(--r) * 2 + 18px);
  border-radius: 50%; transform: translate(-50%, -50%);
  background: conic-gradient(#7cf0ff, #b06bff, #ff7ad9, #ffd34d, #7cf0ff);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 9px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 10px), #000 calc(100% - 9px));
  filter: drop-shadow(0 0 14px rgba(176, 107, 255, .9));
  animation: world-portal-spin .8s linear infinite;
  transition: opacity .3s ease;
}
.world-portal.is-gulp .world-portal__ring { animation: world-portal-spin .45s linear infinite, world-portal-gulp .35s ease; }
.world-portal.is-full .world-portal__ring,
.world-portal.is-full .world-portal__swirl { opacity: 0; }
.world-portal__pet { position: fixed; pointer-events: none; transform-origin: 50% 55%; z-index: 1; }
.world-portal__pet svg { width: 100%; height: 100%; }
.world-portal__flash {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #ffffff, rgba(255, 255, 255, .6) 40%, rgba(255, 255, 255, 0) 75%);
}
.world-portal.is-done { animation: world-portal-out .5s ease forwards; }
.world-portal.is-done .world-portal__flash { animation: world-portal-flash .5s ease forwards; }
.world-portal.is-fade .world-portal__ring { display: none; }
@keyframes world-portal-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes world-portal-gulp { 50% { filter: drop-shadow(0 0 34px #fff) brightness(1.7); } }
@keyframes world-portal-flash { 0% { opacity: 0; } 30% { opacity: .9; } 100% { opacity: 0; } }
@keyframes world-portal-out { 60% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .world-gate__orb::before, .world-gate__emoji, .world-portal__ring { animation: none; }
  .world-portal.is-done { animation-duration: .15s; }
}
