/* Reset + theme vars */
* {
  margin: 0;
  padding: 0;
}
body {
  background-color: var(--page-bg);
}
:root {
  --page-bg: rgb(178, 178, 178);
  --ui-bg: rgba(0, 0, 0, 0.75);
  --ui-hover: rgba(118, 118, 118, 0.9);
  --ui-border: rgba(255, 255, 255, 0.15);
  --ui-border-strong: rgba(255, 255, 255, 0.35);
  --card-bg: rgba(255, 255, 255, 0.86);
  --card-border: rgba(0, 0, 0, 0.12);
  --text-light: #fff;
  --text-light-muted: #ffffffc1;
  --text-dark: #111;
  --popup-close-bg: rgba(255, 255, 255, 0.9);
  --popup-close-hover: #fff;
  --surface-light: #fff;
  --backdrop-dark: #000;
}

/* Loading overlay */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--surface-light);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}
#loading-screen img {
  max-width: 100vh;
  position: relative;
}
#loading-text {
  position: absolute;
  top: 70%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-dark);
  font-size: 26px;
  font-weight: 500;
  background: transparent;
  font-family: "Orbitron", sans-serif;
}

/* Start CTA (appears after load) */
#startBtn {
  position: absolute;
  top: 73%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: var(--ui-bg);
  color: var(--text-light);
  font-size: 16px;
  font-family: "Orbitron", sans-serif;
  cursor: pointer;
  display: none;
  transition: background 0.2s, transform 0.15s;
  z-index: 2100;
  animation: pulseScale 1.2s ease-in-out infinite alternate;/* Gentle pulse to attract tap */
}
#startBtn:hover {
  background: var(--ui-hover);
  transform: translate(-50%, -50%) scale(1.05);
}

@keyframes pulseScale {
  from {
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    transform: translate(-50%, -50%) scale(1.08);
  }
}

/* Controls bar (top-right) */
.controls {
  position: fixed;
  top: 20px;
  right: 20px;
  flex-wrap: wrap;
  gap: 8px 10px;
  z-index: 10000;
  background: transparent;
  align-items: center;
  display: none;
}
.controls .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 20px;
  border: 1px solid var(--ui-border);
  background: var(--ui-bg);
  border-radius: 5px;
  color: var(--text-light-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
  backdrop-filter: blur(6px);
}
/* Hover/focus tuning to avoid stuck states */
.controls .btn:hover,
.color-picker:hover {
  background: var(--ui-hover);
  border-color: var(--ui-border-strong);
  transform: translateY(-1px);
}
.controls .btn:focus:not(:hover),
.color-picker:focus:not(:hover) {
  background: initial;
  border-color: initial;
  transform: none;
}
.controls .btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}
.controls .btn:focus {
  outline: none;
}
.controls .btn:focus:not(:hover) {
  background: var(--ui-bg);
  transform: none;
}

/* Color picker wrapper + native input */
.color-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 34px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-bg);
  color: var(--text-light);
  font-family: "Orbitron", sans-serif;
  font-size: 13px;
  cursor: pointer;
}
.color-picker input[type="color"] {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.color-picker input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-picker input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}
/* Inline reset */
.color-picker .reset-inside {
  margin-left: 6px;
  padding: 2px 6px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: aqua;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}
.color-picker .reset-inside:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Mode-based UI visibility */
body.demo-mode .controls .btn:not(#demoBtn) {
  display: none !important;
}
body.intro-mode .controls .btn:not(#startAnimBtn) {
  display: none !important;
}

/* Global fade (driven by GSAP) */
#fade {
  position: fixed;
  inset: 0;
  background: var(--backdrop-dark);
  opacity: 0;
  pointer-events: none;
  z-index: 1800;
}

/* WebGL canvas */
.canvas {
  position: fixed;
  left: 0;
  top: 0;
}

/* Pulsing hotspots (DOM overlay) */
.pulse {
  position: fixed;
  transform: translate(-50%, -50%);
  z-index: 999;
  display: none;
  cursor: pointer;
  background: transparent;
}
.pulse img {
  width: 28px;
  height: 28px;
  display: block;
  animation: pulse 1s infinite alternate;
}
@keyframes pulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.3);
  }
}
/* Hide during intro/demo */
body.ui-hide-pulses .pulse {
  display: none !important;
}

/* Popup card */
.popup {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  display: none;
  /* Sizing */
  width: clamp(260px, 86vw, 360px);
  max-height: none;
  overflow: visible;
  /* Look */
  padding: 14px 16px 18px;
  border-radius: 14px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  color: var(--text-dark);
  line-height: 1.45;
  font-size: 15px;
  z-index: 1000;
  user-select: text;
  /* Layout */
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Transitions */
  transition: opacity 0.18s ease, transform 0.18s ease;
  /* Transform origin follows arrow (set via CSS var) */
  transform-origin: var(--arrow-x, 50%) var(--origin-y, 100%);
  will-change: transform, opacity;
}
@keyframes pop-in-stable {
  from {
    opacity: 0;
    transform: translate(-50%, -100%) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
  }
}
.popup.appearing {
  animation: none !important;
}

/* Popup close button */
.popup .close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  font-size: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--popup-close-bg);
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  color: var(--text-dark);
  transition: transform 0.08s ease, background 0.12s ease;
}
.popup .close-btn:hover {
  transform: scale(1.06);
  background: var(--popup-close-hover);
}

/* Popup media/content */
.popup-image {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
}
#popup-content {
  flex: 1 1 auto;
  overflow: auto;
  padding: 8px 4px;
  background: transparent;
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translate(-50%, -96%) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
  }
}

/* Popup typography */
#popup-content {
  font-family: sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-dark);
}

/* Input focus/tap polish */
.controls .btn:active {
  transform: none;
}
.controls .btn:focus {
  outline: none;
  background: var(--ui-bg);
  transform: none;
}
.controls .btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}
.controls .btn {
  -webkit-tap-highlight-color: transparent;
}

/* Responsive: mobile */
@media (max-width: 768px) {
  .controls {
    top: 10px;
    right: 4%;
    left: auto;
    width: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 6px;
  }
  .controls .btn,
  .controls .color-picker {
    height: 36px;
    padding: 0 10px;
    font-size: 14px;
  }

  /* Popup scaled for small screens */
  .popup {
    width: min(60vw, 360px);
    max-height: 74vh;
    padding: 12px 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    gap: 8px;
  }
  .popup-image {
    max-height: 28vh;
    object-fit: contain;
  }
  #popup-content {
    max-height: 34vh;
    overflow: auto;
  }

  .popup .close-btn {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }

  /* Push CTA lower on tall mobiles */
  #startBtn {
    top: 75%;
  }
  #loading-text {
    top: 75%;
  }
}

.btn-buy{
  display:inline-block;
  padding:10px 16px;
  border-radius:12px;
  font-weight:600;
  text-decoration:none;
  background:#038cab;
  color:#fff;
  transition:transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn-buy:hover{ transform:translateY(-1px); box-shadow:0 6px 18px rgba(0,0,0,.22); }
.btn-buy:active{ transform:translateY(0); box-shadow:0 2px 8px rgba(0,0,0,.15); }




/* Responsive: mobile landscape */
@media (orientation: landscape) and (max-width: 920px) {
  .popup {
    width: min(52vw, 220px);
    max-height: 64vh;
    padding: 10px 12px;
    gap: 6px;
    
  }
  .popup-image {
    max-height: 35vh;
  }
  #popup-content {
    max-height: 30vh;
       font-size: 10px;
  }

.btn-buy {
  display: inline-block;    
  margin: 15px auto;         
  padding: 10px 16px;

  color: #fff;
  border-radius: 12px;
  width: fit-content;     
}


#loading-screen img {
    max-width: 150vh;
    top: -9%;
    position: relative;
}

  #startBtn {
    top: 77%;
  }
  .controls .btn {
      height: 32px;
    padding: 0 8px;
    font-size: 13px;

  }
}


/* Mobile portrait: 390px (iPhone 12/13/14) */
@media (orientation: portrait) and (max-width: 390px) {




/* ✅ test line – remove after confirming media query works*/  
/* 
    body {
    background-color: lime !important;
  }
*/
  



 .popup {
    width: min(70vw, 300px);
    max-height: 64vh;
    padding: 5px 12px;
    gap: 5px;
    
  }
  .popup-image {
    max-height: 50vh;
  }
  #popup-content {
    max-height: 30vh;
       font-size: 13px;
  }

.btn-buy {
  display: inline-block;    
  margin: 5px auto;         
  padding: 10px 16px;

  color: #fff;
  border-radius: 12px;
  width: fit-content;     
}


#loading-screen img {
    max-width: 100vh;
    top: -9%;
    position: relative;
}

#loading-text {
  position: absolute;
  top: 70%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-dark);
  font-size: 26px;
  font-weight: 500;
  background: transparent;
  font-family: "Orbitron", sans-serif;
}

  #startBtn {
    top: 70%;
  }

.color-picker,
.controls .btn {
  height: 36px;
  padding: 0 10px;
  font-size: 12px;
}

  
  }
