/* ===== CSS Variables & Design Tokens ===== */
:root {
  /* Colors */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #06b6d4;
  --accent: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;
  
  /* Neutrals */
  --bg-dark: #0f172a;
  --bg-medium: #1e293b;
  --bg-light: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  /* Glass morphism */
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== Animated Background ===== */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.floating-shape {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--primary), var(--secondary));
  opacity: 0.1;
  animation: float 20s infinite ease-in-out;
}

.shape-1 {
  width: 400px;
  height: 400px;
  top: -100px;
  left: -100px;
  animation-delay: 0s;
  background: linear-gradient(45deg, var(--primary), transparent);
}

.shape-2 {
  width: 300px;
  height: 300px;
  top: 50%;
  right: -150px;
  animation-delay: -5s;
  background: linear-gradient(45deg, var(--secondary), transparent);
}

.shape-3 {
  width: 200px;
  height: 200px;
  bottom: -50px;
  left: 30%;
  animation-delay: -10s;
  background: linear-gradient(45deg, var(--accent), transparent);
}

.shape-4 {
  width: 250px;
  height: 250px;
  top: 20%;
  left: 60%;
  animation-delay: -15s;
  background: linear-gradient(45deg, var(--primary-light), transparent);
}

.shape-5 {
  width: 350px;
  height: 350px;
  bottom: 20%;
  right: 10%;
  animation-delay: -8s;
  background: linear-gradient(45deg, var(--success), transparent);
}

.gradient-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(244, 63, 94, 0.05) 0%, transparent 30%);
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(50px, -50px) rotate(90deg);
  }
  50% {
    transform: translate(0, -100px) rotate(180deg);
  }
  75% {
    transform: translate(-50px, -50px) rotate(270deg);
  }
}

/* ===== Container & Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl);
  position: relative;
  z-index: 1;
}

/* ===== Header ===== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg) 0;
  margin-bottom: var(--space-xl);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-icon {
  font-size: 2rem;
  animation: spin 20s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  backdrop-filter: blur(10px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.status-badge span {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Hero Section ===== */
.hero {
  text-align: center;
  padding: var(--space-2xl) 0;
  margin-bottom: var(--space-2xl);
}

.hero-icon {
  margin-bottom: var(--space-xl);
}

.gear-animation {
  display: inline-flex;
  position: relative;
  font-size: 3rem;
}

.gear {
  display: inline-block;
  animation: rotate 4s linear infinite;
}

.gear-1 {
  color: var(--primary);
  animation-delay: 0s;
}

.gear-2 {
  color: var(--secondary);
  margin-left: -0.5rem;
  animation-delay: -1.3s;
}

.gear-3 {
  color: var(--accent);
  margin-left: -0.5rem;
  animation-delay: -2.6s;
  font-size: 2.5rem;
}

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

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ===== Glass Card ===== */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  box-shadow: var(--glass-shadow);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  overflow: hidden;
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--glass-border);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-badge {
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-radius: var(--radius-full);
  font-weight: 500;
}

/* ===== Interactive Section ===== */
.interactive-section {
  margin-bottom: var(--space-2xl);
}

.interactive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-xl);
}

/* ===== Clock Card ===== */
.clock-container {
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.analog-clock {
  position: relative;
}

.clock-face {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 8px solid var(--primary);
  position: relative;
  box-shadow: 
    0 0 0 4px var(--glass-border),
    0 20px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.clock-marks {
  position: absolute;
  width: 100%;
  height: 100%;
}

.mark {
  position: absolute;
  background: var(--text-secondary);
}

.mark-12, .mark-6 {
  width: 3px;
  height: 15px;
  left: 50%;
  transform: translateX(-50%);
}

.mark-12 { top: 15px; }
.mark-6 { bottom: 15px; }

.mark-3, .mark-9 {
  width: 15px;
  height: 3px;
  top: 50%;
  transform: translateY(-50%);
}

.mark-3 { right: 15px; }
.mark-9 { left: 15px; }

.clock-numbers {
  position: absolute;
  width: 100%;
  height: 100%;
}

.number {
  position: absolute;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.n12 { top: 30px; left: 50%; transform: translateX(-50%); }
.n3 { right: 30px; top: 50%; transform: translateY(-50%); }
.n6 { bottom: 30px; left: 50%; transform: translateX(-50%); }
.n9 { left: 30px; top: 50%; transform: translateY(-50%); }

.clock-hands {
  position: absolute;
  width: 100%;
  height: 100%;
}

.hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform-origin: bottom center;
  border-radius: 2px;
  z-index: 10;
}

.hour-hand {
  width: 6px;
  height: 50px;
  background: var(--text-primary);
  margin-left: -3px;
}

.minute-hand {
  width: 4px;
  height: 70px;
  background: var(--text-primary);
  margin-left: -2px;
}

.second-hand {
  width: 2px;
  height: 80px;
  background: var(--accent);
  margin-left: -1px;
}

.center-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent);
  border-radius: 50%;
  z-index: 20;
  box-shadow: 0 0 0 4px var(--bg-dark);
}

.digital-clock {
  text-align: center;
}

.time-text {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.date-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ===== Game Card ===== */
.game-container {
  padding: var(--space-lg);
}

.game-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
}

.stat {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-light);
  font-family: var(--font-mono);
}

.game-area {
  position: relative;
  height: 300px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.game-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-secondary);
}

.message-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.8;
}

.message-text {
  font-size: 0.875rem;
  line-height: 1.6;
}

.game-controls {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.game-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.game-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.game-btn:active:not(:disabled) {
  transform: translateY(0);
}

.game-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.game-btn.secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.game-btn.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-icon {
  font-size: 1.25rem;
}

.game-rules {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-sm);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
}

/* ===== Bubble Styles ===== */
.bubble {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, #a0eaff 40%, #4cc9ff 100%);
  box-shadow: 0 4px 15px rgba(76, 201, 255, 0.3);
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease;
}

.bubble:hover {
  transform: scale(1.1);
}

.bubble.popped {
  animation: pop 0.3s ease-out forwards;
}

@keyframes pop {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

@keyframes rise {
  0% {
    transform: translateY(0);
    opacity: 0.9;
  }
  100% {
    transform: translateY(-300px);
    opacity: 0.3;
  }
}

/* ===== Info Section ===== */
.info-section {
  margin-bottom: var(--space-2xl);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

.info-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  transition: all var(--transition-normal);
}

.info-card:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.info-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.info-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.info-value {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.info-value a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.info-value a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--glass-border);
}

.footer-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--primary-light);
}

.divider {
  color: var(--text-muted);
}

.footer-icp {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.icp-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.icp-text a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.icp-text a:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

.icp-divider {
  margin: 0 var(--space-sm);
  color: var(--text-muted);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .container {
    padding: var(--space-md);
  }
  
  .header {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }
  
  .interactive-grid {
    grid-template-columns: 1fr;
  }
  
  .clock-container {
    padding: var(--space-lg);
  }
  
  .clock-face {
    width: 160px;
    height: 160px;
  }
  
  .hour-hand { height: 40px; }
  .minute-hand { height: 55px; }
  .second-hand { height: 65px; }
  
  .game-area {
    height: 250px;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .game-controls {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .glass-card {
    border-radius: var(--radius-lg);
  }
  
  .card-header {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
  
  .game-stats {
    flex-direction: column;
    gap: var(--space-sm);
  }
  
  .icp-text {
    font-size: 0.7rem;
  }
  
  .footer-icp {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
  }
}

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

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: var(--primary);
  color: white;
}