:root {
  /* Common variables */
  --font-family: 'Outfit', sans-serif;
  --transition-speed: 0.5s;
  
  /* Light Mode */
  --bg-color: #f0f4f8;
  --text-main: #1a202c;
  --text-muted: #4a5568;
  --accent-glow: rgba(56, 178, 172, 0.4);
  --cube-border: rgba(26, 32, 44, 0.2);
  --cube-bg: rgba(255, 255, 255, 0.8);
  --dot-color: #1a202c;
}

body.dark-mode {
  /* Dark Mode */
  --bg-color: #0b1120;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --cube-border: rgba(139, 92, 246, 0.5);
  --cube-bg: rgba(30, 41, 59, 0.7);
  --dot-color: #f8fafc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none; /* Prevent text selection */
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Background Effects */
.glass-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 50%, var(--bg-color) 0%, transparent 100%);
  z-index: -2;
}

.ambient-glow {
  position: absolute;
  width: 60vw;
  height: 60vw;
  background: var(--accent-glow);
  filter: blur(100px);
  border-radius: 50%;
  z-index: -1;
  animation: pulse-glow 8s infinite alternate ease-in-out;
}

@keyframes pulse-glow {
  0% { transform: scale(0.8) translate(-10%, -10%); opacity: 0.5; }
  100% { transform: scale(1.2) translate(10%, 10%); opacity: 0.8; }
}

/* Theme Toggle */
.theme-toggle {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: transparent;
  border: none;
  backdrop-filter: none;
  width: 3.5rem;
  height: 3.5rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-main);
  transition: all 0.3s ease;
  z-index: 10;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

.theme-toggle svg {
  position: absolute;
  width: 2.2rem;
  height: 2.2rem;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

/* Light Mode (Moon Icon visible) */
.theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.theme-toggle .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Dark Mode (Sun Icon visible) */
body.dark-mode .theme-toggle .sun-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

body.dark-mode .theme-toggle .moon-icon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

/* Main Content */
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

/* Typography & Floating Text */
.text-container {
  text-align: center;
  margin-top: 3rem;
}

.floating-text {
  font-size: clamp(3rem, 6vw, 6rem);
  font-weight: 900;
  letter-spacing: -2px;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  text-transform: uppercase;
}

.floating-text span {
  display: inline-block;
  background: linear-gradient(to right, var(--text-main), var(--text-muted));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: float 4s ease-in-out infinite;
  text-shadow: 0px 10px 20px rgba(0,0,0,0.1);
}

.floating-text span:nth-child(2) { animation-delay: 0.2s; }
.floating-text span:nth-child(3) { animation-delay: 0.4s; }
.floating-text span:nth-child(4) { animation-delay: 0.6s; }

@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(2deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

.subtitle {
  margin-top: 1rem;
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 2px;
  animation: fade-in-up 1s ease-out 1s both;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 3D Dice Animation */
.cube-container {
  width: 150px;
  height: 150px;
  perspective: 1000px;
  margin-bottom: 2rem;
}

.cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  /* Animation handled by JS for interactivity */
}

.face {
  position: absolute;
  width: 150px;
  height: 150px;
  background: var(--cube-bg);
  border: 2px solid var(--cube-border);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 20px var(--accent-glow) inset;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 20px;
  transition: all var(--transition-speed) ease;
}

/* Cube Transforms */
.front  { transform: rotateY(  0deg) translateZ(75px); }
.back   { transform: rotateY(180deg) translateZ(75px); }
.right  { transform: rotateY( 90deg) translateZ(75px); }
.left   { transform: rotateY(-90deg) translateZ(75px); }
.top    { transform: rotateX( 90deg) translateZ(75px); }
.bottom { transform: rotateX(-90deg) translateZ(75px); }

/* Dots Alignment */
.dot {
  width: 20px;
  height: 20px;
  background: var(--dot-color);
  border-radius: 50%;
  align-self: center;
  justify-self: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: background var(--transition-speed) ease;
}

/* Positions using Grid */
.top-left { grid-column: 1; grid-row: 1; }
.top-right { grid-column: 3; grid-row: 1; }
.middle-left { grid-column: 1; grid-row: 2; }
.middle-center { grid-column: 2; grid-row: 2; }
.middle-right { grid-column: 3; grid-row: 2; }
.bottom-left { grid-column: 1; grid-row: 3; }
.bottom-right { grid-column: 3; grid-row: 3; }

/* 3D Roll Keyframes */
@keyframes roll {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  100% { transform: rotateX(720deg) rotateY(360deg) rotateZ(360deg); }
}

@media (max-width: 768px) {
  .cube-container { width: 100px; height: 100px; }
  .face { width: 100px; height: 100px; padding: 10px; }
  .dot { width: 12px; height: 12px; }
  .front  { transform: rotateY(  0deg) translateZ(50px); }
  .back   { transform: rotateY(180deg) translateZ(50px); }
  .right  { transform: rotateY( 90deg) translateZ(50px); }
  .left   { transform: rotateY(-90deg) translateZ(50px); }
  .top    { transform: rotateX( 90deg) translateZ(50px); }
  .bottom { transform: rotateX(-90deg) translateZ(50px); }
}

