/* ===== SHRINE HUB — TORII TUNNEL ===== */

:root {
  --void: #050208;
  --opal-lavender: #c4b5fd;
  --mist: #c8bfdb;
  --dust: #8a8098;
  --ghost: #f0e6ff;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--void);
}

/* ---- Vignette ---- */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(5,2,8,0.9) 100%);
}

/* ---- Page Title ---- */
.page-title {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  font-family: 'Remeeq', serif;
  font-size: clamp(1.4rem, 4vw, 3.5rem);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  background: linear-gradient(
    135deg,
    #ff7eb3, #c4b5fd, #5eead4, #fde68a, #fca5a5,
    #c084fc, #818cf8, #ff7eb3
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 6s ease-in-out infinite;
  transition: opacity 0.8s ease;
  pointer-events: none;
}

.page-title.faded {
  opacity: 0.15;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ---- Tunnel Viewport ---- */
.tunnel-viewport {
  position: fixed;
  inset: 0;
  perspective: 900px;
  perspective-origin: 50% 58%;
  overflow: hidden;
}

.tunnel {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}


/* ---- Torii Gate ---- */
.torii {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-style: preserve-3d;
  pointer-events: none;
  width: 520px;
  height: 420px;
  margin-left: -260px;
  margin-top: -170px;
}

.torii-inner {
  position: relative;
  width: 100%;
  height: 100%;
  animation: gateFloat var(--float-dur, 5s) ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
}

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

/* Pillars */
.torii-pillar {
  position: absolute;
  bottom: 0;
  width: 32px;
  height: 92%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(
    180deg,
    var(--gate-color) 0%,
    var(--gate-color) 75%,
    color-mix(in srgb, var(--gate-color), #000 60%) 75%,
    color-mix(in srgb, var(--gate-color), #000 70%) 100%
  );
  box-shadow:
    0 0 15px color-mix(in srgb, var(--gate-color), transparent 40%),
    inset -4px 0 8px rgba(0,0,0,0.3),
    inset 4px 0 8px rgba(255,255,255,0.05);
  transition: box-shadow 0.4s ease, filter 0.4s ease;
}

.torii-pillar.left {
  left: 50px;
}

.torii-pillar.right {
  right: 50px;
}

/* Pillar text */
.torii-pillar-text {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: 'zaibtsu', serif;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: rgba(0, 0, 0, 0.5);
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1;
}

/* Kasagi — curved top beam */
.torii-kasagi {
  position: absolute;
  top: 0;
  left: -16px;
  width: calc(100% + 32px);
  height: 28px;
  background: var(--gate-color);
  border-radius: 80% 80% 0 0 / 50% 50% 0 0;
  box-shadow:
    0 0 24px color-mix(in srgb, var(--gate-color), transparent 30%),
    0 4px 12px rgba(0,0,0,0.5),
    inset 0 -3px 6px rgba(0,0,0,0.3),
    inset 0 4px 6px rgba(255,255,255,0.08);
  transition: box-shadow 0.4s ease;
}

/* Shimagi — piece below kasagi */
.torii-shimagi {
  position: absolute;
  top: 26px;
  left: 0;
  right: 0;
  height: 14px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--gate-color), #000 15%),
    color-mix(in srgb, var(--gate-color), #000 25%)
  );
  box-shadow:
    0 0 10px color-mix(in srgb, var(--gate-color), transparent 50%),
    inset 0 2px 4px rgba(255,255,255,0.05);
}

/* Nuki — lower crossbeam */
.torii-nuki {
  position: absolute;
  top: 62px;
  left: 50px;
  right: 50px;
  height: 16px;
  background: var(--gate-color);
  border-radius: 2px;
  box-shadow:
    0 0 12px color-mix(in srgb, var(--gate-color), transparent 40%),
    inset 0 -2px 4px rgba(0,0,0,0.3),
    inset 0 2px 3px rgba(255,255,255,0.06);
  transition: box-shadow 0.4s ease;
}

/* Nuki-end caps where nuki meets pillars */
.torii-nuki-cap {
  position: absolute;
  top: 56px;
  width: 40px;
  height: 28px;
  background: color-mix(in srgb, var(--gate-color), #000 10%);
  border-radius: 3px;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.3);
}

.torii-nuki-cap.left {
  left: 46px;
}

.torii-nuki-cap.right {
  right: 46px;
}

/* Gakuzuka — center tablet between shimagi and nuki */
.torii-gakuzuka {
  position: absolute;
  top: 38px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 26px;
  background: color-mix(in srgb, var(--gate-color), #000 20%);
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--gate-color), #000 40%);
  box-shadow: 0 0 8px color-mix(in srgb, var(--gate-color), transparent 60%);
}

/* ---- Gate States ---- */
.torii.current .torii-kasagi {
  box-shadow:
    0 0 50px color-mix(in srgb, var(--gate-color), transparent 5%),
    0 0 100px color-mix(in srgb, var(--gate-color), transparent 25%),
    0 0 160px color-mix(in srgb, var(--gate-color), transparent 55%),
    0 4px 12px rgba(0,0,0,0.5),
    inset 0 -3px 6px rgba(0,0,0,0.3),
    inset 0 4px 6px rgba(255,255,255,0.08);/* ---- Water Layer ---- */
}


.torii.current .torii-pillar {
  box-shadow:
    0 0 35px color-mix(in srgb, var(--gate-color), transparent 10%),
    0 0 70px color-mix(in srgb, var(--gate-color), transparent 35%),
    0 0 120px color-mix(in srgb, var(--gate-color), transparent 60%),
    inset -4px 0 8px rgba(0,0,0,0.3),
    inset 4px 0 8px rgba(255,255,255,0.05);
}

.torii.current .torii-nuki {
  box-shadow:
    0 0 30px color-mix(in srgb, var(--gate-color), transparent 10%),
    0 0 60px color-mix(in srgb, var(--gate-color), transparent 40%),
    0 0 100px color-mix(in srgb, var(--gate-color), transparent 65%),
    inset 0 -2px 4px rgba(0,0,0,0.3),
    inset 0 2px 3px rgba(255,255,255,0.06);
}

.torii.current .torii-pillar-text {
  color: rgba(0,0,0,0.7);
}

.torii.clickable {
  pointer-events: auto;
}

.torii.clickable:hover .torii-pillar,
.torii.clickable:hover .torii-kasagi,
.torii.clickable:hover .torii-nuki,
.torii.clickable:hover .torii-shimagi {
  filter: brightness(1.3) saturate(1.2);
}

/* ---- Gate Label ---- */
.gate-label {
  position: fixed;
  bottom: 28%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;  /* raise this above the canvas */
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.gate-label.visible {
  opacity: 1;
  pointer-events: auto;  /* enable clicks when visible */
}

.gate-label-name {
  display: block;
  font-family: 'F-Stein', serif;
  font-size: clamp(1.3rem, 3.5vw, 2.2rem);
  color: var(--label-color, var(--opal-lavender));
  text-shadow:
    0 0 20px var(--label-color, var(--opal-lavender)),
    0 0 50px var(--label-color, var(--opal-lavender)),
    0 0 80px color-mix(in srgb, var(--label-color, var(--opal-lavender)), transparent 50%);
  letter-spacing: 0.2em;
}

.gate-label-desc {
  display: block;
  font-family: 'Cavalhatriz', serif;
  font-size: clamp(0.75rem, 1.5vw, 1.2rem);
  color: var(--mist);
  margin-top: 0.4em;
  letter-spacing: 0.12em;
  opacity: 0.65;
  font-style: italic;
}

/* ---- Wisp Canvas ---- */
#wispCanvas {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  width: 100%;
  height: 100%;
}


/* ---- Scroll Hint ---- */
.scroll-hint {
  position: fixed;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  font-family: 'Sweet Dreams', serif;
  font-size: 1.2rem;
  color: var(--dust);
  letter-spacing: 0.15em;
  opacity: 0.6;
  animation: hintPulse 3s ease-in-out infinite;
  transition: opacity 0.6s ease;
  pointer-events: all;
  cursor: pointer;
}

.scroll-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.25; }
}

/* ---- Back Link ---- */
.back-link {
  position: fixed;
  bottom: 1.2rem;
  left: 1.5rem;
  z-index: 110;
  font-family: var(--font-body), serif;
  font-size: 1.2rem;
  color: rgb(0, 0, 0);
  text-decoration: none;
  opacity: 1;
  text-shadow: 
    0 0 12px rgb(161, 137, 255),
    0 0 30px rgba(195, 181, 253, 0.808);
  transition: opacity 0.3s ease, color 0.3s ease, text-shadow 0.3s ease;
  animation: backLinkPulse 4s ease-in-out infinite;
}

.back-link:hover {
  opacity: 1;
  color: #ffffff;
  text-shadow:
    0 0 12px rgba(195, 181, 253, 0.897),
    0 0 30px rgba(195, 181, 253, 0.767);
  animation: none;
}

@keyframes backLinkPulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 0.3; }
}

/* ---- Flash Overlay ---- */
.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  background: #000000;
  transition: opacity 1.2s ease;
}

.flash-overlay.fade-black {
  opacity: 1;
  pointer-events: all;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .torii {
    width: 320px;
    height: 280px;
    margin-left: -160px;
    margin-top: -120px;
  }

  .torii-pillar {
    width: 22px;
  }

  .torii-pillar.left { left: 30px; }
  .torii-pillar.right { right: 30px; }

  .torii-kasagi {
    height: 20px;
    left: -10px;
    width: calc(100% + 20px);
  }

  .torii-shimagi {
    top: 18px;
    height: 10px;
  }

  .torii-nuki {
    top: 46px;
    height: 12px;
    left: 30px;
    right: 30px;
  }

  .torii-nuki-cap {
    top: 40px;
    width: 28px;
    height: 22px;
  }

  .torii-nuki-cap.left { left: 26px; }
  .torii-nuki-cap.right { right: 26px; }

  .torii-gakuzuka {
    top: 27px;
    width: 44px;
    height: 20px;
  }

  .tunnel-viewport {
    perspective: 600px;
  }

.tunnel.walking {
  transition: transform 1.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateZ(600px) scale(1.15) !important;
}

  .torii-pillar-text {
    font-size: 0.55rem;
  }
}

/* ============================================
   YUME NIKKI–STYLE MODAL
   ============================================ */

.yn-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    /* block clicks on everything behind */
    cursor: default;
    animation: yn-overlay-in 0.6s ease-out;
}

@keyframes yn-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.yn-modal-overlay.dismissed {
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.yn-modal {
    /* RPG Maker 2003 windowskin vibe:
       dark blue-purple, semi-transparent,
       pixel-art double border */
    background: rgba(10, 5, 28, 0.92);
    border: 3px solid #5a4a8a;
    outline: 2px solid #2a1f4e;
    outline-offset: 2px;
    box-shadow:
        inset 0 0 0 1px rgba(196, 181, 253, 0.12),
        0 0 40px rgba(100, 60, 180, 0.25);
    padding: 2em 3em 1.5em;
    min-width: 260px;
    max-width: 90vw;
    text-align: center;
    /* Pixel-crisp feel */
    image-rendering: pixelated;
    animation: yn-box-in 0.5s ease-out 0.3s both;
}

@keyframes yn-box-in {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.yn-modal-text {
    font-family: 'Little-Monster';
    font-size: clamp(1rem, 2.5vw, 1.6rem);
    color: #e0d6f5;
    letter-spacing: 0.01em;
    margin: 0 0 1.4em;
    text-shadow:
        0 0 6px rgba(196, 181, 253, 0.35),
        1px 1px 0 #1a0f2e;
    /* RPG Maker–style typewriter spacing */
    line-height: 1.6;
}

.yn-modal-text-header {
  font-family: 'zaibtsu', 'MedievalSharp', monospace;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  letter-spacing: 0.18em;
  display: block;
  margin-bottom: 0.5em;
}

.yn-modal-btn {
    font-family: 'Cavalhatriz', 'MedievalSharp', monospace;
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    letter-spacing: 0.2em;
    color: #e0d6f5;
    background: rgba(42, 31, 78, 0.7);
    border: 2px solid #5a4a8a;
    padding: 0.45em 2.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 0 4px rgba(196, 181, 253, 0.3);
    position: relative;
}

/* Highlight caret — mimics the RPG Maker selector arrow */
.yn-modal-btn::before {
    content: '▶';
    position: absolute;
    left: 0.5em;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7em;
    color: #c4b5fd;
    animation: yn-caret-blink 0.8s steps(2, start) infinite;
}

@keyframes yn-caret-blink {
    50% { opacity: 0; }
}

.yn-modal-btn:hover,
.yn-modal-btn:focus-visible {
    background: rgba(90, 74, 138, 0.5);
    border-color: #c4b5fd;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(196, 181, 253, 0.3);
    outline: none;
}

.yn-modal-btn:active {
    transform: scale(0.96);
}

.gate-enter-btn {
  display: block;
  margin: 0.6em auto 0;
  font-family: 'Little-Monster', 'MedievalSharp', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--opal-lavender);
  background: rgba(10, 5, 28, 0.6);
  border: 1px solid rgba(196, 181, 253, 0.3);
  padding: 0.3em 1em;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.3s ease;
  position: relative;
  z-index: 201;
}

.gate-enter-btn:hover {
  background: rgba(90, 74, 138, 0.4);
  box-shadow: 0 0 10px currentColor;
}

.gate-enter-btn:active {
  transform: scale(0.95);
}

#scrollHint {
  pointer-events: all !important;
  z-index: 99999 !important;
  position: fixed !important;
}

.vignette {
  pointer-events: none !important;
}

#wispCanvas {
  pointer-events: none !important;
}

.tunnel-viewport {
  pointer-events: none !important;
}