:root {
  --cream: #F3F6EC;
  --cream-deep: #E3EBD8;
  --paper: #FAFDF6;
  --ink: #24312A;
  --muted: #3E4B44;
  --line: #D4DFD0;
  --green: #24613F;
  --green-soft: #CDE5D4;
  --sage: #2F6B56;
  --gold: #D4B45A;
  --sun: #F0C96A;
  --shadow: 0 10px 30px rgba(43, 36, 32, 0.07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Hebrew", sans-serif;
  --radius: 1.25rem;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(196, 214, 140, 0.28), transparent 60%),
    radial-gradient(700px 380px at 100% 8%, rgba(180, 216, 196, 0.72), transparent 55%),
    var(--cream);
  min-height: 100vh;
}
h1, h2, .serif {
  font-family: var(--font);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] .serif { letter-spacing: 0; }

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.9rem;
  border-radius: 0.5rem;
  z-index: 50;
  min-height: 44px;
  text-decoration: none;
}
.skip:focus { top: 0.7rem; }

.wrap { width: min(44rem, calc(100% - 2rem)); margin-inline: auto; }

header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0;
  position: relative;
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: inherit;
  text-decoration: none;
  min-height: 44px;
  margin-inline-end: auto;
}
.brand-mark { width: 2.5rem; height: 2.5rem; flex: none; }
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.03em; }

.langs {
  display: flex;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 0.15rem;
  box-shadow: var(--shadow);
  flex: none;
}
.langs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  border-radius: 999px;
  padding: 0.25rem 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
}
.langs a:hover { color: var(--ink); }
.langs a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
}

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

.kicker {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 0.45rem;
  text-align: center;
}
html[dir="rtl"] .kicker { letter-spacing: 0.04em; text-transform: none; }

.panel { display: none; padding: 0.4rem 0 2rem; text-align: center; }
.panel.is-on { display: block; }

.panel h1, .panel h2:not(.step-meta) {
  font-weight: 700;
  font-size: clamp(1.85rem, 7vw, 2.8rem);
  margin: 0 auto 0.75rem;
  text-wrap: balance;
  max-width: 16ch;
}
h2.step-meta {
  font-size: 0.95rem;
  letter-spacing: 0;
  max-width: none;
  margin: 0 0 0.7rem;
}

.lede {
  color: var(--muted);
  max-width: 32rem;
  margin: 0 auto 1.2rem;
  font-size: 1.125rem;
  text-wrap: balance;
}

.scene-frame {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 0.2rem);
  box-shadow: var(--shadow);
  overflow: hidden;
  aspect-ratio: 360 / 260;
}
.scene-frame svg { width: 100%; height: auto; display: block; }

.stars {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.2rem 0 0.45rem;
}
.star {
  width: 1.7rem;
  height: 1.7rem;
  color: #E3D7B0;
}
.star svg { width: 100%; height: 100%; display: block; }
.star.is-on {
  color: var(--sun);
  animation: pop 0.45s ease;
}
.star.is-on svg path { stroke: #E0A454; }

@keyframes pop {
  0% { transform: scale(0.4); }
  70% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.step-meta {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
}

.step-line {
  font-size: clamp(1.35rem, 5.4vw, 1.85rem);
  line-height: 1.35;
  font-weight: 700;
  text-wrap: balance;
  max-width: 22ch;
  margin: 0 auto 1.15rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  min-height: 64px;
  min-width: 64px;
  width: 100%;
  max-width: 24rem;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--green);
  color: var(--paper);
  border-color: var(--green);
}
.btn:hover { background: var(--sage); border-color: var(--sage); }
.btn:active { transform: scale(0.98); }
.btn[disabled] {
  cursor: default;
  transform: none;
}
.btn-ink {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.btn-ink:hover { background: #1a2420; border-color: #1a2420; }

.live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

footer {
  padding: 0.5rem 0 1.6rem;
  color: var(--muted);
  font-size: 0.95rem;
}
footer p { margin: 0 0 0.7rem; }
footer p:last-child { margin-bottom: 0; }
footer a { color: var(--green); }
.noscript {
  max-width: 32rem;
  margin: 1rem auto;
  text-align: center;
  color: var(--muted);
}

/* Scene animations */
.sun-rise { animation: rise 1.1s ease-out both; }
@keyframes rise {
  from { transform: translateY(16px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.stretch-arms {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: stretch 1.6s ease-in-out infinite;
}
@keyframes stretch {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.bubble {
  animation: float-up 2.4s ease-in infinite;
  transform-box: fill-box;
}
.bubble:nth-of-type(2) { animation-delay: 0.4s; }
.bubble:nth-of-type(3) { animation-delay: 0.9s; }
.bubble:nth-of-type(4) { animation-delay: 1.3s; }
@keyframes float-up {
  0% { transform: translateY(0) scale(0.8); opacity: 0.15; }
  20% { opacity: 0.85; }
  100% { transform: translateY(-28px) scale(1.1); opacity: 0; }
}
.water {
  transform-box: fill-box;
  transform-origin: top center;
  animation: pour 1s ease-in-out infinite;
}
@keyframes pour {
  0%, 100% { transform: scaleY(0.9); }
  50% { transform: scaleY(1.08); }
}
.brush {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: wiggle 0.55s ease-in-out infinite;
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-16deg); }
  50% { transform: rotate(16deg); }
}
.tail {
  transform-box: fill-box;
  transform-origin: 10% 90%;
  animation: wag 0.7s ease-in-out infinite;
}
@keyframes wag {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(16deg); }
}
.sock {
  transform-box: fill-box;
  transform-origin: center center;
  animation: sock-wiggle 1.2s ease-in-out infinite;
}
@keyframes sock-wiggle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(10deg); }
}
.steam {
  animation: steam 2s ease-in infinite;
  transform-box: fill-box;
}
.steam-b { animation-delay: 0.5s; }
.steam-c { animation-delay: 1s; }
@keyframes steam {
  0% { transform: translateY(0); opacity: 0.1; }
  30% { opacity: 0.7; }
  100% { transform: translateY(-16px); opacity: 0; }
}
.shoes {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: shoe-bounce 1.1s ease-in-out infinite;
}
@keyframes shoe-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.bag {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: bag-sway 1.6s ease-in-out infinite;
}
@keyframes bag-sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
.sparkle {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 1.4s ease-in-out infinite;
}
.sparkle-b { animation-delay: 0.4s; }
.sparkle-c { animation-delay: 0.8s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}
.celebrate-sun {
  transform-box: fill-box;
  transform-origin: center;
  animation: sun-pulse 2.2s ease-in-out infinite;
}
@keyframes sun-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@media (min-width: 800px) {
  body { font-size: 1.125rem; }
  .panel { padding-top: 0.8rem; }
}

/* v2: tools, drag-and-drop, Koko, stickers, sound */
header .tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
}
.sound-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
  color: var(--green);
  cursor: pointer;
  flex: none;
}
.sound-btn:hover { color: var(--sage); }
.sound-btn[aria-pressed="false"] { color: var(--muted); }
.sound-btn svg { width: 22px; height: 22px; display: block; }
.sound-btn .icon-sound-on,
.sound-btn .icon-sound-off { display: none; }
.sound-btn[aria-pressed="true"] .icon-sound-on { display: block; }
.sound-btn[aria-pressed="false"] .icon-sound-off { display: block; }

.scene-wrap {
  position: relative;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto 1.1rem;
}
.scene-wrap .scene-frame {
  margin: 0;
  max-width: none;
}
.drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.85rem;
  background: rgba(36, 97, 63, 0.14);
  border-radius: calc(var(--radius) + 0.2rem);
  z-index: 4;
  pointer-events: none;
}
.drop-overlay[hidden] { display: none; }
.drop-overlay span {
  background: var(--paper);
  color: var(--green);
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid var(--green-soft);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  box-shadow: var(--shadow);
}
.scene-wrap.is-drop-ready .scene-frame {
  box-shadow: var(--shadow), 0 0 0 3px var(--green);
}
.scene-wrap.is-drop-over .drop-overlay {
  background: rgba(36, 97, 63, 0.26);
}

.koko-bubble {
  position: absolute;
  left: 50%;
  bottom: 0.7rem;
  translate: -50% 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  box-shadow: var(--shadow);
  color: var(--green);
  max-width: calc(100% - 1.5rem);
  z-index: 5;
  pointer-events: none;
  text-wrap: balance;
}
.koko-bubble[hidden] { display: none; }
.koko-bubble.is-on { animation: pop 0.35s ease; }

.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 6;
}
.fx-bit {
  position: absolute;
  font-size: 1.15rem;
  line-height: 1;
  animation: fx-float 0.95s ease-out forwards;
  color: #E8A3B3;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
.fx-bit.is-spark { color: #E0A454; }
@keyframes fx-float {
  0% { opacity: 1; transform: translate(-50%, 0) scale(0.55); }
  100% { opacity: 0; transform: translate(-50%, -58px) scale(1.15); }
}

.koko-hit { cursor: pointer; }
.koko-pad { fill: transparent; }
.koko-hit:focus { outline: none; }
.koko-hit:focus-visible .koko-pad {
  fill: rgba(36, 97, 63, 0.1);
  stroke: var(--green);
  stroke-width: 3;
}
.char-koko.is-cheering {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: koko-bounce 0.65s ease;
}
.char-koko.is-cheering .tail { animation: wag 0.25s ease-in-out infinite; }
@keyframes koko-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  28% { transform: translateY(-11px) scale(1.06); }
  52% { transform: translateY(0) scale(1); }
  74% { transform: translateY(-5px) scale(1.03); }
}

.drag-hint {
  margin: 0 auto 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  max-width: 28ch;
  text-wrap: balance;
}
.tray {
  margin: 0 auto 0.75rem;
  max-width: 24rem;
}
.token-slot {
  min-height: 4.25rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 999px;
}
.token-slot.is-empty {
  border: 2px dashed var(--line);
  background: rgba(255,255,255,0.35);
}
.token {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding-block: 0.4rem;
  padding-inline-start: 0.4rem;
  padding-inline-end: 1.15rem;
  min-height: 64px;
  border-radius: 999px;
  border: 2px dashed var(--green);
  background: var(--paper);
  box-shadow: var(--shadow);
  font: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.token:hover { border-color: var(--sage); }
.token:active, .token.is-dragging { cursor: grabbing; }
.token.is-dragging {
  position: fixed;
  z-index: 80;
  margin: 0;
  pointer-events: none;
  box-shadow: 0 14px 28px rgba(36, 97, 63, 0.2);
  transform: scale(1.05);
  border-style: solid;
}
.token-icon {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  border-radius: 50%;
  color: var(--green);
}
.token-icon svg { width: 30px; height: 30px; display: block; }

.shelf {
  margin: 0 auto 1.15rem;
  padding: 0.95rem 0.8rem 1.05rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 28rem;
  text-align: center;
}
.shelf[hidden] { display: none; }
.shelf-title {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0;
}
.shelf-msg {
  color: var(--muted);
  margin: 0 0 0.8rem;
  font-size: 1rem;
  text-wrap: balance;
}
.shelf-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.32rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}
.sticker {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  border: 2px dashed var(--line);
  background: var(--cream);
  display: grid;
  place-items: center;
  color: #C5D0C2;
  overflow: hidden;
}
.sticker svg { width: 70%; height: 70%; display: block; opacity: 0.25; filter: grayscale(1); }
.sticker.is-earned svg { opacity: 1; filter: none; }
.sticker.is-earned {
  border-style: solid;
  border-color: #E0A454;
  background: #FFF8E6;
  color: inherit;
  box-shadow: 0 4px 10px rgba(212, 180, 90, 0.25);
}
.sticker.is-new { animation: pop 0.55s ease; }

@media (min-width: 400px) {
  .sticker { width: 2.9rem; height: 2.9rem; }
}
