:root {
  --glow-size: 20vmin;
 
  --intro-delay: 2500ms;
  --intro-zoom-scale: 12;
  --intro-zoom-duration: 750ms;
  --intro-fade-duration: 1000ms;
}

/* Gate shell — Sign Up / Log In tabs (single fixed panel) */
#gate-shell.visible-on-gate {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% - 6rem));
  z-index: 120;
  background: rgba(0, 0, 0, 0.7);
  padding: 3vmin 4vmin 4.5vmin;
  border-radius: 2vmin;
  box-shadow: 0 0 2vmin rgba(255, 255, 255, 0.25);
  color: #fff;
  width: min(92vw, var(--panel-width, 28rem));
  max-width: 100%;
  box-sizing: border-box;
  animation: fadeIn 0.6s ease-out forwards;
  font-family: var(--body-font);
}

.gate-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

.gate-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  font-family: var(--title-font);
  font-size: calc(var(--control-font-size, 1rem) * 1.05);
  font-weight: 600;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.gate-tab:hover {
  color: rgba(255, 255, 255, 0.9);
}

.gate-tab.gate-tab--active {
  color: #fff;
  border-bottom-color: var(--color-accent, #ffb347);
}

#gate-shell.visible-on-gate #new-user-form {
  text-align: center;
}
#gate-shell.visible-on-gate #new-user-form > p {
  text-align: left;
  width: 100%;
}

/* Login pane: left-align fields; keep round submit centered on its row */
#gate-shell.visible-on-gate #login-form {
  text-align: left;
}
#gate-shell.visible-on-gate #login-form .field input {
  text-align: left;
}
#gate-shell.visible-on-gate #login-form .keep-line {
  justify-content: flex-start;
  align-self: stretch;
  width: 100%;
  text-align: left;
}
#gate-shell.visible-on-gate #login-form .intro-login-links {
  align-self: stretch;
  width: 100%;
  text-align: left;
}

#gate-shell.visible-on-gate #new-user-form h2,
#gate-shell.visible-on-gate #login-form h2 {
  font-family: var(--title-font);
}

.intro-guest-row--signup {
  /* ~two blank lines below the round submit before “Continue as guest” */
  margin-top: calc(2 * 1.5em);
  text-align: center;
}
.intro-guest-row--signup a {
  color: #fff;
  text-decoration: underline;
  cursor: pointer;
}

/* Fine-tune the round submit alignment */
#new-user-form .intro-submit-line,
#login-form .intro-submit-line {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-top: 2rem;
  /* Size anchor for glow: use the row’s smaller axis so the halo stays square (not wide-oval). */
  container-type: size;
  container-name: intro-submit;
}

#new-user-form .intro-submit,
#login-form .intro-submit {
  position: relative;
  z-index: 10;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  font-size: 1.2rem;
  border: none;
  outline: none;
  cursor: pointer;
  background: var(--color-accent);
  color: #000000ff;
/*
  background: radial-gradient(circle at center,
    #fff 0%,
    #ffb6ff 40%,
    #b72fff 70%,
    #6200ff 100%);
  color: white;
  box-shadow:
    0 0 1vmin 0.5vmin rgba(255, 255, 255, 0.5),
    0 0 2vmin 1vmin rgba(180, 0, 255, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
*/
}

#new-user-form .intro-submit:hover,
#login-form .intro-submit:hover {
  transform: scale(1.1);
  box-shadow:
    0 0 2vmin 0.8vmin rgba(255, 255, 255, 0.6),
    0 0 4vmin 1.5vmin rgba(180, 0, 255, 0.6);
}

/* Signup: button stays enabled for submit events; aria-disabled = visual “not ready” */
#new-user-form .intro-submit[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}
#new-user-form .intro-submit[aria-disabled="true"]:hover {
  transform: none;
  box-shadow: none;
}


/* =========================
   Password Eye / Login Flow
   ========================= */

.pw-field {
  position: relative;
  width: 100%;
}
.pw-field input[type="password"],
.pw-field input[type="text"] {
  width: 100%;
  padding-right: 6vmin;
  box-sizing: border-box;
  display: block;
  position: relative; /* Establish positioning context for icon */
}
.pw-field .field-msg {
  margin-top: 0.5vmin;
  width: 100%;
  position: relative; /* Keep message in normal flow, below input */
}
.pw-eye {
  background: transparent;
  position: absolute;
  right: 2vmin;
  top: 3vmin; /* Fixed position: half of --input-height (6vmin / 2 = 3vmin) */
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 1.1em;
  color: rgba(255,255,255,0.8);
  transition: color 0.2s ease;
  z-index: 85;
  pointer-events: auto; /* Ensure clickable */
}
.pw-eye:hover { color: gold; }

/* Keep “Remember me” inline */
.keep-line {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  font-size: var(--control-font-size, 1rem);
}
.keep-line input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0.2em 0 0 0;
  width: 1em;
  height: 1em;
  cursor: pointer;
}
.keep-line label {
  flex: 1 1 auto;
  white-space: normal;
  font-size: 1em;
  line-height: 1.25;
  cursor: pointer;
}

/* Fallback when #login-form is not .visible-on-gate (duplicate of #login-form rules above) */
.intro-submit-line { display: flex; justify-content: center; margin-top: 1vmin; }
.intro-submit {
  width: 8vmin; height: 8vmin; border-radius: 50%;
  background: var(--color-accent, #FFB347);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.intro-submit i { color: var(--color-primary, #4b006e); font-size: 0.95em; }

/* Guest + forgot links under submit */
.intro-login-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4vmin;
  max-width: 45vmin;
  margin: 1vmin auto 0;
}
.intro-login-links a {
  color: #fff;
  text-decoration: underline;
  cursor: pointer;
}


#sparkle-layer {
    z-index: 95;
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
/*    transform: translate(-50%, -50%); /* true centering */
    background: transparent !important /* #fffff00 */;
    diplay: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: none; /* visual only — was blocking clicks to gate forms below in stack */
}


/* Base fade layer setup */
#page-fade {
  z-index: 92;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#page-fade.fade {
  animation: appear-pause-fade var(--intro-fade-duration, 1.5s) ease forwards; /* Total animation duration */
}

@keyframes appear-pause-fade {
  0% {
    opacity: 0; /* Start fully transparent */
  }
  1% {
    opacity: 1; /* Fade in to fully opaque */
  }
  30% {
    opacity: 1; /* Pause (remain opaque) */
  }
  100% {
    opacity: 0; /* Fade out to fully transparent */
  }
}


#page-zoom.fade {
  opacity: 0;
  transition: opacity var(--intro-fade-duration, 1.5s) ease-in-out;
}


/* Base zoom layer setup */
#page-zoom {
  z-index: 90;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #ffffff 0%, #ffffff 100%);
  opacity: 0;
  pointer-events: none;

  /* Start fully invisible and clipped to center */
  clip-path: circle(0% at 50% 50%);
  transition:
    clip-path var(--intro-fade-duration, 1.5s) ease-in-out,
    opacity var(--intro-fade-duration, 1.5s) ease-in-out;
  will-change: clip-path, opacity;
}

/* === Reveal white overlay === */
#page-zoom.reveal {
  opacity: 1;
  clip-path: circle(150% at 50% 50%);
}

/* === Fade back to landscape === */
#page-zoom.done {
  opacity: 0;
  clip-path: circle(150% at 50% 50%);
  transition:
    opacity var(--intro-fade-duration, 1.5s) ease-in-out;
}


#intro-screen {
    z-index: 60;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000ff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* JAPDEBUG */
body {
    background: #0a;
}

#zoom {
    z-index: 65;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 100vh;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: none; /* dahlia stage only — avoid stealing focus from login when form is inside intro */

    /* anchor the group’s center */
    transform-origin: center center;
    transform: translate(-50%, -50%) scale(1);
    transition: transform var(--intro-zoom-duration, 2s) ease-in-out;
}

/* when .zoom class added */
#zoom.zoom {
    transform: translate(-50%, -50%) scale(var(--intro-zoom-scale, 3));
}

/* Cinematic intro only — square in the full viewport (#zoom is ~square-ish in min dimension via vmin) */
#intro-glow {
    z-index:72;
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--glow-size);
    height: var(--glow-size);
    transform:translate(-50%,-50%) scale(1);
    transform-origin:center center;
    animation: pulseGlow 2s ease-in-out infinite;
    pointer-events: none;
    will-change:transform;
}
#intro-glow.anim-stop {
    transform:translate(-50%,-50%) scale(1);
    animation: none !important;
    background: #ffffffff;
    opacity: 1;
    will-change:transform;
}

#glow-fx {
    z-index: 0;
    position: absolute;
    width: var(--glow-size);
    height: var(--glow-size);
    border-radius: 50%;
    will-change:transform;
    background: radial-gradient(
        circle,
        rgba(240, 100, 255, 0.8) 0%,
        rgba(180, 0,   255, 0.2) 50%,
        rgba(180, 0,   255, 0) 80%
    );
    pointer-events: none;
    background-color:#ffffff;
    box-shadow:
        0 0 1vmin 1vmin rgb(255,255,255),
        0 0 6vmin 2vmin #8a2be2,
        0 0 8vmin 3vmin #6a0dad;
}

/* Gate submit row: row is much wider than tall — tie BOTH axes to the smaller side (height),
   not vmin on width (which tracks the wide viewport and reads as “too wide”). */
#login-glow,
#new-user-glow {
    z-index: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    /* Fallback: square vmin; preferred: cap by submit row so width matches height (not stretched wide). */
    width: var(--glow-size);
    height: var(--glow-size);
    width: min(var(--glow-size), 100cqmin);
    height: min(var(--glow-size), 100cqmin);
    aspect-ratio: 1;
    box-sizing: border-box;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    transform-origin: center center;
    animation: pulseGlow 2s ease-in-out infinite;
    will-change: transform;
    background: radial-gradient(
        circle,
        rgba(240, 100, 255, 0.8) 0%,
        rgba(180, 0,   255, 0.2) 50%,
        rgba(180, 0,   255, 0) 80%
    );
    pointer-events: none;
    background-color: #ffffff;
    box-shadow:
        0 0 1vmin 1vmin rgb(255,255,255),
        0 0 6vmin 2vmin #8a2be2,
        0 0 8vmin 3vmin #6a0dad;
}
#login-glow.anim-stop,
#new-user-glow.anim-stop {
    transform: translate(-50%, -50%) scale(1);
    animation: none !important;
    background: #ffffffff;
    opacity: 1;
    will-change: transform;
}

/* Inner intro glow layer: stay within the circular #intro-glow */
#intro-glow #glow-fx {
    max-width: 100%;
    max-height: 100%;
}


/* Animated pulsing glow */
@keyframes pulseGlow {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: .5;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: .8;
  }
}


#dahlia-img {
    z-index: 65;
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    transform: translate(-50%, -50%); /* true centering */
    background: #00000000;
    diplay: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hidden {
    display: none !important;
}