/* =====================================================
   ASHUNT PORTAL PRODUCTION LAYER
   Desktop visual/animation system is intentionally preserved.
===================================================== */

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

html.no-js .intro-cover {
  display: none !important;
}

html.no-js .portal-hotspots {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.portal-action[type="button"] {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: center;
}

.portal-action:focus-visible {
  outline: 2px solid rgba(var(--glow), .95);
  outline-offset: 8px;
  filter: brightness(1.14);
}

.world-loading h2 {
  margin-top: 34px;
  font-family: 'Cinzel Decorative', Georgia, serif;
  font-size: 32px;
  letter-spacing: 3px;
  color: #f8df9b;
  text-shadow:
    0 0 12px rgba(255, 190, 70, .65),
    0 3px 0 rgba(0,0,0,.9);
}

/* =====================================================
   MOBILE / TOUCH PERFORMANCE MODE
   Heavy desktop canvas effects stay untouched on desktop.
===================================================== */

@media (max-width: 900px), (pointer: coarse) and (max-width: 1100px) {
  html,
  body {
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .main-index {
    width: 100%;
    height: 100svh;
    min-height: 560px;
    overflow: hidden;
    background: #050505;
  }

  .bg-blur {
    width: 100%;
    height: 100%;
    inset: 0;
    object-fit: cover;
    object-position: center 48%;
    transform: scale(1.06);
    filter: blur(12px);
    opacity: .52;
  }

  .bg-image {
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 48%;
    transform: none;
  }

  .dark-overlay {
    z-index: 30;
    background:
      linear-gradient(
        180deg,
        rgba(0,0,0,.16) 0%,
        rgba(0,0,0,.12) 34%,
        rgba(0,0,0,.54) 68%,
        rgba(0,0,0,.88) 100%
      ),
      radial-gradient(
        circle at center,
        rgba(0,0,0,.02),
        rgba(0,0,0,.28)
      );
  }

  /* Desktop-only expensive layers are replaced by the static scene. */
  .portal-layer,
  .cap-layer,
  .fire,
  #rainCanvas,
  #capLightningCanvas,
  .ground-fog,
  #stormFlash,
  .magic-cursor,
  .cursor-trail-layer {
    display: none !important;
  }

  .main-flag {
    inset: 0;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transform: none;
    z-index: 42;
  }

  .flag-cloth {
    display: none !important;
  }

  .flag-logo {
    left: 50%;
    top: max(4.5svh, 24px);
    width: min(58vw, 270px);
    max-height: 22svh;
    transform: translateX(-50%);
    object-fit: contain;
    opacity: .98;
    filter:
      drop-shadow(0 0 16px rgba(255, 175, 50, .30))
      drop-shadow(0 3px 16px rgba(0, 0, 0, .72));
  }

  /* Lightweight rain impression for mobile without a 380-drop canvas. */
  .main-index::after {
    content: "";
    position: absolute;
    inset: -12% -18%;
    z-index: 36;
    pointer-events: none;
    opacity: .10;
    background-image:
      repeating-linear-gradient(
        116deg,
        transparent 0 25px,
        rgba(205, 224, 255, .42) 26px,
        transparent 27px 58px
      );
    background-size: 150px 150px;
    animation: ashuntMobileRain 2.4s linear infinite;
    transform: translate3d(0, 0, 0);
  }

  @keyframes ashuntMobileRain {
    from {
      background-position: 0 -150px;
    }
    to {
      background-position: -44px 150px;
    }
  }

  .portal-hotspots {
    position: absolute;
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(64px + env(safe-area-inset-bottom));
    z-index: 100;

    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;

    padding: 0 22px;
    pointer-events: none;
  }

  .portal-hotspots.show,
  html.no-js .portal-hotspots {
    pointer-events: auto !important;
  }

  .portal-action,
  .portal-80,
  .portal-100,
  .portal-110 {
    position: relative;
    left: auto;
    top: auto;

    width: min(100%, 330px);
    height: 62px;
    margin: 0 auto;

    transform: none;
    touch-action: manipulation;
  }

  .portal-action:hover,
  .portal-action:active {
    transform: scale(1.025);
  }

  .portal-action::before {
    left: 24px;
  }

  .portal-action::after {
    right: 24px;
  }

  .portal-action strong {
    font-size: 17px;
  }

  .portal-action small {
    margin-top: 7px;
    font-size: 13px;
  }

  .portal-social {
    min-height: 50px;
    padding:
      9px 14px
      calc(9px + env(safe-area-inset-bottom));
  }

  .portal-social .copyright {
    font-size: 10.5px;
    line-height: 1.35;
    letter-spacing: .25px;
  }

  .portal-social .brand {
    font-size: 12px;
    letter-spacing: .9px;
  }

  .portal-social .brand::before,
  .portal-social .brand::after {
    display: none;
  }

  .loading-logo {
    width: min(56vw, 250px);
    height: min(56vw, 250px);
  }

  .world-loading h2 {
    margin-top: 18px;
    padding: 0 20px;
    font-size: clamp(21px, 7vw, 30px);
    letter-spacing: 2px;
    text-align: center;
  }

  .world-loading p {
    padding: 0 20px;
    font-size: clamp(16px, 5vw, 21px);
    line-height: 1.35;
    text-align: center;
  }
}

/* Short landscape phones: keep all three worlds visible in one row. */
@media (max-width: 900px) and (max-height: 560px) and (orientation: landscape) {
  .main-index {
    min-height: 0;
  }

  .flag-logo {
    top: 12px;
    width: min(24vw, 180px);
    max-height: 30vh;
  }

  .portal-hotspots {
    bottom: calc(48px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 0 16px;
  }

  .portal-action,
  .portal-80,
  .portal-100,
  .portal-110 {
    width: 100%;
    max-width: 230px;
    height: 54px;
  }

  .portal-action strong {
    font-size: 14px;
  }

  .portal-action small {
    margin-top: 5px;
    font-size: 10px;
  }

  .portal-action::before,
  .portal-action::after {
    display: none;
  }

  .portal-social {
    min-height: 40px;
    padding-top: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }
}

/* Explicit OS-level reduced motion request. */
@media (prefers-reduced-motion: reduce) {
  .main-index::after,
  .portal-frame,
  .portal-energy,
  .portal-social .brand::before {
    animation: none !important;
  }

  .intro-cover,
  .portal-hotspots,
  .world-loading,
  #screenFade,
  .portal-action,
  .portal-layer img,
  .cap-layer img {
    transition-duration: .01ms !important;
  }
}

/* Undo the old source-protection selection lock; it is not a security control. */
html,
body,
body * {
  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
}

.portal-action,
.main-flag,
.portal-layer,
.cap-layer,
.fire,
.magic-cursor,
.cursor-trail-layer,
.portal-social {
  -webkit-user-select: none;
  user-select: none;
}
