/* Shared look: stage, candy buttons, HUD pills, outlined text, bubbles, cards, sky.
   Screen-specific styles live in css/<module>.css. */

:root {
  --cabbage: #5d8a4e; --cabbage-dark: #3f6335; --leaf: #e8f1e3; --cream: #fffaf0; --butter: #f6c453;
  --strawberry: #ff8fa3; --ink: #2f2a24; --muted: #7a7369;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #6EC1F2; overscroll-behavior: none; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, sans-serif;
  font-weight: 700; color: var(--ink);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; position: fixed; inset: 0;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
canvas { display: block; }

/* The virtual canvas: phone-sized, centered, scaled by app.js. */
#stage { position: absolute; left: 50%; top: 50%; transform-origin: center; overflow: hidden; background: #6EC1F2; border-radius: 0; }
.screen, .overlay { position: absolute; inset: 0; overflow: hidden; }
.overlay { z-index: 50; }

/* ---- Squish for tiles and chips */
.squish { transition: transform .22s var(--spring); }
.squish:active { transform: scale(.92); transition-duration: .08s; }

/* ---- Candy button */
.candy {
  position: relative; display: block; width: 100%; border-radius: 999px; padding: 13px 24px;
  font-size: 20px; font-weight: 900; letter-spacing: .2px; text-shadow: 0 1.5px 0 rgba(0,0,0,.25);
  background: linear-gradient(var(--fill-hi), var(--fill) 50%, var(--fill-lo));
  box-shadow: 0 5px 0 var(--fill-edge), 0 13px 14px var(--fill-glow), inset 0 0 0 1.5px rgba(255,255,255,.35);
  transition: transform .2s var(--spring), box-shadow .2s ease;
}
.candy::before { content: ""; position: absolute; left: 3px; right: 3px; top: 3px; height: 50%; border-radius: 999px; background: linear-gradient(rgba(255,255,255,.45), rgba(255,255,255,0)); pointer-events: none; }
.candy:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--fill-edge), 0 6px 10px var(--fill-glow), inset 0 0 0 1.5px rgba(255,255,255,.35); transition-duration: .06s; }
.candy:disabled { opacity: .55; }
.candy-label { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ---- Round game button */
.round-btn {
  position: relative; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 900;
  background: radial-gradient(circle at 35% 30%, var(--fill-hi), var(--fill) 55%, var(--fill-lo));
  box-shadow: 0 3px 0 var(--fill-edge), 0 7px 8px rgba(0,0,0,.25), inset 0 0 0 2px rgba(255,255,255,.7);
  text-shadow: 0 1px 0 rgba(0,0,0,.25); transition: transform .2s var(--spring), filter .3s;
}
.round-btn::before { content: ""; position: absolute; left: 15%; right: 15%; top: 8%; height: 36%; border-radius: 50%; background: linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,0)); pointer-events: none; }
.round-btn:active:not(:disabled) { transform: scale(.92); transition-duration: .08s; }
.round-btn > * { position: relative; }
.chev { font-size: 1.5em; line-height: .8; margin-top: -.12em; margin-left: -.08em; }

/* ---- Outlined HUD text */
.outlined { font-weight: 900; line-height: 1.1; display: inline-block; white-space: pre-line; text-align: center; }

/* ---- HUD pill: frosted glass with a colored rim */
.hud-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 30px;
  background: linear-gradient(rgba(255,255,255,.5), var(--rim-tint)); -webkit-backdrop-filter: blur(14px) saturate(1.6); backdrop-filter: blur(14px) saturate(1.6);
  box-shadow: inset 0 0 0 2.5px var(--rim), inset 0 3px 6px rgba(255,255,255,.6), 0 4px 8px rgba(0,0,0,.2);
}
.hud-emoji { font-size: 18px; line-height: 1; }

/* ---- Speech bubble with a tail underneath */
.bubble {
  position: relative; background: #fff; color: var(--cabbage-dark); font-size: 17px; font-weight: 900; padding: 10px 16px;
  border-radius: 18px; box-shadow: 0 3px 10px rgba(0,0,0,.10); white-space: nowrap; width: max-content;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 16px; height: 16px; background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }

/* ---- Sticker card */
.sticker-card {
  position: relative; border-radius: var(--radius); background: linear-gradient(var(--card), var(--card-lo));
  box-shadow: inset 0 0 0 3px var(--outline), inset 0 0 0 4.5px rgba(255,255,255,.6), 0 4px 10px var(--outline-glow);
}

/* ---- Back HUD */
.back-hud { position: absolute; left: 12px; top: 8px; display: flex; align-items: center; gap: 10px; z-index: 5; }

/* ---- Sticker toast */
.toast {
  position: absolute; left: 50%; top: 58px; z-index: 90; display: flex; align-items: center; gap: 10px; padding: 9px 18px; border-radius: 999px;
  background: linear-gradient(#fff, #fff8ea); box-shadow: inset 0 0 0 2px var(--butter), 0 4px 12px rgba(0,0,0,.14);
  transform: translate(-50%, 0); animation: toast-in .45s var(--spring) both; white-space: nowrap;
}
.toast.out { animation: toast-out .28s ease-in both; }
.toast-emoji { font-size: 30px; line-height: 1; }
.toast-small { font-size: 12px; font-weight: 900; color: var(--muted); }
.toast-title { font-size: 17px; font-weight: 900; color: var(--cabbage-dark); }
@keyframes toast-in { from { transform: translate(-50%, -90px); opacity: 0; } }
@keyframes toast-out { to { transform: translate(-50%, -90px); opacity: 0; } }

.confetto { position: absolute; width: 9px; height: 13px; pointer-events: none; z-index: 80; }
.floater { position: absolute; pointer-events: none; z-index: 70; }

/* ---- Sky, sun, moon, clouds, hills */
.sky { position: absolute; inset: 0; overflow: hidden; transition: background 1.2s ease; }
.sky .stars, .sky .moon { opacity: 0; transition: opacity 1.2s ease; }
.sky.night .stars, .sky.night .moon { opacity: 1; }
.sky.night .sun { opacity: 0; }
.sky .stars { position: absolute; inset: 0; }
.sky .stars i { position: absolute; border-radius: 50%; background: rgba(255,255,255,.9); animation: twinkle 2.6s ease-in-out infinite alternate; }
.sky .stars i:nth-child(odd) { animation-delay: -1.3s; }
@keyframes twinkle { from { opacity: .45; } to { opacity: 1; } }
.moon { position: absolute; left: 82%; top: 22%; width: 44px; height: 44px; margin: -22px; border-radius: 50%;
  box-shadow: inset -14px 6px 0 0 #FFF1B5; filter: drop-shadow(0 0 12px rgba(255,241,181,.7)); transform: rotate(-20deg); }
.sun { position: absolute; width: 54px; height: 54px; margin: -27px; transform: scale(var(--sun-scale, 1)); transition: left 1.2s ease, top 1.2s ease, opacity 1.2s ease; }
.sun-glow { position: absolute; inset: -13px; border-radius: 50%; background: radial-gradient(circle, rgba(255,227,138,.7), rgba(255,227,138,0) 70%); }
.sun-rays { position: absolute; inset: 0; animation: spin 24s linear infinite; }
.sun-rays i { position: absolute; left: 50%; top: 50%; width: 5px; height: 14px; margin: -7px -2.5px; border-radius: 3px; background: linear-gradient(#FFE38A, #FFC94B); }
.sun-core { position: absolute; left: 11px; top: 11px; width: 32px; height: 32px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFF3B0, #FFD94F); box-shadow: 0 0 16px rgba(255,217,79,.7); }
@keyframes spin { to { transform: rotate(360deg); } }

.cloud { position: absolute; filter: drop-shadow(0 3px 4px rgba(0,0,0,.06)); }
.cloud.centered { transform: translate(-50%, -50%); }
.cloud i { position: absolute; background: linear-gradient(#fff, #E6F0FA); border-radius: 999px; }
.cloud i:nth-child(1) { left: 0; width: 100%; height: 60%; top: 40%; }
.cloud i:nth-child(2) { width: calc(var(--h) * .9); height: calc(var(--h) * .9); left: calc(32% - var(--h) * .45); top: 7%; border-radius: 50%; }
.cloud i:nth-child(3) { width: calc(var(--h) * 1.15); height: calc(var(--h) * 1.15); left: calc(58% - var(--h) * .575); top: -16%; border-radius: 50%; }
.cloud i:nth-child(4) { width: calc(var(--h) * .75); height: calc(var(--h) * .75); left: calc(80% - var(--h) * .375); top: 25%; border-radius: 50%; }

.hills { position: absolute; inset: 0; overflow: hidden; }
.hill { position: absolute; border-radius: 50%; }
.hill.back { width: 140%; height: 120%; left: -50%; top: 30%; background: linear-gradient(#A3DB86, #7DBE62); }
.hill.front { width: 130%; height: 110%; left: 20%; top: 50%; background: linear-gradient(#86C96A, #5FA84A); box-shadow: 0 -4px 14px rgba(0,0,0,.12); }

.contact-shadow { display: block; border-radius: 50%; background: rgba(0,0,0,.22); filter: blur(4px); }

/* ---- Shared motion (FoodArt.swift Breathing / WalkBob / Chewing) */
.breathe { transform-origin: 50% 100%; animation: breathe 3.49s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.988, .97); } 50% { transform: scale(1.012, 1.03); } }
.walk { transform-origin: 50% 100%; animation: walk-bob .785s linear infinite; }
.walk.fast { animation-duration: .63s; }
@keyframes walk-bob {
  0% { transform: translateY(0) rotate(0) scaleY(1); } 12.5% { transform: translateY(-5px) rotate(3.5deg) scaleY(1.05); }
  25% { transform: translateY(-7px) rotate(5deg) scaleY(1); } 37.5% { transform: translateY(-5px) rotate(3.5deg) scaleY(.95); }
  50% { transform: translateY(0) rotate(0) scaleY(1); } 62.5% { transform: translateY(-5px) rotate(-3.5deg) scaleY(1.05); }
  75% { transform: translateY(-7px) rotate(-5deg) scaleY(1); } 87.5% { transform: translateY(-5px) rotate(-3.5deg) scaleY(.95); }
  100% { transform: translateY(0) rotate(0) scaleY(1); }
}
.chew { transform-origin: 50% 100%; animation: chew .449s ease-in-out infinite; }
@keyframes chew { 0%, 100% { transform: scale(1, 1) rotate(-1.5deg); } 50% { transform: scale(1.03, .95) rotate(1.5deg); } }

/* ---- Glossy plate and food badge (Art.swift Plate / FoodBadge) */
.plate {
  position: relative; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #fff, #EEF2F5 80%);
  box-shadow: inset 0 0 0 1.5px #D6DEE5, 0 calc(var(--d) * .06) calc(var(--d) * .1) rgba(0,0,0,.16);
  width: var(--d); height: var(--d);
}
.plate::before { content: ""; position: absolute; inset: 14%; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.9), inset 0 1px 2px rgba(0,0,0,.06); }
.plate > * { position: relative; filter: drop-shadow(0 1.5px 1.5px rgba(0,0,0,.18)); }
.food-badge {
  position: relative; border-radius: 50%; flex: none; display: grid; place-items: center; width: var(--d); height: var(--d);
  background: radial-gradient(circle at 35% 30%, var(--tint-hi), var(--tint) 55%, var(--tint-lo));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.7), 0 4px 8px var(--tint-glow);
}
.food-badge::before { content: ""; position: absolute; left: 15%; right: 15%; top: 8%; height: 36%; border-radius: 50%; background: linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,0)); }
.food-badge > * { position: relative; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }

/* Rotate hint: the game is portrait. Shown only on short, wide phone screens. */
#rotate { display: none; position: fixed; inset: 0; z-index: 999; background: linear-gradient(#6EC1F2, #D9F1FF); color: #fff; place-items: center; text-align: center; font-size: 22px; font-weight: 900; text-shadow: 0 2px 0 var(--cabbage-dark); }
@media (orientation: landscape) and (max-height: 500px) { #rotate { display: grid; } }

@media (prefers-reduced-motion: reduce) { .breathe, .sun-rays { animation: none; } }

/* Start-up failure panel (index.html). */
#oops { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; text-align: center; padding: 24px; background: linear-gradient(#6EC1F2, #D9F1FF); color: #fff; font-size: 22px; font-weight: 900; text-shadow: 0 2px 0 var(--cabbage-dark); }
#oops[hidden] { display: none; }
#oops button { margin-top: 8px; padding: 14px 34px; border-radius: 999px; color: #fff; font-size: 22px; font-weight: 900; background: linear-gradient(#ffa3b4, var(--strawberry)); box-shadow: 0 5px 0 #d96b80, 0 12px 14px rgba(255,143,163,.4); }
#oops pre { margin-top: 22px; max-width: 86vw; white-space: pre-wrap; word-break: break-word; font: 600 11px ui-monospace, monospace; color: rgba(63,99,53,.75); text-shadow: none; -webkit-user-select: text; user-select: text; }
