﻿/* ==========================================================================
   AAA-GRADE LIQUID OPTICS, SPECULAR HIGHLIGHTS & DYNAMIC GLASSPHYSICS
   ========================================================================== */

/* 1. Photorealistic Smooth Cross-Fading Background Layers (0.8s transition) */
.theme-bg-layer {
  position: fixed;
  top: -5%;
  left: -5%;
  width: 110vw;
  height: 110vh;
  z-index: -3;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s ease;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: opacity, transform;
}

.theme-bg-layer.active {
  opacity: 1;
  visibility: visible;
}

.theme-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
}

.bg-stargazer.active .theme-bg-img {
  animation: spaceCosmicDrift 35s ease-in-out infinite alternate;
}

.bg-aqua.active .theme-bg-img {
  animation: oceanCinematicDrift 28s ease-in-out infinite alternate;
}

.bg-arctic.active .theme-bg-img {
  animation: arcticAtmosphericDrift 32s ease-in-out infinite alternate;
}

@keyframes spaceCosmicDrift {
  0% { transform: scale(1.0) translate3d(0, 0, 0); }
  50% { transform: scale(1.05) translate3d(-1.5%, -1.2%, 0); }
  100% { transform: scale(1.02) translate3d(1.2%, 1.0%, 0); }
}

@keyframes oceanCinematicDrift {
  0% { transform: scale(1.0) translate3d(0, 0, 0); }
  50% { transform: scale(1.04) translate3d(-1.5%, 1.2%, 0); }
  100% { transform: scale(1.02) translate3d(1.2%, -1.0%, 0); }
}

@keyframes arcticAtmosphericDrift {
  0% { transform: scale(1.0) translate3d(0, 0, 0); }
  50% { transform: scale(1.03) translate3d(1.2%, -1.0%, 0); }
  100% { transform: scale(1.05) translate3d(-1.0%, 1.2%, 0); }
}

body {
  position: relative;
  background-color: #020712 !important;
  overflow-x: hidden;
  transition: background-color 0.8s ease;
}

body::before {
  display: none !important;
}

/* 2. HTML5 Canvas Layer (VFX Caustics, Fluid Ripples, Snow & Stars) */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -1;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: transform;
}

/* ==========================================================================
   3. OPTICAL LIQUID GLASSMORPHISM WITH SPECULAR CURVED EDGES
   ========================================================================== */

/* Universal Bevelled Edge Glass Glow */
.glass-panel,
.board-wrap,
.score-box,
.stat-box,
.how-to,
.icon-btn,
.boost-btn,
.lb-card {
  transition: all 0.35s cubic-bezier(0.25, 1, 0.5, 1) !important;
  border-radius: 18px !important;
  position: relative;
}

/* Bevelled curved-glass reflection highlight on top-border */
.glass-panel::before,
.board-wrap::before,
.score-box::before,
.stat-box::before,
.icon-btn::before,
.boost-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.75) 50%, rgba(255,255,255,0) 100%);
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.85;
}

/* --- THEME 1: STAR GAZER (Futuristic Deep Celestial Glass) --- */
[data-animated-theme="stargazer"] .board-wrap,
[data-animated-theme="stargazer"] .score-box,
[data-animated-theme="stargazer"] .stat-box,
[data-animated-theme="stargazer"] .how-to,
[data-animated-theme="stargazer"] .icon-btn,
[data-animated-theme="stargazer"] .boost-btn,
[data-animated-theme="stargazer"] .lb-card {
  background: rgba(12, 17, 34, 0.48) !important;
  backdrop-filter: blur(18px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(190%) !important;
  border: 1.2px solid rgba(192, 132, 252, 0.38) !important;
  box-shadow: 0 16px 45px rgba(3, 5, 18, 0.75), 0 0 25px rgba(168, 85, 247, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.3) !important;
}

[data-animated-theme="stargazer"] .board-wrap {
  border-radius: 24px !important;
  border: 1.5px solid rgba(192, 132, 252, 0.5) !important;
  box-shadow: 0 24px 60px rgba(3, 4, 15, 0.85), 0 0 40px rgba(168, 85, 247, 0.35), inset 0 2px 2px rgba(255, 255, 255, 0.35) !important;
}

[data-animated-theme="stargazer"] .cell-bg {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(192, 132, 252, 0.12) !important;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* --- THEME 2: AQUA DRIFT (Liquid Optical Glass with Underwater Refraction) --- */
[data-animated-theme="aqua"] .board-wrap,
[data-animated-theme="aqua"] .score-box,
[data-animated-theme="aqua"] .stat-box,
[data-animated-theme="aqua"] .how-to,
[data-animated-theme="aqua"] .icon-btn,
[data-animated-theme="aqua"] .boost-btn,
[data-animated-theme="aqua"] .lb-card {
  background: rgba(255, 255, 255, 0.14) !important;
  backdrop-filter: blur(18px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(200%) !important;
  border: 1.2px solid rgba(255, 255, 255, 0.42) !important;
  box-shadow: 0 16px 45px rgba(0, 35, 75, 0.6), 0 0 25px rgba(0, 240, 255, 0.22), inset 0 1px 1px rgba(255, 255, 255, 0.45) !important;
}

[data-animated-theme="aqua"] .board-wrap {
  border-radius: 24px !important;
  background: rgba(10, 42, 80, 0.32) !important;
  border: 1.5px solid rgba(0, 240, 255, 0.5) !important;
  box-shadow: 0 24px 60px rgba(0, 20, 50, 0.7), 0 0 40px rgba(0, 240, 255, 0.32), inset 0 2px 2px rgba(255, 255, 255, 0.5) !important;
}

[data-animated-theme="aqua"] .cell-bg {
  background: rgba(255, 255, 255, 0.09) !important;
  border: 1px solid rgba(0, 240, 255, 0.15) !important;
  box-shadow: inset 0 2px 8px rgba(0, 15, 35, 0.4) !important;
}

/* --- THEME 3: ARCTIC DRIFT (Glacial Ice Texture with Crystal Frosting) --- */
[data-animated-theme="arctic"] .board-wrap,
[data-animated-theme="arctic"] .score-box,
[data-animated-theme="arctic"] .stat-box,
[data-animated-theme="arctic"] .how-to,
[data-animated-theme="arctic"] .icon-btn,
[data-animated-theme="arctic"] .boost-btn,
[data-animated-theme="arctic"] .lb-card {
  background: rgba(240, 249, 255, 0.18) !important;
  backdrop-filter: blur(18px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(160%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.7) !important;
  box-shadow: 0 16px 45px rgba(15, 35, 65, 0.6), 0 0 25px rgba(56, 189, 248, 0.32), inset 0 1px 2px rgba(255, 255, 255, 0.6) !important;
}

[data-animated-theme="arctic"] .board-wrap {
  border-radius: 24px !important;
  background: rgba(186, 230, 253, 0.14) !important;
  border: 2px solid rgba(255, 255, 255, 0.85) !important;
  box-shadow: 0 24px 60px rgba(10, 25, 45, 0.75), 0 0 45px rgba(186, 230, 253, 0.45), inset 0 2px 3px rgba(255, 255, 255, 0.7) !important;
}

[data-animated-theme="arctic"] .cell-bg {
  background: rgba(255, 255, 255, 0.16) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  box-shadow: inset 0 2px 8px rgba(10, 30, 60, 0.25) !important;
}

/* ==========================================================================
   4. PHOTOREALISTIC 3D BEVELLED TILES WITH INNER SPECULAR SHEEN
   ========================================================================== */
.tile-inner {
  border-radius: 14px !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1.5px 1px rgba(255, 255, 255, 0.65) !important;
}

/* Specular diagonal glass sheen across tiles */
.tile-inner::after {
  content: "";
  position: absolute;
  top: 0;
  left: -20%;
  width: 140%;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.05) 70%, rgba(255, 255, 255, 0) 100%);
  border-radius: 14px 14px 0 0;
  pointer-events: none;
}

.v1 {
  background: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.7) !important;
  box-shadow: 0 4px 16px rgba(0, 150, 255, 0.3), inset 0 1px 1px #fff !important;
}

.v2 {
  background: rgba(56, 189, 248, 0.42) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(186, 230, 253, 0.85) !important;
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.45), inset 0 1px 1px #fff !important;
}

.v4 {
  background: rgba(20, 184, 166, 0.48) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(153, 246, 228, 0.9) !important;
  box-shadow: 0 4px 20px rgba(20, 184, 166, 0.5), inset 0 1px 1px #fff !important;
}

.v8 {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.9), rgba(234, 88, 12, 0.95)) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(254, 215, 170, 0.95) !important;
  box-shadow: 0 0 26px rgba(249, 115, 22, 0.75), inset 0 1px 1px rgba(255,255,255,0.7) !important;
}

.v16 {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.92), rgba(225, 29, 72, 0.96)) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(254, 205, 211, 0.95) !important;
  box-shadow: 0 0 28px rgba(244, 63, 94, 0.8), inset 0 1px 1px rgba(255,255,255,0.7) !important;
}

.v32 {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.92), rgba(124, 58, 237, 0.96)) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(233, 213, 255, 0.95) !important;
  box-shadow: 0 0 28px rgba(168, 85, 247, 0.8), inset 0 1px 1px rgba(255,255,255,0.7) !important;
}

.v64 {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.94), rgba(14, 165, 233, 0.97)) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(165, 243, 252, 0.98) !important;
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.88), inset 0 1px 1px #fff !important;
}

.v128 {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.94), rgba(5, 150, 105, 0.97)) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(167, 243, 208, 0.98) !important;
  box-shadow: 0 0 32px rgba(16, 185, 129, 0.88), inset 0 1px 1px #fff !important;
}

.v256 {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.94), rgba(217, 119, 6, 0.98)) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(254, 240, 138, 0.98) !important;
  box-shadow: 0 0 34px rgba(245, 158, 11, 0.9), inset 0 1px 1px #fff !important;
}

.v512 {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(67, 56, 202, 0.98)) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(199, 210, 254, 0.98) !important;
  box-shadow: 0 0 36px rgba(99, 102, 241, 0.92), inset 0 1px 1px #fff !important;
}

.v1024 {
  background: linear-gradient(135deg, #00f0ff 0%, #0284c7 50%, #f59e0b 100%) !important;
  color: #ffffff !important;
  border: 2.5px solid #ffffff !important;
  box-shadow: 0 0 48px 12px rgba(0, 240, 255, 0.95), inset 0 2px 2px #fff !important;
  animation: winPulse 1.5s infinite alternate !important;
}

/* 5. Top Theme Tabs */
.theme-switch-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  width: 100%;
}

.theme-toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1.2px solid rgba(255, 255, 255, 0.35);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 32px rgba(0, 35, 75, 0.45);
}

.theme-toggle-btn:hover {
  transform: translate3d(0, -2px, 0);
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.6);
  color: #ffffff;
}

.theme-toggle-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.28);
}

.theme-toggle-btn[data-theme="stargazer"].active {
  border-color: #c084fc;
  box-shadow: 0 0 24px rgba(192, 132, 252, 0.75), inset 0 0 10px rgba(192, 132, 252, 0.4);
}

.theme-toggle-btn[data-theme="aqua"].active {
  border-color: #00f0ff;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.75), inset 0 0 10px rgba(0, 240, 255, 0.4);
}

.theme-toggle-btn[data-theme="arctic"].active {
  border-color: #38bdf8;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.75), inset 0 0 10px rgba(56, 189, 248, 0.4);
}

.icon-btn {
  border-radius: 16px !important;
}

.boost-btn {
  border-radius: 999px !important;
}

@media (max-width: 480px) {
  .theme-toggle-btn {
    padding: 9px 5px;
    font-size: 10px;
    letter-spacing: 0.5px;
    gap: 4px;
  }
}
