/* Little Lantern - the Tending Game.
   Calm, pastel, low-saturation base with a few saturated accents on the two
   touchable tools (P18). Big targets (P02). Small, slow, interruptible motion
   that switches off under reduced motion or in the evening (P19, P20). A warm
   overlay veils the scene as evening comes on (P14). */

:root {
  --sky-top: #DCEBEA;
  --sky-bottom: #EFF3EA;
  --ground: #E7D6B8;
  --ground-wet: #D8C29B;
  --ink: #4A4038;
  --ink-soft: #7A6E60;
  --panel: #F5EFE4;
  --water: #6FB6C9;
  --light: #E7B24C;
  --shadow: 0 10px 24px rgba(74, 64, 56, 0.14);
  --warm-overlay: rgba(255, 176, 92, 0);
  --tap-min: 96px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--sky-bottom);
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Warm evening veil over the whole page, driven by the responsible-screen layer. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--warm-overlay);
  transition: background 1.2s ease;
  z-index: 50;
}
.reduced-motion body::after,
.reduced-motion *::after { transition: none !important; }

.skip-adult {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel);
  color: var(--ink-soft);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.skip-adult:focus { left: 12px; top: 12px; z-index: 60; }

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(16px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 4px 4px;
  color: var(--ink-soft);
}
.topbar__mark { display: inline-flex; }
.topbar__name { font-size: 15px; letter-spacing: 0.02em; }

/* The scene grows to fill available height. */
.scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 46vh;
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 62%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.ground {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 20%;
  z-index: 0;
  background: linear-gradient(180deg, var(--ground) 0%, var(--ground-wet) 100%);
  border-top-left-radius: 40% 30px;
  border-top-right-radius: 40% 30px;
  transition: filter 1.5s ease;
}
.scene.is-watered .ground { filter: brightness(0.94) saturate(1.08); }

.plant {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  width: min(60vw, 300px);
  z-index: 2;
  transform-origin: 50% 100%;
  animation: sway 6s ease-in-out infinite;
}
.plant-svg { width: 100%; height: auto; display: block; }
.plant.grow-pop { animation: growpop 0.7s ease-out; }

.reduced-motion .plant { animation: none; }

@keyframes sway {
  0%, 100% { transform: translateX(-50%) rotate(-1.1deg); }
  50% { transform: translateX(-50%) rotate(1.1deg); }
}
@keyframes growpop {
  0% { transform: translateX(-50%) scale(1); }
  40% { transform: translateX(-50%) scale(1.06); }
  100% { transform: translateX(-50%) scale(1); }
}

/* Soft light glow (behind the plant) when the lantern is tapped. */
.glow {
  position: absolute;
  left: 50%;
  top: 26%;
  width: 46%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(0.6);
  background: radial-gradient(circle, rgba(247, 210, 126, 0.85) 0%, rgba(247, 210, 126, 0) 68%);
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
  z-index: 1;
}
.glow.glow--on { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
.reduced-motion .glow { transition: opacity 0.2s linear; }

/* Falling water droplets. */
.drops { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.drop {
  position: absolute;
  top: 30%;
  width: 10px;
  height: 14px;
  background: var(--water);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  opacity: 0.85;
  animation: drip 1s ease-in forwards;
}
@keyframes drip {
  0% { transform: translateY(0); opacity: 0.9; }
  100% { transform: translateY(34vh); opacity: 0; }
}

.message {
  text-align: center;
  font-size: clamp(20px, 3.4vw, 26px);
  line-height: 1.35;
  color: var(--ink);
  min-height: 2.2em;
  margin: 14px 8px 6px;
  font-weight: 500;
}

/* The two big care tools - the only saturated things on the page. */
.tools {
  display: flex;
  justify-content: center;
  gap: clamp(20px, 6vw, 56px);
  padding: 8px 0 6px;
}
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 128px;
  min-height: var(--tap-min);
  padding: 16px 20px;
  border: 3px solid transparent;
  border-radius: 26px;
  background: #ffffff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  -webkit-user-select: none;
  user-select: none;
}
.tool:active { transform: translateY(2px) scale(0.97); box-shadow: 0 4px 12px rgba(74,64,56,0.16); }
.tool:focus-visible { outline: 4px solid rgba(111, 182, 201, 0.6); outline-offset: 3px; }
.tool--water { border-color: var(--water); }
.tool--light { border-color: var(--light); }
.tool__label { font-size: 20px; font-weight: 600; color: var(--ink); }
.reduced-motion .tool { transition: none; }

.paper-panel {
  margin: 10px 0 4px;
  padding: 18px 20px;
  background: var(--panel);
  border-radius: 22px;
  box-shadow: var(--shadow);
  text-align: center;
}
.paper-panel__script {
  margin: 0 0 14px;
  font-size: clamp(16px, 2.6vw, 19px);
  line-height: 1.45;
  color: var(--ink-soft);
}
.paper-btn {
  min-height: 60px;
  padding: 0 28px;
  border: none;
  border-radius: 18px;
  background: var(--light);
  color: #3d2f16;
  font-size: 20px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease;
}
.paper-btn:active { transform: translateY(2px) scale(0.98); }
.paper-btn:focus-visible { outline: 4px solid rgba(231, 178, 76, 0.6); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .plant, .glow, .drop, .tool, .paper-btn, .ground, body::after { animation: none !important; transition: none !important; }
}
