/* ==========================================================================
   Yeda Li — "אוספים דבש" multiplication game
   Kid-first: huge tap targets, high contrast, tablets are priority #1.
   Brand palette per Yeda_li_Brand Guidelines.
   ========================================================================== */

:root {
  --c-white: #ffffff;
  --c-sky: #00b9ff;
  --c-ultra: #010f95;
  --c-saffron: #f5c042;   /* honey! */
  --c-honey-dark: #d99e1b;
  --c-red: #eb3e4e;
  --c-purple: #9f5fa6;
  --c-mint: #2cb992;
  --c-ink: #1b2150;
  --c-ink-soft: #4a5076;

  --font: "Rubik", system-ui, sans-serif;
  --radius: 22px;
  --shadow: 0 8px 24px rgba(1, 15, 149, 0.14);
  --tap: 64px;            /* minimum touch target */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--c-ink);
  background: linear-gradient(180deg, #e9f7ff 0%, #f7fcff 45%, #eef9f3 100%);
  overflow-x: clip;
}

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
}

/* --- meadow backdrop ----------------------------------------------------- */
.meadow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.meadow__hill {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  width: 100%;
  height: clamp(90px, 18vh, 200px);
}

.meadow__flower {
  position: absolute;
  inset-block-end: clamp(8px, 2vh, 30px);
  width: clamp(34px, 5vw, 56px);
  height: auto;
}

.meadow__flower--1 { inset-inline-start: 6%; }
.meadow__flower--2 { inset-inline-start: 84%; }
.meadow__flower--3 { inset-inline-start: 58%; inset-block-end: 2px; width: clamp(26px, 4vw, 44px); }

/* --- top bar -------------------------------------------------------------- */
.topbar {
  position: fixed;
  inset-block-start: 12px;
  inset-inline: 14px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.iconbtn {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--c-white);
  color: var(--c-ultra);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}

.iconbtn:active { transform: scale(0.92); }

.iconbtn svg { width: 26px; height: 26px; }

.iconbtn svg[hidden] { display: none; }

/* --- screens -------------------------------------------------------------- */
.game {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 76px 16px calc(clamp(90px, 18vh, 200px) * 0.4);
}

.screen {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.screen[hidden] { display: none; }

/* ==========================================================================
   start screen
   ========================================================================== */
.start__bee img {
  width: clamp(90px, 16vw, 120px);
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(1, 15, 149, 0.18));
}

.bubble {
  margin-block-start: 10px;
  background: var(--c-white);
  border-radius: 20px;
  padding: 14px 26px;
  box-shadow: var(--shadow);
}

.bubble__hi {
  margin: 0;
  font-size: clamp(1.3rem, 4.5vw, 1.7rem);
  font-weight: 700;
  color: var(--c-ultra);
}

.bubble__sub {
  margin: 4px 0 0;
  font-size: clamp(1rem, 3.2vw, 1.15rem);
  color: var(--c-ink-soft);
}

/* honeycomb table picker */
.tables {
  display: grid;
  grid-template-columns: repeat(4, minmax(64px, 88px));
  gap: 10px;
  justify-content: center;
  margin-block-start: 22px;
}

@media (min-width: 560px) {
  .tables { grid-template-columns: repeat(6, 88px); }
}

.comb-btn {
  position: relative;
  aspect-ratio: 1 / 1.08;
  min-width: var(--tap);
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0% 50%);
  background: var(--c-white);
  border: none;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 800;
  color: var(--c-ultra);
  box-shadow: inset 0 0 0 4px #f4d98c;
  transition: transform 0.15s ease, background-color 0.2s ease;
}

.comb-btn:active { transform: scale(0.93); }

.comb-btn--active {
  background: var(--c-saffron);
  box-shadow: inset 0 0 0 4px var(--c-honey-dark);
}

.comb-btn--done::after {
  content: "🍯";
  position: absolute;
  inset-block-end: 6%;
  inset-inline-end: 14%;
  font-size: 0.85rem;
}

/* modes */
.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: min(100%, 480px);
  margin-block-start: 20px;
}

.mode {
  min-height: var(--tap);
  border-radius: var(--radius);
  background: var(--c-white);
  box-shadow: var(--shadow);
  padding: 12px 10px;
  border: 3px solid transparent;
}

.mode--active {
  border-color: var(--c-ultra);
  background: #eef3ff;
}

.mode__name {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--c-ultra);
}

.mode__hint {
  display: block;
  margin-block-start: 2px;
  font-size: 0.88rem;
  color: var(--c-ink-soft);
}

/* big primary button */
.bigbtn {
  min-height: var(--tap);
  margin-block-start: 22px;
  padding: 16px 46px;
  border-radius: 999px;
  background: var(--c-saffron);
  color: var(--c-ultra);
  font-size: clamp(1.25rem, 4.5vw, 1.5rem);
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(245, 192, 66, 0.55);
  transition: transform 0.15s ease;
}

.bigbtn:active { transform: scale(0.95); }

.bigbtn--ghost {
  background: var(--c-white);
  box-shadow: var(--shadow);
}

.best {
  margin: 14px 0 0;
  font-weight: 600;
  color: var(--c-ink-soft);
}

.reset {
  margin-block-start: 26px;
  background: none;
  font-size: 0.82rem;
  color: var(--c-ink-soft);
  text-decoration: underline;
}

/* ==========================================================================
   game screen
   ========================================================================== */
.hud {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.combs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
}

.comb {
  width: clamp(30px, 7.4vw, 44px);
  aspect-ratio: 1 / 1.08;
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0% 50%);
  background: var(--c-white);
  box-shadow: inset 0 0 0 3px #f4d98c;
  transition: background-color 0.3s ease;
}

.comb--full {
  background: var(--c-saffron);
  box-shadow: inset 0 0 0 3px var(--c-honey-dark);
  animation: comb-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes comb-pop {
  0% { transform: scale(0.6); }
  100% { transform: scale(1); }
}

.hud__info {
  display: flex;
  gap: 10px;
}

.hud__chip {
  background: var(--c-white);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 7px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-ultra);
}

.hud__chip--timer.is-low { background: #fde0e3; color: #b3202f; }

/* stage */
.stage {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  padding-block: clamp(14px, 3vh, 28px);
}

.flower {
  position: relative;
  width: clamp(210px, 42vh, 300px);
}

.flower__svg { width: 100%; height: auto; }

.flower__petals { transform-origin: 120px 120px; }

.flower__q {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(2rem, 7vw, 2.9rem);
  font-weight: 800;
  color: var(--c-ultra);
  unicode-bidi: isolate;
}

.gbee {
  position: absolute;
  inset-inline-start: clamp(2%, 4vw, 12%);
  inset-block-start: 4%;
  width: clamp(64px, 11vw, 88px);
  z-index: 3;
  filter: drop-shadow(0 6px 14px rgba(1, 15, 149, 0.2));
}

.gbee img { width: 100%; height: auto; }

.drop {
  position: absolute;
  z-index: 2;
  width: 22px;
  inset-block-start: 0;
  inset-inline-start: 0;
}

.praise {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 6%;
  margin: 0;
  padding: 10px 20px;
  background: var(--c-white);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  font-weight: 800;
  color: var(--c-ultra);
  opacity: 0;
  z-index: 4;
}

/* answers: HUGE kid-friendly buttons */
.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: min(100%, 560px);
}

.answer {
  min-height: clamp(64px, 11vh, 88px);
  border-radius: var(--radius);
  background: var(--c-white);
  box-shadow: var(--shadow);
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  font-weight: 800;
  color: var(--c-ultra);
  border: 4px solid transparent;
  transition: transform 0.12s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.answer:active { transform: scale(0.95); }

.answer--right {
  background: #e2f7ec;
  border-color: var(--c-mint);
}

.answer--wrong {
  background: #fdeef0;
  border-color: #f6b9c0;
}

.answer[disabled] { cursor: default; }

/* ==========================================================================
   win screen
   ========================================================================== */
.jar { position: relative; width: clamp(130px, 24vh, 170px); }

.jar svg { width: 100%; height: auto; filter: drop-shadow(0 10px 24px rgba(1, 15, 149, 0.18)); }

.jar__num {
  position: absolute;
  inset-inline-start: 50%;
  inset-block-start: 58%;
  translate: -50% -50%;
  font-size: 2.6rem;
  font-weight: 800;
  color: #8a5b00;
}

[dir="rtl"] .jar__num { translate: 50% -50%; }

.win__title {
  margin: 18px 0 0;
  font-size: clamp(1.6rem, 6vw, 2.3rem);
  font-weight: 800;
  color: var(--c-ultra);
}

.win__stats {
  margin: 8px 0 0;
  font-size: clamp(1.05rem, 3.6vw, 1.25rem);
  font-weight: 600;
  color: var(--c-ink-soft);
}

.win__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-block-start: 8px;
}

.win__btns .bigbtn { margin-block-start: 14px; padding-inline: 30px; }

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 30;
}

.confetti i {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  inset-block-start: -20px;
}

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