/* ============================================================
   SWEET CASCADE — Premium iGaming UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0b0015;
  --bg2:        #130025;
  --surface:    #1e0035;
  --surface2:   #2a004a;
  --border:     rgba(180, 80, 255, 0.18);
  --border-hi:  rgba(255, 79, 203, 0.55);
  --accent:     #e040fb;
  --accent2:    #7c4dff;
  --gold:       #ffd600;
  --gold2:      #ffab00;
  --green:      #00e676;
  --text:       #f0e6ff;
  --text-dim:   rgba(240,230,255,0.5);
  --radius:     16px;
  --radius-sm:  10px;
  --shadow-glow: 0 0 24px rgba(224, 64, 251, 0.25);
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Subtle star field background */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 65% 15%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 60%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 10% 75%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 85%, rgba(255,255,255,0.15) 0%, transparent 100%),
    radial-gradient(2px 2px at 55% 45%, rgba(255,255,255,0.15) 0%, transparent 100%),
    radial-gradient(ellipse at 50% 0%, rgba(120, 0, 180, 0.35) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(80, 0, 160, 0.2) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#particle-canvas {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 200;
}

#app { width: 100%; height: 100%; position: relative; z-index: 1; }

/* ---- Loading ---- */
#loading-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; gap: 18px;
  background: radial-gradient(ellipse at center, #2a005a 0%, #0b0015 70%);
}
.load-logo {
  font-size: 76px;
  animation: float-spin 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255,214,0,0.6));
}
@keyframes float-spin {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  25%       { transform: rotate(90deg) translateY(-6px); }
  50%       { transform: rotate(180deg) translateY(0); }
  75%       { transform: rotate(270deg) translateY(-6px); }
}
.load-title {
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  font-weight: 900; letter-spacing: 5px;
  background: linear-gradient(90deg, #e040fb, #ffd600, #e040fb);
  background-size: 200% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: shine-text 2s linear infinite;
}
@keyframes shine-text {
  to { background-position: 200% center; }
}
.load-bar {
  width: 55%; max-width: 260px; height: 5px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
#load-progress {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #7c4dff, #e040fb, #ffd600);
  border-radius: 3px;
  transition: width 0.1s;
  box-shadow: 0 0 10px rgba(224,64,251,0.6);
}

/* ---- Game Screen ---- */
#game-screen {
  display: flex; flex-direction: column;
  height: 100%;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(100, 0, 180, 0.5) 0%, transparent 55%),
    radial-gradient(ellipse at 0% 100%, rgba(60, 0, 120, 0.3) 0%, transparent 45%),
    var(--bg);
}
#game-screen.hidden { display: none; }

/* ---- Header ---- */
#header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,0.45);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  backdrop-filter: blur(12px);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #e040fb, #7c4dff);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 900;
  box-shadow: 0 0 12px rgba(224,64,251,0.4);
  border: 1.5px solid rgba(255,255,255,0.15);
}
.user-name {
  font-size: 13px; font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--text);
}
.balance-label {
  font-size: 9px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1.5px;
}
.balance-amount {
  font-size: clamp(1.2rem, 4.5vw, 1.7rem);
  font-weight: 900; color: var(--gold);
  text-shadow: 0 0 14px rgba(255,214,0,0.55);
  letter-spacing: 0.5px;
}

/* ---- FS Banner ---- */
#fs-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 7px 12px; font-size: 13px; font-weight: 800;
  background: linear-gradient(90deg, #4a0080, #7c4dff, #e040fb, #7c4dff, #4a0080);
  background-size: 300% auto;
  animation: banner-slide 3s linear infinite;
  border-bottom: 1px solid rgba(224,64,251,0.3);
  flex-shrink: 0;
}
#fs-banner.hidden { display: none; }
@keyframes banner-slide { to { background-position: -300% center; } }
.fs-label { font-size: 10px; opacity: 0.8; letter-spacing: 1.5px; text-transform: uppercase; }
.fs-sep { opacity: 0.4; }
#fs-mult { color: var(--gold); font-size: 15px; font-weight: 900; }

/* ---- Grid Wrapper ---- */
#grid-wrap {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 8px;
}

/* Grid frame decoration */
#grid-wrap::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 20px;
  background: radial-gradient(ellipse at 50% 0%, rgba(100,0,180,0.18) 0%, transparent 65%);
  pointer-events: none;
}

#game-canvas {
  display: block;
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(180,80,255,0.2),
    0 0 40px rgba(120,0,200,0.3),
    0 8px 32px rgba(0,0,0,0.6);
}

/* ---- Win Overlay ---- */
#win-overlay {
  position: absolute; bottom: 14px; left: 50%;
  transform: translateX(-50%);
  text-align: center; pointer-events: none;
}
#win-overlay.hidden { display: none; }
.win-label {
  font-size: 10px; letter-spacing: 3px;
  text-transform: uppercase; color: var(--text-dim);
}
#win-amount {
  font-size: clamp(1.8rem, 6.5vw, 2.8rem);
  font-weight: 900; color: var(--gold);
  text-shadow: 0 0 20px rgba(255,214,0,0.8), 0 2px 8px rgba(0,0,0,0.6);
  animation: pop-in 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes pop-in {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ---- Big Win Overlay ---- */
#bigwin-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(5, 0, 15, 0.88);
  z-index: 50;
  backdrop-filter: blur(4px);
}
#bigwin-overlay.hidden { display: none; }
#bigwin-label {
  font-size: clamp(2.6rem, 11vw, 4.5rem);
  font-weight: 900; letter-spacing: 4px;
  animation: rainbow 0.7s linear infinite;
  text-shadow: 0 0 30px currentColor;
  text-transform: uppercase;
}
@keyframes rainbow {
  0%  { color: #e040fb }
  25% { color: #ffd600 }
  50% { color: #00e676 }
  75% { color: #00b0ff }
  100%{ color: #e040fb }
}
#bigwin-amount {
  font-size: clamp(2.2rem, 8.5vw, 3.4rem);
  font-weight: 900; color: var(--gold);
  text-shadow: 0 0 24px rgba(255,214,0,0.9), 0 2px 12px rgba(0,0,0,0.6);
  margin-top: 10px;
}

/* ---- Modals ---- */
.hidden { display: none !important; }

#fs-intro, #fs-end, #buy-confirm {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,0,15,0.88);
  z-index: 60;
  backdrop-filter: blur(6px);
}
.modal-box {
  background: linear-gradient(160deg, #220040 0%, #0e0022 100%);
  border: 1px solid var(--border-hi);
  border-radius: 24px;
  padding: 30px 26px;
  text-align: center;
  max-width: 310px; width: 90%;
  box-shadow: 0 0 60px rgba(224,64,251,0.3), 0 20px 60px rgba(0,0,0,0.7);
  position: relative;
  overflow: hidden;
}
.modal-box::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,79,203,0.8), transparent);
}
.modal-title {
  font-size: clamp(1.4rem, 5.5vw, 2rem);
  font-weight: 900; margin-bottom: 12px;
  background: linear-gradient(90deg, #e040fb, #ffd600);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.modal-sub {
  font-size: 1.15rem; font-weight: 800;
  color: var(--gold); margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(255,214,0,0.4);
}
.modal-hint {
  font-size: 0.82rem; color: var(--text-dim);
  margin-bottom: 20px; line-height: 1.5;
}
.modal-btn {
  background: linear-gradient(135deg, #e040fb, #7c4dff);
  border: none; border-radius: 50px;
  color: #fff; font-size: 1rem; font-weight: 900;
  padding: 13px 32px; cursor: pointer;
  letter-spacing: 1.5px;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 4px 20px rgba(224,64,251,0.45), 0 2px 6px rgba(0,0,0,0.4);
}
.modal-btn:active { transform: scale(0.95); box-shadow: 0 2px 10px rgba(224,64,251,0.3); }
.modal-btn.secondary {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: none; margin-left: 10px;
}
.modal-row { display: flex; justify-content: center; }

/* ---- Controls ---- */
#controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,0.5);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  gap: 8px;
}
.ctrl-panel { text-align: center; min-width: 70px; }
.ctrl-label {
  font-size: 9px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.ctrl-value {
  font-size: clamp(0.95rem, 3.5vw, 1.15rem);
  font-weight: 800; color: var(--text);
}
.ctrl-row { display: flex; align-items: center; gap: 8px; justify-content: center; }
.bet-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff; font-size: 18px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, transform 0.1s;
  font-family: inherit;
}
.bet-btn:active { background: rgba(224,64,251,0.35); transform: scale(0.9); }

#spin-btn {
  background: linear-gradient(135deg, #e040fb 0%, #7c4dff 100%);
  border: none; border-radius: 50px;
  color: #fff; font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 900; letter-spacing: 3px;
  padding: 14px 28px; cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 24px rgba(224,64,251,0.55), 0 0 0 1px rgba(255,255,255,0.1) inset;
  transition: transform 0.1s, box-shadow 0.1s;
  min-width: 110px;
  position: relative;
  overflow: hidden;
}
#spin-btn::before {
  content: '';
  position: absolute; top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  animation: shimmer 2.5s ease infinite;
}
@keyframes shimmer { to { left: 200%; } }
#spin-btn:active { transform: scale(0.94); box-shadow: 0 2px 12px rgba(224,64,251,0.4); }
#spin-btn:disabled {
  opacity: 0.45; cursor: not-allowed; transform: none;
}
#spin-btn:disabled::before { display: none; }

/* ---- Footer ---- */
#footer {
  display: flex; justify-content: space-around; align-items: center;
  padding: 7px 10px 10px;
  background: rgba(0,0,0,0.55);
  border-top: 1px solid rgba(180,80,255,0.1);
  flex-shrink: 0;
  gap: 6px;
}
.fb-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: var(--text); font-size: clamp(0.62rem, 2vw, 0.75rem);
  font-weight: 700; padding: 7px 10px;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.fb-btn:active { transform: scale(0.94); }
.fb-btn:hover  { background: rgba(224,64,251,0.12); border-color: rgba(224,64,251,0.3); }
.fb-btn.active {
  background: rgba(224,64,251,0.2);
  border-color: rgba(224,64,251,0.55);
  color: #e040fb;
  box-shadow: 0 0 10px rgba(224,64,251,0.2);
}

/* ---- Toast ---- */
#toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(22,0,40,0.96);
  border: 1px solid rgba(224,64,251,0.45);
  border-radius: 24px; padding: 10px 22px;
  font-size: 0.88rem; font-weight: 700;
  pointer-events: none; opacity: 0;
  transition: opacity 0.28s, transform 0.28s;
  z-index: 300; max-width: 85vw; text-align: center;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  letter-spacing: 0.3px;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Back button ---- */
.back-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: background 0.15s;
  flex-shrink: 0;
}
.back-btn:hover { background: rgba(224,64,251,0.2); color: #fff; }

/* ---- Intro Splash ---- */
#intro-splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.splash-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, #3a005a 0%, #0b0015 65%),
    radial-gradient(ellipse at 20% 80%, #1a003a 0%, transparent 50%);
}
.splash-candy-rain {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden;
}
.splash-candy {
  position: absolute; top: -60px;
  font-size: 1.8rem;
  animation: candy-fall linear infinite;
  opacity: 0.7;
}
@keyframes candy-fall {
  to { transform: translateY(110vh) rotate(360deg); }
}
.splash-content {
  position: relative; z-index: 1;
  text-align: center;
  padding: 0 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.splash-icon {
  font-size: 88px;
  animation: float-spin 2.8s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(255,214,0,0.7));
}
.splash-subtitle {
  font-size: 0.78rem; letter-spacing: 4px; font-weight: 800;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
}
.splash-title {
  font-size: clamp(2.4rem, 10vw, 3.6rem);
  font-weight: 900; line-height: 1;
  letter-spacing: 4px;
  background: linear-gradient(160deg, #fff 0%, #e040fb 40%, #ffd600 80%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(224,64,251,0.5));
}
.splash-desc {
  font-size: 0.9rem; color: rgba(255,255,255,0.55);
  font-weight: 600; letter-spacing: 0.5px;
}
.splash-maxwin {
  font-size: 0.88rem; font-weight: 800; color: #ffd600;
  background: rgba(255,214,0,0.1);
  border: 1px solid rgba(255,214,0,0.3);
  border-radius: 20px; padding: 5px 18px;
  letter-spacing: 1px;
}
.splash-maxwin span { font-size: 1.1rem; }
.splash-bar-wrap { width: 200px; }
.splash-bar {
  height: 5px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.splash-bar #load-progress {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #7c4dff, #e040fb, #ffd600);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(224,64,251,0.6);
  transition: width 0.15s;
}
.splash-loading-txt {
  font-size: 0.72rem; color: rgba(255,255,255,0.3);
  margin-top: 6px; letter-spacing: 1px;
  text-align: center;
}
