/* MilleRace - Global Main CSS */

html {
  scroll-behavior: smooth;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

/* ==========================================================================
   HIDE ALL SCROLLBARS (Vertical & Horizontal) WHILE PRESERVING SMOOTH SCROLL
   ========================================================================== */
*::-webkit-scrollbar,
::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}


body {
  font-family: var(--font-body);
  background-color: var(--color-dark-bg);
  color: var(--color-text-light);
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-behavior: smooth;
}

/* App Container */
#app {
  width: 100%;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Screen Wrapper */
.screen {
  width: 100%;
  min-height: 100vh;
  display: none !important;
  flex-direction: column;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.screen.active {
  display: flex !important;
}

/* Global Game Top HUD Bar (Exact 3-column grid for dead-center pill) */
.game-hud {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 48px);
  max-width: 1280px;
  height: auto;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0;
  z-index: 100;
  pointer-events: none;
}

/* CENTER PILL: Stage Title & Subtitle */
.hud-stage-info {
  justify-self: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 2px;
  background: rgba(22, 20, 28, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--glass-border);
  border-radius: 30px;
  padding: 8px 28px;
  box-shadow: var(--shadow-card);
  pointer-events: auto;
}

.hud-stage-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-yellow);
  line-height: 1.2;
  margin: 0;
}

.hud-stage-subtitle {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #CBD5E1;
  margin: 0;
  line-height: 1.2;
}

/* RIGHT PILL: Timer with Paused Indicator */
.hud-timer {
  justify-self: end;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-yellow);
  background: rgba(22, 20, 28, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-yellow);
  padding: 8px 22px;
  border-radius: 30px;
  box-shadow: var(--shadow-card);
  pointer-events: auto;
  transition: var(--transition-fast);
}

.hud-timer.paused {
  color: #EF4444 !important;
  border-color: rgba(239, 68, 68, 0.8) !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.45) !important;
}

.hud-timer.paused .timer-icon {
  animation: none;
}

#hud-timer-display {
  font-weight: 900;
  letter-spacing: 1px;
}

.timer-icon {
  animation: pulseTimer 1s infinite alternate;
}

@keyframes pulseTimer {
  from {
    opacity: 0.7;
    transform: scale(1);
  }

  to {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* LEFT PILL: Stage Key Indicator (Purple Theme) */
.hud-keys {
  justify-self: start;
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 12px;
  background: rgba(22, 20, 28, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--glass-border);
  border-radius: 30px;
  padding: 8px 18px;
  box-shadow: var(--shadow-card);
  pointer-events: auto;
  transition: var(--transition-fast);
}

.key-slot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(133, 78, 180, 0.35);
  border: 1.5px dashed rgba(192, 132, 252, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: bold;
  color: #F1F5F9;
  transition: var(--transition-fast);
}

/* Current Active Stage Key Slot Glowing Indicator */
.key-slot.current-stage {
  border-style: solid !important;
  border-width: 2px !important;
  animation: keySlotPulse 1.6s infinite ease-in-out;
}

/* Stage-specific active colors */
.hud-keys[data-stage="1"] .key-slot.current-stage {
  border-color: #F3CD50 !important;
  color: #F3CD50 !important;
  background: rgba(243, 205, 80, 0.28) !important;
  box-shadow: 0 0 16px rgba(243, 205, 80, 0.85) !important;
}

.hud-keys[data-stage="2"] .key-slot.current-stage {
  border-color: #00D2FF !important;
  color: #E0F2FE !important;
  background: rgba(0, 210, 255, 0.28) !important;
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.85) !important;
}

.hud-keys[data-stage="3"] .key-slot.current-stage {
  border-color: #10B981 !important;
  color: #ECFDF5 !important;
  background: rgba(16, 185, 129, 0.28) !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.85) !important;
}

.hud-keys[data-stage="4"] .key-slot.current-stage {
  border-color: #EC4899 !important;
  color: #FDF2F8 !important;
  background: rgba(236, 72, 153, 0.28) !important;
  box-shadow: 0 0 16px rgba(236, 72, 153, 0.85) !important;
}

@keyframes keySlotPulse {

  0%,
  100% {
    transform: scale(1.05);
    filter: brightness(1);
  }

  50% {
    transform: scale(1.18);
    filter: brightness(1.25);
  }
}

.key-slot.collected {
  color: #FFFFFF;
  animation: keyPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#key-slot-1.collected {
  background: rgba(243, 205, 80, 0.85);
  border: 1.5px solid #FDE047;
  box-shadow: 0 0 16px rgba(243, 205, 80, 0.85);
}

#key-slot-2.collected {
  background: rgba(0, 210, 255, 0.85);
  border: 1.5px solid #7DD3FC;
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.85);
}

#key-slot-3.collected {
  background: rgba(16, 185, 129, 0.85);
  border: 1.5px solid #6EE7B7;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.85);
}

#key-slot-4.collected {
  background: rgba(236, 72, 153, 0.85);
  border: 1.5px solid #F472B6;
  box-shadow: 0 0 16px rgba(236, 72, 153, 0.85);
}

@keyframes keyPop {
  0% {
    transform: scale(0);
  }

  70% {
    transform: scale(1.3);
  }

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

/* DYNAMIC CHARACTER DIALOGUE BOX (Anchored Beside Character Still, Expanding Rightward) */
.dialog-box-container {
  width: auto;
  position: relative;
}

.stage-dialog-bottom {
  position: fixed !important;
  bottom: 32px !important;
  left: clamp(260px, 23vw, 410px) !important;
  right: auto !important;
  width: auto !important;
  max-width: calc(100vw - clamp(280px, 25vw, 430px)) !important;
  margin: 0 !important;
  z-index: 90 !important;
}

.dialog-box {
  background: rgba(14, 12, 20, 0.7);
  border: 2px solid var(--color-yellow);
  border-radius: 24px;
  padding: 22px 32px;
  position: relative;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6), var(--shadow-glow-yellow);
  min-height: 90px;
  min-width: 320px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-normal);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dialog-box:hover {
  border-color: #FFE680;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.75), 0 0 25px rgba(243, 205, 80, 0.6);
}

.dialog-box:focus-visible {
  outline: 3px solid var(--color-yellow);
  outline-offset: 4px;
}

.dialog-header-badge {
  position: absolute;
  top: -16px;
  left: 32px;
  background: var(--color-yellow);
  color: var(--color-dark-bg);
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 0.95rem;
  padding: 4px 18px;
  border-radius: 12px;
  letter-spacing: 1.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
}

.dialog-text {
  font-family: var(--font-body);
  font-size: 1.3rem;
  line-height: 1.5;
  color: #FFFFFF;
  min-height: 2.6rem;
}

.dialog-advance-hint {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  color: var(--color-yellow);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  opacity: 0.9;
  animation: dialogHintBounce 1.5s infinite ease-in-out;
}

@keyframes dialogHintBounce {

  0%,
  100% {
    transform: translateY(0);
    opacity: 0.75;
  }

  50% {
    transform: translateY(3px);
    opacity: 1;
    text-shadow: 0 0 8px rgba(243, 205, 80, 0.9);
  }
}

/* Stage Corner Character (1.25x size, 75% opacity yellow-corner-triangle.svg behind Character Still) */
.stage-corner-character {
  position: fixed;
  bottom: 0;
  left: 0;
  width: clamp(250px, 22vw, 400px);
  height: clamp(250px, 22vw, 400px);
  pointer-events: none;
  z-index: 50;
}

.corner-vector-bg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
  opacity: 0.75;
  /* 50% opaque */
}

.corner-char-img {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 95%;
  height: 95%;
  object-fit: contain;
  object-position: bottom left;
  z-index: 2;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.7));
}

/* color: var(--color-text-light); */

/* FOUNDATIONAL GOLD-TO-GREEN ELLIPSE TRANSITION BUTTON */
.btn-foundational-gold,
.btn-primary {
  font-family: var(--font-title);
  background-color: var(--color-yellow, #F3CD50);
  color: var(--color-dark-bg, #16141C);
  border: none;
  padding: 13px 36px;
  font-size: 1.15rem;
  font-weight: bold;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  z-index: 1;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, color 0.3s ease;
}

/* Top-to-Bottom Expanding Green Ellipse Sweep */
.btn-foundational-gold::before,
.btn-primary::before {
  content: '';
  position: absolute;
  top: -120%;
  left: -20%;
  width: 140%;
  height: 240%;
  background: var(--color-teal, #2E9E85);
  border-radius: 50%;
  transform: translateY(-50%) scale(0.6);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  z-index: -1;
  pointer-events: none;
}

.btn-foundational-gold:hover::before,
.btn-primary:hover::before {
  transform: translateY(28%) scale(1.1);
  opacity: 1;
}

.btn-foundational-gold:hover,
.btn-primary:hover {
  transform: translateY(-2px) scale(1.04);
  color: #FFFFFF;
  box-shadow: 0 8px 25px rgba(46, 158, 133, 0.6);
}

.btn-foundational-gold:active,
.btn-primary:active {
  transform: translateY(1px) scale(0.98);
}

/* OVERLAY & MODALS (Req #2 - Key Obtained & Instructions Popups) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--color-dark-bg);
  border: 2px solid var(--color-yellow);
  border-radius: 28px;
  padding: 40px;
  max-width: 580px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), var(--shadow-glow-yellow);
  text-align: center;
  position: relative;
  animation: modalSlideUp 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

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

.modal-title {
  font-family: var(--font-title);
  font-size: 2.1rem;
  color: var(--color-yellow);
  margin-bottom: 16px;
  text-shadow: 0 0 15px rgba(243, 205, 80, 0.5);
}

.modal-body {
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 28px;
  color: var(--color-text-muted);
}

/* Responsive HUD Bar & Dialog Styles */
@media (max-width: 820px) {
  .game-hud {
    width: calc(100% - 24px);
    top: 10px;
    gap: 8px;
  }

  .hud-stage-info {
    padding: 6px 14px;
  }

  .hud-stage-title {
    font-size: 0.92rem;
  }

  .hud-stage-subtitle {
    display: none;
  }

  .hud-keys {
    padding: 6px 12px;
    gap: 6px;
  }

  .key-slot {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  .hud-timer {
    padding: 6px 14px;
    font-size: 1.05rem;
    gap: 6px;
  }

  .stage-dialog-bottom {
    left: 16px !important;
    bottom: 16px !important;
    max-width: calc(100vw - 32px) !important;
  }
}

/* ==========================================================================
   AMBIENT COSMIC GLOW & STARS ANIMATION SYSTEM
   (Landing Page & Final Result Page)
   ========================================================================== */

.cosmic-ambient-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

#screen-landing .cosmic-ambient-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
}

#screen-result .cosmic-ambient-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
}

/* 1. ROTATING COSMIC RADIAL GRADIENT ORBS
   Purple starts at bottom-left (~225deg, 20% 80%) -> rotates to top-left
   Yellow starts at center-top (~90deg, 50% 12%) -> rotates to top-right
   Cyan starts at middle-right (~330deg, 85% 55%) -> rotates to bottom-center
   Continuous clockwise rotation like clock hands slowly */
.cosmic-rotator {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150vmax;
  height: 150vmax;
  margin-top: -75vmax;
  margin-left: -75vmax;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  animation: rotateClockwiseSlow 30s linear infinite;
  background:
    /* Purple orb: bottom-left */
    radial-gradient(circle at 20% 80%, rgba(133, 78, 180, 0.45) 0%, rgba(117, 39, 181, 0.24) 35%, rgba(22, 20, 28, 0) 65%),
    /* Yellow orb: center-top */
    radial-gradient(circle at 50% 12%, rgba(243, 205, 80, 0.34) 0%, rgba(242, 204, 79, 0.16) 35%, rgba(22, 20, 28, 0) 65%),
    /* Cyan orb: middle-right */
    radial-gradient(circle at 85% 55%, rgba(46, 158, 133, 0.4) 0%, rgba(46, 158, 133, 0.2) 35%, rgba(22, 20, 28, 0) 65%);
  filter: blur(45px);
}

@keyframes rotateClockwiseSlow {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* 2. STARS SVG OVERLAY WITH EASE-IN TRANSITION FROM TOP */
.stars-overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.stars-svg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
  pointer-events: none;
  transform-origin: center top;
}

.screen.active .stars-svg-img {
  animation: starsEaseInTop 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes starsEaseInTop {
  0% {
    opacity: 0;
    transform: translateY(-80px) scale(0.96);
  }

  50% {
    opacity: 0.9;
  }

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

/* 3. DYNAMIC TWINKLING & DRIFTING STARS */
.dynamic-stars-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.twinkle-star {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, #FFFFFF 25%, #F3CD50 65%, rgba(243, 205, 80, 0) 100%);
  box-shadow: 0 0 10px rgba(243, 205, 80, 0.9), 0 0 18px rgba(255, 255, 255, 0.7);
  will-change: transform, opacity;
  animation: starTwinklePulse var(--pulse-dur, 3s) ease-in-out infinite alternate,
    starFloatDrift var(--drift-dur, 8s) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
}

.twinkle-star.sparkle-cross {
  clip-path: polygon(50% 0%, 58% 38%, 100% 50%, 58% 62%, 50% 100%, 42% 62%, 0% 50%, 42% 38%);
  background: #F3CD50;
  box-shadow: 0 0 14px rgba(243, 205, 80, 1), 0 0 26px rgba(255, 245, 180, 0.8);
}

@keyframes starTwinklePulse {
  0% {
    transform: scale(0.35);
    opacity: 0.15;
  }

  50% {
    transform: scale(1.4);
    opacity: 1;
  }

  100% {
    transform: scale(0.65);
    opacity: 0.35;
  }
}

@keyframes starFloatDrift {
  0% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(var(--drift-x, 15px), var(--drift-y, -18px));
  }

  100% {
    transform: translate(calc(var(--drift-x, 15px) * -0.7), calc(var(--drift-y, -18px) * -0.7));
  }
}

/* Star Coordinate Layout & Motion Variances */
.star-1 {
  top: 12%;
  left: 8%;
  width: 14px;
  height: 14px;
  --pulse-dur: 2.8s;
  --drift-dur: 7s;
  --drift-x: 12px;
  --drift-y: -14px;
  --delay: 0s;
}

.star-2 {
  top: 22%;
  left: 88%;
  width: 10px;
  height: 10px;
  --pulse-dur: 3.5s;
  --drift-dur: 9s;
  --drift-x: -16px;
  --drift-y: 10px;
  --delay: 0.8s;
}

.star-3 {
  top: 38%;
  left: 16%;
  width: 18px;
  height: 18px;
  --pulse-dur: 4.2s;
  --drift-dur: 11s;
  --drift-x: 18px;
  --drift-y: 16px;
  --delay: 1.5s;
}

.star-4 {
  top: 48%;
  left: 84%;
  width: 12px;
  height: 12px;
  --pulse-dur: 3.1s;
  --drift-dur: 8s;
  --drift-x: -14px;
  --drift-y: -12px;
  --delay: 0.4s;
}

.star-5 {
  top: 65%;
  left: 10%;
  width: 16px;
  height: 16px;
  --pulse-dur: 3.8s;
  --drift-dur: 10s;
  --drift-x: 15px;
  --drift-y: -18px;
  --delay: 2.1s;
}

.star-6 {
  top: 78%;
  left: 92%;
  width: 14px;
  height: 14px;
  --pulse-dur: 2.6s;
  --drift-dur: 7.5s;
  --drift-x: -12px;
  --drift-y: 14px;
  --delay: 1.1s;
}

.star-7 {
  top: 18%;
  left: 52%;
  width: 8px;
  height: 8px;
  --pulse-dur: 4.5s;
  --drift-dur: 12s;
  --drift-x: 10px;
  --drift-y: 12px;
  --delay: 0.6s;
}

.star-8 {
  top: 58%;
  left: 46%;
  width: 12px;
  height: 12px;
  --pulse-dur: 3.3s;
  --drift-dur: 8.5s;
  --drift-x: -10px;
  --drift-y: -15px;
  --delay: 1.8s;
}

.star-9 {
  top: 85%;
  left: 32%;
  width: 16px;
  height: 16px;
  --pulse-dur: 2.9s;
  --drift-dur: 9.5s;
  --drift-x: 14px;
  --drift-y: 10px;
  --delay: 2.4s;
}

.star-10 {
  top: 28%;
  left: 34%;
  width: 10px;
  height: 10px;
  --pulse-dur: 3.6s;
  --drift-dur: 8s;
  --drift-x: -15px;
  --drift-y: 16px;
  --delay: 1.3s;
}

.star-11 {
  top: 72%;
  left: 68%;
  width: 20px;
  height: 20px;
  --pulse-dur: 4.0s;
  --drift-dur: 10.5s;
  --drift-x: 16px;
  --drift-y: -14px;
  --delay: 0.2s;
}

.star-12 {
  top: 92%;
  left: 76%;
  width: 12px;
  height: 12px;
  --pulse-dur: 3.2s;
  --drift-dur: 8s;
  --drift-x: -12px;
  --drift-y: -10px;
  --delay: 1.9s;
}

/* ==========================================================================
   TOP SCROLL PROGRESS INDICATOR
   ========================================================================== */
#scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3.5px;
  background: var(--gradient-scroll-bar, linear-gradient(90deg, #854EB4 0%, #2E9E85 50%, #F3CD50 100%));
  box-shadow: 0 0 10px rgba(133, 78, 180, 0.8), 0 0 16px rgba(243, 205, 80, 0.7);
  z-index: 9999;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
  transition: width 0.1s cubic-bezier(0.1, 0.9, 0.2, 1);
}


/* ==========================================================================
   FLOATING SMOOTH BACK TO TOP BUTTON (Circular Shape)
   ========================================================================== */
.floating-back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  aspect-ratio: 1 / 1 !important;
  background: rgba(22, 20, 28, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid var(--color-yellow);
  color: var(--color-yellow);
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 150;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(243, 205, 80, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s,
              background 0.2s,
              border-color 0.2s,
              box-shadow 0.2s;
  outline: none;
  overflow: hidden;
}


.floating-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.floating-back-to-top:hover {
  background: var(--color-yellow);
  color: var(--color-dark-bg);
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7), 0 0 24px rgba(243, 205, 80, 0.8);
}

.floating-back-to-top:active {
  transform: translateY(0) scale(0.95);
}

.floating-back-to-top:focus-visible {
  outline: 3px solid var(--color-yellow);
  outline-offset: 4px;
}

.floating-back-to-top svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.floating-back-to-top:hover svg {
  transform: translateY(-2px);
}

.floating-arrow-char {
  font-family: var(--font-mono, monospace), system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.floating-back-to-top:hover .floating-arrow-char {
  transform: translateY(-3px);
}


/* ==========================================================================
   ACCESSIBILITY: PREFERS-REDUCED-MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html,
  body,
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}