/* ==========================================================================
   GLOBITO - GAME STYLING (PASTEL SYSTEM & GLASSMORPHISM)
   ========================================================================== */

:root {
  /* Fonts */
  --font-heading: 'Fredoka', cursive, sans-serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Theme: Lavender (Default) */
  --bg-gradient-start: #f3e5f5;
  --bg-gradient-end: #e1bee7;
  --primary-color: #ab47bc;
  --primary-hover: #8e24aa;
  --card-bg: rgba(255, 255, 255, 0.65);
  --card-border: rgba(255, 255, 255, 0.8);
  --text-dark: #4a148c;
  --text-muted: #7b1fa2;
  --accent-glow: rgba(171, 71, 188, 0.3);
  --balloon-color: #ce93d8;
  --balloon-shadow: rgba(156, 39, 176, 0.25);
}

/* Themes Definition */
body[data-theme="mint"] {
  --bg-gradient-start: #e8f5e9;
  --bg-gradient-end: #c8e6c9;
  --primary-color: #43a047;
  --primary-hover: #2e7d32;
  --card-bg: rgba(255, 255, 255, 0.68);
  --card-border: rgba(255, 255, 255, 0.85);
  --text-dark: #1b5e20;
  --text-muted: #388e3c;
  --accent-glow: rgba(67, 160, 71, 0.3);
  --balloon-color: #81c784;
  --balloon-shadow: rgba(46, 125, 50, 0.25);
}

body[data-theme="peach"] {
  --bg-gradient-start: #fff3e0;
  --bg-gradient-end: #ffe0b2;
  --primary-color: #fb8c00;
  --primary-hover: #ef6c00;
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(255, 255, 255, 0.9);
  --text-dark: #e65100;
  --text-muted: #f57c00;
  --accent-glow: rgba(251, 140, 0, 0.3);
  --balloon-color: #ffb74d;
  --balloon-shadow: rgba(230, 81, 0, 0.25);
}

body[data-theme="cloud"] {
  --bg-gradient-start: #e1f5fe;
  --bg-gradient-end: #b3e5fc;
  --primary-color: #039be5;
  --primary-hover: #0277bd;
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(255, 255, 255, 0.9);
  --text-dark: #01579b;
  --text-muted: #0288d1;
  --accent-glow: rgba(3, 155, 229, 0.3);
  --balloon-color: #4fc3f7;
  --balloon-shadow: rgba(2, 119, 189, 0.25);
}

body[data-theme="night"] {
  --bg-gradient-start: #263238;
  --bg-gradient-end: #37474f;
  --primary-color: #80cbc4;
  --primary-hover: #4db6ac;
  --card-bg: rgba(38, 50, 56, 0.75);
  --card-border: rgba(144, 164, 174, 0.3);
  --text-dark: #eceff1;
  --text-muted: #b0bec5;
  --accent-glow: rgba(128, 203, 196, 0.3);
  --balloon-color: #80deea;
  --balloon-shadow: rgba(0, 188, 212, 0.3);
}

/* Reset & Layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  color: var(--text-dark);
  transition: background 0.5s ease, color 0.5s ease;
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
}

/* Top Navigation Bar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  z-index: 20;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

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

.logo-icon {
  font-size: 1.6rem;
  animation: floatMini 3s ease-in-out infinite;
}

.logo-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

.nav-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s ease;
}

.icon-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.85);
}

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

/* Canvas Wrapper */
.canvas-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* HUD Overlay */
.hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  z-index: 10;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.hud-card.level-card {
  min-width: 140px;
  align-items: flex-start;
}

.level-progress-container {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 4px 0 2px 0;
}

.level-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--balloon-color));
  border-radius: 4px;
  transition: width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.level-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hud-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.hud-value {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
}

.hud-bottom {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.breath-bar {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  padding: 10px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 20px var(--accent-glow);
  animation: pulseBreath 4s infinite ease-in-out;
}

.breath-text {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-dark);
}

/* Modal Overlay Screens */
.screen-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.screen-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1.5px solid var(--card-border);
  border-radius: 28px;
  padding: 28px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(0);
  transition: transform 0.3s ease;
}

.start-card h2, .end-card h2 {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  color: var(--text-dark);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Balloon Preview Animation */
.balloon-preview-wrapper {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

/* Game Type Selector (Globito vs Malabarista) */
.game-type-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.06);
  padding: 4px;
  border-radius: 20px;
  gap: 4px;
  margin-bottom: 8px;
}

.type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 16px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.type-btn.active {
  background: var(--card-bg);
  color: var(--text-dark);
  box-shadow: 0 4px 15px var(--accent-glow);
  transform: scale(1.02);
}

.type-icon {
  font-size: 1.3rem;
}

/* Mode Selection Cards */
.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.4);
  border: 2px solid transparent;
  border-radius: 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.7);
}

.mode-btn.active {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.mode-icon {
  font-size: 1.8rem;
}

.mode-info strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.mode-info small {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Dropdowns & Selects */
.difficulty-level {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.4);
  padding: 10px 16px;
  border-radius: 16px;
}

.difficulty-level label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
}

.pastel-select {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-dark);
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

/* Primary Button */
.primary-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 14px 24px;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  border-radius: 24px;
  cursor: pointer;
  box-shadow: 0 8px 20px var(--accent-glow);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 25px var(--accent-glow);
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn.pulse {
  animation: btnPulse 2s infinite ease-in-out;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-dark);
  border: 1px solid var(--card-border);
  padding: 12px 20px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.9);
}

/* End Game Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 10px 0;
}

.stat-box {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--card-border);
  padding: 12px 8px;
  border-radius: 16px;
}

.stat-num {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-color);
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.end-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.end-icon {
  font-size: 3.5rem;
}

/* Modal Headers & Controls */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--text-dark);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.custom-section {
  text-align: left;
}

.custom-section h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* Theme Options Selector Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.theme-card {
  background: rgba(255, 255, 255, 0.4);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.theme-card span {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-dark);
}

.theme-card.active {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.85);
}

.color-preview {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.lavender-prev { background: linear-gradient(135deg, #f3e5f5, #ce93d8); }
.mint-prev { background: linear-gradient(135deg, #e8f5e9, #81c784); }
.peach-prev { background: linear-gradient(135deg, #fff3e0, #ffb74d); }
.cloud-prev { background: linear-gradient(135deg, #e1f5fe, #4fc3f7); }
.night-prev { background: linear-gradient(135deg, #263238, #80deea); }

/* Skin Options Grid */
.skin-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.skin-card {
  background: rgba(255, 255, 255, 0.4);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.skin-card.active {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.85);
}

.skin-emoji {
  font-size: 1.5rem;
}

.skin-card span {
  font-size: 0.7rem;
  color: var(--text-dark);
}

.stats-detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.5);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
}

/* Animations */
@keyframes floatMini {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(4deg); }
}

@keyframes floatBig {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-12px) scale(1.05); }
}

@keyframes pulseBreath {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
}

@keyframes btnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
