/* ═══════════════════════════════════════════
   SPINORA QUEST – Premium Candy Adventure UI
   ═══════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --pink:    #ff2d78;
  --pink-l:  #ff6fab;
  --gold:    #ffd700;
  --gold-l:  #ffe66d;
  --purple:  #7b2fff;
  --deep:    #120024;
  --deep2:   #1e0040;
  --mint:    #00e5cc;
  --white:   #ffffff;
  --glass:   rgba(255,255,255,0.08);
  --glass-b: rgba(255,255,255,0.15);

  --font-display: 'Fredoka One', cursive;
  --font-body:    'Nunito', sans-serif;

  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --shadow-glow-pink:   0 0 40px rgba(255,45,120,0.55), 0 0 80px rgba(255,45,120,0.25);
  --shadow-glow-gold:   0 0 30px rgba(255,215,0,0.5);
  --shadow-card:        0 24px 60px rgba(0,0,0,0.5);
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--deep);
  color: var(--white);
}

/* ── Canvas Particles ── */
#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── App Container ── */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hidden { display: none !important; }

/* ═══════════════════════════════════════════
   SPLASH SCREEN
   ═══════════════════════════════════════════ */
#splash {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100svh;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, #2d0060 0%, var(--deep) 70%);
  overflow: hidden;
  animation: splashIn 0.6s ease both;
}

@keyframes splashIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  z-index: 2;
}

/* ── Logo Ring ── */
.logo-ring {
  position: relative;
  width: 180px;
  height: 180px;
  margin-bottom: 36px;
  animation: floatBob 3.5s ease-in-out infinite;
}

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

.logo-glow {
  position: absolute;
  inset: -10px;
  border-radius: 38px;
  background: conic-gradient(from 0deg, var(--pink), var(--gold), var(--purple), var(--mint), var(--pink));
  animation: spinRing 3s linear infinite;
  filter: blur(8px);
  opacity: 0.85;
}

@keyframes spinRing {
  to { transform: rotate(360deg); }
}

.logo-icon {
  position: absolute;
  inset: 6px;
  border-radius: 30px;
  overflow: hidden;
  background: var(--deep);
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 24px;
  display: block;
}

/* ── Brand ── */
.brand {
  text-align: center;
  margin-bottom: 40px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 10vw, 60px);
  line-height: 1;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--gold-l) 0%, var(--pink-l) 40%, var(--mint) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255,215,0,0.4));
  animation: titleReveal 0.8s cubic-bezier(0.34,1.56,0.64,1) 0.3s both;
}

@keyframes titleReveal {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.brand-sub {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 8px;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
  animation: titleReveal 0.8s cubic-bezier(0.34,1.56,0.64,1) 0.45s both;
}

/* ── Loader ── */
.loader-wrap {
  width: min(260px, 72vw);
  animation: titleReveal 0.8s ease 0.6s both;
}

.loader-track {
  width: 100%;
  height: 12px;
  background: rgba(255,255,255,0.12);
  border-radius: 100px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}

.loader-fill {
  height: 100%;
  width: 0%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--purple), var(--pink), var(--gold));
  transition: width 0.15s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-glow-pink);
}

.shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  animation: shimmerSlide 1.2s ease-in-out infinite;
}

@keyframes shimmerSlide {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

.loader-label {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.5px;
  min-height: 20px;
}

/* ═══════════════════════════════════════════
   HOME / DASHBOARD
   ═══════════════════════════════════════════ */
#home {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100svh;
  overflow: hidden;
}

.home-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 100% 70% at 50% 0%,   rgba(123,47,255,0.35) 0%, transparent 60%),
    radial-gradient(ellipse 70%  60% at 80% 90%,   rgba(255,45,120,0.3) 0%, transparent 55%),
    radial-gradient(ellipse 60%  50% at 10% 80%,   rgba(0,229,204,0.2) 0%, transparent 50%),
    var(--deep);
}

.home-card {
  position: relative;
  z-index: 2;
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-b);
  border-radius: var(--radius-lg);
  padding: 44px 36px 36px;
  width: min(340px, 88vw);
  text-align: center;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.15);
  animation: cardPop 0.7s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes cardPop {
  from { opacity: 0; transform: scale(0.85) translateY(30px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.home-icon-img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 24px;
  margin-bottom: 16px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  filter: drop-shadow(0 8px 24px rgba(255,215,0,0.5));
  animation: floatBob 3s ease-in-out infinite;
}

.home-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 7vw, 38px);
  background: linear-gradient(135deg, var(--gold-l), var(--pink-l));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.home-desc {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  margin-bottom: 32px;
}

/* ── Start Button ── */
.btn-start {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 17px 28px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(255,45,120,0.5), 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 24px;
}

.btn-start:active {
  transform: scale(0.97);
  box-shadow: 0 4px 16px rgba(255,45,120,0.4);
}

.btn-icon {
  font-size: 14px;
  opacity: 0.9;
}

.btn-ripple {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transform: translateX(-100%);
  animation: btnShimmer 2.5s ease-in-out infinite 1s;
}

@keyframes btnShimmer {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

/* ── Badges ── */
.home-badges {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.14);
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════
   FLOATING CANDY DECORATIONS
   ═══════════════════════════════════════════ */
.candies {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.candy {
  position: absolute;
  font-size: clamp(18px, 4vw, 28px);
  opacity: 0;
  animation: floatCandy var(--dur, 8s) ease-in-out var(--delay, 0s) infinite;
  filter: drop-shadow(0 0 8px rgba(255,215,0,0.4));
}

.c1 { left: 8%;  --delay: 0s;    --dur: 7s;  --tx:  20px; }
.c2 { left: 20%; --delay: 1.2s;  --dur: 9s;  --tx: -15px; }
.c3 { left: 75%; --delay: 0.5s;  --dur: 8s;  --tx:  10px; }
.c4 { left: 88%; --delay: 2s;    --dur: 10s; --tx: -20px; }
.c5 { left: 45%; --delay: 3s;    --dur: 7.5s;--tx:  18px; }
.c6 { left: 60%; --delay: 0.8s;  --dur: 11s; --tx: -12px; }
.c7 { left: 33%; --delay: 1.8s;  --dur: 9.5s;--tx:  15px; }
.c8 { left: 55%; --delay: 4s;    --dur: 8.5s;--tx: -18px; }

@keyframes floatCandy {
  0%   { opacity: 0;   transform: translateY(100vh) translateX(0) rotate(0deg); }
  10%  { opacity: 0.7; }
  90%  { opacity: 0.5; }
  100% { opacity: 0;   transform: translateY(-10vh) translateX(var(--tx)) rotate(360deg); }
}

/* ═══════════════════════════════════════════
   IFRAME / WEBVIEW
   ═══════════════════════════════════════════ */
#web {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 10;
  background: var(--deep);
  animation: fadeIn 0.5s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ═══════════════════════════════════════════
   SCREEN-OUT TRANSITION
   ═══════════════════════════════════════════ */
.screen-out {
  animation: screenOut 0.4s cubic-bezier(0.4,0,1,1) forwards !important;
}

@keyframes screenOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.05); }
}

/* ═══════════════════════════════════════════
   RESPONSIVE TWEAKS
   ═══════════════════════════════════════════ */
@media (max-height: 600px) {
  .logo-ring    { width: 120px; height: 120px; margin-bottom: 16px; }
  .brand-title  { font-size: 36px; }
  .brand-sub    { letter-spacing: 5px; }
  .home-card    { padding: 28px 24px 24px; }
  .home-icon-img { width: 80px; height: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
