/* ==========================================================================
   NatureFlow — Enchanted Realm Portal Login Stylesheet
   Complete 6-Layer Architecture & Fluid Micro-Animations
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. CSS Variables & Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette */
  --color-bg-dark: #070c0b;
  --color-wood-dark: #120e0b;
  --color-wood-card: rgba(18, 14, 11, 0.82);
  --color-wood-input: rgba(24, 17, 12, 0.88);
  --color-wood-border: #4a3828;
  --color-wood-border-hover: #785a3c;

  --color-cyan-glow: #00f5d4;
  --color-cyan-bright: #5bf0ff;
  --color-cyan-deep: #00a896;

  --color-emerald-glow: #10b981;
  --color-emerald-bright: #00ffd5;
  --color-emerald-deep: #065f46;

  --color-gold-text: #ffeaa7;
  --color-gold-accent: #f4c430;
  --color-gold-bright: #fff3b0;

  --color-text-main: #f0fdf4;
  --color-text-muted: #9ca3af;
  --color-text-dim: #6b7280;

  /* Typography */
  --font-title: 'Cinzel Decorative', 'Cinzel', serif;
  --font-heading: 'Cinzel', serif;
  --font-body: 'Outfit', sans-serif;

  /* Transitions */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-out: cubic-bezier(0.42, 0, 0.58, 1);

  /* Performance Helpers */
  --gpu-accel: translateZ(0);
}

/* --------------------------------------------------------------------------
   1. Universal Reset & Baseline
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--color-bg-dark);
  font-family: var(--font-body);
  color: var(--color-text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

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

/* --------------------------------------------------------------------------
   2. Master Viewport Container
   -------------------------------------------------------------------------- */
.natureflow-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #060a08;
}

/* --------------------------------------------------------------------------
   LAYER 0: Static Forest Base Environment (z-index: 10)
   -------------------------------------------------------------------------- */
.layer-base-env {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  overflow: hidden;
  pointer-events: none;
}

.base-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.02);
  transition: transform 12s ease-out;
  will-change: transform;
}

.ambient-sky-gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 30%, rgba(91, 240, 255, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 20% 40%, rgba(255, 200, 100, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(0, 255, 213, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

/* Atmospheric Lantern & Mushroom Glows */
.lantern-glow {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 204, 77, 0.6) 0%, rgba(255, 170, 0, 0.25) 40%, transparent 75%);
  filter: blur(12px);
  animation: lanternFlicker 4s ease-in-out infinite alternate;
  pointer-events: none;
}

.lantern-glow-1 {
  top: 31%;
  left: 16.5%;
  width: 50px;
  height: 50px;
  animation-delay: 0s;
}

.lantern-glow-2 {
  top: 13.5%;
  left: 25.5%;
  width: 40px;
  height: 40px;
  animation-delay: 1.3s;
}

.lantern-glow-3 {
  top: 31.5%;
  left: 33.8%;
  width: 45px;
  height: 45px;
  animation-delay: 2.7s;
}

.mushroom-glow {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 255, 213, 0.55) 0%, rgba(0, 180, 216, 0.2) 45%, transparent 80%);
  filter: blur(10px);
  animation: mushroomPulse 5s ease-in-out infinite alternate;
  pointer-events: none;
}

.mushroom-glow-1 {
  top: 48%;
  left: 29.5%;
  width: 45px;
  height: 45px;
  animation-delay: 0.5s;
}

.mushroom-glow-2 {
  top: 57%;
  left: 18.5%;
  width: 55px;
  height: 55px;
  animation-delay: 2.1s;
}

.mushroom-glow-3 {
  top: 69%;
  left: 27%;
  width: 40px;
  height: 40px;
  animation-delay: 3.4s;
}

@keyframes lanternFlicker {
  0% {
    opacity: 0.5;
    transform: scale(0.9);
  }

  50% {
    opacity: 0.85;
    transform: scale(1.08);
  }

  100% {
    opacity: 0.6;
    transform: scale(0.95);
  }
}

@keyframes mushroomPulse {
  0% {
    opacity: 0.4;
    transform: scale(0.92);
  }

  50% {
    opacity: 0.9;
    transform: scale(1.15);
    filter: blur(14px) hue-rotate(20deg);
  }

  100% {
    opacity: 0.5;
    transform: scale(1);
  }
}

/* --------------------------------------------------------------------------
   LAYER 1: Bioluminescent Glow Mask (Tree Core) (z-index: 100)
   -------------------------------------------------------------------------- */
.layer-bioluminescent-pulse {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
}

.tree-glow-mask {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.65;
  filter: drop-shadow(0 0 25px rgba(0, 245, 212, 0.75)) drop-shadow(0 0 50px rgba(0, 229, 255, 0.4));
  animation: treeCorePulse 6.5s ease-in-out infinite alternate;
  will-change: opacity, filter;
}

@keyframes treeCorePulse {
  0% {
    opacity: 0.35;
    filter: drop-shadow(0 0 15px rgba(0, 245, 212, 0.5)) drop-shadow(0 0 30px rgba(0, 180, 216, 0.3)) hue-rotate(-10deg);
  }

  50% {
    opacity: 0.88;
    filter: drop-shadow(0 0 35px rgba(0, 255, 213, 0.95)) drop-shadow(0 0 70px rgba(91, 240, 255, 0.75)) hue-rotate(15deg) brightness(1.15);
  }

  100% {
    opacity: 0.45;
    filter: drop-shadow(0 0 20px rgba(0, 245, 212, 0.6)) drop-shadow(0 0 45px rgba(0, 229, 255, 0.4)) hue-rotate(0deg);
  }
}

/* --------------------------------------------------------------------------
   LAYER 2: Mystic Celestial Clock Assembly (z-index: 200)
   -------------------------------------------------------------------------- */
.layer-celestial-clock {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  overflow: hidden;
  pointer-events: none;
}

.clock-housing {
  position: absolute;
  left: 69.8%;
  top: 32.2%;
  width: 21.8vw;
  height: 21.8vw;
  max-width: 320px;
  max-height: 320px;
  min-width: 180px;
  min-height: 180px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Outer Rune Ring: Counter-Clockwise Rotation */
.clock-outer-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rotateClockCCW 480s linear infinite;
  will-change: transform;
}

.clock-outer-ring {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(255, 214, 102, 0.45));
}

.rune-shimmer-halo {
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  border: 2px dashed rgba(255, 215, 0, 0.35);
  box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.25), 0 0 25px rgba(0, 255, 213, 0.2);
  animation: runePulse 8s ease-in-out infinite alternate;
}

/* Inner Constellation Dial: Clockwise Rotation */
.clock-inner-wrapper {
  position: absolute;
  width: 82%;
  height: 82%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rotateClockCW 240s linear infinite;
  will-change: transform;
}

.clock-inner-dial {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(91, 240, 255, 0.5));
}

.constellation-sparkle-overlay {
  position: absolute;
  inset: 5%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 240, 255, 0.2) 0%, transparent 70%);
  animation: starSparklePulse 4s ease-in-out infinite alternate;
}

/* Clock Hands Assembly */
.clock-hands-container {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.hand-wrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

.hour-hand-wrapper {
  animation: rotateClockCW 200s linear infinite;
}

.minute-hand-wrapper {
  animation: rotateClockCW 40s linear infinite;
}

.clock-hand {
  position: absolute;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(255, 204, 77, 0.8));
}

.clock-hand-hour {
  height: 42%;
  bottom: 50%;
  transform-origin: 50% 93%;
}

.clock-hand-minute {
  height: 52%;
  bottom: 50%;
  transform-origin: 50% 93%;
}

.clock-center-gem {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff3b0 0%, #f4a261 60%, #b8860b 100%);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.9), 0 0 20px rgba(0, 255, 213, 0.6);
  z-index: 10;
}

@keyframes rotateClockCW {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes rotateClockCCW {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(-360deg);
  }
}

@keyframes runePulse {
  0% {
    opacity: 0.4;
    filter: hue-rotate(0deg);
  }

  50% {
    opacity: 0.85;
    filter: hue-rotate(40deg);
  }

  100% {
    opacity: 0.4;
    filter: hue-rotate(-20deg);
  }
}

@keyframes starSparklePulse {
  0% {
    opacity: 0.3;
    transform: scale(0.95);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }

  100% {
    opacity: 0.3;
    transform: scale(0.95);
  }
}

/* --------------------------------------------------------------------------
   LAYER 3: Fluid Dynamics (River & Waterfall) (z-index: 300)
   -------------------------------------------------------------------------- */
.layer-fluid-dynamics {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 300;
  overflow: hidden;
  pointer-events: none;
}

/* Waterfall Shimmer & Mist Bed */
.waterfall-container {
  position: absolute;
  left: 77.2%;
  top: 51.5%;
  width: 14.5vw;
  height: 17vw;
  max-width: 220px;
  max-height: 260px;
  transform: translate(-50%, -50%);
  overflow: hidden;
  mix-blend-mode: hard-light;
  opacity: 0.75;
}

.waterfall-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: waterfallGleam 2.8s ease-in-out infinite alternate;
}

.waterfall-flow-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(180, 245, 255, 0.4) 40%,
      rgba(255, 255, 255, 0.6) 80%,
      rgba(180, 245, 255, 0.1) 100%);
  background-size: 100% 200%;
  animation: waterFlowDown 1.6s linear infinite;
  mix-blend-mode: overlay;
}

.waterfall-mist-bed {
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 35px;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.5) 0%, rgba(91, 240, 255, 0.25) 50%, transparent 80%);
  filter: blur(6px);
  animation: mistBillow 3.5s ease-in-out infinite alternate;
}

@keyframes waterfallGleam {
  0% {
    filter: brightness(1) drop-shadow(0 0 10px rgba(91, 240, 255, 0.4));
  }

  100% {
    filter: brightness(1.3) drop-shadow(0 0 25px rgba(255, 255, 255, 0.7));
  }
}

@keyframes waterFlowDown {
  0% {
    background-position: 0% 0%;
  }

  100% {
    background-position: 0% 200%;
  }
}

@keyframes mistBillow {
  0% {
    transform: scaleX(0.9) translateY(0);
    opacity: 0.4;
  }

  100% {
    transform: scaleX(1.15) translateY(-4px);
    opacity: 0.85;
  }
}

/* Living River Stream */
.river-flow-container {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 48vw;
  height: 38vh;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: 0.55;
}

.river-water-layer {
  position: absolute;
  inset: -20%;
  background-image: url('assets/river-surface.png');
  background-size: 600px 300px;
  background-repeat: repeat-x;
  animation: riverScroll 8s linear infinite;
  opacity: 0.65;
  filter: hue-rotate(10deg) brightness(1.1);
}

.river-shimmer-ripples {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 70%, rgba(91, 240, 255, 0.35) 0%, transparent 70%);
  animation: rippleGleam 2.8s ease-in-out infinite alternate;
}

@keyframes riverScroll {
  0% {
    transform: translateX(0) translateY(0);
  }

  50% {
    transform: translateX(-150px) translateY(20px);
  }

  100% {
    transform: translateX(-300px) translateY(40px);
  }
}

@keyframes rippleGleam {
  0% {
    opacity: 0.45;
    transform: scaleX(1.0);
  }

  100% {
    opacity: 0.9;
    transform: scaleX(1.06);
  }
}

/* --------------------------------------------------------------------------
   LAYER 4: Flora Sprites (Lotus & Lily Pads) (z-index: 400)
   -------------------------------------------------------------------------- */
.layer-flora {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 400;
  overflow: hidden;
  pointer-events: none;
}

.flora-item {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floraBobbing var(--bob-duration, 9s) ease-in-out infinite alternate;
  animation-delay: var(--bob-delay, 0s);
  will-change: transform;
}

.flora-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}

/* Coordinates corresponding to the river stream in artwork */
.lotus-pink-item {
  left: 79.5%;
  top: 90.5%;
  width: 6.2vw;
  max-width: 85px;
  min-width: 48px;
}

.lotus-blue-open-item {
  left: 87.5%;
  top: 80.5%;
  width: 4.8vw;
  max-width: 65px;
  min-width: 38px;
}

.lotus-blue-small-item {
  left: 72.8%;
  top: 96.5%;
  width: 4.2vw;
  max-width: 55px;
  min-width: 30px;
}

.lilypad-top-item {
  left: 90%;
  top: 85%;
  width: 5.5vw;
  max-width: 75px;
  min-width: 42px;
}

.lilypad-bottom-item {
  left: 76%;
  top: 93%;
  width: 7vw;
  max-width: 95px;
  min-width: 55px;
}

/* Glowing Stamens */
.stamen-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(5px);
  animation: stamenPulse 3s ease-in-out infinite alternate;
  pointer-events: none;
}

.pink-stamen-glow {
  top: 35%;
  width: 22px;
  height: 22px;
  background: radial-gradient(circle, #fff3b0 0%, #ff6b81 60%, transparent 80%);
}

.blue-stamen-glow {
  top: 38%;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, #fff3b0 0%, #00f5d4 60%, transparent 80%);
}

.water-ripple-ring {
  position: absolute;
  bottom: -4px;
  width: 110%;
  height: 25%;
  border-radius: 50%;
  border: 1px solid rgba(180, 245, 255, 0.4);
  box-shadow: 0 0 10px rgba(91, 240, 255, 0.3);
  animation: waterRingExpand 4s ease-out infinite;
}

@keyframes floraBobbing {
  0% {
    transform: translateY(-4px) rotate(-1.5deg);
  }

  50% {
    transform: translateY(3px) rotate(1.2deg);
  }

  100% {
    transform: translateY(-4px) rotate(-1.5deg);
  }
}

@keyframes stamenPulse {
  0% {
    opacity: 0.5;
    transform: scale(0.85);
  }

  100% {
    opacity: 0.95;
    transform: scale(1.2);
  }
}

@keyframes waterRingExpand {
  0% {
    transform: scale(0.7);
    opacity: 0.7;
  }

  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   LAYER 5: Particle Canvas Overlay (z-index: 500)
   -------------------------------------------------------------------------- */
.layer-particles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   LAYER 6: HTML5 Interactive Form Controls (z-index: 600)
   -------------------------------------------------------------------------- */
.layer-interactive-form {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Portal Frame Form Container (Nested into tree hollow) */
.portal-frame-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 34px 38px 28px;
  margin: 0 20px;
  pointer-events: auto;
  border-radius: 36px;
  background: var(--color-wood-card);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 2px solid rgba(120, 90, 60, 0.45);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.8),
    0 0 35px rgba(0, 245, 212, 0.18),
    inset 0 1px 2px rgba(255, 230, 180, 0.2),
    inset 0 0 20px rgba(18, 14, 11, 0.9);
  transition: transform 0.4s var(--ease-smooth), box-shadow 0.4s var(--ease-smooth);
}

.portal-frame-container:hover {
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.9),
    0 0 45px rgba(0, 245, 212, 0.28),
    inset 0 1px 3px rgba(255, 230, 180, 0.3),
    inset 0 0 25px rgba(18, 14, 11, 0.95);
}

.hollow-ambient-aura {
  position: absolute;
  inset: -12px;
  border-radius: 44px;
  background: radial-gradient(circle at 50% 50%, rgba(0, 255, 213, 0.15) 0%, rgba(0, 180, 216, 0.05) 50%, transparent 75%);
  filter: blur(14px);
  z-index: -1;
  pointer-events: none;
  animation: portalAuraPulse 6s ease-in-out infinite alternate;
}

@keyframes portalAuraPulse {
  0% {
    opacity: 0.4;
    transform: scale(0.97);
  }

  100% {
    opacity: 0.85;
    transform: scale(1.03);
  }
}

/* Header & Title */
.portal-header {
  text-align: center;
  margin-bottom: 24px;
}

.portal-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.emblem-crystal {
  color: var(--color-cyan-glow);
  text-shadow: 0 0 10px var(--color-cyan-bright);
  animation: emblemSpin 6s ease-in-out infinite alternate;
}

.emblem-leaf-left,
.emblem-leaf-right {
  filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.7));
}

@keyframes emblemSpin {
  0% {
    transform: rotate(0deg) scale(0.9);
  }

  100% {
    transform: rotate(180deg) scale(1.2);
  }
}

.portal-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  letter-spacing: 0.12em;
}

.title-sub {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-gold-text);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 234, 167, 0.4);
}

.title-main {
  font-family: var(--font-title);
  font-size: 1.85rem;
  font-weight: 900;
  background: linear-gradient(180deg, #ffffff 0%, #c4f1e0 40%, #5eead4 80%, #0d9488 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 14px rgba(0, 245, 212, 0.5));
}

.portal-tagline {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  margin-top: 4px;
  text-transform: uppercase;
}

/* Form Styles & Groups */
.nature-login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.carved-input-group {
  position: relative;
  display: flex;
  flex-direction: column;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--color-wood-input);
  border-radius: 18px;
  border: 1.5px solid var(--color-wood-border);
  padding: 4px 14px;
  box-shadow:
    inset 0 3px 6px rgba(0, 0, 0, 0.7),
    inset 0 0 10px rgba(10, 7, 5, 0.8),
    0 1px 1px rgba(255, 255, 255, 0.1);
  transition: border-color 0.3s var(--ease-smooth), box-shadow 0.3s var(--ease-smooth), transform 0.2s var(--ease-smooth);
}

.input-wrapper:hover {
  border-color: var(--color-wood-border-hover);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.8),
    0 0 14px rgba(0, 255, 213, 0.25);
}

.input-wrapper:focus-within {
  border-color: var(--color-cyan-glow);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(0, 245, 212, 0.55),
    0 0 40px rgba(0, 229, 255, 0.2);
  transform: scale(1.01);
}

/* Input Badges (Leaf & Lock Icons) */
.input-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  color: var(--color-emerald-glow);
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.6));
  transition: transform 0.3s var(--ease-bounce), color 0.3s var(--ease-smooth);
}

.input-wrapper:focus-within .input-badge {
  color: var(--color-cyan-bright);
  transform: scale(1.15) rotate(8deg);
  filter: drop-shadow(0 0 10px rgba(91, 240, 255, 0.9));
}

.badge-icon {
  width: 20px;
  height: 20px;
}

/* Carved Input Element */
.carved-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--color-text-main);
  padding: 10px 0;
  letter-spacing: 0.04em;
}

.carved-input::placeholder {
  color: #7d7062;
  font-weight: 400;
  letter-spacing: 0.03em;
  transition: color 0.25s ease;
}

.carved-input:focus::placeholder {
  color: #a89f92;
}

/* Password View Toggle Button */
.password-toggle-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 6px;
  color: #8c7a68;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color 0.2s, transform 0.2s, background-color 0.2s;
}

.password-toggle-btn:hover {
  color: var(--color-cyan-glow);
  transform: scale(1.1);
  background-color: rgba(0, 245, 212, 0.1);
}

/* Emerald Shimmer Sweep on Input Borders */
.shimmer-border {
  position: absolute;
  inset: -1px;
  border-radius: 19px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 255, 213, 0.8) 50%, transparent 100%);
  background-size: 200% 100%;
  transition: opacity 0.3s ease;
  mix-blend-mode: overlay;
}

.input-wrapper:hover .shimmer-border,
.input-wrapper:focus-within .shimmer-border {
  opacity: 1;
  animation: emeraldSweep 2.2s linear infinite;
}

@keyframes emeraldSweep {
  0% {
    background-position: 200% 0%;
  }

  100% {
    background-position: -200% 0%;
  }
}

/* Field Error Messages */
.field-error-msg {
  display: none;
  font-size: 0.76rem;
  color: #f87171;
  margin-top: 4px;
  margin-left: 12px;
  letter-spacing: 0.02em;
}

.carved-input-group.has-error .field-error-msg {
  display: block;
  animation: fadeInDown 0.25s ease-out;
}

.carved-input-group.has-error .input-wrapper {
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Form Options: Remember Me & Forgot Password */
.form-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 0.84rem;
}

.remember-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color 0.2s ease;
}

.remember-toggle-label:hover {
  color: var(--color-text-main);
}

.remember-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.custom-leaf-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--color-wood-input);
  border: 1.5px solid var(--color-wood-border);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  transition: all 0.25s var(--ease-bounce);
}

.checkbox-leaf-mark {
  font-size: 0.75rem;
  opacity: 0;
  transform: scale(0.4) rotate(-20deg);
  transition: all 0.25s var(--ease-bounce);
}

.remember-checkbox:checked+.custom-leaf-checkbox {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--color-emerald-bright);
  box-shadow: 0 0 10px rgba(0, 255, 213, 0.5);
}

.remember-checkbox:checked+.custom-leaf-checkbox .checkbox-leaf-mark {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.magic-link {
  color: var(--color-gold-text);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.03em;
  position: relative;
  transition: color 0.2s ease, text-shadow 0.2s ease;
  background: none;
  border: none;
  cursor: pointer;
}

.magic-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: linear-gradient(90deg, var(--color-cyan-glow), var(--color-gold-accent));
  transition: width 0.3s var(--ease-smooth);
}

.magic-link:hover {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 234, 167, 0.8), 0 0 18px rgba(0, 245, 212, 0.6);
}

.magic-link:hover::after {
  width: 100%;
}

/* --------------------------------------------------------------------------
   Crystalline "Log In" Gem Button (Layer 6 Highlight)
   -------------------------------------------------------------------------- */
.crystal-btn-container {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

.crystal-login-btn {
  position: relative;
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d755d 0%, #10b981 30%, #00ffd5 50%, #0891b2 75%, #064e3b 100%);
  background-size: 200% 200%;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.6),
    0 0 25px rgba(0, 245, 212, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.6),
    inset 0 -2px 6px rgba(0, 0, 0, 0.5);
  transition: all 0.3s var(--ease-smooth);
  will-change: transform, box-shadow;
}

.crystal-login-btn:hover {
  transform: translateY(-2px) scale(1.02);
  background-position: 100% 100%;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.7),
    0 0 45px rgba(0, 255, 213, 0.85),
    0 0 80px rgba(91, 240, 255, 0.4),
    inset 0 2px 6px rgba(255, 255, 255, 0.8);
}

.crystal-login-btn:active {
  transform: translateY(1px) scale(0.98);
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.8),
    0 0 60px rgba(91, 240, 255, 1);
  filter: brightness(1.3);
}

/* Internal Refraction Sweep */
.crystal-light-refraction {
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.7) 50%, transparent 100%);
  transform: rotate(25deg);
  animation: crystalRefract 3.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes crystalRefract {
  0% {
    transform: translateX(-100%) rotate(25deg);
    opacity: 0;
  }

  30% {
    opacity: 0.8;
  }

  60% {
    transform: translateX(450%) rotate(25deg);
    opacity: 0;
  }

  100% {
    transform: translateX(450%) rotate(25deg);
    opacity: 0;
  }
}

.crystal-pulse-glow {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.25) 0%, transparent 70%);
  animation: crystalPulse 2.8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes crystalPulse {
  0% {
    opacity: 0.3;
  }

  100% {
    opacity: 0.85;
  }
}

.btn-text-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 30, 20, 0.8), 0 0 12px rgba(255, 255, 255, 0.8);
}

.gem-sparkle-left,
.gem-sparkle-right {
  font-size: 0.95rem;
  color: #fff3b0;
  text-shadow: 0 0 8px rgba(255, 243, 176, 0.9);
  animation: sparkleTwinkle 2s ease-in-out infinite alternate;
}

.gem-sparkle-right {
  animation-delay: 1s;
}

@keyframes sparkleTwinkle {
  0% {
    transform: scale(0.8) rotate(0deg);
    opacity: 0.6;
  }

  100% {
    transform: scale(1.25) rotate(45deg);
    opacity: 1;
  }
}

/* Footer & Navigation */
.portal-footer {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.signup-prompt {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.signup-link-btn {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-emerald-bright);
}

.guest-access-wrap {
  margin-top: 4px;
}

.guest-link-btn {
  background: transparent;
  border: 1px solid rgba(120, 90, 60, 0.4);
  border-radius: 20px;
  color: #a89f92;
  font-size: 0.78rem;
  font-family: var(--font-body);
  padding: 5px 14px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.25s ease;
}

.guest-link-btn:hover {
  color: #ffffff;
  border-color: var(--color-cyan-glow);
  background: rgba(0, 245, 212, 0.08);
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.3);
}

/* --------------------------------------------------------------------------
   Ambient Audio & Environment Controls
   -------------------------------------------------------------------------- */
.ambient-audio-widget {
  position: absolute;
  bottom: 24px;
  left: 28px;
  z-index: 700;
}

.audio-control-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 24px;
  background: rgba(18, 14, 11, 0.85);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(120, 90, 60, 0.5);
  color: var(--color-text-main);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  transition: all 0.3s var(--ease-smooth);
}

.audio-control-btn:hover {
  border-color: var(--color-cyan-glow);
  box-shadow: 0 8px 25px rgba(0, 245, 212, 0.4);
  transform: translateY(-2px);
}

.audio-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 14px;
}

.wave-bar {
  width: 3px;
  height: 100%;
  background: var(--color-cyan-glow);
  border-radius: 2px;
  animation: soundWave 1.2s ease-in-out infinite alternate;
}

.audio-control-btn.is-muted .wave-bar {
  animation: none;
  height: 3px;
  background: #6b7280;
}

.wave-bar:nth-child(1) {
  animation-delay: 0.1s;
}

.wave-bar:nth-child(2) {
  animation-delay: 0.4s;
  height: 75%;
}

.wave-bar:nth-child(3) {
  animation-delay: 0.7s;
  height: 50%;
}

@keyframes soundWave {
  0% {
    height: 20%;
  }

  100% {
    height: 100%;
  }
}

.audio-tooltip {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-gold-text);
}

/* Magic Surge Boost Widget */
.env-toggle-widget {
  position: absolute;
  bottom: 24px;
  right: 28px;
  z-index: 700;
}

.env-mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 24px;
  background: rgba(18, 14, 11, 0.85);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(120, 90, 60, 0.5);
  color: var(--color-text-main);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  transition: all 0.3s var(--ease-smooth);
}

.env-mode-btn:hover,
.env-mode-btn.is-active {
  border-color: var(--color-emerald-bright);
  background: rgba(16, 185, 129, 0.2);
  box-shadow: 0 8px 25px rgba(0, 255, 213, 0.5);
  transform: translateY(-2px);
}

.env-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-emerald-bright);
}

/* --------------------------------------------------------------------------
   Modals & Notifications
   -------------------------------------------------------------------------- */
.nature-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 7, 6, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-smooth);
}

.nature-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.nature-modal-card {
  position: relative;
  width: 90%;
  max-width: 420px;
  background: var(--color-wood-card);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(120, 90, 60, 0.6);
  border-radius: 28px;
  padding: 36px 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 245, 212, 0.3);
  display: none;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.35s var(--ease-bounce);
}

.nature-modal-backdrop.is-open .nature-modal-card.is-active {
  display: block;
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 20px;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: #a89f92;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #fff;
  transform: scale(1.15) rotate(90deg);
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.modal-icon {
  font-size: 2.2rem;
  display: inline-block;
  margin-bottom: 6px;
  animation: iconFloat 3s ease-in-out infinite alternate;
}

@keyframes iconFloat {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-6px);
  }
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  color: var(--color-gold-text);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 0.86rem;
  color: var(--color-text-muted);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-input-group {
  position: relative;
}

.modal-input {
  width: 100%;
  background: var(--color-wood-input);
  border: 1.5px solid var(--color-wood-border);
  border-radius: 14px;
  padding: 12px 16px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.25s ease;
}

.modal-input:focus {
  border-color: var(--color-cyan-glow);
  box-shadow: 0 0 16px rgba(0, 245, 212, 0.45);
}

.modal-submit-btn {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #10b981, #00ffd5, #0891b2);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 255, 213, 0.4);
  transition: all 0.25s ease;
}

.modal-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 255, 213, 0.7);
}

/* Success Card */
.nature-success-card {
  position: relative;
  text-align: center;
  max-width: 380px;
  padding: 40px 30px;
  background: var(--color-wood-card);
  backdrop-filter: blur(24px);
  border-radius: 32px;
  border: 2px solid var(--color-emerald-bright);
  box-shadow: 0 0 50px rgba(0, 255, 213, 0.6);
  display: none;
}

.nature-modal-backdrop.is-open .nature-success-card.is-active {
  display: block;
  animation: successPop 0.45s var(--ease-bounce);
}

@keyframes successPop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.success-glyph {
  font-size: 2.2rem;
  color: var(--color-cyan-glow);
  text-shadow: 0 0 15px var(--color-cyan-bright);
}

.success-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: #fff;
  margin: 12px 0 6px;
}

.success-msg {
  font-size: 0.92rem;
  color: var(--color-gold-text);
  margin-bottom: 20px;
}

.success-loader-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.loader-emerald-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--color-emerald-glow), var(--color-cyan-bright));
  box-shadow: 0 0 10px var(--color-cyan-bright);
  animation: loaderProgress 2.2s ease-in-out forwards;
}

@keyframes loaderProgress {
  0% {
    width: 0%;
  }

  100% {
    width: 100%;
  }
}

/* Toast Notifications */
.nature-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(18, 14, 11, 0.95);
  backdrop-filter: blur(14px);
  border: 1.5px solid var(--color-cyan-glow);
  border-radius: 24px;
  padding: 12px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 245, 212, 0.5);
  opacity: 0;
  transition: transform 0.4s var(--ease-bounce), opacity 0.4s ease;
  pointer-events: none;
}

.nature-toast.is-shown {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-icon {
  font-size: 1.2rem;
}

.toast-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-main);
}

/* --------------------------------------------------------------------------
   Responsive Layout & Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .portal-frame-container {
    max-width: 92%;
    padding: 26px 22px 22px;
    border-radius: 28px;
  }

  .title-main {
    font-size: 1.5rem;
  }

  .clock-housing {
    width: 28vw;
    height: 28vw;
  }

  .ambient-audio-widget {
    left: 14px;
    bottom: 14px;
  }

  .env-toggle-widget {
    right: 14px;
    bottom: 14px;
  }
}

@media (max-width: 480px) {
  .portal-title .title-sub {
    font-size: 0.95rem;
  }

  .portal-title .title-main {
    font-size: 1.35rem;
  }

  .clock-housing {
    width: 34vw;
    height: 34vw;
  }
}