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

body {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 40%, #334155 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px;
}

#game-container {
  background: linear-gradient(180deg, #f0fdfa 0%, #ecfeff 50%, #f0fdf4 100%);
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.5),
              inset 0 2px 0 rgba(255,255,255,0.9);
  max-width: 580px;
  width: 100%;
  overflow: hidden;
}

#header {
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  padding: 16px 20px 12px;
  text-align: center;
  border-bottom: 4px solid #0369a1;
  position: relative;
}

#header h1 {
  font-family: 'Bangers', cursive;
  font-size: 2.2rem;
  color: #ffffff;
  text-shadow: 3px 3px 0 #0369a1, 4px 4px 8px rgba(0,0,0,0.3);
  letter-spacing: 3px;
}

#cash-display {
  font-family: 'Bangers', cursive;
  font-size: 1.4rem;
  color: #fde047;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.4);
  margin-top: 2px;
}

#flag-decoration {
  font-size: 0.7rem;
  margin-top: 4px;
  color: rgba(255,255,255,0.8);
  letter-spacing: 1px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#selection-screen {
  padding: 24px 16px;
  text-align: center;
}

#selection-screen h2 {
  font-family: 'Bangers', cursive;
  font-size: 2rem;
  color: #0369a1;
  margin-bottom: 4px;
}

.subtitle {
  color: #64748b;
  font-size: 0.88rem;
  margin-bottom: 18px;
  font-style: italic;
}

#country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: 8px;
  max-width: 500px;
  margin: 0 auto;
}

.country-btn {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 3px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 4px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.country-btn:hover {
  transform: translateY(-4px) scale(1.04);
  border-color: #0ea5e9;
  box-shadow: 0 8px 20px rgba(14,165,233,0.25);
}

.country-preview { width: 56px; height: 56px; }
.country-preview canvas { border-radius: 50%; }
.country-name { font-size: 0.78rem; color: #334155; font-weight: 600; }

#game-screen { padding: 14px; }

#canvas {
  display: block;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.08), 0 6px 20px rgba(0,0,0,0.12);
  border: 3px solid #cbd5e1;
}

#stats-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  background: rgba(255,255,255,0.85);
  border-radius: 14px;
  border: 2px solid #e2e8f0;
}

.stat-item { display: flex; align-items: center; gap: 6px; }
.stat-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.stat-bar-container {
  flex: 1; height: 12px; background: #e2e8f0;
  border-radius: 6px; overflow: hidden; border: 2px solid #cbd5e1;
}
.stat-bar {
  height: 100%; border-radius: 4px;
  transition: width 0.4s ease;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1);
}
.stat-value { font-size: 0.75rem; font-weight: 600; color: #475569; min-width: 36px; text-align: right; }

#controls {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px;
}

.action-btn {
  border: none; border-radius: 12px; padding: 10px 14px;
  font-family: 'Fredoka', sans-serif; font-size: 0.9rem; font-weight: 600;
  color: #1e293b; cursor: pointer; transition: all 0.2s ease;
}

.action-btn:disabled {
  opacity: 0.5; cursor: not-allowed; transform: none !important;
}

.feed-btn { background: linear-gradient(180deg, #fbbf24, #f59e0b); box-shadow: 0 3px 0 #b45309; }
.play-btn { background: linear-gradient(180deg, #4ade80, #22c55e); box-shadow: 0 3px 0 #15803d; }
.clean-btn { background: linear-gradient(180deg, #60a5fa, #3b82f6); box-shadow: 0 3px 0 #1d4ed8; }
.sleep-btn { background: linear-gradient(180deg, #a78bfa, #8b5cf6); box-shadow: 0 3px 0 #6d28d9; }
.gift-btn { background: linear-gradient(180deg, #f472b6, #ec4899); box-shadow: 0 3px 0 #be185d; }

.action-btn:hover:not(:disabled) { transform: translateY(-2px); }
.action-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 currentColor; }

.overlay-menu {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,0.8); display: flex;
  justify-content: center; align-items: center; z-index: 100;
  backdrop-filter: blur(6px);
}

.menu-content {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-radius: 20px; padding: 24px; max-width: 380px; width: 92%;
  position: relative; border: 4px solid #0ea5e9;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4);
  max-height: 85vh; overflow-y: auto;
}

.menu-content h3 {
  font-family: 'Bangers', cursive; font-size: 1.5rem; color: #0369a1;
  text-align: center; margin-bottom: 16px; letter-spacing: 1px;
}

.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.menu-grid.wide { grid-template-columns: repeat(3, 1fr); }

.menu-btn {
  background: linear-gradient(180deg, #f8fafc, #e2e8f0);
  border: 2px solid #cbd5e1; border-radius: 10px; padding: 10px 8px;
  font-family: 'Fredoka', sans-serif; font-size: 0.85rem;
  cursor: pointer; transition: all 0.2s ease; text-transform: capitalize;
}

.menu-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #e0f2fe, #bae6fd);
  border-color: #0ea5e9; transform: translateY(-2px);
}

.menu-btn.favorite { background: linear-gradient(180deg, #fef3c7, #fde68a); border-color: #f59e0b; }
.menu-btn.equipped { background: linear-gradient(180deg, #bbf7d0, #86efac); border-color: #22c55e; }
.menu-btn.locked { opacity: 0.5; cursor: not-allowed; }

.cook-method-btn {
  background: linear-gradient(180deg, #fff7ed, #fed7aa);
  border: 2px solid #fb923c; border-radius: 12px; padding: 14px 10px;
  font-family: 'Fredoka', sans-serif; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease; text-align: center;
}
.cook-method-btn:hover {
  transform: translateY(-3px); box-shadow: 0 6px 16px rgba(251,146,60,0.3);
}

.cook-result-display {
  text-align: center; padding: 20px 10px;
}
.cook-result-display .result-emoji { font-size: 3rem; margin-bottom: 12px; }
.cook-result-display .result-name {
  font-family: 'Bangers', cursive; font-size: 1.4rem; color: #334155; margin-bottom: 8px;
}
.cook-result-display .result-reaction {
  font-size: 1rem; color: #64748b; font-style: italic;
}

.close-btn {
  position: absolute; top: 10px; right: 10px; background: #ef4444;
  border: none; color: white; width: 30px; height: 30px; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(239,68,68,0.4);
}
.close-btn:hover { background: #dc2626; transform: scale(1.1); }

.price-tag {
  font-size: 0.75rem; color: #b45309; font-weight: 700;
}

#minigame-container {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: #1a1a2e; z-index: 200; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
}

#minigame-canvas {
  border: 2px solid #334155; border-radius: 8px;
  max-width: 100%; max-height: 80vh;
  touch-action: none;
}

#minigame-hud {
  position: absolute; top: 10px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 20px;
  font-family: 'Bangers', cursive; font-size: 1.3rem; color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  pointer-events: none;
}

.cooldown-text {
  font-size: 0.7rem; color: #94a3b8;
}

#footer {
  background: linear-gradient(180deg, #e2e8f0, #cbd5e1);
  padding: 12px 20px; text-align: center;
  border-top: 2px solid #94a3b8;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}

#day-counter { font-size: 0.9rem; color: #334155; font-weight: 600; }

#footer a {
  color: #0ea5e9; text-decoration: none; font-size: 0.85rem; font-weight: 600;
}
#footer a:hover { color: #0284c7; text-decoration: underline; }

@media (max-width: 420px) {
  #header h1 { font-size: 1.7rem; }
  .action-btn { padding: 8px 10px; font-size: 0.8rem; }
  #stats-panel { grid-template-columns: 1fr; }
  .country-preview { width: 48px; height: 48px; }
  .country-name { font-size: 0.7rem; }
  #country-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
}