/* game.css — how Capi-Life looks. (Colors and fonts are at the top.) */
@font-face { font-family: 'Fredoka'; src: url('/fonts/Fredoka.ttf') format('truetype'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('/fonts/Nunito.ttf') format('truetype'); font-weight: 200 1000; font-display: swap; }

:root {
  --grass: #7EC850; --grass-dark: #5DA832;
  --carrot: #FF8C42; --carrot-dark: #C46020;
  --sky: #87CEEB;
  --cream: #FFF8E7; --cream-2: #FFEFCF;
  --brown: #4A3426; --outline: #4A3022; --line: #E9D8B8;
  --purple: #9B59B6; --purple-dark: #7D3C98;
  --pink: #EC4899; --pink-dark: #BE185D;
  --blue: #3498DB; --blue-dark: #1F6FAA;
  --gold: #FFC93C; --gold-dark: #D99A00;
  --red: #E74C3C;
  --font-title: 'Fredoka', 'Arial Rounded MT Bold', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', 'Fredoka', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body); color: var(--brown); background: #8FD3F0;
  overflow: hidden; overscroll-behavior: none; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
button { font-family: inherit; }

/* ── Panels (cozy cream cards with a thick brown outline) ─────────────────── */
.panel {
  background: var(--cream); border: 4px solid var(--outline); border-radius: 26px;
  box-shadow: 0 6px 0 rgba(74, 48, 34, .35), 0 16px 40px rgba(0, 0, 0, .18);
  padding: 20px; color: var(--brown);
}
.panel h2, .panel .title { font-family: var(--font-title); font-weight: 700; margin: 0 0 6px; font-size: 26px; }

/* ── Chunky 3-D buttons (the first Capi-Life had these too) ────────────────── */
.btn {
  --c: var(--carrot); --d: var(--carrot-dark);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 3px solid var(--outline); border-radius: 18px; padding: 10px 20px;
  background: var(--c); color: #fff; font-family: var(--font-title); font-weight: 700; font-size: 18px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .18); cursor: pointer; line-height: 1.1;
  box-shadow: 0 5px 0 var(--d); transform: translateY(0); transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 6px 0 var(--d); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--d); }
.btn:disabled { filter: grayscale(.6) opacity(.55); cursor: not-allowed; }
.btn-orange { --c: var(--carrot); --d: var(--carrot-dark); }
.btn-green { --c: var(--grass-dark); --d: #3D7A1C; }
.btn-blue { --c: var(--blue); --d: var(--blue-dark); }
.btn-purple { --c: var(--purple); --d: var(--purple-dark); }
.btn-pink { --c: var(--pink); --d: var(--pink-dark); }
.btn-gold { --c: var(--gold); --d: var(--gold-dark); color: var(--brown); text-shadow: none; }
.btn-plain { --c: #FFFDF6; --d: #D9C7A6; color: var(--brown); text-shadow: none; }
.btn-red { --c: #F06A5B; --d: #B8382C; }
.btn-big { font-size: 24px; padding: 14px 34px; border-radius: 22px; }
.btn-small { font-size: 14px; padding: 6px 12px; border-radius: 14px; box-shadow: 0 3px 0 var(--d); }
.btn-round { width: 52px; height: 52px; padding: 0; border-radius: 50%; font-size: 24px; }

.pop-in { animation: popIn .35s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes popIn { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.slide-up { animation: slideUp .3s ease-out both; }
@keyframes slideUp { 0% { transform: translateY(24px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

.ribbon {
  display: inline-block; background: var(--pink); color: #fff; font-family: var(--font-title); font-weight: 700;
  padding: 6px 18px; border-radius: 12px; border: 3px solid var(--outline); transform: rotate(-3deg);
  box-shadow: 0 4px 0 var(--pink-dark); animation: wobble 1.2s ease-in-out infinite;
}
@keyframes wobble { 0%, 100% { transform: rotate(-3deg) scale(1); } 50% { transform: rotate(3deg) scale(1.06); } }

/* ── Mini-game shell ───────────────────────────────────────────────────────── */
.mg-layer { position: fixed; inset: 0; z-index: 500; background: #2B4A66; }
.mg-root { position: absolute; inset: 0; overflow: hidden; }
.mg-bar { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; display: flex; gap: 8px; z-index: 30; }
.mg-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--outline); background: var(--cream);
  font-size: 20px; font-weight: 800; color: var(--brown); cursor: pointer; box-shadow: 0 4px 0 rgba(74, 48, 34, .4);
}
.mg-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(74, 48, 34, .4); }
.mg-hud { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 20; pointer-events: none; max-width: calc(100% - 130px); }
.mg-pill {
  background: rgba(255, 248, 231, .95); border: 3px solid var(--outline); border-radius: 18px; padding: 4px 12px;
  font-family: var(--font-title); font-size: 20px; color: var(--brown); display: flex; align-items: center; gap: 6px;
  box-shadow: 0 3px 0 rgba(74, 48, 34, .35);
}
.mg-pill b { font-weight: 700; }
.mg-emoji { font-size: 18px; }
.mg-heart { font-size: 18px; }
.mg-heart.off { opacity: .55; }
.mg-countdown {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 40; pointer-events: none;
  font-family: var(--font-title); font-weight: 700; font-size: 120px; color: #fff;
  -webkit-text-stroke: 6px var(--outline); paint-order: stroke fill; text-shadow: 0 8px 0 rgba(0, 0, 0, .25);
}
.mg-countdown.pop { animation: cdPop .6s ease-out both; }
@keyframes cdPop { 0% { transform: scale(2.2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(.8); opacity: 0; } }
.mg-overlay { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(30, 20, 10, .45); padding: 16px; }
.mg-card { text-align: center; max-width: 380px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.mg-title { font-family: var(--font-title); font-size: 32px; font-weight: 700; }
.mg-sub { font-size: 16px; font-weight: 800; opacity: .75; }
.mg-desc { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.mg-emoji-big { font-size: 64px; line-height: 1; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .15)); }
.mg-score { font-family: var(--font-title); font-size: 64px; font-weight: 700; line-height: 1; color: var(--carrot); -webkit-text-stroke: 3px var(--outline); paint-order: stroke fill; }
.mg-rewards { display: flex; gap: 14px; justify-content: center; margin: 6px 0; min-height: 34px; }
.mg-reward { display: flex; align-items: center; gap: 4px; font-family: var(--font-title); font-size: 24px; animation: popIn .4s .2s both; }
.mg-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.mg-capy { margin-top: -8px; }
.mg-results .ribbon { position: absolute; top: -18px; }
.mg-err { font-size: 12px; text-align: left; white-space: pre-wrap; max-width: 100%; overflow: auto; background: #fff; padding: 8px; border-radius: 10px; }

/* Korean: wrap between words, never in the middle of one (keep-all changes nothing for English/Spanish) */
body { word-break: keep-all; overflow-wrap: anywhere; }
