:root {
  --bg-main: #06080f;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-surface: #0f172a;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.1) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.6) 0px, transparent 100%);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

/* Header */
header {
  border-bottom: 1px solid var(--border);
  background: rgba(6, 8, 15, 0.85);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.logo-badge {
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.pwa-install-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: transform 0.2s;
}

.pwa-install-btn:hover {
  transform: scale(1.04);
}

/* Main Container */
main {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* Home / Hub View */
.arcade-hero {
  text-align: center;
  padding: 20px 0 28px 0;
}

.arcade-hero h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 60%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.arcade-hero p {
  color: var(--text-muted);
  font-size: 14px;
}

/* PWA App Banner */
.pwa-banner {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  backdrop-filter: blur(8px);
}

.pwa-banner-text {
  font-size: 13px;
  line-height: 1.5;
}

.pwa-banner-title {
  font-weight: 700;
  color: #c7d2fe;
}

.pwa-banner-desc {
  color: var(--text-muted);
  font-size: 12px;
}

/* Game Card Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

@media (max-width: 480px) {
  .game-grid {
    grid-template-columns: 1fr;
  }
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 16px 30px -10px rgba(0, 0, 0, 0.6), 0 0 20px var(--primary-glow);
}

.game-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 14px;
}

/* Cute Thumbnail Cards */
.card-thumb {
  width: 100%;
  height: 140px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
  background: #1e1b4b;
}

.card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.game-card:hover .card-thumb-img {
  transform: scale(1.08);
}

.game-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
  z-index: 2;
}

.game-badge.cat {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.game-badge.bear {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.game-badge.bubble {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.game-badge.snake {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.play-tag.bounce {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: white;
  animation: mini-bounce 2s infinite ease-in-out;
}

@keyframes mini-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.game-card-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.game-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

.game-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}

.play-tag {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* Game Play Views */
.game-view {
  display: none;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.25s ease-out;
}

.game-view.active {
  display: flex;
}

/* Canvas Box & Cute Indicators */
.canvas-box {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: #0f172a;
  margin-bottom: 14px;
  max-width: 100%;
}

.canvas-box canvas {
  display: block;
  touch-action: none;
}

.next-fruit-preview, .next-bubble-preview, .balls-count-box {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  background: rgba(99, 102, 241, 0.08);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid #6366f1;
  max-width: 340px;
  margin-bottom: 12px;
  text-align: left;
}

.cat-tap-btn {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4);
  transition: transform 0.1s;
  user-select: none;
  margin-top: 6px;
}

.cat-tap-btn:active {
  transform: scale(0.94);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.game-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.back-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.pause-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.pause-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  color: #ffffff;
  transform: translateY(-1px);
}

.pause-btn:active {
  transform: scale(0.95);
}

.pause-btn.paused {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  border-color: #f43f5e;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.55);
  animation: pulse-pause 1.6s infinite ease-in-out;
}

@keyframes pulse-pause {
  0%, 100% { box-shadow: 0 0 12px rgba(244, 63, 94, 0.4); }
  50% { box-shadow: 0 0 22px rgba(244, 63, 94, 0.85); transform: scale(1.02); }
}

.score-board {
  display: flex;
  gap: 10px;
}

.score-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  text-align: center;
  min-width: 75px;
}

.score-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.score-num {
  font-size: 16px;
  font-weight: 800;
  color: #38bdf8;
  font-family: var(--font-mono);
}



/* =========================================
/* =========================================
   Game 5: Neon Snake Style
   ========================================= */
.canvas-box.snake-box {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 35px rgba(20, 184, 166, 0.28);
  border: 2px solid rgba(45, 212, 191, 0.35);
  background: #020617;
  position: relative;
  touch-action: none;
}

#canvas-snake {
  display: block;
  background: #020617;
  touch-action: none;
  cursor: grab;
}

#canvas-snake:active {
  cursor: grabbing;
}

/* Neon Arcade D-Pad Virtual Controller */
.snake-controller-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 14px;
}

.d-pad.neon-pad {
  display: grid;
  grid-template-columns: repeat(3, 62px);
  grid-template-rows: repeat(3, 62px);
  gap: 10px;
  background: rgba(15, 23, 42, 0.65);
  padding: 12px;
  border-radius: 24px;
  border: 1px solid rgba(45, 212, 191, 0.25);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(45, 212, 191, 0.06);
  backdrop-filter: blur(12px);
}

.neon-pad .d-btn {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(45, 212, 191, 0.35);
  color: #5eead4;
  font-size: 22px;
  font-weight: 800;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: all 0.12s cubic-bezier(0.16, 1, 0.3, 1);
  text-shadow: 0 0 8px rgba(45, 212, 191, 0.6);
  user-select: none;
  -webkit-user-select: none;
}

.neon-pad .d-btn:hover {
  background: rgba(45, 212, 191, 0.2);
  border-color: #2dd4bf;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(45, 212, 191, 0.4);
}

.neon-pad .d-btn:active {
  transform: scale(0.92);
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #042f2e;
  text-shadow: none;
  box-shadow: 0 0 20px rgba(45, 212, 191, 0.8);
}

.neon-pad .d-btn.neon-center {
  background: rgba(236, 72, 153, 0.2);
  border-color: rgba(236, 72, 153, 0.45);
  color: #f472b6;
  font-size: 18px;
  text-shadow: 0 0 10px rgba(236, 72, 153, 0.7);
}

.neon-pad .d-btn.neon-center:hover {
  background: rgba(236, 72, 153, 0.35);
  color: #ffffff;
}

.neon-pad .d-btn.neon-center:active {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  color: white;
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.8);
}

.restart-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  margin-top: 10px;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  background: rgba(6, 8, 15, 0.6);
  margin-top: auto;
}

/* Game 6: 냥냥 케이크 타워 */
.game-badge.cake {
  background: linear-gradient(135deg, #f472b6, #fb923c);
  box-shadow: 0 4px 12px rgba(244, 114, 182, 0.4);
}
.cake-thumb {
  background: linear-gradient(180deg, #8fd3ff, #e0f7ff);
}
