/* הַיּוֹם שֶׁלִּי בְּבֵית הַסֵּפֶר · Looly soft pastel UI
   Strict: no blur, no backdrop-filter, no feathered / faded edges. Crisp offset shadows only. */
@font-face {
  font-family: 'HeeboLooly';
  src: url('../fonts/Heebo.ttf?v=7') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --cream: #FFF9F1;
  --paper: #FFFFFF;
  --text: #4A3F55;
  --text-soft: #6E6280;
  --plum: #6B4C9A;
  --line: #EADFD3;
  --gold: #F2B35E;
  --gold-soft: #FFF1D6;
  --mint: #DDF3E6;
  --mint-d: #A9DDBF;
  --lav: #ECE4FA;
  --lav-d: #C9B6EE;
  --peach: #FDE7D9;
  --peach-d: #F5C3A3;
  --sky: #E2F0FB;
  --sky-d: #A9CFEE;
  --butter: #FFF3CF;
  --butter-d: #F2D88A;
  --rose: #FCE6EE;
  --rose-d: #F2B9CB;
  --marker: #FFF3A8;
  --marker-pulse: #F2D88A;
  --shadow: 0 6px 0 rgba(110, 90, 108, 0.10);
  --shadow-sm: 0 4px 0 rgba(110, 90, 108, 0.10);
  --radius: 26px;
  --radius-sm: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  font-family: 'HeeboLooly', 'Heebo', 'Rubik', system-ui, sans-serif;
  background: var(--cream);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
body { min-height: 100dvh; overflow-x: hidden; position: relative; }
img { -webkit-user-drag: none; user-select: none; }
button { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
.ico { width: 26px; height: 26px; flex: none; }

.decor { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; }
.b1 { width: 340px; height: 340px; background: #FBEADF; top: -150px; right: -110px; }
.b2 { width: 260px; height: 260px; background: #EAF3EC; bottom: -120px; left: -90px; }
.b3 { width: 120px; height: 120px; background: #F1EAFB; top: 38%; left: -60px; }
.b4 { width: 90px; height: 90px; background: #FCEFF4; bottom: 12%; right: -36px; }

.screen {
  position: relative; z-index: 1;
  display: none; flex-direction: column;
  min-height: 100dvh; width: 100%; max-width: 1240px;
  margin: 0 auto;
  padding: calc(14px + var(--safe-top)) 20px calc(16px + var(--safe-bottom));
}
.screen.active { display: flex; animation: screenIn 0.35s ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 12px 26px;
  border: 3px solid transparent; border-radius: 999px;
  font-size: 1.3rem; font-weight: 700; line-height: 1.3;
  cursor: pointer; touch-action: manipulation; user-select: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(110, 90, 108, 0.12); }
.btn:focus-visible, .stage-card:focus-visible, .opt:focus-visible, .say:focus-visible,
.gender-btn:focus-visible, .match-sent:focus-visible, .match-pic:focus-visible, .dot:focus-visible {
  outline: 4px solid var(--gold); outline-offset: 3px;
}
.btn-main { background: #8FCFAE; color: #24493A; border-color: #7EC19F; }
.btn-main:hover { background: #9BD6B7; }
.btn-soft { background: var(--paper); color: var(--plum); border-color: var(--line); }
.btn-soft:hover { background: #FFF6EC; }
.btn-listen {
  background: var(--sky); color: #3F6C99; border-color: var(--sky-d);
  min-height: 52px; padding: 10px 20px; font-size: 1.2rem;
}
.btn-listen:hover { background: #D5E9F9; }
.btn-listen.talking { animation: talk 0.6s ease; }

.say {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid #CFE4F5; background: var(--sky); color: #4E79A7;
  cursor: pointer; touch-action: manipulation; flex: none;
  box-shadow: 0 3px 0 rgba(78, 121, 167, 0.18);
  transition: transform 0.15s ease;
}
.say .ico { width: 24px; height: 24px; }
.say:hover { background: #D5E9F9; }
.say.talking { animation: talk 0.6s ease; }
.say-sm { width: 36px; height: 36px; }
.say-sm .ico { width: 20px; height: 20px; }
@keyframes talk { 0%,100% { transform: scale(1); } 40% { transform: scale(1.15); } }

/* home */
.home-hero {
  display: flex; flex-direction: column; align-items: stretch;
  background: var(--paper); border: 3px solid var(--line);
  border-radius: 34px; padding: 14px 22px 18px; box-shadow: var(--shadow);
  position: relative;
}
.hero-logo { position: absolute; top: 14px; left: 18px; width: 116px; height: auto; }
.hero-main { display: flex; align-items: center; gap: 22px; }
.hero-giraffe { width: auto; height: 200px; flex: none; }
.hero-text { flex: 1; min-width: 0; padding-top: 8px; }
.title { font-size: clamp(1.85rem, 4vw, 2.9rem); font-weight: 800; color: var(--plum); line-height: 1.35; }
.subtitle { font-size: clamp(1.1rem, 2.2vw, 1.45rem); color: var(--text-soft); font-weight: 600; margin-top: 4px; line-height: 1.55; }
.gender-pick { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.gender-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 20px; min-height: 58px;
  border-radius: 999px; border: 3px solid var(--line); background: #FFFDF9;
  font-size: 1.25rem; font-weight: 700; cursor: pointer; touch-action: manipulation;
  box-shadow: var(--shadow-sm);
}
.gender-btn[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold); }
.g-face { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: #FCEBDD; flex: none; position: relative; border: 2px solid #fff; }
.g-face img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }

/* story card */
.story-card {
  margin-top: 16px; background: var(--paper); border: 3px solid var(--line);
  border-radius: 30px; padding: 16px 18px 18px; box-shadow: var(--shadow);
}
.story-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.story-guide { width: auto; height: 64px; flex: none; }
.story-head-text { flex: 1; min-width: 140px; }
.story-title { font-size: 1.55rem; font-weight: 800; color: var(--plum); line-height: 1.3; }
.story-hint { font-size: 1.05rem; font-weight: 600; color: var(--text-soft); line-height: 1.45; }
.story-body { display: flex; flex-direction: column; gap: 12px; }
.para {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px 12px; align-items: start;
  background: #FFFAF4; border: 3px solid var(--line); border-radius: 22px; padding: 12px 14px;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.para-img {
  width: 100px; height: 100px; border-radius: 18px; object-fit: contain; object-position: center;
  border: 2px solid #fff; background: #fff; flex: none;
  box-shadow: 0 3px 0 rgba(110, 90, 108, 0.08);
}
.para-text { font-size: clamp(1.45rem, 2.6vw, 1.95rem); font-weight: 600; line-height: 1.85; color: var(--text); }
.para.reading {
  background: var(--sky); border-color: var(--sky-d);
  box-shadow: 0 0 0 4px rgba(169, 207, 238, 0.55);
}
.para.answer-hl {
  background: #FFF3A8; border-color: #F2D88A;
  box-shadow: 0 0 0 5px rgba(242, 179, 94, 0.65);
  animation: pulseOutline 1.4s ease 2;
}
.para.hint-pulse {
  animation: pulseOutline 1.4s ease 3;
  border-color: var(--gold);
}
@keyframes pulseOutline {
  0%,100% { box-shadow: 0 0 0 0 rgba(242, 179, 94, 0); }
  50% { box-shadow: 0 0 0 6px rgba(242, 179, 94, 0.75); }
}
.sent-hl {
  background: #FFE566; border-radius: 8px; padding: 1px 6px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
  box-shadow: 0 0 0 2px rgba(242, 179, 94, 0.55);
}

.progress-strip {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 14px 4px 0; font-size: 1.15rem; font-weight: 700; color: var(--text-soft);
}
.progress-strip .chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--paper); border: 3px solid var(--line); border-radius: 999px;
  padding: 6px 14px; box-shadow: var(--shadow-sm);
}
.progress-strip .chip img { width: 28px; height: 28px; }

.stages-head { font-size: 1.6rem; font-weight: 800; color: var(--plum); margin: 18px 6px 10px; }
.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stage-card {
  position: relative; display: grid;
  grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  text-align: right; padding: 16px 18px; min-height: 138px;
  border-radius: var(--radius); border: 3px solid transparent;
  cursor: pointer; touch-action: manipulation; box-shadow: var(--shadow);
  transition: transform 0.18s ease;
}
.stage-card:hover { transform: translateY(-3px); }
.stage-card:active { transform: translateY(2px); }
.stage-card.s1 { background: var(--mint); border-color: var(--mint-d); }
.stage-card.s2 { background: var(--lav); border-color: var(--lav-d); }
.stage-card.s3 { background: var(--peach); border-color: var(--peach-d); }
.stage-card.s4 { background: var(--sky); border-color: var(--sky-d); }
.stage-card.s5 { background: var(--butter); border-color: var(--butter-d); }
.stage-num {
  position: absolute; top: -12px; right: 16px;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--paper); border: 3px solid currentColor; color: var(--plum);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem;
}
.stage-done {
  position: absolute; top: -12px; left: 16px; width: 38px; height: 38px; border-radius: 50%;
  background: #8FCFAE; color: #fff; display: flex; align-items: center; justify-content: center;
  border: 3px solid #fff; box-shadow: 0 3px 0 rgba(36, 73, 58, 0.18);
}
.stage-thumbs { grid-row: 1 / span 2; display: flex; align-items: center; }
.stage-thumbs img {
  width: 84px; height: 84px; border-radius: 22px; border: 3px solid #fff; background: #FFFAF3;
  object-fit: contain; object-position: center;
}
.stage-thumbs img + img { margin-right: -22px; transform: rotate(-6deg); }
.stage-thumbs img:first-child:not(:last-child) { transform: rotate(5deg); position: relative; z-index: 1; }
.stage-title { font-size: 1.45rem; font-weight: 800; color: var(--text); line-height: 1.35; align-self: end; }
.stage-desc { font-size: 1.05rem; font-weight: 500; color: var(--text-soft); line-height: 1.45; align-self: start; }
.stage-stars { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 1rem; font-weight: 700; color: var(--plum); }
.stage-stars img { width: 22px; height: 22px; }

@media (min-width: 900px) {
  .stage-card { grid-template-columns: 1fr; grid-template-rows: auto auto auto; justify-items: center; text-align: center; row-gap: 2px; }
  .stage-thumbs { grid-row: auto; margin-bottom: 6px; }
  .stage-thumbs img { width: 104px; height: 104px; border-radius: 26px; object-fit: contain; background: #FFFAF3; }
  .stage-title { font-size: 1.55rem; }
}

/* play */
.topbar { display: flex; align-items: center; gap: 12px; min-height: 58px; flex-wrap: wrap; }
.top-logo { width: 86px; height: auto; flex: none; }
.top-title { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 800; color: var(--plum); min-width: 0; }
.stage-badge {
  width: 38px; height: 38px; border-radius: 50%; background: var(--gold-soft); border: 3px solid var(--gold);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; flex: none;
}
.dots { display: flex; gap: 7px; margin-inline-start: auto; flex-wrap: wrap; justify-content: center; }
.dot {
  width: 18px; height: 18px; border-radius: 50%; background: #F1E7DC; border: 2px solid #E6D8CA;
  cursor: pointer; touch-action: manipulation; transition: background 0.3s ease, transform 0.15s ease;
  padding: 0;
}
.dot.on { background: #8FCFAE; border-color: #7EC19F; transform: scale(1.12); }
.dot.done { background: var(--butter); border-color: var(--butter-d); }
.dot.starred { background: var(--gold); border-color: #E0A04A; }
.star-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--gold-soft); border: 3px solid var(--gold); border-radius: 999px;
  padding: 4px 12px 4px 8px; font-size: 1.2rem; font-weight: 800; color: var(--plum); flex: none;
}
.star-chip img { width: 28px; height: 28px; }
.btn-home { min-height: 50px; padding: 8px 18px; font-size: 1.12rem; flex: none; }

.coach { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0 8px; }
.coach-giraffe { width: auto; height: 66px; flex: none; }
.coach-giraffe.happy { animation: hop 0.6s ease; }
@keyframes hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-12px) rotate(-3deg); } 70% { transform: translateY(-3px); } }
.coach-bubble {
  background: var(--paper); border: 3px solid var(--line); border-radius: 22px;
  padding: 10px 18px; font-size: 1.25rem; font-weight: 600; line-height: 1.5; box-shadow: var(--shadow-sm);
  position: relative; max-width: 720px;
}
.coach-bubble::before {
  content: ''; position: absolute; right: -11px; top: 50%; margin-top: -9px;
  border-width: 9px 0 9px 11px; border-style: solid; border-color: transparent transparent transparent var(--line);
}

.strategy {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
  background: var(--lav); border: 3px solid var(--lav-d); border-radius: 999px;
  padding: 8px 14px; margin: 0 0 12px; font-size: 0.98rem; font-weight: 700; color: #5A4688;
}
.st-step { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.st-n {
  width: 22px; height: 22px; border-radius: 50%; background: var(--paper); color: var(--plum);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 800;
  border: 2px solid var(--lav-d);
}
.st-arr { width: 18px; height: 18px; color: #9B86C9; flex: none; transform: scaleX(-1); }

.play-area { flex: 1; display: flex; flex-direction: column; gap: 14px; min-height: 0; }

.feedback {
  min-height: 60px; margin-top: 10px;
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  font-size: 1.45rem; font-weight: 800; border-radius: 999px; padding: 8px 20px;
  opacity: 0; transform: translateY(6px); transition: opacity 0.25s ease, transform 0.25s ease;
}
.feedback.show { opacity: 1; transform: none; }
.feedback.ok { background: var(--mint); color: #2E6A4C; border: 3px solid var(--mint-d); }
.feedback.try { background: var(--rose); color: #8A4A5E; border: 3px solid var(--rose-d); }
.fb-star { width: 42px; height: 42px; animation: starPop 0.5s ease; }
@keyframes starPop { 0% { transform: scale(0.4) rotate(-20deg); } 70% { transform: scale(1.15) rotate(6deg); } 100% { transform: scale(1); } }
.feedback .btn-listen { min-height: 44px; font-size: 1.05rem; padding: 6px 14px; }

/* play story panel (above question) */
.play-story {
  background: var(--paper); border: 3px solid var(--line); border-radius: 24px;
  padding: 10px 14px 12px; box-shadow: var(--shadow-sm);
}
.play-story-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap;
}
.play-story-head h3 { font-size: 1.2rem; font-weight: 800; color: var(--plum); flex: 1; }
.play-story-toggle {
  background: transparent; border: 2px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 0.95rem; font-weight: 700; color: var(--plum); cursor: pointer;
}
.play-story .story-body {
  gap: 10px; max-height: min(42vh, 360px); overflow-y: auto; padding-inline-end: 4px;
}
.play-story .para { padding: 10px 12px; border-radius: 16px; grid-template-columns: auto 1fr auto; }
.play-story .para-img { width: 88px; height: 88px; border-radius: 14px; }
.play-story .para-text { font-size: clamp(1.35rem, 2.4vw, 1.75rem); line-height: 1.8; }
.play-story.collapsed .story-body { display: none; }
.play-story.play-story-match .story-body { max-height: min(26vh, 210px); }
.play-story.play-story-match .para-img { width: 80px; height: 80px; }
.play-story.play-story-match .para-text { font-size: clamp(1.35rem, 2.3vw, 1.65rem); line-height: 1.8; }

.q-panel {
  background: var(--paper); border: 3px solid var(--line); border-radius: 26px;
  padding: 12px 16px; box-shadow: var(--shadow);
}
.q-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.q-text { font-size: clamp(1.35rem, 2.6vw, 1.7rem); font-weight: 800; color: var(--plum); line-height: 1.45; flex: 1; }
.opts { display: grid; gap: 12px; }
.opts.mc { grid-template-columns: 1fr; }
@media (min-width: 800px) { .opts.mc { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
.opts.mc .opt { min-height: 64px; padding: 12px 14px; font-size: clamp(1.15rem, 2vw, 1.4rem); }
.opt {
  width: 100%; text-align: right; border-radius: 22px; border: 3px solid var(--line); background: #FFFAF4;
  cursor: pointer; touch-action: manipulation; box-shadow: var(--shadow-sm);
  padding: 14px 18px; font-size: clamp(1.25rem, 2.4vw, 1.55rem); font-weight: 700; line-height: 1.5;
  transition: transform 0.15s ease, background 0.25s ease, border-color 0.25s ease;
}
.opt:hover { transform: translateY(-2px); background: #FFF6EC; }
.opt.correct { background: var(--mint); border-color: var(--mint-d); color: #2E6A4C; }
.opt.wrong { background: var(--rose); border-color: var(--rose-d); color: #8A4A5E; opacity: 0.85; }
.opt:disabled { cursor: default; }

/* true/false */
.tf-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.opt-tf { min-height: 72px; font-size: 1.6rem; font-weight: 800; justify-content: center; display: flex; align-items: center; }
.opt-true { background: var(--mint); border-color: var(--mint-d); color: #2E6A4C; }
.opt-false { background: var(--peach); border-color: var(--peach-d); color: #8A5A3E; }
.opt-true.correct, .opt-false.correct { background: var(--mint); border-color: var(--mint-d); color: #2E6A4C; }
.opt-true.wrong, .opt-false.wrong { background: var(--rose); border-color: var(--rose-d); color: #8A4A5E; }

/* matching */
.match-board {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start;
}
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-col#col-pics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.match-col#col-pics .match-col-h { grid-column: 1 / -1; }
/* pics: contain — never crop characters; card sized to image */
.match-col-h {
  font-size: 1.2rem; font-weight: 800; color: var(--plum); text-align: center;
  background: var(--butter); border: 3px solid var(--butter-d); border-radius: 999px; padding: 6px 12px;
}
.match-sent, .match-pic {
  position: relative; display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 3px solid var(--line); border-radius: 20px;
  padding: 10px 12px; cursor: pointer; touch-action: none; user-select: none;
  box-shadow: var(--shadow-sm); transition: transform 0.15s ease, border-color 0.2s ease, background 0.25s ease;
  min-height: 72px;
}
.match-sent:hover, .match-pic:hover { transform: translateY(-2px); }
.match-sent .ms-text { flex: 1; font-size: clamp(1.35rem, 2.5vw, 1.7rem); font-weight: 700; line-height: 1.7; }
.match-pic {
  padding: 6px; justify-content: center; align-items: center;
  min-height: 0; aspect-ratio: 4 / 3; overflow: hidden;
  background: #FFFAF3;
}
.match-pic img {
  width: 100%; height: 100%;
  object-fit: contain; object-position: center; /* full character, no crop */
  border-radius: 12px; background: #FFFAF3; display: block;
  transform: none;
}
.match-sent.selected, .match-pic.selected {
  border-color: var(--gold); background: var(--gold-soft);
  box-shadow: 0 6px 0 rgba(242, 179, 94, 0.3);
}
.match-sent.matched, .match-pic.matched {
  background: var(--mint); border-color: var(--mint-d); cursor: default;
}
.match-sent.matched::after, .match-pic.matched::after {
  content: ''; position: absolute; top: -10px; left: -8px;
  width: 32px; height: 32px;
  background: url('../assets/star-96.png?v=7') center/contain no-repeat;
}
.match-sent.shake, .match-pic.shake { animation: shake 0.5s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }
.match-ghost {
  position: fixed; z-index: 1000; pointer-events: none; opacity: 0.92;
  transform: rotate(-2deg) scale(1.04); border-color: var(--gold) !important; background: var(--gold-soft) !important;
  box-shadow: 0 10px 0 rgba(110, 90, 108, 0.16); margin: 0; max-width: 320px;
}
.match-progress {
  text-align: center; font-size: 1.15rem; font-weight: 700; color: var(--text-soft); margin-top: 4px;
}

/* end */
#screen-end { align-items: center; justify-content: center; }
.end-card {
  width: min(100%, 920px); background: var(--paper); border: 3px solid var(--line); border-radius: 36px;
  padding: 18px 26px 22px; box-shadow: var(--shadow); text-align: center; position: relative; z-index: 2;
}
.end-head { display: flex; align-items: center; justify-content: center; gap: 14px; }
.end-star { width: 58px; height: 58px; animation: starPop 0.7s ease both; }
.end-title { font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 800; color: var(--plum); line-height: 1.3; }
.end-sub { font-size: clamp(1.25rem, 2.6vw, 1.6rem); font-weight: 700; color: var(--text-soft); margin: 2px 0 14px; line-height: 1.5; }
.end-tiles {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px;
}
.end-tile {
  background: var(--cream); border: 3px solid var(--line); border-radius: 22px; padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.end-tile.t1 { background: var(--gold-soft); border-color: var(--gold); }
.end-tile.t2 { background: var(--mint); border-color: var(--mint-d); }
.end-tile.t3 { background: var(--sky); border-color: var(--sky-d); }
.end-tile.t4 { background: var(--lav); border-color: var(--lav-d); }
.end-tile.t5 { background: var(--peach); border-color: var(--peach-d); }
.end-tile.t6 { background: var(--butter); border-color: var(--butter-d); }
.end-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.end-tile img { width: 40px; height: 40px; }
.end-tile .et-val { font-size: 1.8rem; font-weight: 800; color: var(--plum); line-height: 1.2; }
.end-tile .et-lab { font-size: 1.05rem; font-weight: 600; color: var(--text-soft); }
.end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.end-giraffe { position: fixed; bottom: 8px; left: 14px; height: 190px; width: auto; z-index: 1; pointer-events: none; }

/* modal – opaque, no blur */
.modal-bg {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(74, 63, 85, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--paper); border: 3px solid var(--line); border-radius: 28px;
  padding: 22px 24px; max-width: 420px; width: 100%; box-shadow: var(--shadow); text-align: center;
}
.modal h3 { font-size: 1.5rem; font-weight: 800; color: var(--plum); margin-bottom: 8px; }
.modal p { font-size: 1.15rem; font-weight: 600; color: var(--text-soft); margin-bottom: 16px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* fx */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 2000; overflow: hidden; }
.fx-star { position: absolute; margin: -12px 0 0 -12px; animation: fly 0.9s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes fly {
  0% { transform: translate(0, 0) scale(0.3) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--rot)); opacity: 0; }
}
.fx-ring { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 4px solid var(--gold); animation: ring 0.7s ease-out forwards; }
@keyframes ring { from { transform: scale(0.4); opacity: 0.9; } to { transform: scale(4.2); opacity: 0; } }
.confetti { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 4px; animation-name: fall; animation-timing-function: linear; animation-fill-mode: forwards; }
.confetti.round { width: 13px; height: 13px; border-radius: 50%; }
@keyframes fall { from { transform: translate(0, -20px) rotate(0); } to { transform: translate(var(--drift), 110vh) rotate(var(--spin)); } }

@media (min-width: 900px) and (max-height: 860px) {
  .screen { padding-top: 10px; padding-bottom: 10px; }
  .hero-giraffe { height: 170px; }
  .coach { margin: 4px 0 6px; }
  .coach-giraffe { height: 54px; }
  .strategy { font-size: 0.9rem; padding: 6px 12px; }
  .play-story .para-img { width: 72px; height: 72px; }
  .play-story .para-text { font-size: 1.35rem; }
  .play-story .story-body { max-height: min(36vh, 300px); }
}

@media (max-width: 899px) {
  .stage-grid { grid-template-columns: 1fr; }
  .match-board { grid-template-columns: 1fr; }
  .end-giraffe { display: none; }
  .strategy { border-radius: 22px; font-size: 0.88rem; }
  .st-arr { display: none; }
  .tf-opts { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .screen { padding: calc(10px + var(--safe-top)) 12px calc(12px + var(--safe-bottom)); }
  .home-hero { padding: 12px 14px 16px; border-radius: 28px; }
  .hero-logo { width: 84px; top: 10px; left: 12px; }
  .hero-main { flex-direction: column; gap: 4px; text-align: center; }
  .hero-giraffe { height: 140px; }
  .title { font-size: 1.7rem; }
  .gender-pick { justify-content: center; }
  .story-card { padding: 12px; border-radius: 24px; }
  .para { grid-template-columns: auto 1fr; }
  .para .say { grid-column: 2; justify-self: start; }
  .para-img { width: 78px; height: 78px; }
  .para-text { font-size: 1.4rem; line-height: 1.75; }
  .topbar { gap: 8px; }
  .top-logo { width: 62px; }
  .btn-home-label { display: none; }
  .dots { order: 5; width: 100%; margin: 2px 0 0; }
  .coach-bubble { font-size: 1rem; padding: 6px 12px; }
  .coach-giraffe { height: 46px; }
  .q-text { font-size: 1.35rem; }
  .opt { font-size: 1.2rem; padding: 12px 14px; }
  .end-tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .end-actions .btn { width: 100%; }
  .feedback { font-size: 1.2rem; border-radius: 22px; }
}

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

@media (min-width: 900px) and (max-height: 860px) {
  .story-card { margin-top: 10px; padding: 10px 14px 12px; }
  .para { padding: 8px 10px; gap: 8px; }
  .para-img { width: 96px; height: 96px; }
  .para-text { font-size: 1.8rem; line-height: 1.85; }
  .stages-head { margin: 10px 6px 8px; font-size: 1.35rem; }
  .stage-card { min-height: 110px; padding: 12px 14px; }
  .progress-strip { margin-top: 8px; }
}

/* fill + prep */
.word-bank {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 8px;
}
.word-chip {
  min-width: 120px; min-height: 58px !important; font-size: clamp(1.25rem, 2.4vw, 1.55rem) !important;
  padding: 10px 18px !important;
}
.blank {
  display: inline-block; min-width: 4.5em; margin: 0 4px; padding: 2px 10px;
  border-bottom: 4px solid var(--gold); border-radius: 8px;
  background: var(--gold-soft); color: var(--plum); font-weight: 800;
  text-align: center; line-height: 1.6;
}
.blank.filled {
  background: var(--mint); border-bottom-color: var(--mint-d); color: #2E6A4C;
}
.fill-sent { line-height: 1.7 !important; }
.prep-tip {
  text-align: center; font-size: 1.1rem; font-weight: 700; color: #5A4688;
  background: var(--lav); border: 3px solid var(--lav-d); border-radius: 999px;
  padding: 8px 16px; margin-bottom: 10px;
}
.opt-wrap { position: relative; }
.say-opt { position: absolute; left: 10px; top: 50%; margin-top: -18px; z-index: 2; }
@media (max-width: 600px) {
  .word-chip { min-width: 44%; }
  .prep-tip { font-size: 0.95rem; border-radius: 18px; }
  .end-tiles { grid-template-columns: 1fr 1fr !important; }
}


/* v6: story parts + category chips */
.story-part { margin-bottom: 18px; }
.part-head {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 4px 12px; padding: 10px 14px;
  background: var(--lav); border: 3px solid var(--lav-d);
  border-radius: 18px; box-shadow: var(--shadow-sm);
}
.part-title {
  flex: 1; font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  font-weight: 800; color: var(--plum); line-height: 1.35;
}
.cat-chip {
  display: inline-flex; align-items: center; justify-content: center;
  align-self: flex-start;
  margin: 0 0 10px;
  padding: 6px 14px; min-height: 34px;
  border-radius: 999px; border: 3px solid transparent;
  font-size: 1.05rem; font-weight: 800; letter-spacing: 0.01em;
  box-shadow: var(--shadow-sm);
}
.cat-easy { background: #E8F6EE; border-color: #A8D5B5; color: #2F6B45; }
.cat-info { background: var(--sky); border-color: var(--sky-d); color: #3F6C99; }
.cat-cause { background: var(--peach); border-color: var(--peach-d); color: #8A5A3A; }
.cat-seq { background: var(--mint); border-color: var(--mint-d); color: #2F5A45; }
.cat-infer { background: var(--lav); border-color: var(--lav-d); color: var(--plum); }
.cat-challenge { background: var(--butter); border-color: var(--butter-d); color: #7A5A18; }
.q-panel { display: flex; flex-direction: column; }
