/* ============================================================
   Lemonade Stand — "juicy summer pop" sticker-book aesthetic
   ============================================================ */

@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/baloo2-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/baloo2-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+2C60-2C7F;
}

:root {
  --ink: #4a2b12;            /* dark chocolate outline / text */
  --lemon: #ffd93b;
  --lemon-deep: #ffb63b;
  --sky: #8ed8f8;
  --sky-deep: #5db9e8;
  --pink: #ff6f9c;
  --pink-soft: #ffd1e0;
  --green: #7ed957;
  --green-deep: #4cb944;
  --cream: #fff6df;
  --paper: #fffdf6;
  --shadow: rgba(74, 43, 18, 0.28);
  --radius: 26px;
  --border: 3px solid var(--ink);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Baloo 2', 'Comic Sans MS', cursive, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.55) 0 42px, transparent 43px),
    radial-gradient(circle at 82% 26%, rgba(255, 255, 255, 0.45) 0 30px, transparent 31px),
    radial-gradient(circle at 70% 80%, rgba(255, 217, 59, 0.25) 0 60px, transparent 61px),
    radial-gradient(circle at 10% 70%, rgba(255, 111, 156, 0.15) 0 46px, transparent 47px),
    linear-gradient(180deg, var(--sky) 0%, #bfe9fb 45%, var(--cream) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#app {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  animation: screen-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes screen-pop {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------------- Buttons ---------------- */

.btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  border: var(--border);
  border-radius: 999px;
  padding: 12px 26px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.05); }
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn-big { font-size: 1.45rem; padding: 16px 32px; }
.btn-yellow { background: linear-gradient(180deg, #ffe373, var(--lemon)); }
.btn-green  { background: linear-gradient(180deg, #a3e97e, var(--green)); }
.btn-blue   { background: linear-gradient(180deg, #aee3fa, var(--sky-deep)); }
.btn-pink   { background: linear-gradient(180deg, #ffa8c2, var(--pink)); }

.btn-round {
  width: 58px;
  height: 58px;
  padding: 0;
  font-size: 1.9rem;
  line-height: 1;
  background: linear-gradient(180deg, #ffe373, var(--lemon));
  flex: none;
}

.btn:disabled {
  filter: grayscale(0.7) opacity(0.55);
  cursor: not-allowed;
}
.btn:disabled:active { transform: none; box-shadow: 0 5px 0 var(--ink); }

/* ---------------- Cards ---------------- */

.card {
  background: var(--paper);
  border: var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 7px 0 var(--shadow);
}

.card-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.card-label {
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------------- Title screen ---------------- */

#screen-title { justify-content: center; align-items: center; text-align: center; position: relative; }

.lang-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  border: var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--shadow);
}
.lang-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 7px 14px;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  opacity: 0.5;
}
.lang-btn.active { background: var(--lemon); opacity: 1; }

.title-hero { margin-top: 30px; width: 100%; }

.hero-art {
  width: min(400px, 92%);
  margin: 22px auto 0;
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 0 var(--shadow);
  transform: rotate(-1.5deg);
  animation: hero-sway 6s ease-in-out infinite;
}
.hero-art img { display: block; width: 100%; }
@keyframes hero-sway {
  0%, 100% { transform: rotate(-1.5deg); }
  50% { transform: rotate(1.2deg); }
}

.title-lemon {
  font-size: 4.4rem;
  line-height: 1;
  filter: drop-shadow(0 8px 0 var(--shadow));
  animation: lemon-rock 2.6s ease-in-out infinite;
}
@keyframes lemon-rock {
  0%, 100% { transform: rotate(-8deg) translateY(0); }
  50% { transform: rotate(8deg) translateY(-10px); }
}

.game-logo {
  font-size: clamp(2.4rem, 10vw, 3.6rem);
  font-weight: 800;
  line-height: 1.05;
  margin-top: 8px;
  color: var(--ink);
  text-shadow:
    3px 3px 0 var(--lemon),
    6px 6px 0 var(--pink);
}

.tagline {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  opacity: 0.75;
  margin-top: 6px;
}

.title-menu {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 34px;
  width: min(320px, 100%);
}
.title-menu .btn { width: 100%; }

.title-deco .deco {
  position: fixed;
  font-size: 2rem;
  opacity: 0.85;
  animation: deco-float 5s ease-in-out infinite;
  pointer-events: none;
}
.deco.d1 { left: 6%;  top: 16%; animation-delay: 0s; }
.deco.d2 { right: 8%; top: 30%; animation-delay: -1.2s; }
.deco.d3 { left: 10%; top: 62%; animation-delay: -2.4s; font-size: 2.6rem; }
.deco.d4 { right: 12%; top: 72%; animation-delay: -3.1s; }
.deco.d5 { left: 46%; top: 84%; animation-delay: -4s; font-size: 1.5rem; }
@keyframes deco-float {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-16px) rotate(6deg); }
}

/* ---------------- HUD ---------------- */

.hud { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.hud-pill {
  background: var(--paper);
  border: var(--border);
  border-radius: 999px;
  padding: 4px 13px;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 4px 0 var(--shadow);
  white-space: nowrap;
}
.hud-money { background: linear-gradient(180deg, #ffe373, var(--lemon)); }

/* ---------------- Weather card ---------------- */

.weather-row {
  background: linear-gradient(135deg, #d9f2ff, var(--paper) 70%);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.weather-top { display: flex; align-items: center; gap: 12px; }
.weather-top .btn-mentor-sm { margin-left: auto; }
.weather-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.weather-actions:empty { display: none; }
.btn-mentor-sm {
  font-size: 1rem;
  padding: 2px 12px;
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--ink);
  flex: none;
}
.btn-mentor-sm:active { box-shadow: 0 1px 0 var(--ink); }
.weather-emoji { font-size: 2.2rem; line-height: 1; animation: weather-bob 4s ease-in-out infinite; }
@keyframes weather-bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-3px) rotate(3deg); }
}
.weather-name { font-size: 1.2rem; font-weight: 800; line-height: 1.1; }

.fx-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.forecast-row { display: flex; gap: 5px; }
.forecast-row .fc-chip { flex: 1; justify-content: center; padding: 0 4px; min-width: 0; font-size: 0.82rem; }
.forecast-row .btn-forecast { flex: none; }

/* Event, ad and forecast chips share one height so the row lines up. */
.fx-chip,
.fc-chip {
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0 11px;
  white-space: nowrap;
  line-height: 1;
}
.fx-chip { background: var(--lemon); cursor: pointer; }
.fx-chip-ad { background: var(--pink-soft); cursor: default; }
.fc-chip { background: #e6f4fc; }
.btn-forecast {
  font-size: 0.78rem;
  padding: 4px 12px;
  box-shadow: 0 3px 0 var(--ink);
}
.btn-forecast:active { box-shadow: 0 1px 0 var(--ink); }

/* ---------------- Ads ---------------- */

.ads-card {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.ads-card:active { transform: translateY(2px); }
.ads-active { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.ads-plus {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
  background: var(--pink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 0 var(--ink);
  flex: none;
}
.chip-pic {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  object-fit: cover;
  margin-right: 2px;
}

/* Ads modal */
.ads-rows { display: flex; flex-direction: column; gap: 9px; margin: 12px 0; }
.ad-row {
  font-family: inherit;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 9px 13px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--shadow);
  text-align: left;
}
.ad-row:disabled { filter: grayscale(0.6) opacity(0.6); cursor: not-allowed; }
.ad-row:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
.ad-row-emoji { font-size: 1.6rem; }
.ad-row-info { display: flex; flex-direction: column; line-height: 1.25; flex: 1; }
.ad-row-info b { font-size: 1rem; }
.ad-row-info span { font-size: 0.82rem; font-weight: 700; opacity: 0.75; }
.ad-row-price { font-weight: 800; font-size: 1.05rem; white-space: nowrap; }

.inf-label { margin-top: 4px; }
.inf-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fff0f6, var(--cream));
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 10px 13px;
  margin: 8px 0 14px;
  box-shadow: 0 3px 0 var(--shadow);
}
.inf-pic {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  object-fit: cover;
  flex: none;
  background: var(--pink-soft);
}
.inf-info { display: flex; flex-direction: column; line-height: 1.3; flex: 1; min-width: 0; }
.inf-info b { font-size: 1.05rem; }
.inf-info span { font-size: 0.82rem; font-weight: 700; opacity: 0.8; }
.inf-info .inf-boost { color: #c9366f; opacity: 1; }
.inf-run { font-size: 1rem; }
.btn-hire { font-size: 0.85rem; padding: 8px 12px; flex: none; white-space: nowrap; }

/* ---------------- News modal ---------------- */

.news-card { text-align: center; }
.news-emoji { font-size: 3.4rem; line-height: 1.1; animation: deco-float 3s ease-in-out infinite; }
.news-hint {
  font-weight: 800;
  background: var(--cream);
  border: 2px dashed var(--ink);
  border-radius: 14px;
  padding: 8px 12px;
  margin: 10px 0 6px;
}
.news-days { font-weight: 700; opacity: 0.75; margin-bottom: 14px; }

/* ---------------- Morning screen (compact: fits an iPhone SE) ---------------- */

#screen-morning { gap: 8px; }
#screen-morning .card { padding: 10px 12px; box-shadow: 0 5px 0 var(--shadow); border-radius: 18px; }

.row { display: flex; align-items: center; gap: 12px; }

.row-title {
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
}
.shop-card .row-title, .recipe-card .row-title { display: block; margin-bottom: 6px; }
.recipe-card .row-title { text-transform: none; letter-spacing: 0; font-size: 0.85rem; }

.shop-list { display: flex; flex-direction: column; gap: 6px; }

.shop-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.shop-row .item-emoji { font-size: 1.5rem; line-height: 1; position: relative; }

.sale-badge {
  position: absolute;
  top: -9px;
  left: -8px;
  background: #e5352b;
  color: #fff;
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  transform: rotate(-10deg);
  white-space: nowrap;
  animation: sale-wiggle 1.2s ease-in-out infinite;
}
@keyframes sale-wiggle {
  0%, 100% { transform: rotate(-10deg) scale(1); }
  50% { transform: rotate(-4deg) scale(1.08); }
}
.shop-row .item-stock {
  font-size: 0.9rem;
  font-weight: 800;
  opacity: 0.75;
  min-width: 2.6em;
}
.btn-tier {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  line-height: 1.2;
  padding: 7px 4px;
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  white-space: nowrap;
}
.btn-tier:active { box-shadow: 0 1px 0 var(--ink); }
.btn-tier .tier-qty { font-size: 0.9rem; font-weight: 800; }
.btn-tier .tier-price { font-size: 0.72rem; font-weight: 700; opacity: 0.85; }

.shop-row.bought { animation: item-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes item-pop { 50% { transform: scale(1.04); } }

.recipe-steppers {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 4px 2px;
  min-width: 0;
}
.stepper .item-emoji { font-size: 1.05rem; }
.stepper-value { font-size: 1.05rem; min-width: 1em; text-align: center; }
.stepper .btn-round-sm { width: 30px; height: 30px; font-size: 1.15rem; }

.max-cups {
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  margin: 0;
}

/* ---------------- Price picker ---------------- */

.price-row { justify-content: space-between; }
.price-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}
.price-value {
  font-size: 1.5rem;
  font-weight: 800;
  min-width: 100px;
  text-align: center;
  background: var(--cream);
  border: var(--border);
  border-radius: 14px;
  padding: 2px 8px;
}

.btn-round-sm {
  width: 40px;
  height: 40px;
  font-size: 1.4rem;
  box-shadow: 0 3px 0 var(--ink);
}
.btn-round-sm:active { box-shadow: 0 1px 0 var(--ink); }

.warn {
  text-align: center;
  font-weight: 800;
  color: #c62838;
  animation: warn-shake 0.4s ease;
}
@keyframes warn-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

#btn-open { margin-top: 0; font-size: 1.25rem; padding: 12px 28px; }

/* Roomy portrait phones: spend the vertical slack on bigger type. */
@media (orientation: portrait) and (min-height: 660px) {
  /* Fluid type: taller screens get proportionally bigger text.
     lvh = viewport with browser bars retracted, so the size is stable
     whether or not Safari's chrome is showing. */
  html { font-size: clamp(16px, 2.18vh, 23px); }
  html { font-size: clamp(16px, 2.18lvh, 23px); }
  #screen-morning { gap: 7px; }
  #screen-morning .card { padding: 8px 12px; }
  .fx-chip, .fc-chip { height: 27px; }
  .shop-list { gap: 6px; }
  .btn-tier { padding: 5px 4px; }
  .stepper { padding: 3px 2px; }
  .hud-pill { padding: 3px 12px; }
  .price-line { margin-top: 5px; }
  #btn-open { padding: 10px 26px; }
  .hero-art img { max-height: 24lvh; object-fit: cover; object-position: center bottom; }
  .title-hero { margin-top: 12px; }
  .title-menu { margin-top: 22px; gap: 11px; }
}

/* Short screens (iPhone SE etc.): shave the remaining slack. */
@media (max-height: 700px) {
  #app { padding-top: 6px; padding-bottom: 10px; }
  #screen-morning { gap: 4px; }
  #screen-morning .card { padding: 5px 10px; }
  .weather-row { gap: 3px; }
  .hud-pill { font-size: 0.8rem; padding: 2px 9px; }
  .weather-emoji { font-size: 1.7rem; }
  .weather-name { font-size: 1.05rem; }
  .row-title { font-size: 0.82rem; }
  .recipe-card .row-title { font-size: 0.76rem; margin-bottom: 3px; }
  .shop-card .row-title { margin-bottom: 3px; }
  .shop-list { gap: 4px; }
  .btn-tier { padding: 4px 2px; }
  .btn-tier .tier-qty { font-size: 0.85rem; }
  .stepper { padding: 2px; }
  .stepper .btn-round-sm { width: 27px; height: 27px; font-size: 1.05rem; }
  .btn-ad { padding: 3px 2px; line-height: 1.15; }
  .fx-chip, .fc-chip { height: 21px; font-size: 0.68rem; padding: 0 7px; border-width: 1.5px; }
  .btn-forecast { font-size: 0.7rem; padding: 2px 9px; }
  .btn-ad .ad-emoji { font-size: 1rem; }
  .price-value { font-size: 1.2rem; min-width: 84px; }
  .price-row .btn-round-sm { width: 34px; height: 34px; }
  .max-cups { font-size: 0.85rem; }
  #btn-open { padding: 8px 24px; font-size: 1.15rem; }
  .results-list { gap: 5px; }
  .results-list li { padding: 5px 11px; font-size: 0.92rem; }
}

/* ---------------- Day scene ---------------- */

#screen-day { justify-content: center; }

.scene {
  position: relative;
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  width: 100%;
  max-height: 62dvh;
  margin: auto 0;
  box-shadow: 0 7px 0 var(--shadow);
  background: #bfe9fb;
}

.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right bottom;
}

.heat {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 150, 40, 0.28), transparent 65%);
  mix-blend-mode: overlay;
  animation: heat-pulse 2.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes heat-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.rain {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to bottom, transparent 0 40%, rgba(80, 130, 190, 0.55) 40% 60%, transparent 60% 100%);
  background-size: 3px 26px;
  animation: rain-fall 0.5s linear infinite;
  opacity: 0.6;
}
@keyframes rain-fall {
  from { background-position: 0 0; }
  to   { background-position: -8px 26px; }
}

/* Customers — art sprites driven by the Web Animations API (walk path)
   plus a CSS bob for the step rhythm. */
.customer {
  position: absolute;
  bottom: 2%;
  left: 0;
  z-index: 2;
  will-change: transform;
}
.customer .sprite {
  display: block;
  height: var(--sprite-h, 110px);
  width: auto;
  animation: walk-bob var(--bob-dur, 0.55s) ease-in-out infinite alternate;
  filter: drop-shadow(0 6px 4px rgba(30, 40, 20, 0.3));
}
@keyframes walk-bob {
  from { transform: translateY(0) rotate(-1.5deg); }
  to   { transform: translateY(-7px) rotate(1.5deg); }
}
/* Wheelchair user glides — no stepping bounce. */
.customer.roll .sprite { animation-name: roll-glide; }
@keyframes roll-glide {
  from { transform: translateY(0); }
  to   { transform: translateY(-2px); }
}
.customer .bubble {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 1.1rem;
  white-space: nowrap;
  animation: bubble-pop 1.4s ease forwards;
}
@keyframes bubble-pop {
  0% { transform: translateX(-50%) scale(0); }
  20% { transform: translateX(-50%) scale(1.15); }
  30%, 80% { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) scale(0.8); opacity: 0; }
}

.sold-banner {
  position: absolute;
  right: 5%;
  top: 32%;
  z-index: 6;
  background: #e5352b;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  padding: 7px 16px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  transform: rotate(-8deg);
  box-shadow: 0 5px 0 var(--shadow);
  animation: banner-slam 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes banner-slam {
  from { transform: rotate(-8deg) scale(2.2); opacity: 0; }
  to   { transform: rotate(-8deg) scale(1); opacity: 1; }
}

.hud-btn { cursor: pointer; font-family: inherit; line-height: inherit; }

.cost-hint { font-size: 0.82rem; font-weight: 700; opacity: 0.7; text-transform: none; letter-spacing: 0; margin-top: 2px; text-align: center; }
.price-line { flex-direction: column; align-items: stretch; gap: 6px; margin-top: 8px; }
.price-line .price-picker { justify-content: center; }

.menu-card { display: flex; flex-direction: column; gap: 12px; text-align: center; }

.day-counters {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  z-index: 5;
}

.nobody {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 4;
}
.nobody-emoji { font-size: 4rem; animation: deco-float 3s ease-in-out infinite; }
.nobody-text {
  background: var(--paper);
  border: var(--border);
  border-radius: 999px;
  padding: 6px 18px;
  font-weight: 800;
}

.day-clock {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
}

.day-stock {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 5;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.stock-pill {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.82rem;
  font-weight: 800;
}
.stock-pill.short {
  background: #ffd4d4;
  color: #c62838;
  animation: warn-shake 0.5s ease;
}

.version {
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.45;
}

.day-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.day-price-value {
  font-size: 1.3rem;
  font-weight: 800;
  min-width: 92px;
  text-align: center;
  background: var(--paper);
  border: var(--border);
  border-radius: 14px;
  padding: 4px 8px;
}
.btn-skip { align-self: center; margin-left: 8px; }

/* ---------------- Results ---------------- */

#screen-results { justify-content: center; }

.results-card { text-align: center; }

.results-list {
  list-style: none;
  margin: 14px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.results-list { gap: 7px; }
.results-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 1rem;
  opacity: 0;
  animation: line-in 0.4s ease forwards;
}
.results-list li:nth-child(1) { animation-delay: 0.05s; }
.results-list li:nth-child(2) { animation-delay: 0.15s; }
.results-list li:nth-child(3) { animation-delay: 0.25s; }
.results-list li:nth-child(4) { animation-delay: 0.35s; }
.results-list li:nth-child(5) { animation-delay: 0.45s; }
.results-list li:nth-child(6) { animation-delay: 0.55s; }
.results-list li:nth-child(7) { animation-delay: 0.65s; }
.results-list li:nth-child(8) { animation-delay: 0.75s; }
.results-list li:nth-child(9) { animation-delay: 0.85s; }
@keyframes line-in {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
.results-list .value { font-weight: 800; white-space: nowrap; flex: none; max-width: 72%; overflow: hidden; text-overflow: ellipsis; }
.results-list li > span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results-list li.good { background: #e6f9db; }
.results-list li.bad  { background: #ffe3e3; }

/* ---------------- Season end ---------------- */

#screen-end { justify-content: center; }

.end-card { text-align: center; display: flex; flex-direction: column; gap: 12px; }

.end-trophy {
  font-size: 4.6rem;
  line-height: 1;
  animation: trophy-bounce 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite alternate;
}
@keyframes trophy-bounce {
  from { transform: translateY(0) rotate(-4deg); }
  to   { transform: translateY(-12px) rotate(4deg); }
}

.end-money { font-size: 1.9rem; font-weight: 800; }

/* End-of-season stats */
.stats-block { display: flex; flex-direction: column; gap: 6px; }
.stats-title { font-size: 1.05rem; font-weight: 800; margin-top: 6px; }
.stats-chart {
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 8px 6px 4px;
}
.stats-chart svg { display: block; width: 100%; height: auto; }
.stats-list { margin: 4px 0 0; }
.stats-list li { font-size: 0.92rem; padding: 5px 12px; }

.new-highscore {
  font-size: 1.2rem;
  font-weight: 800;
  color: #d4491f;
  animation: deco-float 1.6s ease-in-out infinite;
}

.name-input {
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  border: var(--border);
  border-radius: 14px;
  padding: 10px;
  width: min(240px, 100%);
  margin: 10px auto;
  display: block;
  background: var(--cream);
  color: var(--ink);
}
.name-input:focus { outline: 3px solid var(--sky-deep); }

/* ---------------- Scores table ---------------- */

.scores-rows { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 18px; }
.score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 8px 14px;
  font-weight: 700;
}
.score-row .rank { font-weight: 800; width: 2em; font-size: 1.15rem; }
.score-row .who { flex: 1; text-align: left; }
.score-row .pts { font-weight: 800; }
.score-row.top1 { background: linear-gradient(180deg, #ffe373, var(--lemon)); }
.score-row.top2 { background: #eef2f5; }
.score-row.top3 { background: #f7e3cf; }
.score-row.mine { outline: 3px dashed var(--pink); }

.empty-scores { font-weight: 700; opacity: 0.75; margin: 16px 0; }

/* ---------------- Achievements ---------------- */

.ach-progress { font-weight: 800; opacity: 0.75; margin: 2px 0 10px; }

.ach-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.ach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #ffe373, var(--lemon));
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 8px 12px;
  text-align: left;
}
.ach-row.locked { background: var(--cream); filter: grayscale(0.85) opacity(0.7); }
.ach-row .ach-emoji { font-size: 1.7rem; flex: none; }
.ach-row .ach-mark { flex: none; font-size: 1.1rem; }
.ach-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.ach-text b { font-size: 0.98rem; }
.ach-text span { font-size: 0.8rem; font-weight: 700; opacity: 0.75; }

/* Season-end splash */
.ach-splash-card { text-align: center; overflow: hidden; }
.ach-splash-confetti { display: flex; justify-content: center; gap: 14px; font-size: 1.6rem; }
.ach-splash-confetti span { animation: deco-float 1.4s ease-in-out infinite; }
.ach-splash-confetti span:nth-child(2n) { animation-delay: 0.35s; }
.ach-splash-confetti span:nth-child(3n) { animation-delay: 0.7s; }
.ach-splash-title {
  font-size: 1.5rem;
  margin: 6px 0 12px;
  animation: splash-title-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes splash-title-pop {
  from { opacity: 0; transform: scale(0.4) rotate(-6deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}
.ach-splash-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ach-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #ffe373, var(--lemon));
  border: var(--border);
  border-radius: 16px;
  padding: 10px 14px;
  text-align: left;
  box-shadow: 0 4px 0 var(--ink);
  opacity: 0;
  animation: badge-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.ach-badge .ach-emoji {
  font-size: 2.2rem;
  flex: none;
  animation: trophy-bounce 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite alternate;
}
@keyframes badge-pop {
  from { opacity: 0; transform: scale(0.3) translateY(30px); }
  60%  { transform: scale(1.08) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------------- How-to modal ---------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(74, 43, 18, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal-card {
  max-width: 440px;
  width: 100%;
  max-height: 85dvh;
  overflow-y: auto;
  animation: screen-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.howto-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 18px;
  text-align: left;
}
.howto-list li {
  font-weight: 700;
  font-size: 1rem;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 9px 12px;
}

/* ---------------- Small screens ---------------- */

@media (max-width: 380px) {
  .shop-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .btn-big { font-size: 1.25rem; }
  .game-logo { text-shadow: 2px 2px 0 var(--lemon), 4px 4px 0 var(--pink); }
}

@media (max-height: 780px) {
  .title-hero { margin-top: 10px; }
  .title-lemon { font-size: 3rem; }
  .game-logo { font-size: clamp(2rem, 8vw, 2.8rem); }
  .hero-art { margin-top: 12px; }
  .hero-art img { height: 150px; object-fit: cover; object-position: center bottom; }
  .title-menu { margin-top: 18px; gap: 10px; }
  .title-menu .btn-big { font-size: 1.25rem; padding: 12px 26px; }
}

/* ---------------- Landscape phones ---------------- */

@media (orientation: landscape) and (max-height: 560px) {
  #app { max-width: 920px; }

  #screen-morning {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-content: start;
    align-items: start;
  }
  #screen-morning .hud, #screen-morning .warn { grid-column: 1 / -1; }
  #screen-morning .weather-row, #screen-morning .shop-card { grid-column: 1; }
  #screen-morning .recipe-card, #screen-morning .ads-card,
  #screen-morning .price-row, #screen-morning .max-cups, #screen-morning #btn-open { grid-column: 2; }

  .title-hero { margin-top: 4px; }
  .title-lemon { font-size: 2.2rem; }
  .game-logo { font-size: 2rem; }
  .hero-art { display: none; }
  .title-menu { flex-direction: row; flex-wrap: wrap; justify-content: center; margin-top: 14px; width: auto; }
  .title-menu .btn { width: auto; }

  .scene {
    width: min(100%, calc(62dvh * 4 / 3));
    margin: 0 auto;
  }

  .results-list { display: grid; grid-template-columns: 1fr 1fr; }
  .results-card { max-width: 720px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
