@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
  /* Light Mode Palette - Airy & Vibrant */
  --bg-color: #f8fafc;
  --bg-gradient: radial-gradient(circle at 10% 0%, rgba(56, 189, 248, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 90% 10%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 50% 100%, rgba(236, 72, 153, 0.1) 0%, transparent 50%),
                var(--bg-color);
  
  --surface: rgba(255, 255, 255, 0.75);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --surface-soft: rgba(241, 245, 249, 0.6);
  --border: rgba(15, 23, 42, 0.06);
  --border-glow: rgba(15, 23, 42, 0.12);
  
  --text: #0f172a;
  --text-muted: #64748b;
  
  --primary: #0ea5e9;
  --secondary: #8b5cf6;
  --accent: #ec4899;
  
  --ok: #10b981;
  --danger: #ef4444;
  
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 30px 60px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.06);
  
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;
  
  --glass-blur: blur(24px);
  --transition-spring: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-smooth: 0.3s ease;
}

body:not(.light) {
  /* Dark Mode Palette - Deep Aurora */
  --bg-color: #030712;
  --bg-gradient: radial-gradient(circle at 10% 0%, rgba(14, 165, 233, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 90% 10%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 50% 100%, rgba(236, 72, 153, 0.1) 0%, transparent 50%),
                var(--bg-color);
  
  --surface: rgba(15, 23, 42, 0.6);
  --surface-strong: rgba(30, 41, 59, 0.85);
  --surface-soft: rgba(30, 41, 59, 0.4);
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 255, 255, 0.15);
  
  --text: #f8fafc;
  --text-muted: #94a3b8;
  
  --primary: #38bdf8;
  --secondary: #a78bfa;
  --accent: #f472b6;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-hover: 0 30px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

* { 
  box-sizing: border-box; 
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: 'Outfit', -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg-gradient);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--transition-smooth), color var(--transition-smooth);
}

b, strong { font-weight: 700; }
a { text-decoration: none; color: inherit; }

/* Animated Blobs */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.6;
  animation: float 20s infinite ease-in-out;
}
.blob.one {
  width: 400px; height: 400px;
  background: var(--primary);
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.blob.two {
  width: 300px; height: 300px;
  background: var(--secondary);
  bottom: 10%; right: -50px;
  animation-delay: -5s;
}
.blob.three {
  width: 350px; height: 350px;
  background: var(--accent);
  top: 40%; left: 30%;
  opacity: 0.3;
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

.container {
  width: min(1200px, 94%);
  margin: 0 auto;
  position: relative;
  z-index: 1;
  padding-bottom: 60px;
}

/* Glassmorphism Core Utilities */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: transform var(--transition-spring), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
}
.glass:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-hover);
}

/* Typography Enhancements */
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 800; margin-bottom: 12px; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; margin-bottom: 24px; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }

.gradient {
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
  background-size: 200% auto;
  animation: shine 4s linear infinite;
}
@keyframes shine {
  to { background-position: 200% center; }
}
.muted { color: var(--text-muted); }

/* Navigation */
nav {
  position: sticky;
  top: 16px;
  z-index: 50;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-radius: var(--radius-full);
  margin-top: 16px;
  margin-bottom: 40px;
}
.brand { 
  font-weight: 800; 
  font-size: 1.25rem; 
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand span { color: var(--primary); }
.links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.links a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  transition: all var(--transition-smooth);
}
.links a:hover { 
  color: var(--text); 
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
}

.chip-btn {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: var(--radius-full);
  padding: 8px 20px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition-spring);
}
.chip-btn:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.2);
}

/* Hero Section */
.hero {
  padding: 48px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
  align-items: center;
  margin-bottom: 32px;
}
.hero p { font-size: 1.1rem; max-width: 500px; }

.quick-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.info-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  background: var(--surface-soft);
  transition: transform var(--transition-spring), border-color var(--transition-smooth);
}
.info-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--border-glow);
  background: var(--surface-strong);
}
.info-card b { 
  display: block; 
  font-size: 1.25rem; 
  font-family: 'JetBrains Mono', monospace; 
  font-weight: 700;
  color: var(--primary);
}

/* Sections */
section {
  padding: 40px;
  margin-bottom: 32px;
}

/* Controls & Inputs */
.search-wrap { display: flex; gap: 12px; margin-bottom: 24px; }
input[type="text"], input[type="number"], .notes-textarea {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: all var(--transition-smooth);
  width: 100%;
}
input[type="text"]::placeholder, .notes-textarea::placeholder { color: var(--text-muted); }
input:focus, .notes-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
  background: var(--surface);
}

/* Buttons */
.btn {
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  background: var(--surface-strong);
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition-spring);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { 
  transform: translateY(-2px); 
  border-color: var(--primary); 
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); }

.btn.primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}
.btn.primary:hover {
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
  filter: brightness(1.1);
}

/* Grids & Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.layout-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px;}

.tool-card, .mini-tool {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all var(--transition-spring);
  position: relative;
  overflow: hidden;
}
.tool-card::before, .mini-tool::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity var(--transition-smooth);
}
.tool-card:hover, .mini-tool:hover {
  transform: translateY(-5px);
  background: var(--surface-strong);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-glow);
}
.tool-card:hover::before, .mini-tool:hover::before { opacity: 1; }

.tool-card p { margin-bottom: 20px; font-size: 0.95rem; color: var(--text-muted); line-height: 1.5; min-height: 44px; }
.tool-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--surface-strong);
  transition: all var(--transition-spring);
}
.tool-card a:hover { 
  background: var(--primary); 
  color: #fff; 
  border-color: transparent; 
  transform: translateY(-2px);
}

/* Status Indicators */
.status-good { color: var(--ok); font-weight: 600; }
.status-bad { color: var(--danger); font-weight: 600; }

/* Games Lounge */
.game-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-soft);
}
.tab {
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 10px 20px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-smooth);
}
.tab:hover { color: var(--text); background: var(--surface-strong); }
.tab.active {
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
  color: var(--primary);
  border-color: var(--border);
}

.game-panel { 
  display: none; 
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.game-panel.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Game Canvases & Shells */
.flappy-shell, .board-shell {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 20px;
  margin-top: 20px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}
.flappy-shell { width: min(100%, 600px); }

.flappy-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.flappy-pill {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  padding: 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.flappy-pill b { 
  display: block; 
  font-size: 1.25rem; 
  color: var(--primary); 
  font-family: 'JetBrains Mono', monospace; 
  margin-bottom: 4px; 
}

#flappyCanvas, #snakeCanvas, .arcade-canvas {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: block;
}
#flappyCanvas { background: #56adff; aspect-ratio: 536 / 300; }
#snakeCanvas { background: #06111f; aspect-ratio: 1/1; max-width: 400px; margin-bottom: 20px; box-shadow: 0 0 0 4px rgba(103, 232, 249, 0.1); }
.arcade-canvas { aspect-ratio: 560 / 300; max-width: 600px; background: #050a16; margin-bottom: 20px; }

/* Grid Games */
.guess-grid { 
  display: grid; gap: 10px; margin-top: 16px; width: 100%; justify-content: center;
}
.guess-cell {
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-spring);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
}

/* 2048 specific */
.grid-2048 { max-width: 340px !important; grid-template-columns: repeat(4, 1fr) !important; aspect-ratio: 1;}
.tile-2048 {
  font-weight: 800;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: #0f172a;
  border: none;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.1);
  aspect-ratio: 1;
}
.tile-2048:hover { transform: scale(1.05); }
.tile-empty { background: rgba(148, 163, 184, 0.2); color: transparent; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }

/* Tic Tac Toe */
.grid-tic { max-width: 300px !important; grid-template-columns: repeat(3, 1fr) !important; }
.tic-cell {
  font-size: 3rem;
  font-weight: 800;
  aspect-ratio: 1;
}
.tic-cell:hover:not(:empty) { transform: none; }
.tic-cell:hover:empty { background: var(--surface); }
.tic-cell.x { color: var(--primary); text-shadow: 0 4px 12px rgba(14, 165, 233, 0.4); }
.tic-cell.o { color: var(--accent); text-shadow: 0 4px 12px rgba(236, 72, 153, 0.4); }

/* Whack-a-Mole */
.grid-whack { max-width: 320px !important; grid-template-columns: repeat(3, 1fr) !important; gap: 16px;}
.whack-cell {
  border-radius: 50%;
  aspect-ratio: 1;
  font-size: 2rem;
  background: radial-gradient(circle at 35% 30%, var(--surface-strong), var(--surface-soft));
  box-shadow: inset 0 -6px 12px rgba(0,0,0,0.1);
}
.whack-cell.active {
  background: radial-gradient(circle at 45% 35%, var(--accent), #be185d);
  box-shadow: 0 0 24px rgba(244, 114, 182, 0.5), inset 0 -4px 8px rgba(0,0,0,0.2);
  transform: translateY(-4px) scale(1.05);
  font-size: 2.5rem;
}

/* Connect 4 */
.grid-connect4 { gap: 8px; max-width: 460px !important; grid-template-columns: repeat(7, 1fr) !important;}
.connect4-cell {
  border-radius: 50%;
  aspect-ratio: 1;
  background: radial-gradient(circle at 50% 50%, var(--surface-strong), var(--surface-soft));
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.1);
}
.connect4-cell.red {
  background: radial-gradient(circle at 35% 30%, #fca5a5, #ef4444);
  box-shadow: inset 0 -4px 8px rgba(153, 27, 27, 0.4);
}
.connect4-cell.yellow {
  background: radial-gradient(circle at 35% 30%, #fde047, #eab308);
  box-shadow: inset 0 -4px 8px rgba(161, 98, 7, 0.4);
}

/* Memory Match */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: min(100%, 400px);
  margin-top: 20px;
}
.memory-card {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.memory-card.revealed, .memory-card.matched {
  color: var(--text);
  background: var(--surface-strong);
  transform: rotateY(180deg);
  box-shadow: var(--shadow-sm);
}
.memory-card.matched {
  border-color: var(--ok);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

/* Notes App */
.notes-app {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  margin-top: 16px;
}
.notes-sidebar, .notes-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  padding: 16px;
}
.notes-sidebar { height: 400px; display: flex; flex-direction: column;}
.notes-list { 
  display: flex; flex-direction: column; gap: 8px; margin-top: 16px; 
  overflow-y: auto; flex: 1;
  padding-right: 4px;
}
.notes-list::-webkit-scrollbar { width: 4px; }
.notes-list::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 4px; }

.note-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: all var(--transition-smooth);
}
.note-item:hover { background: var(--surface-strong); }
.note-item.active {
  background: var(--surface-strong);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.1);
  color: var(--primary);
  font-weight: 600;
}
.notes-editor { display: flex; flex-direction: column; gap: 16px; height: 400px;}
.notes-textarea { flex: 1; resize: none; line-height: 1.6; font-size: 1.05rem; }
.notes-status { font-size: 0.85rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace;}

/* Scroll Reveal */
.reveal { opacity: 0; transform: translateY(30px) scale(0.98); transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.show { opacity: 1; transform: translateY(0) scale(1); }

footer {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; padding: 32px; text-align: center; }
  .hero p { margin: 0 auto; }
  .layout-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .grid { grid-template-columns: 1fr; }
  .notes-app { grid-template-columns: 1fr; height: auto; }
  .notes-sidebar { height: 250px; }
  .quick-info { grid-template-columns: 1fr; }
  .game-tabs { justify-content: center; }
  h1 { font-size: 2.5rem; }
  nav { padding: 12px; justify-content: center; }
}
