const { useState, useEffect, useRef } = React;

const C = {
  t:"#C4785A",tl:"#E8A98A",cr:"#FAF6F0",cd:"#F0E8DC",
  sg:"#8A9E8C",sgl:"#C2D0C4",br:"#5C3D2E",tx:"#3A2E28",txl:"#6B5C54"
};
const card = {background:"white",borderRadius:16,padding:20,marginBottom:16,boxShadow:"0 2px 12px rgba(92,61,46,0.08)"};
const ttl = {fontFamily:"Georgia,serif",fontSize:20,color:C.br,marginBottom:12};
const bdy = {fontSize:14,lineHeight:1.7,color:C.txl};

const WD = {
  4:{sz:"פרג",emoji:"🌱",szEn:"poppy seed",hl:"האמבריון נקשר לרחם",sys:"הלב והמוח מתחילים",tip:"חומצה פולית חשובה!",sym:"עייפות, בחילות קלות",tests:[]},
  5:{sz:"גרגיר שומשום",emoji:"🌾",szEn:"sesame seed",hl:"הלב מתחיל לפעום!",sys:"צינור עצבי נסגר",tip:"הפסיקי אלכוהול ועישון",sym:"בחילות, עייפות קיצונית",tests:[]},
  6:{sz:"אפונה",emoji:"🫛",szEn:"pea",hl:"ניצנים של ידיים ורגליים",sys:"המוח מתפתח מהר",tip:"קבעי אולטרסאונד ראשון",sym:"בחילות בוקר וערב, ריח מוגבר",tests:["בדיקת דם ראשונה","TSH – בלוטת תריס"]},
  8:{sz:"פטל",emoji:"🫐",szEn:"raspberry",hl:"כל האיברים החיוניים קיימים!",sys:"אצבעות מתפתחות",tip:"אולטרסאונד ראשון בקרוב",sym:"בחילות, שינויי מצב רוח",tests:["אולטרסאונד ראשון – דופק"]},
  10:{sz:"תות",emoji:"🍓",szEn:"strawberry",hl:"העובר יכול לבלוע!",sys:"מפרקים נוצרים",tip:"בדיקת CVS אם הוצע – שב 10-13",sym:"בחילות מתמשכות",tests:[]},
  12:{sz:"שזיף",emoji:"🍑",szEn:"plum",hl:"סוף טרימסטר ראשון!",sys:"מע' עצבים מפותחת",tip:"NT + בדיקת דם גנטית",sym:"פיחות רגליים, כאבי גב",tests:["שקיפות עורפית (NT)","בדיקת כרומוזומים מדם"]},
  14:{sz:"לימון",emoji:"🍋",szEn:"lemon",hl:"כמעט ורי לשמוע דפיקות לב!",sys:"ביטויי פנים מתפתחים",tip:"אנרגיה חוזרת לרוב!",sym:"אנרגיה חוזרת, תיאבון גדל",tests:[]},
  16:{sz:"אבוקדו",emoji:"🥑",szEn:"avocado",hl:"תנועות ראשונות – פרפרים!",sys:"שמיעה מתפתחת",tip:"בדיקת מי שפיר אם הוצע",sym:"כאבי גב, תנועות עדינות",tests:["בדיקת מי שפיר (אם מוצעת)","AFP + Quad Screen"]},
  18:{sz:"בטטה",emoji:"🍠",szEn:"sweet potato",hl:"פעמים ראשונות לבעיטות!",sys:"רשתית העין מתפתחת",tip:"ישני על הצד השמאלי",sym:"כאבי גב, סחרחורות",tests:[]},
  20:{sz:"בננה",emoji:"🍌",szEn:"banana",hl:"אמצע ההריון! אולטרסאונד מלא",sys:"עור מכוסה vernix",tip:"אנטומיה מקיפה בשב 20-22",sym:"כאבי גב, תכיפות שתן",tests:["סקירת מחצית – בדיקת אנטומיה"]},
  22:{sz:"פפאיה",emoji:"🫐",szEn:"papaya",hl:"מגיב לצלילים מבחוץ",sys:"שיניים מתפתחות",tip:"שוחי בריכה – מצוין לגב!",sym:"גרפון, שרירי בטן מתוחים",tests:[]},
  24:{sz:"תירס",emoji:"🌽",szEn:"corn",hl:"ריאות מתחילות לייצר surfactant",sys:"עיניים נפתחות!",tip:"בדיקת סוכרת בשב 24-28",sym:"גרפון, נפיחות",tests:["בדיקת סוכרת הריון (GCT/OGTT)","ספירת דם – ברזל"]},
  26:{sz:"כרוב",emoji:"🥦",szEn:"head of lettuce",hl:"עיניים נפתחות ונסגרות!",sys:"ריאות מתפתחות",tip:"הכיני תוכנית לידה ראשונית",sym:"כאבי גב, קוצר נשימה קל",tests:[]},
  28:{sz:"חציל",emoji:"🍆",szEn:"eggplant",hl:"טרימסטר שלישי! מוח מתפתח מהר",sys:"מוח מתפתח מהר",tip:"קורס לידה עכשיו!",sym:"קוצר נשימה, ברייקסטון-היקס",tests:["בדיקת דם – ברזל","בדיקת GCT אם עוד לא"]},
  30:{sz:"כרוב סיני",emoji:"🥬",szEn:"cabbage",hl:"מתחיל לצבור שומן מתחת לעור",sys:"מרכז הראייה מתפתח",tip:"Spinning Babies כבר מועיל!",sym:"עייפות חוזרת, כאבי אגן",tests:[]},
  32:{sz:"קוקוס",emoji:"🥥",szEn:"coconut",hl:"מתהפך לתנוחת לידה",sys:"עצמות מתחזקות",tip:"שוחחי על תוכנית לידה עם הצוות",sym:"כאבי אגן, קשיי שינה",tests:["בדיקת GBS (סטרפטוקוק)","NST אם יש הוריה"]},
  34:{sz:"קישוא",emoji:"🥒",szEn:"butternut squash",hl:"מרוב שומן – עור מקומט פחות",sys:"מערכת חיסון מתחזקת",tip:"הכיני שקי לידה!",sym:"כאבי גב חזקים, קשיי שינה",tests:[]},
  36:{sz:"פפאיה גדולה",emoji:"🍈",szEn:"papaya",hl:"ראש יורד לאגן – הקלה בנשימה!",sys:"ריאות כמעט בשלות",tip:"שקי לידה מוכנים? צקליסט!",sym:"לחץ על אגן, ירידת בטן",tests:["בדיקת GBS","בדיקת NST שבועית"]},
  38:{sz:"אבטיח קטן",emoji:"🍉",szEn:"watermelon",hl:"תינוקך full term!",sys:"כל המערכות מוכנות",tip:"כל יום הוא בונוס!",sym:"לחץ חזק, ייתכן ירידת מים",tests:["NST שבועי","אולטרסאונד מי שפיר"]},
  40:{sz:"קווה",emoji:"🎃",szEn:"pumpkin",hl:"מועד הלידה המחושב!",sys:"הכל מוכן",tip:"רגועה – הלידה תגיע בזמן הנכון",sym:"לחץ, ציפייה, התרגשות",tests:["NST","בדיקת מי שפיר","ביקור רופאה"]}
};


function getWD(w){const ks=Object.keys(WD).map(Number).sort((a,b)=>a-b);let b=ks[0];for(const k of ks){if(k<=w)b=k;}return WD[b];}
function getTri(w){if(w<=13)return{l:'טרימסטר ראשון',c:'#3A6B3A',bg:'#E8F4E8'};if(w<=26)return{l:'טרימסטר שני',c:'#E65100',bg:'#FFF3E0'};return{l:'טרימסטר שלישי',c:'#C62828',bg:'#FCE4EC'};}
function fmt(s){return`${String(Math.floor(s/60)).padStart(2,'0')}:${String(s%60).padStart(2,'0')}`;}

const BPS=[
  {s:"סביבת הלידה",it:["סביבה שקטה ועמומה","מוזיקה רכה ברקע","כמה שפחות אנשים","ליווי אישי (דולה/בן זוג)"]},
  {s:"ניהול כאב",it:["ניסיון ללא אפידורל","אפידורל אם אבקש","גז Entonox","תנועה חופשית","בריכת לידה"]},
  {s:"מהלך הלידה",it:["מינימום ניטור רציף","בחירת תנוחת לידה","הימנעות מאפיזיוטומיה","עיכוב חיתוך חבל הטבור","בן/בת הזוג יחתכו"]},
  {s:"אחרי הלידה",it:["מגע עור לעור מיידי","הנקה בחדר לידה","הימנעות ממוצץ","רחצה ראשונה אחרי שעה"]}
];

const CL={
  "מה לקנות":["עגלה + מושב בטיחות לרכב","מיטת תינוק + מזרן","חיתולים (0 + גודל 1)","מגבוני לחות","בגדי גוף (0-3 חודשים) x6","פיגמות x4","שמיכות דקות x3","כיסא רחצה","מוניטור (baby monitor)","משאבת חלב + שקיות אחסון","כריות הנקה x2","מוצץ (לגיבוי)","שמן לעיסוי תינוק","מדחום דיגיטלי","ערסל/כיסא תנועה"],
  "מה לעשות":["סיור מחלקת לידה","קורס הכנה ללידה","תיאום עם קופת חולים","הכנת חדר תינוק","בחירת שם","ביטוח בריאות לתינוק","הגדרת עוזרים לאחרי הלידה","הכנת ארוחות להקפאה","שמירת מספר דולה/חדר לידה","סיכום תוכנית לידה עם הצוות","בדיקת כיסא בטיחות לרכב (התקנה!)"],
  "ציוד חדר לידה":["בגד ים / חלוק להרגשה טובה","גרביים חמות (גם בקיץ!)","שמן לעיסוי (שקדים/קוקוס)","פלייליסט מוכן + אוזניות","מנורת לילה קטנה","צעיף / רוזבו","חטיפים אנרגיה לשותפ/ה","מטען טלפון ארוך","שפתון (פה מתייבש!)","מחממת גב / פדים חמים"],
  "מזוודה לאמא":["תעודת זהות + כרטיס קופ\"ח","כרטיס ביקורים לידה","חלוק נוח לאחרי הלידה x2","פיגמה נוחה x2","חזיית הנקה + רפידות x3","תחתוני לאחרי לידה (גדולים) x5","שמפו, סבון, קרם","מברשת שיניים + שפתון","מגבת אישית","כרית הנקה","אוכל קל ומשקאות","נעלי בית עם אחיזה"],
  "מזוודה לתינוק":["בגד גוף x4 (גודל לידה + 0-3)","פיגמה x3","כובע קטן x2","גרביים x3","שמיכה דקה","מגבות גזה x4","חיתולים שלב 1 – 20 יח'","מגבונים עדינים","קרם חיתול (Bepanthen)","בגד חגיגי ליום השחרור"],
  "אחרי לידה":["הגשת לידה בביטוח לאומי (תוך 90 יום)","רישום תעודת לידה (תוך 10 ימים)","ביקור טיפת חלב ראשון","פגישה עם יועצת הנקה","הרשמה לקופת חולים לתינוק","חיסון ראשון בשב' 2","ביקור רופאת נשים 6 שבועות","הגשת בקשה לקצבת ילד"]
};

const RX_POINTS = [
  {id:"nausea",label:"בחילות",emoji:"🤢",color:"#E8F5E9",tc:"#2E7D32",
   foot:{x:50,y:30,r:12},
   desc:"לחצי על האמצע של כרית המטטרסוס (כרית הגדולה מתחת לאצבעות). לחץ עדין מעגלי 30 שניות כל צד. P6 ביד: 2 ס\"מ מהכרית לכיוון המרפק בין הגידים."},
  {id:"backpain",label:"כאבי גב",emoji:"🦴",color:"#E3F2FD",tc:"#1565C0",
   foot:{x:15,y:50,r:10},
   desc:"הצד הפנימי של כף הרגל = עמוד שדרה. לגב תחתון: אזור הקשת הפנימית. לגב עליון: בסיס האגודל. תנועה: גלגול איטי מהעקב לאגודל."},
  {id:"headache",label:"כאב ראש",emoji:"🧠",color:"#FCE4EC",tc:"#C62828",
   foot:{x:50,y:8,r:10},
   desc:"קצות האצבעות ופד האגודל = ראש ומוח. לחץ מעגלי קל על פד האגודל 30 שניות. עבדי על כל האצבעות בסירוגין. לחץ בין האגודל לאצבע של כף היד = LI4."},
  {id:"contractions",label:"עידוד צירים",emoji:"🌊",color:"#FFF3E0",tc:"#E65100",
   foot:{x:20,y:75,r:12},
   desc:"SP6: 4 אצבעות מעל הקרסול הפנימי, לחץ חזק על הנקודה 60 שניות. נקודת הרחם: מדיאלית לקרסול הפנימי. ⚠️ אסור לפני שב' 37!"},
  {id:"relax",label:"הרגעה כללית",emoji:"🌙",color:"#EDE7F6",tc:"#4527A0",
   foot:{x:50,y:55,r:14},
   desc:"פלקסוס סולארי: מרכז כף הרגל, לחץ עמוק והחזיקי 30 שניות תוך נשימה עמוקה. סיום: 5 לחיצות קטנות בפד כל אצבע בסירוגין. עיגולים בכיוון השעון בעקב."},
  {id:"digestion",label:"עיכול/גרפון",emoji:"🌿",color:"#E8F5E9",tc:"#2E7D32",
   foot:{x:65,y:40,r:11},
   desc:"כף ימין: אזור הכבד (תחת האצבע הקטנה, אמצע הכף). מעי: תנועת C מהאצבע הקטנה ימין ועד הכף שמאל. לחץ קל, תנועה איטית בכיוון השעון."}
];

const SPINNING = [
  {id:"rebozo",title:"Rebozo Sifting (צעיף/עם Am Jiggel)",emoji:"🧣",core:true,
   desc:"נדנוד עדין של הבטן עם צעיף – מרפה את הרצועות ומאפשר לתינוק למצוא תנוחה אופטימלית. אפשר גם Am Jiggel (נדנוד הבטן בידיים).",
   how:["שכבי על הגב (לא יותר מ-10 דקות)","המלווה מניח/ה צעיף רחב תחת הבטן","נדנוד עדין ורציף מצד לצד, 10-20 שניות","הפסקה קצרה, שוב 3-5 דורות","Am Jiggel: המלווה מניח/ה ידיים בצדי הבטן ומנדנד עדין"],
   when:"מ-שב' 20! מומלץ לפני כל טכניקה אחרת",
   warning:"בטוח, נעים. לא לאחר ניתוח בטן ב-6 שבועות האחרונים",
   video:"https://www.youtube.com/results?search_query=rebozo+sifting+spinning+babies"},
  {id:"inversion",title:"Forward-leaning Inversion (היפוך קדימה)",emoji:"🙃",core:true,
   desc:"היפוך עדין שמרפה את הרצועות בתחתית הרחם ומאפשר לתינוק לסדר את ראשו. שלב 2 בשלישיית הליבה.",
   how:["ברכיים על ספה/מיטה","ידיים על הרצפה, מרפקים כפופים","שמרי ראש ועורף נמוכים מהישבן","30 שניות – לא יותר!","חזרי 3 פעמים ביום"],
   when:"מ-שב' 20. במיוחד אם התינוק בתנוחה אחורית או עם ראש גבוה",
   warning:"לא לרפלוקס חמור, לחץ דם גבוה, סחרחורות. קומי לאט!",
   video:"https://www.youtube.com/results?search_query=forward+leaning+inversion+spinning+babies"},
  {id:"sidelying",title:"Side-lying Release (שחרור צדי)",emoji:"↔️",core:true,
   desc:"הרפיית רצועות האגן העמוקות. מרחיבה את האגן ומאפשרת תנוחה טובה יותר. שלב 3 בשלישיית הליבה.",
   how:["שכבי על הצד הקשה/כואב יותר","ברך עליונה מונחת על כרית גבוהה – ירך מונמכת","הרפי לחלוטין – אל תחזיקי","3-5 דקות","חזרי על הצד השני"],
   when:"מ-שב' 20. מומלץ לפני שינה ואחרי Rebozo",
   warning:"אם יש כאב חזק – הפסיקי. יש לעשות שני הצדדים",
   video:"https://www.youtube.com/results?search_query=side+lying+release+spinning+babies"},
  {id:"lifttuck",title:"Abdominal Lift and Tuck",emoji:"⬆️",core:false,
   desc:"הרמת הבטן בעדינות בזמן צעידה, מסייעת לתינוק להכנס לאגן ולהתיישר. יעיל במיוחד בגב תחתון ובצירים עקשנים.",
   how:["עמדי זקופה","שלבי אצבעות מתחת לבטן","בכל צעד – הרמי את הבטן קלות ופנימה","10-20 צעדים, מנוחה, שוב","אפשר גם בזמן ציר – תמיכה עדינה מלמטה"],
   when:"מ-שב' 34. מצוין לצירים עקשנים בשלב לטנטי",
   warning:"עדין בלבד. לא להרים חזק. לא בצירים חזקים מאוד",
   video:"https://www.youtube.com/results?search_query=abdominal+lift+and+tuck+spinning+babies"},
  {id:"__REMOVED__",title:"",core:false,
   desc:"הרחבת כניסת האגן בזמן צירים. עוזרת לראש לרדת ולהסתובב.",
   how:["עמדי ליד קיר או עם כיסא","בזמן ציר – שלחי רגל אחת הצידה על הכיסא","הטי את הגוף לכיוון הרגל המורמת","10-20 שניות, שחררי","חזרי לסירוגין על שני הצדדים"],
   when:"שלב פעיל, ראש לא יורד או צירים ארוכים",
   warning:"אזני שני הצדדים. אחזי בתמיכה יציבה",
   video:"https://www.youtube.com/results?search_query=lunge+spinning+babies+labor"}
];

const SPINNING_IN_LABOR = [
  {situation:"ראש לא יורד",exercises:["Lunge בזמן כל ציר","Abdominal Lift and Tuck","הליכה במדרגות"]},
  {situation:"צירים עקשנים / לא מתקדמים",exercises:["Side-lying Release","Rebozo בין צירים","Forward Inversion – 3 פעמים"]},
  {situation:"כאב גב קשה (OP – תינוק אחורי)",exercises:["ארבע רגליים + נדנוד","Side-lying Release","כדור פיזיו – עיגולים"]},
  {situation:"ראש מסובב (asynclitic)",exercises:["Lunge צד הרגשה הגדולה","Side-lying Release על הצד הנגדי","שחי קדימה על כדור"]}
];



// ===== BIRTH TYPES =====
const BIRTH_TYPES = [
  {
    id:"natural", title:"לידה טבעית", emoji:"🌸",
    desc:"לידה וגינלית ללא התערבות רפואית. הגוף עובד עם הכוחות הטבעיים שלו. מומלץ לכל נשים עם הריון תקין.",
    pros:["התאוששות מהירה יותר","קשר עור-לעור מיידי","פחות סיכונים","הנקה מתחילה בקלות","שחרור מוקדם יותר"],
    cons:["כאב ללא הרדמה","דורש הכנה מנטלית ופיזית","לא תמיד אפשרי"],
    who:"מתאים לרוב הנשים עם הריון תקין ורצון לידה טבעית",
    tips:"הכנה בקורס לידה, Spinning Babies, רפלקסולוגיה ודיקור – כולם עוזרים מאוד!"
  },
  {
    id:"epidural", title:"לידה עם אפידורל", emoji:"💉",
    desc:"לידה וגינלית עם הרדמה אזורית של הגב התחתון. הנפוצה ביותר בישראל. ניתן להחליט בכל שלב.",
    pros:["הפחתת כאב משמעותית","אפשר לנוח","מאפשר ריכוז על הדחיפה","ניתן לתת בכל שלב"],
    cons:["מגביל תנועה","עלול להאיט צירים","לחץ דם יכול לרדת","תחושת כובד ברגליים"],
    who:"זמין לכל יולדת. ניתן לשלב עם לידה טבעית עד שלב מסוים",
    tips:"ניתן לבקש אפידורל קל (walking epidural) שמאפשר תנועה חלקית",
    procedure:"רק רופא/ת מרדים/ה מבצע/ת את ההזרקה (לא המיילדת) – לרוב מגיע/ה לחדר הלידה בתוך 20-40 דקות מהבקשה, תלוי בעומס. בזמן ההזרקה עצמה (כ-10-15 דקות) לרוב מבקשים שרק את/ה תהיי בחדר עם הצוות הרפואי – בן/בת הזוג ממתינ/ה בחוץ לכמה דקות, ולאחר מכן חוזר/ת. ההשפעה מתחילה תוך 10-20 דקות מההזרקה, ומגיעה לשיא תוך כ-30 דקות. לאחר ההזרקה מוחדר קטטר קבוע לשתן (כי קשה להרגיש את הצורך), ומבוצע ניטור רציף."
  },
  {
    id:"csection_planned", title:"קיסרי מתוכנן", emoji:"📅",
    desc:"ניתוח שנקבע מראש. מועד ידוע, הכנה מסודרת. נעשה בהרדמה אפידורלית – בת הזוג יכולה להיות נוכחת!",
    pros:["מועד ידוע מראש","זמן להכנה","בן/בת הזוג נוכח/ת","פחות דחיפות"],
    cons:["ניתוח גדול – החלמה 6 שבועות","הגבלות פעילות","הנקה דורשת סיוע בהתחלה","צלקת"],
    who:"שליה קדמית (previa), תאומים עם תנוחה מסוימת, בקשת האמא, בעיות רפואיות",
    tips:"VBAC – לידה וגינלית אחרי קיסרי – אפשרית ב-60-80% מהמקרים! שאלי את הרופאה."
  },
  {
    id:"csection_urgent", title:"קיסרי דחוף", emoji:"⚡",
    desc:"קיסרי שהוחלט עליו במהלך הלידה, אך לא בחירום. לרוב בהרדמה אפידורלית. בן/בת הזוג יכול/ה להיות נוכח/ת.",
    pros:["בן/בת הזוג נוכח/ת","הרדמה אפידורלית – ערה","קשר עם תינוק מהיר יחסית"],
    cons:["מהיר ולא מתוכנן","לחץ רגשי","לרוב אחרי לידה ממושכת"],
    who:"קיפאון בלידה, CTG לא תקין, ראש לא יורד – אך אין סכנה מיידית",
    tips:"בקשי שבן/בת הזוג יישארו. Skin-to-skin אפשרי לעיתים גם בחדר ניתוח!"
  },
  {
    id:"csection_emergency", title:"קיסרי חירום", emoji:"🚨",
    desc:"ניתוח חירום מיידי בסכנה לחיים. לרוב בהרדמה כללית (מלאה) – בן/בת הזוג לא נוכח/ת בחדר ניתוח.",
    pros:["מציל חיים","מהיר מאוד","הצוות פועל בדיוק ומקצועיות"],
    cons:["הרדמה כללית – לא ערה","בן/בת הזוג לא נוכח/ת","לרוב ללא הכנה","טראומה אפשרית"],
    who:"מצוקה עוברית קשה, ירידת חבל טבור, קרע שליה, לחץ דם מסכן חיים",
    tips:"אחרי קיסרי חירום – חשוב מאוד עיבוד רגשי. אל תהססי לבקש תמיכה ופגישה עם מיילדת."
  },
  {
    id:"water", title:"לידת מים", emoji:"🌊",
    desc:"לידה בתוך בריכת מים חמים. המים מקלים על הכאב, מרפים את הרצועות ומאטים קרעים.",
    pros:["הפחתת כאב טבעית","מרגיע ומקל","מפחית קרעים","תנועה חופשית","לידה עדינה לתינוק"],
    cons:["לא זמין בכל בית חולים","יש קריטריונים רפואיים","לא עם אפידורל"],
    who:"הריון תקין, מ-37 שבועות, ללא סיבוכים. זמין בחלק מבתי החולים בישראל",
    tips:"בדקי אם בית החולים שלך מציע בריכת לידה! עדיף להזמין מראש."
  },
  {
    id:"twins", title:"לידת תאומים", emoji:"👯",
    desc:"לידה של שניים מחייבת מעקב צמוד יותר. כ-60% מלידות התאומים הן קיסריות, אך לידה וגינלית אפשרית.",
    pros:["לידה וגינלית אפשרית אם תאום א' ראשי","פחות סיכון ניתוחי"],
    cons:["דורש ניטור כפול","ייתכן שתאום ב' יזדקק לקיסרי","פגי יותר"],
    who:"תלוי בתנוחת תאום א', סוג השליה (מונוכוריאלי/דיכוריאלי) ועוד",
    tips:"חפשי מרכז רפואי עם ניסיון בלידות תאומים וגינליות!",
    room:"חדר הלידה: ברוב המקרים לידה וגינלית של תאומים מתבצעת בחדר ניתוח (OR) מאובזר, גם אם מתוכננת כווגינלית – כדי שיהיה ניתן לעבור לקיסרי במהירות אם תאום ב' יזדקק לכך. צוות גדול יותר נוכח (2 מיילדות, נאונטולוג, רופא/ה מרדים)."
  },
  {
    id:"vacuum", title:"לידת ואקום/מלקחיים", emoji:"🔵",
    desc:"כלי שמסייע להוצאת התינוק בשלב הדחיפה כשיש מצוקה עוברית או עייפות של האמא.",
    pros:["מונע קיסרי חירום","מהיר יחסית","אם צוואר פתוח לחלוטין"],
    cons:["ייתכן כאב וקרע גדול","סימנים זמניים על ראש התינוק","דורש מיומנות"],
    who:"כשיש מצוקה עוברית, צירים עוצרים, אמא עייפה מאוד – ושלב הדחיפה",
    tips:"ניתן לסרב ולבקש זמן נוסף אם אין סכנה מיידית. שאלי שאלות!"
  },
  {
    id:"vbac", title:"VBAC – לידה וגינלית אחרי קיסרי", emoji:"🔁",
    desc:"לידה וגינלית לאחר ניתוח קיסרי קודם. אפשרית ומוצלחת ב-60-80% מהמקרים, בהתאם לסיבת הקיסרי הקודם ולמצב הצלקת.",
    pros:["החלמה מהירה משמעותית מקיסרי","הנקה מתחילה בקלות","סיכון נמוך יותר לסיבוכים בהריונות עתידיים"],
    cons:["סיכון נדיר אך קיים לקרע ברחם (כ-0.5-1%)","דורש ניטור רציף","לא כל בית חולים תומך, ולא כל מצב מתאים"],
    who:"תלוי בסיבת הקיסרי הקודם (לא חזרתי = סיכוי טוב יותר), מספר קיסרים קודמים, סוג החתך הרחמי, ומרווח זמן מההריון הקודם",
    tips:"שאלי מראש את בית החולים על מדיניות VBAC ואחוזי הצלחה. דרשי ניטור רציף בלידה – זה תנאי הכרחי לבטיחות."
  },
  {
    id:"breech", title:"לידת עכוז", emoji:"🙃",
    desc:"לידה כאשר התינוק במצב עכוז (רגליים/ישבן למטה) ולא במצב ראש-למטה הרגיל. כיום רוב לידות העכוז בישראל מתבצעות בקיסרי, אך לידה וגינלית אפשרית במרכזים מנוסים ובתנאים מסוימים.",
    pros:["אם מתאפשר וגינלית – כל היתרונות של לידה טבעית"],
    cons:["סיכון מוגבר ללכידת ראש או חבל טבור בלידה וגינלית","דורש צוות מנוסה מאוד בלידות עכוז וגינליות","ברוב המקרים בישראל ימליצו על קיסרי"],
    who:"תלוי בסוג העכוז (מלא/לא מלא), משקל משוער, ניסיון המרכז הרפואי. שווה לנסות גרסה חוץ-רחמית (ECV – היפוך עוברי חיצוני) לפני ההחלטה",
    tips:"אם מתגלה עכוז בשבועות 35-37, שאלי על אפשרות ECV (היפוך) – לעיתים אפשר להפוך את התינוק למצג ראש ולחזור ללידה רגילה!"
  }
];

// ===== HOSPITAL GUIDE =====
const HOSPITALS = [
  {
    name:"איכילוב – תל אביב", region:"center", emoji:"🏙️",
    waterBirth:true, naturalBirth:true,
    nicu:"פגייה רמה 3 – הגדולה בישראל",
    rooms:"חדרי לידה מאובזרים + כדור פיזיו + בריכת לידה",
    accommodation:"יש מלונית. אשפוז לאחר לידה: חדרים זוגיים וגם חדרים ליחיד (לפי זמינות)"
  },
  {
    name:"שיבא – תל השומר", region:"center", emoji:"🏥",
    waterBirth:false, naturalBirth:true,
    nicu:"פגייה רמה 3 – מרכז רפואי גדול",
    rooms:"חדרי לידה מודרניים + כדור פיזיו",
    accommodation:"יש מלונית. אשפוז לאחר לידה: בעיקר חדרים זוגיים"
  },
  {
    name:"וולפסון – חולון", region:"center", emoji:"🏥",
    waterBirth:false, naturalBirth:true,
    nicu:"פגייה רמה 3",
    rooms:"חדרי לידה + כדור פיזיו",
    accommodation:"יש מלונית. אשפוז לאחר לידה: חדרים זוגיים"
  },
  {
    name:"מאיר – כפר סבא", region:"center", emoji:"🌿",
    waterBirth:false, naturalBirth:true,
    nicu:"פגייה רמה 2",
    rooms:"חדרי לידה + כדור פיזיו",
    accommodation:"אין מלונית. אשפוז לאחר לידה: חדרים זוגיים ולעיתים יחידים"
  },
  {
    name:"הדסה עין כרם – ירושלים", region:"north", emoji:"🕍",
    waterBirth:true, naturalBirth:true,
    nicu:"פגייה רמה 3 – מרכז רפואי אקדמי",
    rooms:"חדרי לידה גדולים + בריכת לידה + כדור פיזיו + מוזיקה",
    accommodation:"יש מלונית לבני זוג. אשפוז לאחר לידה: זוגיים ויחידים"
  },
  {
    name:"שערי צדק – ירושלים", region:"north", emoji:"🕍",
    waterBirth:false, naturalBirth:true,
    nicu:"פגייה רמה 3",
    rooms:"חדרי לידה + כדור פיזיו",
    accommodation:"יש מלונית. אשפוז לאחר לידה: חדרים זוגיים"
  },
  {
    name:"רמבם – חיפה", region:"north", emoji:"⚓",
    waterBirth:true, naturalBirth:true,
    nicu:"פגייה רמה 3",
    rooms:"חדרי לידה מודרניים + בריכת לידה + כדור פיזיו",
    accommodation:"יש מלונית עם נוף לים. אשפוז לאחר לידה: זוגיים ויחידים"
  },
  {
    name:"כרמל – חיפה", region:"north", emoji:"⚓",
    waterBirth:false, naturalBirth:true,
    nicu:"פגייה רמה 2",
    rooms:"חדרי לידה + כדור פיזיו",
    accommodation:"אין מלונית. אשפוז לאחר לידה: חדרים זוגיים"
  },
  {
    name:"לניאדו – נתניה", region:"center", emoji:"🌿",
    waterBirth:false, naturalBirth:true,
    nicu:"פגייה רמה 3",
    rooms:"חדרי לידה + כדור פיזיו",
    accommodation:"אין מלונית. אשפוז לאחר לידה: חדרים זוגיים"
  },
  {
    name:"סורוקה – באר שבע", region:"south", emoji:"🌵",
    waterBirth:false, naturalBirth:true,
    nicu:"פגייה רמה 3 – מרכז הנגב",
    rooms:"חדרי לידה + כדור פיזיו",
    accommodation:"יש מלונית. אשפוז לאחר לידה: חדרים זוגיים ולעיתים יחידים"
  },
  {
    name:"אסותא אשדוד", region:"south", emoji:"🌊",
    waterBirth:false, naturalBirth:true,
    nicu:"פגייה רמה 2",
    rooms:"חדרי לידה + כדור פיזיו",
    accommodation:"אין מלונית. אשפוז לאחר לידה: חדרים זוגיים"
  },
  {
    name:"קפלן – רחובות", region:"south", emoji:"🌿",
    waterBirth:false, naturalBirth:true,
    nicu:"פגייה רמה 3",
    rooms:"חדרי לידה + כדור פיזיו",
    accommodation:"אין מלונית. אשפוז לאחר לידה: חדרים זוגיים"
  }
];


// ===== FETAL STATIONS =====
const FETAL_STATIONS_DATA = {
  desc:"תחנות העובר (Fetal Station) מתארות את עמדת ראש התינוק ביחס לספינות האגן – הנקודה הצרה ביותר של האגן.",
  stations:[
    {val:"-3",label:"מינוס 3",desc:"ראש גבוה מאוד, לא נכנס לאגן. שלב מוקדם מאוד.",emoji:"⬆️",color:"#E3F2FD"},
    {val:"-2",label:"מינוס 2",desc:"ראש מעל הספינות – מצב שכיח בסוף ההריון לפני תחילת לידה.",emoji:"↑",color:"#BBDEFB"},
    {val:"-1",label:"מינוס 1",desc:"ראש קרוב לספינות – מתחיל לרדת. שלב לטנטי.",emoji:"↗️",color:"#90CAF9"},
    {val:"0",label:"אפס – הספינות",desc:"ראש ברמת הספינות – engaged! נקודת ציון חשובה בשלב הפעיל.",emoji:"📍",color:"#FFF9C4"},
    {val:"+1",label:"פלוס 1",desc:"ראש מתחת לספינות – מתקדם יפה. שלב פעיל מתקדם.",emoji:"↘️",color:"#C8E6C9"},
    {val:"+2",label:"פלוס 2",desc:"ראש נמוך מאוד, נגיש לראייה – קרוב מאוד ללידה!",emoji:"↓",color:"#A5D6A7"},
    {val:"+3",label:"פלוס 3 – כתרת",desc:"ראש גלוי! כתרת (crowning) – עוד דחיפה אחת!",emoji:"🌟",color:"#81C784"}
  ]
};

// ===== WATER BREAKING GUIDE =====
const WATER_BREAK_GUIDE = {
  signs:["זרימת נוזל פתאומית (כמו ברז שנפתח)","טפטוף מתמשך שלא ניתן לעצור","ריח מתוק (לא שתן)","נוזל צלול, ורוד או בעל גושים לבנים"],
  doNow:["הישארי רגועה","שימי כרית/מגבת","ציני את השעה המדויקת","בדקי את צבע הנוזל","התקשרי לחדר לידה מיד!"],
  colors:{
    clear:"✅ צלול – תקין. צרי קשר עם חדר הלידה",
    pink:"✅ ורדרד קל – נורמלי, עם קצת דם מהצוואר",
    green:"🚨 ירוק/שחור = מקוניום. פני לחדר לידה מיד!",
    red:"🚨 אדום כהה = דם. פני לחדר לידה מיד!"
  },
  timing:"רוב הנשים נכנסות לצירים תוך 12-24 שעות מפקיעת הקרומים. אם לא יזרזו. לא ניתן להחזיר את המים.",
  warning:"אם ירד חבל טבור (לחץ בנרתיק) – שכבי על ארבע רגליים ופני למיון מיד!"
};
const BIRTH_STAGES = [
  {id:"latent",title:"שלב לטנטי (Latent Phase)",emoji:"🌱",duration:"שעות עד ימים",cervix:"פתיחה 4-6 ס\"מ",desc:"הצירים מתחילים – לא סדירים, לא חזקים. הגוף מתחמם לקראת הלידה. רוב הנשים לא מודעות שהתחיל.",tips:["המשיכי בשגרה","שני או נוחי","אכלי ושתי","אל תצאי לביה\"ח עדיין"],signs:["צירים לא סדירים","הפרשה ורודה (show)","צוואר רחם מתבשל"]},
  {id:"active",title:"שלב פעיל (Active Labor)",emoji:"🌊",duration:"4-8 שעות",cervix:"6-10 ס\"מ",desc:"הצירים חזקים, סדירים וארוכים. זמן לצאת לפי כלל 4-1-1.",tips:["תנועה חופשית","נשימות עמוקות","עיסוי גב","שינוי תנוחות כל 20-30 דקות"],signs:["צירים כל 5 דקות","כל ציר 60 שניות","משך שעה"]},
  {id:"transition",title:"טרנזיציה",emoji:"⚡",duration:"30-90 דקות",cervix:"8-10 ס\"מ",desc:"הקשה ביותר – אבל הקצרה! כמעט סיימת.",tips:["ציר אחד בכל פעם","'אני יכולה, זה עובר'","קרח על הפנים","הסתמכי על המלווים"],signs:["צירים ארוכים ועצימים","רעידות","בחילה אפשרית"]},
  {id:"pushing",title:"שלב הדחיפה",emoji:"💪",duration:"20 דקות עד 3 שעות",cervix:"10 ס\"מ (מלא)",desc:"הגוף דוחף! עיקבי אחרי הגוף ואחרי המיילדת.",tips:["נשמי בין לדחיפה","תנוחות: ישיבה, צד, כריעה","דחיפה בצירים בלבד","שחרור רצפת האגן"],signs:["דחף דחיפה","לחץ חזק על פרינאום","ראש התינוק מתקדם"]},
  {id:"placenta",title:"שליית הלידה",emoji:"🌸",duration:"5-30 דקות",cervix:"אחרי הלידה",desc:"לאחר לידת התינוק, השליה יוצאת. תינוקך כבר בזרועותייך!",tips:["הנקה מיידית עוזרת","skin-to-skin","הרגיעי"],signs:["כיווץ קל","שליה יוצאת","דימום קל"]}
];

const BF_CONTENT = {
  positions:[
    {name:"עריסה (Cradle Hold)",desc:"ראש בקיפול המרפק, גוף לאורך הזרוע. לתינוקות שכבר שולטים בראש.",icon:"cradle"},
    {name:"עריסה הפוכה (Cross-cradle)",desc:"כף היד תומכת בראש מאחור. מומלצת לתינוקות חדשים – שליטה רבה יותר.",icon:"crosscradle"},
    {name:"כדורגל (Football Hold)",desc:"התינוק לאורך הצד, רגליים מאחורי גבך. מצוין אחרי קיסרי ולשדיים גדולות.",icon:"football"},
    {name:"שכיבה על הצד",desc:"שניכם שוכבים מצד, פה מול פטמה. מצוין להנקות לילה.",icon:"sidelying"},
    {name:"הנקה ביולוגית (Laid-back)",desc:"הישענות לאחור, תינוק על החזה. מנצלת את רפלקסי התינוק.",icon:"laidback"}
  ],
  latch:["פה פתוח רחב לפני הלידה","שפתיים מוחצנות החוצה","לחיים עגולות, לא שקועות","הסנטר נוגע בשד","ללא כאב חד","אפשר לשמוע בליעה"],
  problems:[
    {p:"כאב בפטמות",s:"לרוב מעיד על לידה לקויה. אם נמשך מעל יומיים – פני ליועצת."},
    {p:"פטמות סדוקות",s:"מרחי חלב אחרי הנקה, אל תשאירי פטמות רטובות, נסי משחת לנולין."},
    {p:"שד גדוש",s:"הנקות תכופות, קירור בין הנקות, עיסוי קל לפני. יחלוף תוך 3-5 ימים."},
    {p:"צינורית סתומה",s:"עיסוי לכיוון הפטמה, חום לפני הנקה, הנקות תכופות מאותו צד."},
    {p:"דלקת שד (Mastitis)",s:"אל תפסיקי להניק! חום + כאב + אדמומיות – פני לרופאה לאנטיביוטיקה."},
    {p:"מעט חלב",s:"חלב מיוצר לפי ביקוש. הנקות תכופות = יותר חלב. בדקי לידה קודם."}
  ],
  nutrition:"בזמן הנקה את צורכת כ-500 קלוריות נוספות ביום. חשוב: שתייה מרובה, אומגה 3, ברזל, סידן. קפה – עד 2 כוסות ביום."
};


// ===== POST-TERM PREGNANCY (הריון עודף) =====
const POSTTERM_DATA = {
  intro: "מעבר לשבוע 40 (40 שבועות) זה נורמלי לגמרי – רק 5% מהתינוקות נולדים בדיוק במועד! עם זאת, ככל שעוברים את 40, חשוב מעקב צמוד.",
  timeline: [
    {week:"שבוע 40",title:"מועד הלידה המשוער",desc:"רק תאריך משוער – לא דדליין. תינוקות רבים נולדים שבוע-שבועיים אחריו.",action:"המשיכי בשגרה. תיאום ביקור מעקב."},
    {week:"שבוע 41",title:"תחילת מעקב מוגבר",desc:"מרגע זה ממליצים על מעקב NST (ניטור) ובדיקת מי שפיר באולטרסאונד.",action:"NST פעמיים בשבוע + בדיקת מי שפיר (AFI)"},
    {week:"שבוע 41+3 עד 42",title:"שיחה על זירוז",desc:"רוב הפרוטוקולים בישראל ממליצים על זירוז סביב שבוע 41-42, תלוי מצב השליה והעובר.",action:"שיחה עם הרופאה על תזמון זירוז"},
    {week:"מעבר לשבוע 42",title:"זירוז מומלץ",desc:"מעבר לשבוע 42 הסיכון לשליה מתבלה עולה. ברוב המקרים יומלץ זירוז.",action:"זירוז – לרוב מתואם מראש"}
  ],
  monitoring: [
    {name:"NST (ניטור עוברי)",desc:"בודק דופק עוברי וצירים. 20-40 דקות. מ-שב 41 – פעמיים בשבוע.",where:"בית חולים / מיון יולדות"},
    {name:"בדיקת מי שפיר (AFI)",desc:"אולטרסאונד מודד כמות מי שפיר. ירידה משמעותית = דאגה.",where:"מכון אולטרסאונד / בית חולים"},
    {name:"בדיקת Doppler",desc:"בודקת זרימת דם בחבל הטבור ובשליה – מעיד על תקינות אספקת חמצן.",where:"בית חולים / מכון אולטרסאונד מתקדם"}
  ],
  naturalTips: ["הליכה יומית","רפלקסולוגיה (תיאום עם דפנה)","דיקור סיני מ-שב 40","עיסוי פטמות","קיום יחסים אם אין מניעה","תזונה: תמרים 6/יום מוכחים מועילים"],
  emotional: "תחושות תסכול, חוסר סבלנות וחרדה הן נורמליות מאוד! זה לא נכשל – הגוף שלך עובד לפי הזמן שלו. שמרי על שגרה, מנוחה, ותני לעצמך חמלה."
};

// ===== INTERVENTION DECISION TREE (עץ החלטות) =====
const DECISION_TREE = {
  start: {
    question:"מציעים לך זירוז – על מה זה מבוסס?",
    options:[
      {label:"עברתי שבוע 41-42",next:"postterm"},
      {label:"מים ירדו ואין צירים",next:"prom"},
      {label:"לחץ דם / רעלת הריון",next:"preeclampsia"},
      {label:"תינוק קטן/גדול מהצפוי",next:"size"},
      {label:"סוכרת הריון",next:"diabetes"},
      {label:"מיעוט/ריבוי מי שפיר",next:"fluid"},
      {label:"אחר / לא בטוחה",next:"unsure"}
    ]
  },
  postterm: {
    question:"הריון עודף (41-42 שבועות)",
    info:"מעבר לשבוע 41 הסיכון לשליה מתבלה עולה בהדרגה. ברוב המקרים זירוז בשלב זה משפר את הסיכויים ללידה וגינלית מוצלחת.",
    options:[
      {label:"מה האפשרויות הרפואיות?",next:"medical_options"},
      {label:"מה הזירוזים הטבעיים?",next:"natural_options"},
      {label:"מה קורה אם אסרב?",next:"refuse_postterm"}
    ]
  },
  prom: {
    question:"ירידת מים ללא צירים (PROM)",
    info:"כ-50% מהנשים יתחילו צירים תוך 24 שעות מעצמן. הסיכון העיקרי הוא זיהום – ככל שעובר זמן רב יותר. אם בכל זאת מחליטים על זירוז: לאחר ירידת מים, האפשרות הרפואית היחידה לזירוז היא פיטוצין (עירוי) – וזה מתבצע רק בחדר לידה (לא בבית או במיון), תחת מעקב רציף.",
    options:[
      {label:"מה האפשרויות הטבעיות עד אז?",next:"natural_options"},
      {label:"כמה זמן אפשר לחכות?",next:"prom_wait"},
      {label:"חזרה להתחלה",next:"start"}
    ]
  },
  fluid: {
    question:"מיעוט או ריבוי מי שפיר",
    info:"מיעוט מי שפיר (Oligohydramnios) – פחות מ-5 ס\u05f3מ AFI – יכול להעיד על תפקוד שליה מופחת, ולעיתים מוביל להמלצה על זירוז, בעיקר אם זה קרוב למועד. ריבוי מי שפיר (Polyhydramnios) – מעל 24 ס\u05f3מ – יכול לעיתים להיות קשור לסוכרת הריון או למצבים אחרים, ונדרש מעקב נוסף. בשני המקרים – חשוב לשאול מה רמת המי שפיר המדויקת ומה המגמה (יורד/עולה) בין הבדיקות.",
    options:[
      {label:"מה האפשרויות הרפואיות?",next:"medical_options"},
      {label:"מה האפשרויות הטבעיות?",next:"natural_options"},
      {label:"חזרה להתחלה",next:"start"}
    ]
  },
  preeclampsia: {
    question:"לחץ דם גבוה / רעלת הריון",
    info:"⚠️ זהו מצב שדורש התייחסות רפואית רצינית. הטיפול היחיד לרעלת הריון הוא לידה. אם הומלץ לך זירוז מסיבה זו – חשוב מאוד לא לדחות.",
    options:[
      {label:"מה האפשרויות הרפואיות?",next:"medical_options"},
      {label:"קראי על רעלת הריון",next:"END_PREECLAMPSIA"}
    ]
  },
  size: {
    question:"חשד לתינוק קטן/גדול מהצפוי",
    info:"הערכות משקל באולטרסאונד יכולות לסטות ב-10-15%. לפני זירוז שמבוסס רק על הערכת משקל, שווה לשאול על דיוק ההערכה ואפשרויות מעקב נוספות.",
    options:[
      {label:"מה האפשרויות הרפואיות?",next:"medical_options"},
      {label:"מה הזירוזים הטבעיים?",next:"natural_options"},
      {label:"מה קורה אם אסרב?",next:"refuse_size"}
    ]
  },
  diabetes: {
    question:"סוכרת הריון",
    info:"בסוכרת הריון מאוזנת היטב, רבות מהפרוטוקולים מאפשרים להמשיך עד שבוע 40-41. אם הסוכרת לא מאוזנת או שיש תינוק גדול – ימליצו על זירוז מוקדם יותר.",
    options:[
      {label:"מה האפשרויות הרפואיות?",next:"medical_options"},
      {label:"מה הזירוזים הטבעיים?",next:"natural_options"}
    ]
  },
  unsure: {
    question:"לא בטוחה למה מציעים זירוז",
    info:"זו שאלה מצוינת לשאול! לפני שמחליטים, חשוב להבין את הסיבה המדויקת. כל החלטה רפואית צריכה להיות מבוססת על מידע ברור.",
    options:[
      {label:"שאלות שכדאי לשאול",next:"END_QUESTIONS"},
      {label:"מה האפשרויות הרפואיות?",next:"medical_options"},
      {label:"מה הזירוזים הטבעיים?",next:"natural_options"}
    ]
  },
  medical_options: {
    question:"אפשרויות זירוז רפואיות",
    info:"📋 השיטות הנפוצות: בלון פוֹלִי (התרחבות מכנית), פרוסטגלנדינים (ריכוך צוואר), פיטוצין (עירוי לעידוד צירים), פקיעת קרומים מבוקרת (AROM), וסטריפינג. כל שיטה מתאימה למצב אחר – תלוי מצב הצוואר.",
    options:[
      {label:"קראי עוד בעמוד התערבויות",next:"END_INDUCTION_PAGE"},
      {label:"מה הזירוזים הטבעיים?",next:"natural_options"},
      {label:"חזרה להתחלה",next:"start"}
    ]
  },
  natural_options: {
    question:"זירוזים טבעיים",
    info:"🌿 רפלקסולוגיה, דיקור סיני, עיסוי פטמות, הליכה, קיום יחסים וסטריפינג – כולם יכולים לתמוך בתהליך, אך הראיות המחקריות משתנות. רובם בטוחים מ-שבוע 37-39.",
    options:[
      {label:"קראי עוד בעמוד התערבויות",next:"END_INDUCTION_PAGE"},
      {label:"מה האפשרויות הרפואיות?",next:"medical_options"},
      {label:"חזרה להתחלה",next:"start"}
    ]
  },
  refuse_postterm: {
    question:"מה קורה אם אסרבי לזירוז בהריון עודף?",
    info:"⚠️ יש לך זכות לסרב לכל הליך רפואי. עם זאת, מ-שבוע 42 הסיכון לסיבוכים (כולל לתינוק) עולה משמעותית. אם מסרבת – ימליצו על מעקב צמוד יותר (NST יומי, בדיקת מי שפיר). חשוב לקבל החלטה מודעת ולא מתוך פחד בלבד – שיחה פתוחה עם הצוות הרפואי חיונית.",
    options:[
      {label:"חזרה להתחלה",next:"start"}
    ]
  },
  refuse_size: {
    question:"מה קורה אם אסרבי לזירוז עקב הערכת משקל?",
    info:"יש לך זכות לבקש מעקב נוסף (Doppler, NST) לפני החלטה על זירוז שמבוסס רק על הערכת משקל. שיחה עם הרופאה על הביטחון בהערכה ועל הסיכונים הספציפיים יכולה לעזור להחליט בראש פתוח.",
    options:[
      {label:"חזרה להתחלה",next:"start"}
    ]
  },
  prom_wait: {
    question:"כמה זמן אפשר לחכות אחרי ירידת מים?",
    info:"רוב הפרוטוקולים בישראל ממליצים על זירוז תוך 12-24 שעות מירידת מים אם אין צירים, בעיקר עקב סיכון לזיהום (חורון, אלח דם לתינוק). בדיקות חוזרות של חום וזיהום (CRP, ספירת דם) מסייעות במעקב. אם תרצי לחכות מעבר לזה – חשוב מעקב צמוד וחום גוף תקין.",
    options:[
      {label:"חזרה להתחלה",next:"start"}
    ]
  }
};
const INDUCTION_DATA = [
  {method:"בלון (Foley Catheter)",type:"מכאני",emoji:"🎈",desc:"בלון קטן מוכנס לצוואר הרחם וגורם לפתיחה מכאנית.",pros:["לא הורמונלי","מתאים לצלקת קיסרית","ניתן לשילוב עם פיטוצין"],cons:["לא נוח","תהליך ממושך"],who:"נפוץ בישראל, מומלץ לנשים עם צלקת קיסרית"},
  {method:"פיטוצין (Oxytocin IV)",type:"הורמונלי",emoji:"💉",desc:"אוקסיטוצין סינתטי בעירוי לגרימת צירים.",pros:["שליטה מדויקת","ניתן לעצור","מהיר"],cons:["צירים חזקים יותר","ניטור רציף חובה","פחות תנועה"],who:"שכיח מאוד, משמש גם להגברת לידה שהתחילה"},
  {method:"פרוסטגלנדין",type:"הורמונלי",emoji:"💊",desc:"להבשלת צוואר הרחם וגרימת צירים.",pros:["מבשיל את הצוואר","ניתן לשחרר"],cons:["סיכון ל-hyperstimulation","לא לצלקת קיסרית בדכ"],who:"מתאים כשהצוואר לא בשל"},
  {method:"ציטוטק (Cytotec / Misoprostol)",type:"הורמונלי",emoji:"💊",desc:"תרופה (טבליה) שמבשילה את צוואר הרחם ועשויה לעורר צירים. ניתנת לוגינלית או דרך הפה במינון נמוך.",pros:["זול ויעיל","אפשר לתת שוב ושוב במינונים קטנים","יעיל מאוד להבשלת צוואר לא בשל"],cons:["סיכון ל-hyperstimulation (צירים תכופים מדי)","אסור בצלקת קיסרית","מעקב CTG נדרש"],who:"שכיח כשצוואר הרחם לא בשל בכלל. לא מתאים לאחר קיסרי קודם"},
  {method:"פקיעת קרומים (AROM)",type:"מכאני",emoji:"🌊",desc:"פקיעת שק מי השפיר בכוונה להאצת לידה.",pros:["מהיר","מגביר צירים"],cons:["בלתי הפיך","סיכון זיהום","ירידת חבל טבור"],who:"בשילוב שיטות אחרות"},
  {method:"סטריפינג (Membrane Sweep)",type:"מכאני",emoji:"🤲",desc:"בבדיקה וגינלית, הרופאה/מיילדת מפרידה בעדינות את קרומי מי השפיר מצוואר הרחם באמצעות האצבע. מטרתו להפריש פרוסטגלנדינים טבעיים ולעודד התחלת צירים.",pros:["לא דורש אשפוז","ניתן לבצע במרפאה או בקופת חולים","מעלה סיכוי לתחילת צירים תוך 48 שעות"],cons:["יכול להיות לא נוח/כואב","לעיתים דימום קל אחריו","לא מבטיח התחלת צירים"],who:"מוצע מ-שב 38-39. מוצע כשיש הוריה לזירוז אך הצוואר עוד לא מוכן לבלון/פרוסטגלנדין"},
  {method:"זירוז טבעי – רפלקסולוגיה",type:"טבעי",emoji:"👣",
   desc:"נקודות ספציפיות בכפות הרגליים יכולות לעורר את הרחם ולהכין את הצוואר. יעיל במיוחד מ-שב' 39.",
   pros:["ללא תרופות","מרגיע ונעים","תומך גם רגשית"],
   cons:["רק מ-שב' 37 ובזהירות","יש להגיע לרפלקסולוגיסטית מוסמכת"],
   who:"SP6, נקודת הרחם, נקודת האגן. לתיאום טיפול – כדאי עם דפנה"},
  {method:"זירוז טבעי – דיקור סיני",type:"טבעי",emoji:"🌿",
   desc:"דיקור יכול לרכך צוואר רחם, לעורר צירים ולהפחית חרדה. פרוטוקול ידוע של 4-6 טיפולים.",
   pros:["יעיל לרכוך צוואר","מפחית חרדה","בטוח"],
   cons:["דורש מטפל מוסמך","מספר טיפולים"],
   who:"SP6, LI4, BL60, BL67 – נקודות ידועות לעידוד לידה. אפשר לתאם עם דפנה"},
  {method:"עיסוי פטמות",type:"טבעי",emoji:"🤱",
   desc:"גירוי הפטמות מפריש אוקסיטוצין טבעי שיכול לעורר צירים. אחת השיטות היחידות עם ראיות מחקריות.",
   pros:["ראיות מדעיות","בבית","ללא עלות"],
   cons:["יכול לגרום לצירים חזקים","לא מומלץ לפני שב' 39","דורש ניטור"],
   who:"עיסוי עגול של הפטמה 1-2 שעות ביום, 3 פעמים. הפסיקי אם יש צירים עזים"},
  {method:"הליכה, ים, ריקוד",type:"טבעי",emoji:"🚶",
   desc:"תנועה ומים עוזרים לתינוק לרדת לאגן ומעודדים ייצור אוקסיטוצין טבעי.",
   pros:["נעים","מרגיע","בטוח לחלוטין"],
   cons:["לא ייזרז לבד בדרך כלל"],
   who:"הליכה יחפה בים = לחץ על נקודות רפלקסולוגיה ותנועה טבעית. מומלץ!"},
  {method:"קיום יחסים",type:"טבעי",emoji:"💑",
   desc:"הזרע מכיל פרוסטגלנדינים שמרככים צוואר הרחם. אורגזמה משחררת אוקסיטוצין.",
   pros:["פרוסטגלנדינים טבעיים","אוקסיטוצין","חיבור בין בני הזוג"],
   cons:["לא לאחר פקיעת קרומים","לא לשליה נמוכה"],
   who:"בטוח מ-שב' 37 אם אין סיכון. לא אחרי ירידת מים!"}
];

const RIGHTS_DATA = [
  {category:"זכויות בחדר לידה",emoji:"🏥",items:["הזכות לסרב לכל פרוצדורה לאחר הסבר","הזכות לשאול שאלות ולקבל תשובות","הזכות למלווה אחד/אחת לפחות","הזכות לפרטיות ולכבוד","הזכות לבחור תנוחת לידה","הזכות לדחות אפיזיוטומיה","הזכות לבקש חוות דעת שנייה"]},
  {category:"זכויות מול קופת חולים",emoji:"📋",items:["אולטרסאונד מלא בשב' 20-22 – בחינם","בדיקות דם ושתן תקופתיות – בחינם","שקיפות עורפית (NT) – בחינם","בדיקת GCT סוכרת – בחינם","יועצת הנקה – זכאות לפגישה אחת לפחות"]},
  {category:"זכויות בעבודה",emoji:"💼",items:["חופשת לידה: 26 שבועות (15 בתשלום ממל\"ל)","איסור פיטורין מהחודש הראשון להריון","שמירת הריון: מחלה מאושרת מגינקולוג","היעדרות לבדיקות הריון – בתשלום","הנקה בעבודה: 1-2 שעות ביום עד גיל 4 חודשים"]},
  {category:"זכויות לאחר לידה",emoji:"👶",items:["קצבת לידה חד-פעמית מביטוח לאומי","דמי לידה: 15 שבועות ממל\"ל","קצבת ילד חודשית","זכאות לטיפת חלב – מעקב חינם","חיסונים לפי לוח – חינם"]}
];

const RESOURCES = {
  books:[
    {title:"מיילדות טבע",author:"איינה מיי גספקין",desc:"הקלאסיקה המוחלטת. סיפורי לידה טבעית, אמון בגוף האישה."},
    {title:"הנקה – המדריך המלא",author:"לה לצה ליג",desc:"הספר הסמכותי ביותר להנקה. פרקטי ומלא תמיכה."},
    {title:"Birth Partner",author:"פני סימקין",desc:"המדריך לבן/בת הזוג ולדולה. מה לעשות בכל שלב."},
    {title:"Expecting Better",author:"אמילי אוסטר",desc:"כלכלנית מנתחת את הספרות המדעית על הריון. מפריכה מיתוסים."},
    {title:"Ina May's Guide to Childbirth",author:"איינה מיי גספקין",desc:"מעמיק יותר. פרק שלם על 'sphincter law'."},
    {title:"Spinning Babies Parent Class",author:"גיל אריאס",desc:"מלווה לקורס Spinning Babies. תנוחות + איורים. מ-שב' 30."}
  ],
  podcasts:[
    {title:"The Birth Hour",host:"ברין וויינברגר",desc:"מאות סיפורי לידה אמיתיים. מפתח ציפיות ריאליסטיות. אנגלית."},
    {title:"Informed Pregnancy Podcast",host:"ד\"ר אלי שטרן",desc:"שיחות עם מומחים. מעמיק ומדויק. אנגלית."},
    {title:"Birthful",host:"אדריאנה לאלמה",desc:"כל היבטי ההריון, הלידה וההורות. גישה מאוזנת. אנגלית."},
    {title:"The Midwives Cauldron",host:"סטייסי ושיר",desc:"שתי מיילדות. כנה, מצחיק, מקצועי. אנגלית."},
    {title:"ICAN Israel – יוטיוב",host:"ICAN",desc:"עברית. תמיכה אחרי קיסרי ומידע על VBAC."}
  ],
  videos:[
    {title:"Business of Being Born",type:"סרט תיעודי",desc:"על לידה בארה\"ב. מחולל מחשבה. נטפליקס/יוטיוב."},
    {title:"Orgasmic Birth",type:"סרט תיעודי",desc:"לידות עוצמתיות ושמחות. משנה תפיסה."},
    {title:"ערוץ Spinning Babies ביוטיוב",type:"הדרכה",desc:"הדגמות ויזואליות של כל התרגילים. חינם."},
    {title:"The Leaky Boob ביוטיוב",type:"הנקה",desc:"כל מה שצריך לדעת על הנקה בווידאו."},
    {title:"HypnoBirthing – Mongan Method",type:"קורס",desc:"נשימות, ויזואליזציה, הרפיה. יוטיוב + קורסים."}
  ]
};

const COMP=[
  {
    n:"סוכרת הריון (GDM)",u:"routine",ul:"מעקב",
    d:"עלייה ברמות הסוכר בדם עקב שינויים הורמונליים. שכיחה ב-5-10% מההריונות. ניתן לאבחן ולנהל.",
    details:"בדיקת GCT בשב' 24-28: שתיית 50 גרם גלוקוז + בדיקת דם שעה אחר כך. אם חריג – בדיקת OGTT מאשרת. ניהול: תזונה, ספורט, לעיתים אינסולין.",
    s:["לרוב ללא תסמינים","צמאון מוגבר","תכיפות שתן","עייפות חריגה","פצעים שמתרפאים לאט"],
    a:"בדיקת GCT כחלק מהמעקב הרגיל. ניהול נכון = לידה בריאה לחלוטין.",
    afterbirth:"ב-95% מהמקרים חולפת לאחר הלידה. בדיקת סוכר 6 שבועות אחרי."
  },
  {
    n:"רעלת הריון (פרה-אקלמפסיה)",u:"immediate",ul:"דחוף",
    d:"לחץ דם גבוה מעל 140/90 + חלבון בשתן. מתפתח לרוב אחרי שב' 20. מצב שדורש מעקב צמוד.",
    details:"גורמי סיכון: הריון ראשון, גיל מעל 35, סוכרת, לחץ דם קיים, הריון מרובה עוברים. הטיפול היחיד הוא לידה.",
    s:["כאב ראש עז שלא עובר","ראייה מטושטשת/נקודות","נפיחות פתאומית בפנים וידיים","כאב חד בבטן עליונה (ימין)","הרגשה כללית רעה"],
    a:"פנה לחדר מיון מיד! אל תחכי לבדיקה אצל רופאה.",
    afterbirth:"בדרך כלל חולפת תוך ימים אחרי הלידה. מעקב לחץ דם 6 שבועות."
  },
  {
    n:"דימום בהריון",u:"immediate",ul:"דחוף",
    d:"דימום וגינלי בהריון דורש תמיד הערכה רפואית. הסיבות שונות לפי שלב ההריון ורובן ניתנות לטיפול.",
    details:"טרימסטר 1: לעיתים השרשה/הפלה מאיימת. טרימסטר 2-3: שליה נמוכה, קרע שליה, ירידת מים עם דם – כל אלה דורשים הערכה מיידית.",
    s:["דימום אדום טרי","דימום חום/שחור","כתמים עם כאב בטן","כתמים ללא כאב","הפרשה מימית עם ורוד"],
    a:"כל דימום בהריון – פני לרופא/חדר מיון באותו יום. גם כתמים קלים.",
    afterbirth:"לא רלוונטי – דימום לאחר לידה נבדק בנפרד."
  },
  {
    n:"ניטור לא תקין (Non-reassuring CTG)",u:"soon",ul:"בהקדם",
    d:"ניטור עוברי (CTG) בודק דפיקות לב תינוק + צירים. דפוס לא תקין לא תמיד מעיד על סכנה – אך דורש הערכה.",
    details:"סוגים: תאצלרציות חסרות (אין עליות), דצלרציות (ירידות בדפיקות), ווריאביליות נמוכה. הרבה גורמים שפירים: שינה של התינוק, כדורי שינה, תנוחת אמא.",
    s:["תינוק לא זז כרגיל","CTG מראה דפוס חריג","תינוק 'שקט' מהרגיל","ירידה בתנועות מעל שעתיים"],
    a:"10 תנועות ב-2 שעות = תקין. פחות מזה – פנה לבדיקה.",
    afterbirth:"לא רלוונטי לאחר הלידה."
  },
  {
    n:"מיעוט ורביון מי שפיר",u:"soon",ul:"בהקדם",
    d:"מיעוט (Oligohydramnios): פחות מ-5 סמ AFI. ריבוי (Polyhydramnios): מעל 24 סמ. שניהם דורשים מעקב.",
    details:"מיעוט מים: יכול להעיד על בעיות כליות של התינוק, שליה לא מספקת, או דליפת מים. ריבוי: לעיתים סוכרת, מצב של התינוק. מעקב שבועי באולטרסאונד.",
    s:["בטן קטנה מהצפוי","תנועות ירדו","בטן גדולה מאוד/קשה לנשום","הרגשת דליפה"],
    a:"אולטרסאונד מודד מי שפיר. מעקב צמוד + שתיה מרובה (למיעוט מים).",
    afterbirth:"בדרך כלל מסתדר לאחר הלידה."
  },
  {
    n:"צירים מוקדמים (Preterm Labor)",u:"soon",ul:"בהקדם",
    d:"כיווצי רחם סדירים לפני שב' 37. לא כל כיווץ הוא ציר אמיתי – ברייקסטון-היקס שכיחים ולא מסוכנים.",
    details:"ברייקסטון-היקס: לא כואבים, לא סדירים, חולפים בשינוי תנוחה. צירים אמיתיים: סדירים, מתחזקים, לא חולפים.",
    s:["כיווצים כל 10 דקות או פחות","כאב גב תחתון לא רגיל","לחץ אגני חדש","שינוי בהפרשות","הרגשת לחץ בצוואר הרחם"],
    a:"שתי 2-3 כוסות מים ונוחי. אם לא עוברים תוך שעה – פני לחדר לידה.",
    afterbirth:"לא רלוונטי."
  },
  {
    n:"אנמיה בהריון",u:"routine",ul:"מעקב",
    d:"ירידה בהמוגלובין, שכיחה מאוד בהריון. הגוף מייצר יותר דם אבל לא תמיד מספיק ברזל.",
    details:"ערך תקין בהריון: מעל 10.5 ג/דל. טרימסטר 2-3 קריטיים לברזל. מזונות: בשר אדום, קטניות, ירקות ירוקים + ויטמין C לספיגה. הימנעי מקפה/תה עם אוכל.",
    s:["עייפות קיצונית","חיוורון בפנים וחניכיים","קוצר נשימה","דפיקות לב מואצות","ציפורניים שבירות"],
    a:"תוספי ברזל לפי מרשם. בדיקת דם כל טרימסטר.",
    afterbirth:"המשיכי בברזל 3 חודשים לאחר הלידה."
  }
];

const POSTPARTUM_MOM_CL=["בדיקת לחץ דם כל 4 שעות ב-24 הראשונות","בדיקת טמפרטורה","מעקב דימום (לוכיה)","בדיקת תפר (אם היה קרע/אפיזיוטומיה)","שתן ראשון תוך 6 שעות","הליכה ראשונה עם עזרה","בדיקת דם (המוגלובין)","ייעוץ הנקה בבית החולים","חיסון אדמת/חצבת אם נחוץ","השלמת תיק מסמכים לביטוח לאומי"];
const POSTPARTUM_BABY_CL=["שקילה ראשונה (מיד אחרי לידה)","ציון אפגר (1 ו-5 דקות)","חיסון ויטמין K","בדיקת שמיעה","בדיקת עיניים","בדיקת לב (pulse oximetry)","בדיקת דם לתשב\"ץ (PKU)","זיהוי – צמיד אמא ותינוק","הרשמה לקופת חולים","שקילה ביום 3-4"];
const EMOTIONS_QS=[
  {q:"האם אני מרגישה עצובה או בוכה ללא סיבה?",opts:["לא","לפעמים","כן, הרבה"]},
  {q:"האם אני מצליחה לישון כשהתינוק ישן?",opts:["כן","לפעמים","לא כלל"]},
  {q:"האם יש לי מחשבות מדאיגות על נזק לעצמי?",opts:["לא","לפעמים","כן"]},
  {q:"האם אני מרגישה שאני לא מסוגלת להתמודד?",opts:["לא","לפעמים","כן, רוב הזמן"]},
  {q:"האם אני מרגישה ניתוק מהתינוק?",opts:["לא","לפעמים","כן"]}
];
const VACCINE_SCHEDULE=[
  {age:"לידה",vaccines:["ויטמין K (זריקה)","חיסון הפטיטיס B (ראשון)"]},
  {age:"שבוע 2",vaccines:["ביקור טיפת חלב ראשון","בדיקת משקל והתפתחות"]},
  {age:"חודש 2",vaccines:["פנטה-היב (DTP+Hib+IPV)","פנאומוקוק (PCV)","רוטה-וירוס (פה)"]},
  {age:"חודש 4",vaccines:["פנטה-היב (שני)","פנאומוקוק (שני)","רוטה (שני)"]},
  {age:"חודש 6",vaccines:["פנטה-היב (שלישי)","פנאומוקוק (שלישי)","שפעת (אוקטובר-פברואר)"]},
  {age:"שבוע 6 לאמא",vaccines:["בדיקת רופאת נשים","בדיקת תפר","המלצה לאמצעי מניעה"]}
];

const TIPS=["שתי 8-10 כוסות מים ביום","הליכה 30 דקות – טובה לגב, שינה ומצב רוח","כריית הריון בין הברכיים משפרת שינה","ישני על הצד השמאלי","כאבי גב? בדקי נעלי תמיכה","אכלי ארוחות קטנות ותכופות","רגליים נפוחות? הרימי אותן 15 דקות","קגל כל יום – 3 סטים של 10 כיווצים!"];

const BABY_MASSAGE=[
  {step:"רגליים",emoji:"🦵",desc:"התחילי מהרגליים – הכי פחות מאיים. שמני שמן על הידיים, גלגלי את כף הרגל בין כפות ידייך, לחץ עדין מהעקב לאצבעות.",benefit:"מרגיע, זרימת דם, מקל על גזים"},
  {step:"בטן",emoji:"🫃",desc:"עיגולים בכיוון השעון בלבד. שלוש אצבעות, לחץ קל. תנועת I-L-U על הבטן. הכניסי ברכיים לבטן בעדינות.",benefit:"מקל על גזים, עצירות וקוליק – פיצר #1!"},
  {step:"חזה וזרועות",emoji:"💪",desc:"מרכז החזה החוצה כמו פתיחת ספר. גלגול זרועות מהכתף לאגרוף. פתיחת כף יד אחת-אחת.",benefit:"עוזר לנשימה, מחזק חיבור"},
  {step:"גב",emoji:"🔙",desc:"שכב על הבטן (רק אם מחזיק ראש). תנועות מהעורף לישבן. עיגולים קטנים לצד עמוד השדרה.",benefit:"מרגיע, עוזר לשינה"},
  {step:"פנים",emoji:"😊",desc:"עיגולים קטנים על הלחיים. מן המרכז החוצה על המצח. מסביב לפה ולאוזניים.",benefit:"מקל על שיני חלב, מרגיע"}
];

const BABY_REFLEX=[
  {area:"בטן וגזים",emoji:"🌀",points:["אזור מרכז כף הרגל = המעיים","עיגולים בכיוון השעון, לחץ עדין","10-15 שניות, 3-4 פעמים","שחרר ועשי שוב"],tip:"הכי יעיל 20 דקות אחרי הנקה"},
  {area:"שינה והרגעה",emoji:"😴",points:["פד האגודל = מוח/ראש","לחץ עדין עם גלגול קל","האצבעות הקטנות = עצבים","גלגול מהפד לקצה כל אצבע"],tip:"עשי בחדר חשוך, לפני אמבטיה"},
  {area:"שיניים",emoji:"🦷",points:["אצבעות הרגליים = לסת ושיניים","לחץ עגול על פדי האצבעות","גד האגודל = מוח","עיסוי כל אצבע מהבסיס לקצה"],tip:"מועיל גם לאחר חיסונים"},
  {area:"נזלת ועומס",emoji:"🤧",points:["האגודל = סינוסים","מדיאלית לאצבע הקטנה = ריאות","תנועת V עדינה","3-5 דקות כל צד"],tip:"שמרי ראש גבוה לאחר מכן"}
];

// ===== WHITE NOISE ENGINE =====
function createWhiteNoise(ctx) {
  const buf = ctx.createBuffer(1, ctx.sampleRate*2, ctx.sampleRate);
  const d = buf.getChannelData(0);
  for(let i=0;i<d.length;i++) d[i] = Math.random()*2-1;
  const src = ctx.createBufferSource(); src.buffer=buf; src.loop=true;
  return src;
}
function createRain(ctx) {
  // Pink-ish noise with gentle filtering
  const buf = ctx.createBuffer(1, ctx.sampleRate*2, ctx.sampleRate);
  const d = buf.getChannelData(0);
  let b0=0,b1=0,b2=0,b3=0,b4=0;
  for(let i=0;i<d.length;i++){
    const w=Math.random()*2-1;
    b0=0.99886*b0+w*0.0555179; b1=0.99332*b1+w*0.0750759;
    b2=0.96900*b2+w*0.1538520; b3=0.86650*b3+w*0.3104856;
    b4=0.55000*b4+w*0.5329522;
    d[i]=(b0+b1+b2+b3+b4)*0.11;
  }
  const src = ctx.createBufferSource(); src.buffer=buf; src.loop=true;
  return src;
}
function createHairDryer(ctx) {
  const osc = ctx.createOscillator();
  osc.type='sawtooth'; osc.frequency.value=80;
  const buf = ctx.createBuffer(1, ctx.sampleRate, ctx.sampleRate);
  const d = buf.getChannelData(0);
  for(let i=0;i<d.length;i++) d[i]=Math.random()*2-1;
  const src = ctx.createBufferSource(); src.buffer=buf; src.loop=true;
  return src;
}
// Ocean waves: pink noise with slow amplitude modulation
function createOceanSrc(ctx) {
  const buf = ctx.createBuffer(1, ctx.sampleRate*4, ctx.sampleRate);
  const d = buf.getChannelData(0);
  let b0=0,b1=0,b2=0,b3=0,b4=0;
  for(let i=0;i<d.length;i++){
    const w=Math.random()*2-1;
    b0=0.99886*b0+w*0.0555179; b1=0.99332*b1+w*0.0750759;
    b2=0.96900*b2+w*0.1538520; b3=0.86650*b3+w*0.3104856;
    b4=0.55000*b4+w*0.5329522;
    const wave = 0.6 + 0.4*Math.sin(2*Math.PI*0.15*(i/ctx.sampleRate));
    d[i]=(b0+b1+b2+b3+b4)*0.11*wave;
  }
  const src = ctx.createBufferSource(); src.buffer=buf; src.loop=true;
  return src;
}
// Soft chimes/drone: layered oscillators for ambient music
function createChimesSrc(ctx) {
  const buf = ctx.createBuffer(2, ctx.sampleRate*8, ctx.sampleRate);
  const freqs=[261.6,329.6,392,440]; // C E G A - soothing pentatonic-ish chord
  for(let ch=0;ch<2;ch++){
    const d = buf.getChannelData(ch);
    for(let i=0;i<d.length;i++){
      const t=i/ctx.sampleRate;
      let v=0;
      freqs.forEach((f,fi)=>{
        const env = 0.5+0.5*Math.sin(2*Math.PI*(0.05+fi*0.01)*t + fi);
        v += Math.sin(2*Math.PI*f*t)*0.06*env;
      });
      d[i]=v;
    }
  }
  const src = ctx.createBufferSource(); src.buffer=buf; src.loop=true;
  return src;
}

// Text-to-speech for guided imagery using the browser's built-in voice
function speakText(text, id, currentSpeaking, setSpeaking) {
  if (!('speechSynthesis' in window)) { alert('הדפדפן לא תומך בהקראה'); return; }
  if (currentSpeaking === id) {
    window.speechSynthesis.cancel();
    setSpeaking(null);
    return;
  }
  window.speechSynthesis.cancel();
  const utter = new SpeechSynthesisUtterance(text);
  utter.lang = 'he-IL';
  utter.rate = 0.85;
  utter.pitch = 1;
  utter.onend = () => setSpeaking(null);
  utter.onerror = () => setSpeaking(null);
  window.speechSynthesis.speak(utter);
  setSpeaking(id);
}

function buildNoiseGraph(ctx, type) {
  let src;
  if(type==='rain'||type==='womb') src=createRain(ctx);
  else if(type==='ocean') src=createOceanSrc(ctx);
  else if(type==='chimes'||type==='lullaby'||type==='drums') src=createChimesSrc(ctx);
  else src=createWhiteNoise(ctx);
  const lp = ctx.createBiquadFilter(); lp.type='lowpass';
  const hp = ctx.createBiquadFilter(); hp.type='highpass';
  const gain = ctx.createGain(); gain.gain.value=0.35;
  const configs = {
    vacuum:{lp:3500,hp:200},
    rain:{lp:800,hp:80},
    hairdryer:{lp:5000,hp:400},
    womb:{lp:400,hp:60},
    fan:{lp:1500,hp:100},
    shush:{lp:6000,hp:1000},
    ocean:{lp:1200,hp:50},
    chimes:{lp:8000,hp:50,gain:0.5},
    lullaby:{lp:8000,hp:50,gain:0.5},
    drums:{lp:8000,hp:50,gain:0.5}
  };
  const cfg = configs[type]||configs.vacuum;
  lp.frequency.value=cfg.lp; hp.frequency.value=cfg.hp;
  if(cfg.gain) gain.gain.value=cfg.gain;
  src.connect(lp); lp.connect(hp); hp.connect(gain); gain.connect(ctx.destination);
  return {src,gain,lp,hp};
}

const WHITE_NOISES=[
  {id:"vacuum",name:"שואב אבק",emoji:"🌀",desc:"רעש כבד ועמוק"},
  {id:"rain",name:"גשם",emoji:"🌧️",desc:"רעש עדין ומרגיע"},
  {id:"hairdryer",name:"מייבש שיער",emoji:"💨",desc:"רעש גבוה ורציף"},
  {id:"womb",name:"רחם",emoji:"🌸",desc:"תדר נמוך ועמוק"},
  {id:"fan",name:"מאוורר",emoji:"~️",desc:"רחש בינוני עדין"},
  {id:"shush",name:"שש-שש",emoji:"🤫",desc:"רעש גבוה וחד"}
];

// ===== COMPONENTS =====

function Home({go}) {
  const tip=TIPS[new Date().getDay()];
  const lnks=[
    {ic:'📅',lb:'תוכן שבועי',tb:'w'},{ic:'⏱',lb:'טיימר צירים',tb:'c'},
    {ic:'🌊',lb:'שלבי לידה',tb:'stages'},{ic:'🧣',lb:'Spinning Babies',tb:'spinning'},
    {ic:'📋',lb:'תוכנית לידה',tb:'bp'},{ic:'🤱',lb:'הנקה',tb:'bf'},
    {ic:'💉',lb:'התערבויות',tb:'induction'},{ic:'⚖️',lb:'זכויות',tb:'rights'},
    {ic:'🌺',lb:'אחרי לידה',tb:'postpartum'},{ic:'👶',lb:'הכל לתינוק',tb:'baby'},
    {ic:'🛠️',lb:'עזרים',tb:'tools'},{ic:'✅',lb:'צקליסטים',tb:'cl'}
  ];
  return (
    <div>
      <div style={{background:`linear-gradient(135deg,${C.br},${C.t})`,borderRadius:16,padding:24,color:'white',marginBottom:16,textAlign:'center'}}>
        <div style={{fontSize:40,marginBottom:8}}>🌸</div>
        <div style={{fontFamily:'Georgia,serif',fontSize:28,fontWeight:'normal',marginBottom:6}}>ברוכה הבאה</div>
        <div style={{fontSize:14,opacity:0.85}}>המלווה הדיגיטלית שלך לכל המסע</div>
      </div>
      <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:10,marginBottom:16}}>
        {lnks.map(l=>(
          <div key={l.tb} onClick={()=>go(l.tb)} style={{background:'white',borderRadius:14,padding:16,textAlign:'center',cursor:'pointer',boxShadow:'0 2px 8px rgba(92,61,46,0.08)'}}>
            <div style={{fontSize:28,marginBottom:6}}>{l.ic}</div>
            <div style={{fontSize:13,fontWeight:500,color:C.br}}>{l.lb}</div>
          </div>
        ))}
      </div>
      <div style={{background:'linear-gradient(135deg,#E8F4E8,#F0E8DC)',borderRadius:14,padding:16,borderRight:`4px solid ${C.sg}`,marginBottom:16}}>
        <div style={{fontSize:11,textTransform:'uppercase',letterSpacing:1,color:C.sg,fontWeight:500,marginBottom:6}}>✨ טיפ היום</div>
        <div style={{fontSize:14,lineHeight:1.6}}>{tip}</div>
      </div>
    </div>
  );
}

function Weekly() {
  const [week,setWeek]=useState(20);
  const d=getWD(week); const tri=getTri(week);
  return (
    <div>
      <div style={card}>
        <div style={{display:'flex',alignItems:'center',gap:12,marginBottom:16}}>
          <span style={{fontSize:14,color:C.txl,flexShrink:0}}>שבוע</span>
          <input type="range" min={4} max={42} value={week} onChange={e=>setWeek(+e.target.value)} style={{flex:1,accentColor:C.t}}/>
          <div style={{background:C.t,color:'white',borderRadius:20,padding:'4px 14px',fontSize:14,fontWeight:500,flexShrink:0}}>שב׳ {week}</div>
        </div>
        <span style={{display:'inline-block',padding:'3px 10px',borderRadius:10,fontSize:12,background:tri.bg,color:tri.c,marginBottom:12}}>{tri.l}</span>
        <div style={{textAlign:'center',padding:'16px 0',background:`linear-gradient(135deg,${C.cr},white)`,borderRadius:12,marginBottom:4}}>
          <div style={{fontSize:80,marginBottom:4,filter:'drop-shadow(0 4px 8px rgba(0,0,0,0.1))'}}>{d.emoji}</div>
          <div style={{fontFamily:'Georgia,serif',fontSize:22,color:C.br,marginBottom:2}}>גודל: {d.sz}</div>
          <div style={{fontSize:12,color:C.txl,fontStyle:'italic'}}>{d.szEn}</div>
        </div>
      </div>
      <div style={card}><div style={ttl}>✨ הדגש השבועי</div><div style={bdy}>{d.hl}</div></div>
      <div style={card}><div style={ttl}>🫀 התפתחות</div><div style={bdy}>{d.sys}</div></div>
      <div style={card}><div style={ttl}>💡 טיפ</div><div style={bdy}>{d.tip}</div></div>
      <div style={card}><div style={ttl}>🌸 תסמינים</div><div style={bdy}>{d.sym}</div></div>
      {d.tests&&d.tests.length>0&&(
        <div style={{...card,border:`1px solid #90CAF9`,background:'#E3F2FD'}}>
          <div style={{...ttl,color:'#1565C0'}}>🔬 בדיקות מומלצות בשבוע זה</div>
          {d.tests.map((t,i)=>(
            <div key={i} style={{display:'flex',gap:8,padding:'8px 0',borderBottom:i<d.tests.length-1?`1px solid #BBDEFB`:'none',fontSize:13,color:'#1565C0'}}>
              <span>💉</span><span>{t}</span>
            </div>
          ))}
        </div>
      )}
    </div>
  );
}

function Contractions() {
  const [list,setList]=useState([]);
  const [active,setActive]=useState(false);
  const [elapsed,setElapsed]=useState(0);
  const tRef=useRef(null);
  useEffect(()=>{if(active){tRef.current=setInterval(()=>setElapsed(e=>e+1),1000);}else{clearInterval(tRef.current);}return()=>clearInterval(tRef.current);},[active]);
  function start(){setElapsed(0);setActive(true);}
  function stop(){const dur=elapsed;const now=Date.now();let gap=null;if(list.length>0)gap=Math.round((now-list[0].endTime)/1000);setList(p=>[{id:p.length+1,dur,gap,endTime:now,time:new Date().toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'})},...p].slice(0,10));setActive(false);setElapsed(0);}
  const rec=list.slice(0,5);
  const avgGap=rec.filter(c=>c.gap!==null).reduce((s,c)=>s+(c.gap||0),0)/(rec.filter(c=>c.gap!==null).length||1);
  const avgDur=rec.reduce((s,c)=>s+c.dur,0)/(rec.length||1);
  const showAlert=list.length>=3&&avgGap<600&&avgDur>30;
  return (
    <div>
      <div style={card}>
        <div style={{textAlign:'center',padding:'24px 0'}}>
          <div style={{fontFamily:'Georgia,serif',fontSize:56,fontWeight:'normal',color:C.br,lineHeight:1}}>{fmt(elapsed)}</div>
          <div style={{fontSize:13,color:C.txl,marginTop:6}}>{active?'⏱ ציר פעיל':'מחכה לציר'}</div>
        </div>
        {!active?<button onClick={start} style={{width:'100%',padding:14,border:'none',borderRadius:12,fontFamily:'inherit',fontSize:16,fontWeight:500,cursor:'pointer',marginBottom:10,background:C.t,color:'white'}}>🔴 התחלת ציר</button>:<button onClick={stop} style={{width:'100%',padding:14,border:'none',borderRadius:12,fontFamily:'inherit',fontSize:16,fontWeight:500,cursor:'pointer',marginBottom:10,background:C.sg,color:'white'}}>⏹ סיום ציר</button>}
        {list.length>0&&<button onClick={()=>{setList([]);setElapsed(0);setActive(false);}} style={{width:'100%',padding:12,border:'none',borderRadius:12,fontFamily:'inherit',fontSize:14,cursor:'pointer',background:C.cd,color:C.txl}}>🔄 איפוס</button>}
      </div>
      {showAlert&&<div style={{background:'linear-gradient(135deg,#FFF3E0,#FCE4EC)',border:`1px solid ${C.tl}`,borderRadius:12,padding:14,marginBottom:16,fontSize:13,lineHeight:1.6}}><strong style={{color:C.t,display:'block',marginBottom:4}}>🚨 דפוס סדיר!</strong>ציר כל {Math.round(avgGap/60)} דקות, משך {Math.round(avgDur)} שניות. הגיע הזמן! 📞</div>}
      {list.length>0&&<div style={card}><div style={ttl}>📊 צירים אחרונים</div>{list.map((c,i)=><div key={c.id} style={{display:'flex',justifyContent:'space-between',padding:'10px 0',borderBottom:i<list.length-1?`1px solid ${C.cd}`:'none',fontSize:13}}><span style={{color:C.t,fontWeight:500}}>#{list.length-i}</span><span>⏱ {fmt(c.dur)}</span><span>{c.gap!==null?`↔ ${fmt(c.gap)}`:'—'}</span><span style={{color:C.txl,fontSize:12}}>{c.time}</span></div>)}</div>}
      <div style={card}><div style={ttl}>📖 כלל 4-1-1</div><div style={bdy}>צירים כל <strong>4 דקות</strong>, משך <strong>דקה</strong>, למשך <strong>שעה</strong> – זמן לבית חולים!<br/><br/>סימנים נוספים: ירידת מים, דימום, ירידה בתנועות תינוק, תחושת לחץ חזק בצוואר רחם.</div></div>
      {list.length>=3&&(
        <div style={card}>
          <div style={ttl}>📈 גרף התקדמות צירים</div>
          <div style={{overflowX:'auto',paddingBottom:8}}>
            <div style={{minWidth:280,height:120,position:'relative',background:C.cr,borderRadius:10,padding:'10px 8px'}}>
              <div style={{position:'absolute',bottom:10,left:8,right:8,height:2,background:C.cd}}/>
              <div style={{position:'absolute',bottom:10,left:8,top:10,width:2,background:C.cd}}/>
              {list.slice(0,8).reverse().map((c,i,arr)=>{
                const maxDur=Math.max(...arr.map(x=>x.dur),60);
                const h=Math.round((c.dur/maxDur)*80);
                const barW=Math.floor((280-32)/(arr.length));
                return(
                  <div key={c.id} style={{position:'absolute',bottom:12,left:8+i*barW+2,width:barW-4,height:h,background:`linear-gradient(to top,${C.t},${C.tl})`,borderRadius:'4px 4px 0 0',display:'flex',alignItems:'flex-start',justifyContent:'center',paddingTop:2}}>
                    <span style={{fontSize:8,color:'white',fontWeight:600}}>{fmt(c.dur)}</span>
                  </div>
                );
              })}
              <div style={{position:'absolute',top:4,left:12,fontSize:10,color:C.txl}}>משך צירים (שניות)</div>
            </div>
          </div>
          {list.length>=3&&(()=>{
            const durs=list.slice(0,5).map(c=>c.dur);
            const trend=durs[0]>durs[durs.length-1]?'⬆️ הצירים מתארכים':'➡️ צירים יציבים';
            const gaps=list.slice(0,5).filter(c=>c.gap!==null).map(c=>c.gap);
            const gapTrend=gaps.length>1&&gaps[0]<gaps[gaps.length-1]?'הפרקים מתקצרים!':'הפרקים יציבים';
            return(
              <div style={{marginTop:8,display:'grid',gridTemplateColumns:'1fr 1fr',gap:8}}>
                <div style={{background:'#E8F5E9',borderRadius:8,padding:'8px 10px',fontSize:12,color:'#2E7D32',textAlign:'center'}}>{trend}</div>
                <div style={{background:'#E3F2FD',borderRadius:8,padding:'8px 10px',fontSize:12,color:'#1565C0',textAlign:'center'}}>{gapTrend}</div>
              </div>
            );
          })()}
        </div>
      )}
    </div>
  );
}


// ===== BIRTH POSITIONS DATA =====
const BIRTH_POSITIONS = {
  latent:[
    {name:"הליכה",emoji:"🚶",desc:"הליכה איטית – הכבידה מסייעת לתינוק לרדת. האידיאלית לשלב הראשוני.",visual:"🚶‍♀️➡️"},
    {name:"כדור פיזיו",emoji:"⚽",desc:"כדור פיזיו (Birth Ball) – ישיבה ועיגולים על הכדור. פותח את האגן, מקל על כאבי גב ומסייע לתינוק לרדת.",visual:"🔵🔄"},
    {name:"שכיבה על הצד",emoji:"🛌",desc:"לנוח ולחסוך אנרגיה לשלב הפעיל. כרית בין הברכיים.",visual:"↔️😴"}
  ],
  active:[
    {name:"עמידה ונדנוד",emoji:"💃",desc:"עמדי עם ידיים על הקיר. בזמן ציר – נדנדי אגן קדימה-אחורה.",visual:"🔄🦴"},
    {name:"כריעה (Squat)",emoji:"🏋️",desc:"כריעה רחבה עם תמיכה. מרחיבה את האגן ב-28%. מאיצה לידה.",visual:"⬇️📐"},
    {name:"ארבע רגליים",emoji:"🐄",desc:"ידיים וברכיים על הרצפה. מרגיעה כאבי גב, מסובבת תינוק אחורי.",visual:"🔃"},
    {name:"תנוחת הטאנגו",emoji:"💑",desc:"רגל אחת על כיסא בזמן ציר, הטיית גוף לצד. מרחיבה כניסת אגן.",visual:"🦵↗️"},
    {name:"ישיבה הפוכה על כיסא",emoji:"🪑",desc:"ישבי על כיסא הפוך, ידיים על גב הכיסא. תמיכה + פתיחת אגן.",visual:"🔄🪑"}
  ],
  transition:[
    {name:"ארבע רגליים + נדנוד",emoji:"🐄",desc:"עיגולים בזמן ציר. מפחית עוצמת כאב גב. גרון ורצפה – שחרר!",visual:"🔄"},
    {name:"תלייה על בן הזוג",emoji:"🤝",desc:"תלי את משקלך על בן הזוג/דולה בזמן ציר. שחרר לחלוטין.",visual:"🫂"},
    {name:"אמבטיה/מקלחת",emoji:"🚿",desc:"מים חמים על הגב – אחד מהמשככי כאב הטובים ביותר!",visual:"💧🌡️"}
  ],
  pushing:[
    {name:"כריעה עם תמיכה",emoji:"🏋️",desc:"הכי אפקטיבית! כוח הכבידה + פתיחת אגן מקסימלית.",visual:"⬇️💪"},
    {name:"שכיבה על הצד",emoji:"↔️",desc:"מפחיתה קרעים. מאפשרת לרופאה לסייע. טובה לעייפות.",visual:"↔️🛌"},
    {name:"ישיבה חצי-זקופה",emoji:"🛋️",desc:"גב משופע, ידיים אוחזות ברגליים. שכיחה בבתי חולים.",visual:"📐🤲"},
    {name:"כריעה מעל מקל/כיסא",emoji:"🌉",desc:"Dangle squat – ירכיים בזווית קיצונית. מרחיבה אגן מקסימלית.",visual:"⬇️⬇️"}
  ]
};

// ===== NIGHT CHAT =====
const isNightTime = () => {
  const h = new Date().getHours();
  return h >= 23 || h < 6;
};

// ===== ACUPUNCTURE DATA =====
const ACUPUNCTURE_DATA = [
  {point:"SP6 (סן-ין-גיאו)",location:"4 אצבעות מעל הקרסול הפנימי, מאחורי השוק",use:"עידוד צירים, כאבי חיק, הנקה",warning:"⚠️ אסור לפני שב' 37!",emoji:"🦶"},
  {point:"LI4 (הה-גו)",location:"בשקע שבין האגודל לאצבע הראשונה של כף היד",use:"כאבי ראש, כאבים כלליים, עידוד לידה",warning:"⚠️ אסור בהריון לפני שב' 37!",emoji:"✋"},
  {point:"BL32 (צה-לייאו)",location:"גומות בגב תחתון, לצד עמוד השדרה",use:"כאבי גב, צירים עצימים, רגיעה",warning:"✅ בטוח בכל שלבי הלידה",emoji:"🔙"},
  {point:"PC6 (נֵי-גוּאן)",location:'2 סמ מהכרית של כף היד, בין שני הגידים',use:"בחילות, חרדה, הפחתת כאב",warning:"✅ בטוח בכל ההריון",emoji:"🤲"},
  {point:"GB21 (גיאן-גינג)",location:"אמצע הכתף, נקודה הכי גבוהה",use:"ירידת ראש התינוק, כאבי כתפיים",warning:"⚠️ שב' 37+ בלבד!",emoji:"💆"}
];

// ===== NEW BREASTFEEDING DATA =====
const BF_TROUBLESHOOT = [
  {
    issue:"גודש שד (Engorgement)",
    urgent:false,
    steps:[
      {title:"הקלה מיידית",action:"עיסוי רך מהחזה לכיוון הפטמה לפני הנקה. מים חמים 2-3 דקות לפני.",heat:true},
      {title:"בין הנקות",action:"קירור עם קרח עטוף במגבת 15-20 דקות. ועלי כרוב קרים!",heat:false},
      {title:"שאבי מעט",action:"לא לרוקן לגמרי – שאבי רק עד הקלה. ריקון מלא מגביר ייצור.",heat:null}
    ]
  },
  {
    issue:"פטמות סדוקות",
    urgent:false,
    steps:[
      {title:"מיד אחרי הנקה",action:"מרחי טיפת חלב על הפטמה ותני לה להתייבש. עדיף משחת לנולין.",heat:null},
      {title:"בדיקה דחופה",action:"בדקי לידה מחדש. פה פתוח רחב, שפתיים מוחצנות. זו הסיבה העיקרית.",heat:null},
      {title:"שמרי על יובש",action:"אל תשאירי פטמות רטובות. אוויר בין הנקות. כרות הנקה סיליקון.",heat:null}
    ]
  },
  {
    issue:"צינורית סתומה (Plugged Duct)",
    urgent:false,
    steps:[
      {title:"חום לפני הנקה",action:"קומפרס חם 5 דקות על האזור הכואב. מרכך את החסימה.",heat:true},
      {title:"עיסוי בזמן הנקה",action:"עיסוי עדין מהאזור הכואב לכיוון הפטמה בזמן הנקה או שאיבה.",heat:true},
      {title:"הנקי מהצד הכואב ראשון",action:"תינוק רעב יינק בעוצמה גדולה יותר. לא לדלג על הנקות!",heat:null}
    ]
  },
  {
    issue:"דלקת שד (Mastitis)",
    urgent:true,
    desc:"דלקת ברקמת השד, לרוב כתוצאה מצינורית סתומה שלא טופלה. מתבטאת באזור אדום, חם, כואב בשד, לרוב בליווי חום וצמרמורות כלליות.",
    steps:[
      {title:"⚠️ אל תפסיקי להניק!",action:"הנקה או שאיבה מרוקנת את הדלקת. עצירה מחמירה.",heat:null},
      {title:"פני לרופאה תוך 24 שעות",action:"חום מעל 38.5, אדמומיות, כאב חזק = אנטיביוטיקה נחוצה.",heat:null},
      {title:"מנוחה מרבית",action:"גוף שנלחם בדלקת זקוק למנוחה. בקשי עזרה. זה חשוב.",heat:null}
    ]
  },
  {
    issue:"פטריה (Thrush)",
    urgent:false,
    desc:"זיהום פטרייתי (קנדידה) שמופיע לעיתים בפטמות ובפה התינוק. מתבטא בכאב צורב/דוקר בפטמות (גם בין הנקות), פטמות אדומות ומבריקות, ולעיתים כתמים לבנים בפה התינוק (פה לבן).",
    steps:[
      {title:"זהי את הסימנים",action:"כאב צורב או דוקר שמופיע פתאום, גם כאשר הלידה תקינה. בדקי את פי התינוק לכתמים לבנים שלא נמחקים.",heat:null},
      {title:"פני לרופאה",action:"פטריה דורשת טיפול אנטי-פטרייתי לאם ולתינוק במקביל – גם אם רק אחד מראה תסמינים.",heat:null},
      {title:"היגיינה קפדנית",action:"החליפי כריות הנקה בתדירות גבוהה, רחצי ידיים, חממי כלים/פטמות סיליקון במים רותחים.",heat:null}
    ]
  },
  {
    issue:"מיעוט חלב (Low Milk Supply)",
    urgent:false,
    desc:"תחושה או מצב שבו כמות החלב אינה מספקת לתינוק. לעיתים זו תחושה בלבד (לא ירידה אמיתית), ולעיתים אכן יש ירידה הניתנת לטיפול.",
    steps:[
      {title:"בדקי סימני שובע",action:"6+ חיתולים רטובים ביום, עלייה במשקל תקינה = הספקה תקינה גם אם לא 'מרגישה' מלאה.",heat:null},
      {title:"הנקות תכופות יותר",action:"חלב מיוצר לפי ביקוש – הנקה/שאיבה כל 2-3 שעות מגבירה ייצור תוך ימים.",heat:null},
      {title:"רוקני שדים לגמרי",action:"שאיבה נוספת של 10 דקות אחרי הנקה (Power Pumping) מאיצה ייצור.",heat:true},
      {title:"בדקי תרופות/מצבים",action:"גלולות מסוימות, עישון, וחוסר שינה משפיעים. שאלי רופאה לפני שינוי תרופות.",heat:null}
    ]
  }
];

// Decision tree for breastfeeding challenges
const BF_DECISION_TREE = {
  start:{
    question:"מה את מרגישה?",
    options:[
      {label:"כאב בפטמה",next:"nipple_pain"},
      {label:"גוש/אזור כואב בשד",next:"lump"},
      {label:"חום + כאב כללי בשד",next:"fever"},
      {label:"מרגישה שיש מעט חלב",next:"END_lowmilk"}
    ]
  },
  nipple_pain:{
    question:"איך הכאב מתבטא?",
    options:[
      {label:"כאב חד רק בזמן הנקה",next:"END_latch"},
      {label:"כאב צורב/דוקר גם בין הנקות",next:"END_thrush"},
      {label:"פטמה סדוקה/פצועה",next:"END_crack"}
    ]
  },
  lump:{
    question:"איך מרגיש הגוש?",
    options:[
      {label:"כואב אבל בלי חום",next:"END_plugged"},
      {label:"כואב + אדום + חום גוף",next:"END_mastitis"}
    ]
  },
  fever:{
    question:"יש לך חום מעל 38?",
    options:[
      {label:"כן, עם אזור אדום וכואב בשד",next:"END_mastitis"},
      {label:"לא בטוחה",next:"END_mastitis"}
    ]
  }
};
const BF_DECISION_END = {
  END_latch:{title:"כנראה בעיית חיבור",desc:"כאב חד שמתרכז בזמן ההנקה ונרגע אחריה מעיד לרוב על חיבור לא אופטימלי. עברי ללשונית 'חיבור' לבדיקת הסימנים.",emoji:"👄"},
  END_thrush:{title:"אפשרי – פטריה (Thrush)",desc:"כאב צורב/דוקר שממשיך גם בין הנקות יכול להעיד על פטריה. ראי את הסעיף 'פטריה' באתגרים, ופני לרופאה.",emoji:"🔬"},
  END_crack:{title:"פטמה סדוקה",desc:"לרוב נובע מחיבור לא נכון. ראי את הסעיף 'פטמות סדוקות' באתגרים לטיפול מיידי.",emoji:"🩹"},
  END_plugged:{title:"כנראה צינורית סתומה",desc:"גוש כואב ללא חום מתאים לצינורית סתומה. ראי את הסעיף 'צינורית סתומה' באתגרים – חום ועיסוי יעזרו.",emoji:"🔘"},
  END_mastitis:{title:"⚠️ כנראה דלקת שד (Mastitis)",desc:"חום + אזור אדום וכואב = ייתכן ודורש אנטיביוטיקה. פני לרופאה תוך 24 שעות, והמשיכי להניק/לשאוב!",emoji:"🚨"},
  END_lowmilk:{title:"מיעוט חלב",desc:"לעיתים זו תחושה בלבד. בדקי חיתולים ועלייה במשקל. ראי את הסעיף 'מיעוט חלב' באתגרים לטיפים.",emoji:"🍼"}
};

const MILK_STORAGE_RULES = [
  {location:"חדר (25°C)",time:"4 שעות",emoji:"🌡️"},
  {location:"מקרר (4°C)",time:"4 ימים",emoji:"❄️"},
  {location:"הקפאה",time:"6 חודשים",emoji:"🧊"},
  {location:"אחרי הפשרה",time:"24 שעות במקרר בלבד",emoji:"⏰"}
];

const SAFE_FOODS_BF = {
  safe:["קפה (עד 2 כוסות)","שוקולד (מתון)","ירקות ופירות","בשר ודגים","מוצרי חלב","לחם ודגנים"],
  avoid:["אלכוהול (אם שתית – המתיני 2 שעות)","עישון"],
  galactagogues:["שיבולת שועל – מגבירה ייצור","שמרי בירה – ויטמיני B + ייצור","שום – מגביר ייצור","עלי מרווה – מפחיתה ייצור (שימי לב!)","תה קמומיל – בטוח ומרגיע"]
};

// Medication database for breastfeeding safety search
const BF_MEDICATIONS = [
  {name:"אקמול / פרצטמול / Acamol / Paracetamol",category:"משככי כאבים",verdict:"safe",note:"הבטוח ביותר להנקה. ניתן להשתמש לפי הצורך."},
  {name:"אדוויל / נורופן / איבופרופן / Advil / Ibuprofen",category:"משככי כאבים נגד דלקת",verdict:"safe",note:"בטוח בהנקה, נחשב קו ראשון גם לכאבי דלקת/חלב."},
  {name:"פנדול / Panadol",category:"משככי כאבים",verdict:"safe",note:"מכיל פרצטמול – בטוח להנקה."},
  {name:"וולטרן / דיקלופנק / Voltaren / Diclofenac",category:"משככי כאבים נגד דלקת",verdict:"caution",note:"בטוח לטווח קצר. העדיפי איבופרופן אם אפשר."},
  {name:"אופטלגין / דיפירון / Optalgin",category:"משככי כאבים",verdict:"caution",note:"שימוש מקובל בישראל לטווח קצר, אך פחות נתונים זמינים מאקמול/איבופרופן."},
  {name:"אספירין / Aspirin",category:"משככי כאבים",verdict:"avoid",note:"להימנע במינון רגיל למשככי כאבים (מינון נמוך לקרדיולוגיה – בהתייעצות בלבד)."},
  {name:"קודאין / Codeine",category:"משככי כאבים אופיואידים",verdict:"avoid",note:"לא מומלץ – עלול להגיע לתינוק ולגרום ישנוניות/דיכוי נשימה. רק בהמלצת רופא ולזמן קצר ביותר."},
  {name:"אמוקסיצילין / אוגמנטין / Amoxicillin / Augmentin",category:"אנטיביוטיקה",verdict:"safe",note:"שכיח ובטוח בהנקה."},
  {name:"אנטיביוטיקה כללי",category:"אנטיביוטיקה",verdict:"caution",note:"רוב האנטיביוטיקות בטוחות, אך תמיד ציינו לרופא שמניקה כדי לבחור תרופה מותאמת."},
  {name:"לנולין / Lansinoh",category:"משחות לפטמות",verdict:"safe",note:"בטוח לחלוטין, לא צריך לנקות לפני הנקה."},
  {name:"ויטמינים / ברזל / חומצה פולית",category:"תוספים",verdict:"safe",note:"מומלצים ובטוחים בהנקה."},
  {name:"גלולות למניעת היריון – פרוגסטרון בלבד / מיני פיל",category:"אמצעי מניעה",verdict:"safe",note:"בטוחות בהנקה, לא משפיעות על ייצור החלב."},
  {name:"גלולות משולבות (אסטרוגן)",category:"אמצעי מניעה",verdict:"caution",note:"עשויות להפחית ייצור חלב, בעיקר בשבועות הראשונים. שאלי על אלטרנטיבה."},
  {name:"תרופות הרגעה / בנזודיאזפינים",category:"תרופות פסיכיאטריות",verdict:"caution",note:"חלקן תואמות הנקה בהמלצת רופא, חלקן לא – תלוי תרופה ספציפית."},
  {name:"אלכוהול",category:"אחר",verdict:"caution",note:"אם נשתה – מומלץ להמתין כ-2 שעות לכל מנת אלכוהול לפני הנקה."}
];

// ===== COMPONENTS =====



// ===== BIRTH TYPES COMPONENT =====
function BirthTypesScreen() {
  const [open,setOpen]=useState(null);
  return (
    <div>
      <div style={{background:`linear-gradient(135deg,${C.br},${C.t})`,borderRadius:16,padding:20,marginBottom:16,textAlign:'center',color:'white'}}>
        <div style={{fontSize:36,marginBottom:6}}>🌸</div>
        <div style={{fontFamily:'Georgia,serif',fontSize:22,fontWeight:'normal',marginBottom:4}}>סוגי לידות</div>
        <div style={{fontSize:13,opacity:0.85}}>כל הדרכים שבהן יכול תינוקך להגיע לעולם</div>
      </div>
      {BIRTH_TYPES.map((bt,i)=>(
        <div key={bt.id} style={{border:`1px solid ${C.cd}`,borderRadius:14,overflow:'hidden',marginBottom:10}}>
          <div onClick={()=>setOpen(open===bt.id?null:bt.id)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:open===bt.id?C.cr:'white'}}>
            <div><div style={{fontSize:16,fontWeight:600,color:C.br}}>{bt.emoji} {bt.title}</div><div style={{fontSize:12,color:C.txl,marginTop:2}}>{bt.desc.slice(0,55)}...</div></div>
            <span style={{color:C.txl,fontSize:18}}>{open===bt.id?'▲':'▼'}</span>
          </div>
          {open===bt.id&&<div style={{background:C.cr}}>
            <div style={{padding:'12px 16px',fontSize:13,lineHeight:1.7,color:C.tx,borderBottom:`1px solid ${C.cd}`}}>{bt.desc}</div>
            <div style={{padding:'12px 16px',display:'grid',gridTemplateColumns:'1fr 1fr',gap:10,borderBottom:`1px solid ${C.cd}`}}>
              <div style={{background:'#E8F5E9',borderRadius:8,padding:'8px 10px'}}><div style={{fontSize:11,fontWeight:600,color:'#2E7D32',marginBottom:4}}>✅ יתרונות</div>{bt.pros.map((p,j)=><div key={j} style={{fontSize:12,color:C.txl,marginBottom:2}}>• {p}</div>)}</div>
              <div style={{background:'#FFF3E0',borderRadius:8,padding:'8px 10px'}}><div style={{fontSize:11,fontWeight:600,color:'#E65100',marginBottom:4}}>⚠️ אתגרים</div>{bt.cons.map((c,j)=><div key={j} style={{fontSize:12,color:C.txl,marginBottom:2}}>• {c}</div>)}</div>
            </div>
            <div style={{padding:'10px 16px',borderBottom:`1px solid ${C.cd}`}}>
              <div style={{fontSize:12,fontWeight:600,color:C.br,marginBottom:4}}>👤 מתאים ל:</div>
              <div style={{fontSize:13,color:C.txl}}>{bt.who}</div>
            </div>
            {bt.room&&<div style={{padding:'10px 16px',borderBottom:`1px solid ${C.cd}`,background:'#E3F2FD'}}>
              <div style={{fontSize:12,fontWeight:600,color:'#1565C0',marginBottom:4}}>🚪 חדר הלידה</div>
              <div style={{fontSize:13,color:C.tx,lineHeight:1.6}}>{bt.room}</div>
            </div>}
            <div style={{padding:'10px 16px',background:'#FFF0EB'}}>
              <div style={{fontSize:12,fontWeight:600,color:C.t,marginBottom:4}}>💡 טיפ של דפנה:</div>
              <div style={{fontSize:13,color:C.tx}}>{bt.tips}</div>
            </div>
            {bt.procedure&&<div style={{padding:'10px 16px',background:'#EDE7F6'}}>
              <div style={{fontSize:12,fontWeight:600,color:'#4527A0',marginBottom:4}}>📋 איך זה מתבצע בפועל</div>
              <div style={{fontSize:13,color:C.tx,lineHeight:1.7}}>{bt.procedure}</div>
            </div>}
          </div>}
        </div>
      ))}
    </div>
  );
}

// ===== HOSPITAL GUIDE COMPONENT =====
function HospitalGuide() {
  const [open,setOpen]=useState(null);
  const [region,setRegion]=useState('center');
  const regions=[{id:'north',lb:'⛰️ צפון'},{id:'center',lb:'🏙️ מרכז'},{id:'south',lb:'🌵 דרום'}];
  const filtered = HOSPITALS.filter(h=>h.region===region);
  return (
    <div>
      <div style={{background:`linear-gradient(135deg,#E3F2FD,${C.cr})`,borderRadius:16,padding:20,marginBottom:16,textAlign:'center'}}>
        <div style={{fontSize:36,marginBottom:6}}>🏥</div>
        <div style={{fontFamily:'inherit',fontSize:22,fontWeight:700,color:C.br,marginBottom:4}}>מדריך בית יולדות</div>
        <div style={{fontSize:13,color:C.txl}}>השוואת בתי יולדות לפי אזור, ניווט וסיורים</div>
      </div>
      <div style={{display:'flex',gap:8,marginBottom:16}}>
        {regions.map(r=>(
          <button key={r.id} onClick={()=>setRegion(r.id)} style={{flex:1,padding:9,border:`2px solid ${region===r.id?C.t:C.cd}`,borderRadius:10,background:region===r.id?'#FFF0EB':'white',cursor:'pointer',fontFamily:'inherit',fontSize:13,fontWeight:region===r.id?600:400}}>{r.lb}</button>
        ))}
      </div>
      {filtered.map((h,i)=>(
        <div key={i} style={{border:`1px solid ${C.cd}`,borderRadius:14,overflow:'hidden',marginBottom:10}}>
          <div onClick={()=>setOpen(open===i?null:i)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:open===i?C.cr:'white'}}>
            <div>
              <div style={{display:'flex',alignItems:'center',gap:8,marginBottom:4}}>
                <span style={{fontSize:18}}>{h.emoji}</span>
                <span style={{fontSize:15,fontWeight:600,color:C.br}}>{h.name}</span>
              </div>
              <div style={{display:'flex',gap:6,flexWrap:'wrap'}}>
                {h.waterBirth&&<span style={{fontSize:11,background:'#E3F2FD',color:'#1565C0',borderRadius:8,padding:'2px 8px'}}>🌊 לידת מים</span>}
                {h.naturalBirth&&<span style={{fontSize:11,background:'#E8F5E9',color:'#2E7D32',borderRadius:8,padding:'2px 8px'}}>🌸 לידה טבעית</span>}
              </div>
            </div>
            <span style={{color:C.txl,fontSize:18}}>{open===i?'▲':'▼'}</span>
          </div>
          {open===i&&<div style={{background:C.cr}}>
            <div style={{padding:'12px 16px',borderBottom:`1px solid ${C.cd}`}}>
              <button onClick={()=>window.open(`https://www.google.com/search?q=${encodeURIComponent(h.name+' מחלקת יולדות אתר רשמי')}`,'_blank')} style={{width:'100%',padding:11,background:'#E3F2FD',color:'#1565C0',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:13,cursor:'pointer',display:'flex',alignItems:'center',justifyContent:'center',gap:6}}>
                🌐 אתר מחלקת היולדות
              </button>
            </div>
            <div style={{padding:'12px 16px',borderBottom:`1px solid ${C.cd}`}}>
              <div style={{fontSize:11,fontWeight:600,color:C.br,marginBottom:4}}>🛏 חדרי לידה</div>
              <div style={{fontSize:12,color:C.txl}}>{h.rooms}</div>
            </div>
            <div style={{padding:'10px 16px',borderBottom:`1px solid ${C.cd}`}}>
              <div style={{fontSize:11,fontWeight:600,color:C.br,marginBottom:4}}>🏨 לינה ואשפוז</div>
              <div style={{fontSize:12,color:C.txl,lineHeight:1.6}}>{h.accommodation}</div>
            </div>
            <div style={{padding:'10px 16px',borderBottom:`1px solid ${C.cd}`}}>
              <div style={{fontSize:11,fontWeight:600,color:C.br,marginBottom:4}}>👶 פגייה</div>
              <div style={{fontSize:12,color:C.txl}}>{h.nicu}</div>
            </div>
            <div style={{padding:'12px 16px',display:'flex',gap:8}}>
              <button onClick={()=>window.open(`https://www.google.com/maps/search/${encodeURIComponent(h.name)}`,'_blank')} style={{flex:1,padding:9,background:'#4285F4',color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:12,cursor:'pointer'}}>🧭 ניווט בוויז/מפות</button>
              <button onClick={()=>window.open(`https://www.google.com/search?q=${encodeURIComponent(h.name+' מועדון יולדות סיור')}`,'_blank')} style={{flex:1,padding:9,background:C.sg,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:12,cursor:'pointer'}}>🚶 סיור – מועדון יולדות</button>
            </div>
          </div>}
        </div>
      ))}
      <div style={{...card,background:'#FFF8E1'}}>
        <div style={{fontSize:13,color:'#5D4037',lineHeight:1.8}}>
          <strong>💡 טיפים לבחירת בית חולים:</strong><br/>
          • בצעי סיור מחלקת לידה – מרגישה את הוויב<br/>
          • בדקי מדיניות: האם תומכים בלידה טבעית?<br/>
          • שאלי על אחוזי אפיזיוטומיה וקיסרי<br/>
          • בדקי זמינות בריכת לידה ודולות<br/>
          • קרבה לבית חשובה ללידה שנייה ומעלה!
        </div>
      </div>
    </div>
  );
}

// ===== FETAL STATIONS COMPONENT (added to BirthStages) =====
const STATION_POSITIONS = {
  "-3":{moves:["הליכה מהירה","כריעות עמוקות","Spinning Babies – Forward Inversion"],desc:"ראש גבוה מאוד, עוד לא נכנס לאגן. המשיכי בתנועה ובכבידה."},
  "-2":{moves:["הליכה + עיגולי אגן","כדור פיזיו – ישיבה ועיגולים","Side-lying Release"],desc:"ראש מעל הספינות. צירים ותנועה יעזרו לירידה."},
  "-1":{moves:["Lunge על כיסא","הליכה במדרגות","שכיבה על הצד + כרית"],desc:"ראש קרוב לספינות. שלב לטנטי – תנועה וסבלנות."},
  "0": {moves:["כריעה רחבה (Squat)","תנוחת ארבע רגליים","Rebozo Sifting"],desc:"ראש ברמת הספינות! Engaged. שלב פעיל מתחיל."},
  "+1":{moves:["כריעה עם תמיכה","עמידה ונדנוד","לחץ על ספינות מהצדדים"],desc:"ראש מתחת לספינות – מתקדם יפה. שלב פעיל."},
  "+2":{moves:["כריעה מלאה – Dangle Squat","Abdominal Lift and Tuck","דחיפות מכוונות"],desc:"ראש נמוך מאוד. קרוב מאוד ללידה! דחיפות."},
  "+3":{moves:["שחרורי רצפת אגן","נשמי ואל תדחפי עד ציר","מיילדת מכוונת – כמעט סיימת!"],desc:"ראש גלוי! כתרת (Crowning) – עוד רגע!"}
};

function PelvisDiagram({selected}) {
  const ys=[38,56,74,96,116,132,148];
  const labels=["-3","-2","-1","0","+1","+2","+3"];
  const lineColors=["#BBDEFB","#90CAF9","#64B5F6","#E53935","#A5D6A7","#66BB6A","#2E7D32"];
  return (
    <div style={{background:'#F8F4F0',borderRadius:12,padding:12,marginBottom:12,border:`1px solid ${C.cd}`}}>
      <div style={{fontSize:12,fontWeight:700,color:C.br,marginBottom:6,textAlign:'center'}}>
        חתך אגן – תחנות העובר (מבט מהצד)
      </div>
      <svg viewBox="0 0 280 200" width="100%" style={{display:'block',margin:'0 auto',maxWidth:300}}>
        {/* Canal outline - the birth path */}
        <path d="M 80 10 Q 140 8 200 10 L 198 80 Q 140 88 82 80 Z" fill="#EDD5A8" stroke="#B89450" strokeWidth="2"/>
        {/* Left pelvic wall */}
        <path d="M 20 0 L 80 0 L 80 10 L 82 80 L 84 160 Q 70 175 50 180 Q 30 178 22 165 L 20 0Z" fill="#DCC090" stroke="#B89450" strokeWidth="2"/>
        {/* Right pelvic wall */}
        <path d="M 260 0 L 200 0 L 200 10 L 198 80 L 196 160 Q 210 175 230 180 Q 250 178 258 165 L 260 0Z" fill="#DCC090" stroke="#B89450" strokeWidth="2"/>
        {/* Bottom arch (pubic bone) */}
        <path d="M 84 160 Q 140 172 196 160 Q 194 180 140 188 Q 86 180 84 160Z" fill="#C4944A" stroke="#B89450" strokeWidth="2"/>
        {/* Sacrum (top bone) */}
        <rect x="80" y="0" width="120" height="10" rx="3" fill="#C4944A" stroke="#B89450" strokeWidth="1.5"/>
        {/* Station lines */}
        {ys.map((y,i)=>(
          <g key={i}>
            <line x1={i===3?20:30} y1={y} x2={i===3?260:250} y2={y}
              stroke={lineColors[i]} strokeWidth={i===3?3.5:2}
              strokeDasharray={i===3?'none':'5,3'}/>
            <rect x={i===3?218:220} y={y-8} width={i===3?44:40} height={16} rx={8} fill={lineColors[i]}/>
            <text x={i===3?240:240} y={y+5} textAnchor="middle" fontSize={i===3?10:9} fill="white" fontWeight="bold">{labels[i]}</text>
          </g>
        ))}
        {/* Baby head */}
        {selected!==null&&(()=>{
          const y=ys[selected];
          return(
            <g>
              <ellipse cx="140" cy={y} rx="24" ry="19" fill="#FFE082" stroke="#F9A825" strokeWidth="2.5"/>
              <text x="140" y={y-4} textAnchor="middle" fontSize="8" fill="#5C3D2E" fontWeight="600">ראש</text>
              <text x="140" y={y+9} textAnchor="middle" fontSize="9" fill="#5C3D2E" fontWeight="700">{labels[selected]}</text>
            </g>
          );
        })()}
        {/* Arrows showing direction */}
        <text x="12" y="104" fontSize="10" fill="#E53935" fontWeight="bold">↕</text>
        {/* Labels */}
        <text x="140" y="7" textAnchor="middle" fontSize="9" fill="white" fontWeight="600">כניסה</text>
        <text x="140" y="196" textAnchor="middle" fontSize="9" fill="#5C3D2E" fontWeight="600">יציאה</text>
        {selected===null&&<text x="140" y="118" textAnchor="middle" fontSize="10" fill="#AAA">לחצי על תחנה</text>}
      </svg>
      <div style={{display:'flex',justifyContent:'center',gap:12,marginTop:6,flexWrap:'wrap'}}>
        {[["#E53935","0 ספינות"],["#90CAF9","מינוס – גבוה"],["#66BB6A","פלוס – יורד"]].map(([c,l])=>(
          <div key={l} style={{display:'flex',alignItems:'center',gap:4,fontSize:11}}>
            <div style={{width:14,height:3,background:c,borderRadius:2}}/>
            <span style={{color:C.txl}}>{l}</span>
          </div>
        ))}
      </div>
    </div>
  );
}

function FetalStations() {
  const [selected,setSelected]=useState(null);
  const d=FETAL_STATIONS_DATA;
  const labels=["-3","-2","-1","0","+1","+2","+3"];
  return (
    <div>
      <div style={{...card,padding:16,marginBottom:4}}>
        <div style={ttl}>📍 תחנות העובר באגן</div>
        <div style={{fontSize:13,color:C.txl,marginBottom:12,lineHeight:1.6}}>{d.desc}</div>
        <PelvisDiagram selected={selected}/>
        <div style={{display:'flex',flexDirection:'column',gap:6}}>
          {d.stations.map((st,i)=>(
            <div key={i}>
              <div onClick={()=>setSelected(selected===i?null:i)} style={{display:'flex',alignItems:'center',gap:10,padding:'10px 12px',borderRadius:10,background:selected===i?st.color+'CC':'white',border:`1px solid ${selected===i?'#90A4AE':C.cd}`,cursor:'pointer',transition:'all 0.2s'}}>
                <div style={{width:42,height:42,borderRadius:'50%',background:st.color,display:'flex',alignItems:'center',justifyContent:'center',flexShrink:0,border:`2px solid ${selected===i?'#546E7A':C.cd}`,fontWeight:700,fontSize:12,color:'#37474F'}}>
                  {st.val}
                </div>
                <div style={{flex:1}}>
                  <div style={{fontSize:14,fontWeight:600,color:C.br}}>{st.emoji} {st.label}</div>
                  <div style={{fontSize:11,color:C.txl,marginTop:1}}>{st.desc.slice(0,50)}...</div>
                </div>
                <span style={{color:C.txl,fontSize:13}}>{selected===i?'▲':'▼'}</span>
              </div>
              {selected===i&&STATION_POSITIONS[st.val]&&(
                <div style={{margin:'2px 0 4px 0',padding:'12px 14px',background:st.color+'55',borderRadius:'0 0 10px 10px',border:`1px solid ${C.cd}`,borderTop:'none'}}>
                  <div style={{fontSize:13,color:C.tx,marginBottom:8,lineHeight:1.6}}>{STATION_POSITIONS[st.val].desc}</div>
                  <div style={{fontSize:12,fontWeight:600,color:C.br,marginBottom:6}}>תנועות מומלצות:</div>
                  {STATION_POSITIONS[st.val].moves.map((m,j)=>(
                    <div key={j} style={{display:'flex',gap:8,padding:'4px 0',fontSize:12,borderBottom:j<STATION_POSITIONS[st.val].moves.length-1?`1px solid ${C.cd}33`:'none'}}>
                      <span style={{color:C.t,flexShrink:0}}>•</span><span>{m}</span>
                    </div>
                  ))}
                </div>
              )}
            </div>
          ))}
        </div>
        <div style={{marginTop:10,padding:'8px 12px',background:'#E3F2FD',borderRadius:8,fontSize:12,color:'#1565C0'}}>
          💡 המיילדת בודקת תחנה עם בדיקה פנימית. 0=Engaged, +3=כתרת!
        </div>
      </div>
    </div>
  );
}

function WaterBreakGuide() {
  const [open,setOpen]=useState(false);
  return (
    <div style={{border:`2px solid #90CAF9`,borderRadius:14,overflow:'hidden',marginBottom:10}}>
      <div onClick={()=>setOpen(!open)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:open?'#E3F2FD':'white'}}>
        <div>
          <div style={{fontWeight:600,fontSize:15,color:'#1565C0'}}>💧 ירידת מים – מה עושים?</div>
          <div style={{fontSize:12,color:C.txl,marginTop:2}}>מדריך שלב אחר שלב</div>
        </div>
        <span style={{color:'#1565C0',fontSize:18}}>{open?'▲':'▼'}</span>
      </div>
      {open&&<div style={{background:'#E3F2FD'}}>
        <div style={{padding:'12px 16px',borderBottom:'1px solid #BBDEFB'}}>
          <div style={{fontWeight:500,color:'#1565C0',marginBottom:8,fontSize:13}}>🔍 איך יודעים שירדו מים?</div>
          {WATER_BREAK_GUIDE.signs.map((s,i)=><div key={i} style={{display:'flex',gap:8,marginBottom:4,fontSize:13}}><span style={{color:'#1976D2'}}>•</span><span>{s}</span></div>)}
          <div style={{marginTop:8,padding:'8px 10px',background:'white',borderRadius:8,fontSize:12,color:'#5D4037'}}>💡 הבדל מהטלת שתן: לא ניתן לעצור את הזרימה, ריח שונה, ממשיך לטפטף</div>
        </div>
        <div style={{padding:'12px 16px',borderBottom:'1px solid #BBDEFB'}}>
          <div style={{fontWeight:500,color:'#1565C0',marginBottom:8,fontSize:13}}>✅ מה עושים מיד:</div>
          {WATER_BREAK_GUIDE.doNow.map((s,i)=><div key={i} style={{display:'flex',gap:8,marginBottom:6,fontSize:13}}><div style={{width:20,height:20,background:'#1976D2',borderRadius:'50%',display:'flex',alignItems:'center',justifyContent:'center',color:'white',fontSize:11,flexShrink:0}}>{i+1}</div><span>{s}</span></div>)}
        </div>
        <div style={{padding:'12px 16px',borderBottom:'1px solid #BBDEFB'}}>
          <div style={{fontWeight:500,color:'#1565C0',marginBottom:8,fontSize:13}}>🎨 צבע הנוזל – מה משמעותו:</div>
          {Object.values(WATER_BREAK_GUIDE.colors).map((s,i)=>(
            <div key={i} style={{padding:'6px 10px',background:'white',borderRadius:8,marginBottom:6,fontSize:13}}>{s}</div>
          ))}
        </div>
        <div style={{padding:'12px 16px',background:'white'}}>
          <div style={{fontSize:13,color:C.tx,lineHeight:1.7,marginBottom:8}}>{WATER_BREAK_GUIDE.timing}</div>
          <div style={{padding:'10px 12px',background:'#FFEBEE',borderRadius:8,fontSize:13,color:'#C62828',fontWeight:500}}>{WATER_BREAK_GUIDE.warning}</div>
        </div>
      </div>}
    </div>
  );
}
// ===== HOSPITAL TRIAGE PROCESS (מיון יולדות) =====
const TRIAGE_DATA = {
  intro:"כשמגיע הזמן (צירים, ירידת מים, או חשד למיעוט תנועות), כך בדרך כלל נראה התהליך מרגע ההגעה לבית היולדות.",
  steps:[
    {step:1,title:"הגעה וקבלה",emoji:"🚗",desc:"מגיעים לכניסת מיון יולדות (לרוב כניסה נפרדת מהמיון הכללי). בקבלה מציגים תעודת זהות וכרטיס ביקור לידה (שקיבלת מקופ׳ח). מקבלים צמיד זיהוי."},
    {step:2,title:"חדר מיון יולדות – ניטור 20 דקות",emoji:"📊",desc:"מחברים לניטור CTG (רצועות על הבטן) למשך כ-20 דקות – בודק דופק עוברי וצירים. שוכבים/יושבים, אפשר לבקש שינוי תנוחה אם לא נוח."},
    {step:3,title:"בדיקה פנימית (פתיחה ומחיקה)",emoji:"🔍",desc:"מיילדת מבצעת בדיקה ואגינלית לבדיקת פתיחת צוואר הרחם ומחיקה (ראי הסבר מפורט למטה). בודקים גם תנוחת התינוק ותחנה."},
    {step:4,title:"אנמנזה (שאלות)",emoji:"📋",desc:"שאלון קצר חוזר: מתי התחילו הצירים/ירידת המים, תדירות ועצימות הצירים, תנועות עובר, דימום, אלרגיות, היסטוריה רפואית ותרופות, הריונות/לידות קודמות."},
    {step:5,title:"החלטה – מה הלאה?",emoji:"🚪",desc:"בהתאם לפתיחה ולמצב, אחת מ-4 אפשרויות:"}
  ],
  outcomes:[
    {title:"חדר לידה",emoji:"🌸",desc:"פתיחה מתקדמת (לרוב 4+ ס׳מ) וצירים פעילים – עוברים לחדר לידה להמשך מעקב ולידה."},
    {title:"טרום לידה (השהיה)",emoji:"⏳",desc:"פתיחה מוקדמת או צירים לא סדירים – לעיתים משאירים להמשך מעקב במחלקת טרום-לידה, או ממליצים לחזור הביתה."},
    {title:"חזרה לבית",emoji:"🏠",desc:"שלב לטנטי מוקדם מאוד, הכל תקין – ממליצים לחזור הביתה ולהמשיך לעקוב אחרי הצירים, ולחזור כשהם מתגברים (כלל 4-1-1)."},
    {title:"הפניה לרופא/ת",emoji:"👩‍⚕️",desc:"אם יש חשד למצב שדורש בדיקה נוספת (למשל לחץ דם, מיעוט תנועות) – יוזמן רופא/ה בכיר/ה לבדיקה והערכה."}
  ],
  cervixCheck:{
    title:"בדיקת פתיחה ומחיקה – מה בודקים?",
    desc:"בדיקה ואגינלית שבה המיילדת מעריכה באמצעות אצבעות (עם כפפה וחומר סיכה) שלושה פרמטרים מרכזיים:",
    items:[
      {name:"פתיחה (Dilation)",desc:"כמה ס׳מ צוואר הרחם פתוח – מ-0 (סגור) עד 10 ס׳מ (פתיחה מלאה). זה הפרמטר המוכר ביותר."},
      {name:"מחיקה (Effacement)",desc:"באיזו מידה צוואר הרחם 'נספג'/התקצר, באחוזים מ-0% (אורך מלא) עד 100% (דק לחלוטין). חשוב כמו הפתיחה!"},
      {name:"תחנה (Station)",desc:"מיקום ראש התינוק ביחס לאגן – ראי את הסקשן 'תחנות עובר' להסבר מלא."}
    ],
    note:"הבדיקה יכולה להיות לא נעימה אך לרוב לא כואבת. את יכולה לבקש שיסבירו כל שלב, ולבקש הפסקה אם צריך. אם יש לך רגישות – אמרי זאת מראש."
  },
  anamnesisQuestions:["מתי התחילו הצירים? כל כמה זמן ולכמה זמן?","מתי ירדו מי השפיר (אם ירדו)? צבע המים?","מתי הייתה התנועה האחרונה של התינוק?","יש דימום? כמה וכיצד נראה?","מועד הלידה המשוער ושבוע נוכחי","הריונות ולידות קודמות – איך התנהלו?","אלרגיות לתרופות?","תרופות שאת נוטלת באופן קבוע?","קבוצת דם ו-Rh","תוצאות בדיקת GBS (סטרפטוקוק) האחרונה"]
};

// ===== WARNING SIGNS - WHEN TO GO TO HOSPITAL =====
const WARNING_SIGNS = [
  {
    title:"מיעוט תנועות עובר",emoji:"👶",urgent:true,
    desc:"תנועות עובר הן סימן חשוב לרווחתו. ירידה משמעותית בתנועות (לא רק 'פחות מהרגיל' אלא שינוי בולט) מצריכה פנייה.",
    howToCheck:"שיטת ה-Kick Count: שכבי על הצד השמאלי בשעה שקטה (בד׳כ אחרי אוכל), וספרי כמה זמן לוקח להגיע ל-10 תנועות (כולל בעיטות, גלגולים, ולא רק 'הצקצוקים' הקטנים). אם זה לוקח יותר משעתיים – או שאת לא מרגישה כלל תנועה בפרק זמן ארוך מהרגיל לך – פני למיון יולדות.",
    action:"פני למיון יולדות לניטור (CTG) ללא דיחוי. אל תחכי לבוקר!"
  },
  {
    title:"דימום וגינלי",emoji:"🩸",urgent:true,
    desc:"דימום בכל שלב בהריון (לא הפרשה ורודה קלה הקשורה ל'פקק הריר') מצריך בירור. הבדל בין 'דימום' (כמו מחזור או יותר, אדום בוהק) ל'הכתמה' (כמה טיפות, חום/ורוד).",
    howToCheck:"כמות (כמה פדים?), צבע (אדום בוהק = דחוף יותר), נלווה לכאב? לצירים?",
    action:"דימום משמעותי = מיון יולדות מיידי. הכתמה קלה ללא כאב – התקשרי לקבל הנחיה, יתכן שאפשר להמתין לבוקר."
  },
  {
    title:"סימני רעלת הריון (פרה-אקלמפסיה)",emoji:"⚠️",urgent:true,
    desc:"רעלת הריון היא מצב מסוכן הדורש זיהוי מהיר. שילוב של כמה מהסימנים הבאים הוא דחוף במיוחד.",
    howToCheck:"כאב ראש חזק שלא חולף עם אקמול, הפרעות ראייה (נקודות מהבהבות, ראייה מטושטשת), כאב חזק מתחת לצלעות (במיוחד בצד ימין), נפיחות פתאומית בפנים/ידיים, עלייה מהירה במשקל (2+ ק׳ג בשבוע), בחילה/הקאות פתאומיות בשליש שלישי.",
    action:"כל אחד מהסימנים האלה – פני למיון יולדות לבדיקת לחץ דם ובדיקת שתן (חלבון) באופן מיידי."
  },
  {
    title:"חום גבוה",emoji:"🌡️",urgent:false,
    desc:"חום מעל 38 מעלות בהריון יכול להעיד על זיהום שדורש טיפול.",
    howToCheck:"מדדי חום. בדקי אם יש תסמינים נוספים: כאב בהטלת שתן, הפרשות לא תקינות, כאב באזור הרחם.",
    action:"חום מעל 38 – התקשרי לקופ׳ח/בית יולדות להנחיה. אם מלווה בכאבי בטן חזקים – פני למיון."
  },
  {
    title:"כאבי בטן חזקים/מתמשכים",emoji:"😣",urgent:true,
    desc:"כאב בטן שונה מצירים – מתמשך, לא מגיע ונחלף, ולעיתים ממוקם בצד אחד.",
    howToCheck:"האם הכאב מגיע ועובר (ציר) או קבוע? מלווה בדימום? בחום? בהקאות?",
    action:"כאב קבוע וחזק, בעיקר עם דימום או חום – מיון יולדות מיידי."
  },
  {
    title:"גירוד עז בכפות ידיים/רגליים",emoji:"🤲",urgent:false,
    desc:"גירוד חזק במיוחד בכפות הידיים והרגליים (בלי פריחה) בשליש השלישי יכול להעיד על מצב נדיר (כולסטזיס הריון) הדורש בירור.",
    howToCheck:"הגירוד חזק במיוחד בלילה, מתרכז בכפות הידיים והרגליים, ללא תפרחת גלויה.",
    action:"דווחי לרופאה/קופ׳ח – יבצעו בדיקת דם לתפקודי כבד."
  }
];
function BirthStages() {
  const [mainTab,setMainTab]=useState('stages');
  const [open,setOpen]=useState('latent');
  const [waterOpen,setWaterOpen]=useState(false);
  const mainTabs=[
    {id:'stages',lb:'🌊 שלבים'},
    {id:'triage',lb:'🏥 מיון יולדות'},
    {id:'pressure',lb:'💆 נקודות לחיצה'},
    {id:'stations',lb:'📍 תחנות עובר'},
    {id:'water',lb:'💧 ירידת מים'},
    {id:'warning',lb:'🚨 סימני אזהרה'}
  ];
  return (
    <div>
      <div style={{display:'flex',gap:6,marginBottom:16,flexWrap:'wrap'}}>
        {mainTabs.map(t=>(
          <button key={t.id} onClick={()=>setMainTab(t.id)} style={{flex:1,padding:'9px 6px',border:`1px solid ${mainTab===t.id?C.t:C.cd}`,borderRadius:10,background:mainTab===t.id?C.t:'white',color:mainTab===t.id?'white':C.tx,cursor:'pointer',fontFamily:'inherit',fontSize:12,fontWeight:mainTab===t.id?500:400}}>
            {t.lb}
          </button>
        ))}
      </div>
      {mainTab==='stages'&&<div>
      <div style={{...card,marginBottom:12}}><div style={ttl}>🌊 שלבי הלידה</div><div style={bdy}>כל לידה שונה, אך בדרך כלל עוברת דרך השלבים האלה. ידע = כוח.</div></div>
      {BIRTH_STAGES.map(stage=>(
        <div key={stage.id} style={{border:`1px solid ${C.cd}`,borderRadius:12,overflow:'hidden',marginBottom:10}}>
          <div onClick={()=>setOpen(open===stage.id?null:stage.id)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:open===stage.id?C.cr:'white'}}>
            <div><div style={{fontSize:15,fontWeight:500,color:C.br}}>{stage.emoji} {stage.title}</div><div style={{fontSize:12,color:C.txl,marginTop:2}}>{stage.duration} | {stage.cervix}</div></div>
            <span style={{color:C.txl,fontSize:18}}>{open===stage.id?'▲':'▼'}</span>
          </div>
          {open===stage.id&&<div style={{padding:'14px 16px',background:C.cr,fontSize:13,lineHeight:1.7}}>
            <p style={{color:C.tx,marginBottom:12}}>{stage.desc}</p>
            <div style={{marginBottom:10}}><div style={{fontWeight:500,color:C.br,marginBottom:6}}>🌟 מה עוזר:</div>{stage.tips.map((t,i)=><div key={i} style={{display:'flex',gap:8,marginBottom:4}}><span style={{color:C.t}}>•</span><span style={{color:C.txl}}>{t}</span></div>)}</div>
            <div style={{marginBottom:12}}><div style={{fontWeight:500,color:C.br,marginBottom:6}}>🔍 סימנים:</div><div style={{display:'flex',flexWrap:'wrap',gap:6}}>{stage.signs.map((s,i)=><span key={i} style={{background:'white',border:`1px solid ${C.cd}`,borderRadius:8,padding:'4px 8px',fontSize:12}}>{s}</span>)}</div></div>
            {BIRTH_POSITIONS[stage.id]&&<div>
              <div style={{fontWeight:500,color:C.br,marginBottom:8}}>🏃 תנוחות ותנועות מומלצות:</div>
              {BIRTH_POSITIONS[stage.id].map((pos,i)=>(
                <div key={i} style={{background:'white',borderRadius:10,padding:'10px 12px',marginBottom:8,border:`1px solid ${C.cd}`}}>
                  <div style={{display:'flex',alignItems:'center',gap:8,marginBottom:4}}>
                    <span style={{fontSize:20}}>{pos.emoji}</span>
                    <span style={{fontWeight:500,color:C.br,fontSize:13}}>{pos.name}</span>
                    <span style={{fontSize:16,marginRight:'auto'}}>{pos.visual}</span>
                  </div>
                  <div style={{fontSize:12,color:C.txl,lineHeight:1.6}}>{pos.desc}</div>
                </div>
              ))}
            </div>}
          </div>}
        </div>
      ))}
      </div>}
      {mainTab==='pressure'&&<PressurePoints/>}
      {mainTab==='triage'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#E3F2FD,${C.cr})`}}>
            <div style={ttl}>🏥 הגעה למיון יולדות – מה קורה שם?</div>
            <div style={bdy}>{TRIAGE_DATA.intro}</div>
          </div>
          <div style={card}>
            <div style={ttl}>📍 תהליך הקבלה</div>
            {TRIAGE_DATA.steps.map((s,i)=>(
              <div key={i} style={{display:'flex',gap:10,marginBottom:14}}>
                <div style={{flexShrink:0,width:36,height:36,borderRadius:'50%',background:C.t,color:'white',display:'flex',alignItems:'center',justifyContent:'center',fontSize:16}}>{s.emoji}</div>
                <div style={{flex:1}}>
                  <div style={{fontWeight:700,color:C.br,fontSize:13,marginBottom:2}}>{s.step}. {s.title}</div>
                  <div style={{fontSize:12,color:C.txl,lineHeight:1.6}}>{s.desc}</div>
                </div>
              </div>
            ))}
          </div>
          <div style={card}>
            <div style={ttl}>🚪 לאן ממשיכים?</div>
            <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:10}}>
              {TRIAGE_DATA.outcomes.map((o,i)=>(
                <div key={i} style={{background:C.cr,borderRadius:10,padding:12}}>
                  <div style={{fontSize:24,marginBottom:4}}>{o.emoji}</div>
                  <div style={{fontWeight:700,color:C.br,fontSize:13,marginBottom:4}}>{o.title}</div>
                  <div style={{fontSize:11,color:C.txl,lineHeight:1.5}}>{o.desc}</div>
                </div>
              ))}
            </div>
          </div>
          <div style={{...card,background:'#FFF8E1'}}>
            <div style={{...ttl,color:'#5D4037'}}>🔍 {TRIAGE_DATA.cervixCheck.title}</div>
            <div style={{fontSize:13,color:'#5D4037',lineHeight:1.7,marginBottom:10}}>{TRIAGE_DATA.cervixCheck.desc}</div>
            {TRIAGE_DATA.cervixCheck.items.map((it,i)=>(
              <div key={i} style={{background:'white',borderRadius:8,padding:'8px 12px',marginBottom:6}}>
                <div style={{fontWeight:600,color:C.br,fontSize:12,marginBottom:2}}>{it.name}</div>
                <div style={{fontSize:12,color:C.txl,lineHeight:1.6}}>{it.desc}</div>
              </div>
            ))}
            <div style={{marginTop:8,fontSize:12,color:'#5D4037',fontStyle:'italic'}}>{TRIAGE_DATA.cervixCheck.note}</div>
          </div>
          <div style={card}>
            <div style={ttl}>📋 שאלות שיחזרו ויישאלו (אנמנזה)</div>
            {TRIAGE_DATA.anamnesisQuestions.map((q,i)=>(
              <div key={i} style={{display:'flex',gap:8,padding:'7px 0',borderBottom:i<TRIAGE_DATA.anamnesisQuestions.length-1?`1px solid ${C.cd}`:'none',fontSize:13}}>
                <span style={{color:C.t}}>{i+1}.</span><span>{q}</span>
              </div>
            ))}
            <div style={{marginTop:10,fontSize:12,color:C.txl,background:C.cr,borderRadius:8,padding:'8px 10px'}}>💡 טיפ: כתבי לעצמך מראש זמני הצירים, שעת ירידת מי השפיר וצבעם – יחסוך זמן וזיכרון!</div>
          </div>
        </div>
      )}
      {mainTab==='warning'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#FFEBEE,${C.cr})`}}>
            <div style={{...ttl,color:'#C62828'}}>🚨 סימני אזהרה – מתי לפנות לבית יולדות</div>
            <div style={bdy}>סימנים אלה דורשים פנייה גם אם אין צירים או ירידת מים. במצבים דחופים – אל תחכי.</div>
          </div>
          {WARNING_SIGNS.map((w,i)=>(
            <div key={i} style={{border:`2px solid ${w.urgent?'#FFCDD2':C.cd}`,borderRadius:12,overflow:'hidden',marginBottom:10}}>
              <div style={{padding:'14px 16px',background:w.urgent?'#FFEBEE':'white',display:'flex',alignItems:'center',gap:10}}>
                <span style={{fontSize:24}}>{w.emoji}</span>
                <div style={{fontWeight:700,fontSize:14,color:w.urgent?'#C62828':C.br}}>{w.title}</div>
                {w.urgent&&<span style={{marginRight:'auto',fontSize:11,background:'#C62828',color:'white',borderRadius:8,padding:'2px 8px'}}>דחוף</span>}
              </div>
              <div style={{padding:'12px 16px',background:C.cr}}>
                <div style={{fontSize:13,color:C.tx,lineHeight:1.6,marginBottom:8}}>{w.desc}</div>
                <div style={{background:'white',borderRadius:8,padding:'8px 10px',marginBottom:8}}>
                  <div style={{fontSize:11,fontWeight:600,color:C.br,marginBottom:3}}>🔎 איך לבדוק:</div>
                  <div style={{fontSize:12,color:C.txl,lineHeight:1.6}}>{w.howToCheck}</div>
                </div>
                <div style={{fontSize:12,fontWeight:600,color:w.urgent?'#C62828':'#2E7D32',background:w.urgent?'#FFEBEE':'#E8F5E9',borderRadius:8,padding:'8px 10px'}}>👉 {w.action}</div>
              </div>
            </div>
          ))}
        </div>
      )}
      {mainTab==='stations'&&<FetalStations/>}
      {mainTab==='water'&&<WaterBreakGuide/>}
    </div>
  );
}

function PressurePoints() {
  return (
    <div>
      <div style={{...card,background:`linear-gradient(135deg,#FCE4EC,${C.cr})`}}>
        <div style={ttl}>💆 נקודות לחיצה בלידה</div>
        <div style={bdy}>נקודות שיאצו שהמלווה לוחץ עליהן להקלת כאב וקידום לידה. אין צורך בדיקור!</div>
      </div>
      {ACUPUNCTURE_DATA.map((pt,i)=>(
        <div key={i} style={{...card,padding:14,marginBottom:8}}>
          <div style={{display:'flex',gap:10,alignItems:'flex-start'}}>
            <span style={{fontSize:24,flexShrink:0}}>{pt.emoji}</span>
            <div style={{flex:1}}>
              <div style={{fontWeight:600,color:C.br,fontSize:14,marginBottom:4}}>{pt.point}</div>
              <div style={{fontSize:12,color:C.txl,marginBottom:4}}>📍 {pt.location}</div>
              <div style={{fontSize:12,color:C.tx,marginBottom:4}}>✅ {pt.use}</div>
              <div style={{fontSize:11,fontWeight:500,color:pt.warning.includes('⚠️')?'#E65100':'#2E7D32',background:pt.warning.includes('⚠️')?'#FFF3E0':'#E8F5E9',borderRadius:6,padding:'3px 8px',display:'inline-block'}}>{pt.warning}</div>
            </div>
          </div>
        </div>
      ))}
      <div style={{...card,background:'#FFF3E0'}}>
        <div style={{fontSize:13,color:'#5D4037',lineHeight:1.8}}>
          <strong>💡 איך ללחוץ?</strong><br/>
          לחץ עמוק וקבוע 30-60 שניות בזמן ציר. שחרר לאט. המלווה יכול לעשות זאת!
        </div>
      </div>
    </div>
  );
}

const BIRTH_TOOLS_OILS = [
  {situation:"לכאבי גב ולחץ בגב התחתון",oil:"שמן לבנדר + שמן קוקוס בסיס",how:"עיסוי קל בגב התחתון בזמן ציר, או דילול 2-3 טיפות ב-10 מ׳ל שמן בסיס"},
  {situation:"להרגעה ולהפחתת חרדה",oil:"שמן לבנדר או שמן ילנג-ילנג",how:"מפזר אדים בחדר, או טיפה על כרית/מטפחת לשאיפה עמוקה"},
  {situation:"לעידוד צירים (בשלב מתאים)",oil:"שמן קלארי סייג (Clary Sage)",how:"רק מ-שב 37+ ובאישור מטפלת מוסמכת! דילול נמוך לעיסוי בטן/גב"},
  {situation:"לבחילות",oil:"שמן ג'ינג'ר (זנגביל) או נענע",how:"שאיפה ממטפחת, או טיפה על פרק כף היד"},
  {situation:"לעייפות ולהמרצת אנרגיה",oil:"שמן הדרים (תפוז/לימון)",how:"שאיפה ישירה או מפזר אדים – מרענן ומעורר"},
  {situation:"לתחושת שליטה וביטחון",oil:"שמן ורד או יסמין",how:"דילול קל לעיסוי כתפיים/ידיים – ריח מוכר שיוצר עוגן רגשי"}
];

const BIRTH_TOOLS_MASSAGE = [
  {name:"עיסוי גב תחתון בלחץ",desc:"לחיצה עמוקה וקבועה (לא שיפשוף) בשני הצדדים של עמוד השדרה התחתון, בזמן הציר. עוזר במיוחד בתינוק אחורי (OP).",timing:"בזמן הציר עצמו"},
  {name:"Double Hip Squeeze",desc:"המלווה לוחץ בשתי הידיים על שני צידי האגן (עצמות הכסל) בזמן הציר – פותח את האגן ומקל מאוד על כאב.",timing:"בזמן הציר עצמו"},
  {name:"עיסוי כפות רגליים",desc:"עיסוי עגול ועדין של כפות הרגליים בין הצירים – מרגיע מאוד את מערכת העצבים.",timing:"בין צירים, להרפיה"},
  {name:"עיסוי כתפיים וצוואר",desc:"שיפשוף עגול וקצבי של הכתפיים – משחרר מתח שמצטבר באזור הזה לאורך הלידה.",timing:"בכל שלב"},
  {name:"לחיצה על הסקרום (Sacral Pressure)",desc:"לחיצה ישירה ומרוכזת עם כף היד או האגרוף על עצם הזנב, בזמן הציר – מקלה משמעותית על כאבי גב.",timing:"בזמן הציר, תינוק אחורי"},
  {name:"Rebozo – נדנוד עדין",desc:"צעיף ארוך מתחת לבטן, נדנוד עדין מצד לצד – מרפה רצועות ועוזר לתינוק להתמקם.",timing:"בין צירים"}
];

function BirthTools() {
  const [subTab,setSubTab]=useState('meditation');
  const [playing,setPlaying]=useState(null);
  const [speaking,setSpeaking]=useState(null);
  const nodesRef=useRef({});
  const [breathPhase,setBreathPhase]=useState(null);
  const [breathCount,setBreathCount]=useState(0);
  const breathRef=useRef(null);
  function startBreath() {
    let phase=0;
    const phases=['שאפי...','החזיקי...','נשפי...','החזיקי...'];
    const times=[4000,4000,6000,2000];
    function next(){
      setBreathPhase(phases[phase]);
      setBreathCount(c=>c+1);
      breathRef.current=setTimeout(()=>{phase=(phase+1)%4;next();},times[phase]);
    }
    next();
  }
  function stopBreath(){clearTimeout(breathRef.current);setBreathPhase(null);setBreathCount(0);}
  useEffect(()=>()=>clearTimeout(breathRef.current),[]);
  const subTabs=[{id:'meditation',lb:'🧘 מדיטציה'},{id:'music',lb:'🎵 מוזיקה'},{id:'oils',lb:'🌸 שמנים'},{id:'massage',lb:'💆 עיסויים'}];
  function playSound(soundId){
    if(playing===soundId){
      if(nodesRef.current[soundId]){try{nodesRef.current[soundId].src.stop();}catch(e){}delete nodesRef.current[soundId];}
      setPlaying(null);return;
    }
    if(playing&&nodesRef.current[playing]){try{nodesRef.current[playing].src.stop();}catch(e){}delete nodesRef.current[playing];}
    try{
      const ctx=new(window.AudioContext||window.webkitAudioContext)();
      const graph=buildNoiseGraph(ctx,soundId);
      graph.src.start();
      nodesRef.current[soundId]={src:graph.src,ctx};
      setPlaying(soundId);
    }catch(e){alert('לא ניתן להפעיל שמע');}
  }
  useEffect(()=>()=>{Object.values(nodesRef.current).forEach(n=>{try{n.src.stop();}catch(e){}});},[]);
  return (
    <div>
      <div style={{...card,background:`linear-gradient(135deg,${C.sgl},${C.cr})`}}>
        <div style={ttl}>🛠️ עזרים ללידה</div>
        <div style={bdy}>כלים שיעזרו לך להישאר רגועה, נוכחת ובשליטה בזמן הלידה</div>
      </div>
      <div style={{display:'flex',gap:6,marginBottom:16,flexWrap:'wrap'}}>
        {subTabs.map(t=><button key={t.id} onClick={()=>setSubTab(t.id)} style={{flex:1,padding:'8px 4px',border:`1px solid ${subTab===t.id?C.t:C.cd}`,borderRadius:10,background:subTab===t.id?C.t:'white',color:subTab===t.id?'white':C.tx,cursor:'pointer',fontFamily:'inherit',fontSize:12,fontWeight:subTab===t.id?600:400}}>{t.lb}</button>)}
      </div>

      {subTab==='meditation'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#EDE7F6,${C.cr})`}}>
            <div style={ttl}>🫁 תרגיל נשימה אינטראקטיבי</div>
            <div style={{fontSize:13,color:C.txl,marginBottom:12}}>נשימה 4-4-6-2 – הקצב הקלאסי להרגעת מערכת העצבים בזמן ציר</div>
            {!breathPhase?(
              <button onClick={startBreath} style={{width:'100%',padding:13,background:`linear-gradient(135deg,#EDE7F6,#D1C4E9)`,border:'none',borderRadius:12,fontFamily:'inherit',fontSize:15,cursor:'pointer',color:'#4527A0'}}>▶ התחילי תרגיל נשימה</button>
            ):(
              <div style={{textAlign:'center'}}>
                <div style={{fontSize:32,fontWeight:700,color:'#4527A0',marginBottom:8,transition:'all 0.3s'}}>{breathPhase}</div>
                <div style={{fontSize:12,color:C.txl,marginBottom:12}}>נשימה #{Math.ceil(breathCount/4)}</div>
                <button onClick={stopBreath} style={{padding:'10px 28px',background:'#EDE7F6',border:'none',borderRadius:20,fontFamily:'inherit',fontSize:14,cursor:'pointer',color:'#4527A0'}}>עצרי</button>
              </div>
            )}
          </div>
          <div style={card}>
            <div style={ttl}>💭 דמיון מודרך – עם הקראה</div>
            <div style={{fontSize:13,color:C.txl,marginBottom:12}}>לחצי 🔊 כדי שהטלפון יקריא לך בקול – או קראי לבד / בקשי מהמלווה</div>
            {[
              {title:"פתיחה ושחרור",text:"עם כל ציר, דמיינו את צוואר הרחם כפרח שנפתח בעדינות, עלה אחר עלה. כל גל הוא חלק מהפריחה. את לא נלחמת בו – את נפתחת איתו. נשמי עמוק, ועם הנשיפה דמיינו את הפרח נפתח עוד קצת."},
              {title:"מקום בטוח",text:"דמיינו מקום שבו את מרגישה שלווה לחלוטין – חוף, יער, חדר מוכר. הרגישי את הריח, הצבעים, הקול שבמקום הזה. כל ציר חולף, והמקום הבטוח הזה ממשיך לחכות לך."},
              {title:"כל ציר מקרב אותך",text:"כל ציר הוא צעד נוסף לקראת הרגע שתפגשי את התינוק. הגוף שלך יודע בדיוק מה לעשות – הוא עשה זאת מאז ומתמיד. סמכי עליו. עם כל נשימה, תני לגוף לעבוד, ולעצמך לנוח בין הגלים."}
            ].map((g,i)=>(
              <div key={i} style={{background:C.cr,borderRadius:10,padding:12,marginBottom:8}}>
                <div style={{display:'flex',justifyContent:'space-between',alignItems:'center',marginBottom:6}}>
                  <div style={{fontWeight:600,color:C.br,fontSize:13}}>💭 {g.title}</div>
                  <button onClick={()=>speakText(g.text, i, speaking, setSpeaking)} style={{background:speaking===i?C.t:'#EDE7F6',color:speaking===i?'white':'#4527A0',border:'none',borderRadius:8,padding:'5px 12px',fontSize:12,cursor:'pointer',fontFamily:'inherit',flexShrink:0}}>{speaking===i?'⏸ עצרי':'🔊 הקריאי'}</button>
                </div>
                <div style={{fontSize:13,color:C.tx,lineHeight:1.8}}>{g.text}</div>
              </div>
            ))}
            <div style={{fontSize:11,color:C.txl,marginTop:4}}>💡 ההקראה משתמשת בקול המובנה של הטלפון/דפדפן</div>
          </div>
        </div>
      )}

      {subTab==='music'&&(
        <div>
          <div style={card}>
            <div style={ttl}>🎵 מוזיקה רגועה ללידה</div>
            <div style={{fontSize:13,color:C.txl,marginBottom:12}}>לחצי על ▶ להשמעה – צלילים נעימים שנוצרים ישירות באפליקציה, ללא צורך באינטרנט</div>
            {playing&&<div style={{marginBottom:8,padding:'6px 12px',background:'#E8F5E9',borderRadius:8,fontSize:13,color:'#2E7D32',textAlign:'center'}}>▶️ מתנגן כעת</div>}
            {[
              {id:"rain",name:"צלילי טבע – גשם ויער",emoji:"🌧️"},
              {id:"ocean",name:"גלי אוקיינוס",emoji:"🌊"},
              {id:"chimes",name:"מוזיקה אינסטרומנטלית רגועה",emoji:"🎹"},
              {id:"womb",name:"צלילי רחם – מוכר ומרגיע",emoji:"🌸"}
            ].map((m,i)=>(
              <div key={i} onClick={()=>playSound(m.id)} style={{display:'flex',alignItems:'center',gap:10,background:playing===m.id?'#FFF0EB':C.cr,borderRadius:10,padding:'12px 14px',marginBottom:8,cursor:'pointer',border:`2px solid ${playing===m.id?C.t:'transparent'}`}}>
                <span style={{fontSize:22}}>{playing===m.id?'⏸':'▶'}</span>
                <span style={{fontSize:13,color:C.tx,flex:1}}>{m.emoji} {m.name}</span>
              </div>
            ))}
            <div style={{marginTop:8,padding:'10px 12px',background:'#E3F2FD',borderRadius:8,fontSize:12,color:'#1565C0'}}>
              💡 ניתן גם להפעיל פלייליסט אישי מהטלפון במקביל לאפליקציה
            </div>
          </div>
        </div>
      )}

      {subTab==='oils'&&(
        <div>
          <div style={{...card,background:'#FFF8E1'}}>
            <div style={{...ttl,color:'#5D4037'}}>🌸 שמנים אתריים ללידה</div>
            <div style={{fontSize:12,color:'#E65100'}}>⚠️ תמיד דללו בשמן בסיס. התייעצי עם מטפלת מוסמכת לפני שימוש, במיוחד בהריון</div>
          </div>
          {BIRTH_TOOLS_OILS.map((o,i)=>(
            <div key={i} style={card}>
              <div style={{fontWeight:700,color:C.br,fontSize:13,marginBottom:4}}>{o.situation}</div>
              <div style={{fontSize:12,color:C.t,marginBottom:4}}>🌿 {o.oil}</div>
              <div style={{fontSize:12,color:C.txl,lineHeight:1.6}}>{o.how}</div>
            </div>
          ))}
        </div>
      )}

      {subTab==='massage'&&(
        <div>
          <div style={card}>
            <div style={ttl}>💆 עיסויים לזמן צירים</div>
            <div style={{fontSize:13,color:C.txl,marginBottom:12}}>למלווה: תרגלו את אלה מראש כדי שתהיו מוכנים!</div>
          </div>
          {BIRTH_TOOLS_MASSAGE.map((m,i)=>(
            <div key={i} style={card}>
              <div style={{fontWeight:700,color:C.br,fontSize:13,marginBottom:4}}>💆 {m.name}</div>
              <div style={{fontSize:12,color:C.txl,lineHeight:1.6,marginBottom:4}}>{m.desc}</div>
              <div style={{fontSize:11,background:'#E8F4E8',color:'#2E7D32',borderRadius:6,padding:'3px 8px',display:'inline-block'}}>⏱ {m.timing}</div>
            </div>
          ))}
        </div>
      )}
    </div>
  );
}

function SpinningBabies() {
  const [open,setOpen]=useState('rebozo');
  const [showInLabor,setShowInLabor]=useState(false);
  return (
    <div>
      <div style={{background:`linear-gradient(135deg,${C.cr},#E8F4E8)`,borderRadius:16,padding:16,marginBottom:12}}>
        <div style={ttl}>🧣 Spinning Babies</div>
        <div style={bdy}>שיטה לעידוד תנוחה אופטימלית של התינוק. מומלץ לתרגל בהנחיית דולה מוסמכת.</div>
        <div style={{marginTop:8,padding:'8px 12px',background:'#E8F4E8',borderRadius:8,fontSize:12,color:'#2E7D32'}}>✅ שלישיית הליבה: Rebozo → היפוך → Side-lying – לפי הסדר הזה!</div>
      </div>
      {SPINNING.map((item)=>(
        <div key={item.id} style={{border:`2px solid ${item.core?C.tl:C.cd}`,borderRadius:12,overflow:'hidden',marginBottom:10}}>
          <div onClick={()=>setOpen(open===item.id?null:item.id)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:open===item.id?C.cr:'white'}}>
            <div>
              <div style={{display:'flex',alignItems:'center',gap:6}}>
                <span style={{fontSize:15,fontWeight:500,color:C.br}}>{item.emoji} {item.title}</span>
                {item.core&&<span style={{fontSize:10,background:C.t,color:'white',borderRadius:8,padding:'2px 6px'}}>ליבה</span>}
              </div>
              <div style={{fontSize:11,color:C.txl,marginTop:2}}>{item.when}</div>
            </div>
            <span style={{color:C.txl,fontSize:18}}>{open===item.id?'▲':'▼'}</span>
          </div>
          {open===item.id&&<div style={{padding:'14px 16px',background:C.cr,fontSize:13,lineHeight:1.7}}>
            <p style={{color:C.tx,marginBottom:12}}>{item.desc}</p>
            <div style={{marginBottom:10}}><div style={{fontWeight:500,color:C.br,marginBottom:6}}>📌 שלבים:</div>{item.how.map((h,j)=><div key={j} style={{display:'flex',gap:8,marginBottom:4}}><span style={{color:C.t,fontWeight:600,flexShrink:0}}>{j+1}.</span><span style={{color:C.txl}}>{h}</span></div>)}</div>
            <div style={{background:'#FFF8E1',borderRadius:8,padding:'8px 12px',fontSize:12,marginBottom:8}}><strong style={{color:'#E65100'}}>⚠️</strong> <span style={{color:C.txl}}>{item.warning}</span></div>
            <a href={item.video} target="_blank" rel="noreferrer" style={{display:'flex',alignItems:'center',gap:6,background:'#FF0000',color:'white',borderRadius:8,padding:'8px 12px',fontSize:12,textDecoration:'none',justifyContent:'center'}}>
              <span>▶️</span><span>צפי בסרטון הסבר ביוטיוב</span>
            </a>
          </div>}
        </div>
      ))}
      <div style={{border:`1px solid ${C.cd}`,borderRadius:12,overflow:'hidden',marginBottom:10}}>
        <div onClick={()=>setShowInLabor(!showInLabor)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:showInLabor?'#FFF3E0':'white'}}>
          <div style={{fontWeight:500,color:C.br,fontSize:15}}>⚡ Spinning Babies בזמן צירים</div>
          <span style={{color:C.txl}}>{showInLabor?'▲':'▼'}</span>
        </div>
        {showInLabor&&<div style={{padding:'14px 16px',background:'#FFF3E0'}}>
          {SPINNING_IN_LABOR.map((item,i)=>(
            <div key={i} style={{marginBottom:12,padding:'10px 12px',background:'white',borderRadius:8}}>
              <div style={{fontWeight:500,color:C.br,fontSize:13,marginBottom:6}}>🔹 {item.situation}</div>
              {item.exercises.map((ex,j)=><div key={j} style={{fontSize:12,color:C.txl,padding:'3px 0'}}>• {ex}</div>)}
            </div>
          ))}
        </div>}
      </div>
    </div>
  );
}

function BirthPlan() {
  const [checked,setChecked]=useState({});
  const [notes,setNotes]=useState('');
  const toggle=k=>setChecked(p=>({...p,[k]:!p[k]}));
  return (
    <div>
      {BPS.map(({s:sec,it:items})=>(
        <div key={sec} style={card}>
          <div style={{fontFamily:'Georgia,serif',fontSize:17,color:C.br,marginBottom:10,paddingBottom:6,borderBottom:`1px solid ${C.cd}`}}>{sec}</div>
          {items.map((item,i)=>{const k=`${sec}-${i}`;return(<div key={i} onClick={()=>toggle(k)} style={{display:'flex',alignItems:'flex-start',gap:10,padding:'8px 0',cursor:'pointer'}}><div style={{width:18,height:18,borderRadius:4,border:`2px solid ${checked[k]?C.sg:C.sgl}`,background:checked[k]?C.sg:'white',display:'flex',alignItems:'center',justifyContent:'center',flexShrink:0,marginTop:1,color:'white',fontSize:12}}>{checked[k]&&'✓'}</div><div style={{fontSize:13,lineHeight:1.5}}>{item}</div></div>);})}
        </div>
      ))}
      <div style={card}><div style={ttl}>✏️ הערות אישיות</div><textarea value={notes} onChange={e=>setNotes(e.target.value)} placeholder="כתבי כאן רצונות נוספים..." style={{width:'100%',minHeight:80,padding:12,border:`1px solid ${C.cd}`,borderRadius:10,fontFamily:'inherit',fontSize:13,background:C.cr,outline:'none',resize:'vertical'}}/><button style={{width:'100%',padding:13,background:C.br,color:'white',border:'none',borderRadius:12,fontFamily:'inherit',fontSize:15,cursor:'pointer',marginTop:8}}>🖨️ הדפסת תוכנית הלידה</button></div>
    </div>
  );
}

function BFPositionIcon({type}) {
  // Clear, realistic-style mother+baby breastfeeding illustrations
  const common = {viewBox:"0 0 160 140", width:"140", height:"122"};
  const skinM="#E8B894", skinB="#FAD7C0", hairM="#5C3D2E", shirt="#C4785A", blanket="#E8D4C0";
  if(type==='cradle'){
    return (
      <svg {...common}>
        {/* Mother seated, torso */}
        <path d="M 25 50 Q 80 30 140 55 L 138 130 L 20 130 Z" fill={shirt}/>
        {/* Mother head */}
        <circle cx="35" cy="32" r="20" fill={skinM}/>
        <path d="M 15 32 Q 15 8 35 8 Q 58 8 58 32 Q 58 24 35 22 Q 18 22 15 32 Z" fill={hairM}/>
        {/* Mother arm cradling */}
        <path d="M 50 55 Q 90 50 120 78 Q 122 90 110 92 Q 80 70 50 70 Z" fill={skinM} opacity="0.9"/>
        {/* Baby body lying along arm */}
        <ellipse cx="95" cy="75" rx="40" ry="17" fill={blanket}/>
        {/* Baby head at breast */}
        <circle cx="58" cy="65" r="15" fill={skinB} stroke="#E8A98A" strokeWidth="1"/>
        <path d="M 46 58 Q 58 50 70 58 Q 70 52 58 50 Q 46 52 46 58 Z" fill="#D4A574"/>
        {/* Connection to breast */}
        <ellipse cx="48" cy="62" rx="6" ry="9" fill={skinM} opacity="0.95"/>
        <text x="80" y="125" textAnchor="middle" fontSize="11" fill="#5C3D2E" fontWeight="600">עריסה (Cradle)</text>
      </svg>
    );
  }
  if(type==='crosscradle'){
    return (
      <svg {...common}>
        <path d="M 25 50 Q 80 30 140 55 L 138 130 L 20 130 Z" fill={shirt}/>
        <circle cx="35" cy="32" r="20" fill={skinM}/>
        <path d="M 15 32 Q 15 8 35 8 Q 58 8 58 32 Q 58 24 35 22 Q 18 22 15 32 Z" fill={hairM}/>
        {/* Opposite hand supports baby's head/neck */}
        <path d="M 60 80 Q 75 50 60 40 Q 50 45 50 60 Q 50 75 60 80 Z" fill={skinM} opacity="0.9"/>
        <ellipse cx="95" cy="75" rx="38" ry="17" fill={blanket}/>
        <circle cx="58" cy="62" r="15" fill={skinB} stroke="#E8A98A" strokeWidth="1"/>
        <path d="M 46 55 Q 58 47 70 55 Q 70 49 58 47 Q 46 49 46 55 Z" fill="#D4A574"/>
        <ellipse cx="48" cy="60" rx="6" ry="9" fill={skinM} opacity="0.95"/>
        {/* Hand cupping head */}
        <ellipse cx="56" cy="55" rx="12" ry="8" fill={skinM} opacity="0.7"/>
        <text x="80" y="125" textAnchor="middle" fontSize="11" fill="#5C3D2E" fontWeight="600">עריסה הפוכה</text>
      </svg>
    );
  }
  if(type==='football'){
    return (
      <svg {...common}>
        <path d="M 25 50 Q 80 30 140 55 L 138 130 L 20 130 Z" fill={shirt}/>
        <circle cx="35" cy="32" r="20" fill={skinM}/>
        <path d="M 15 32 Q 15 8 35 8 Q 58 8 58 32 Q 58 24 35 22 Q 18 22 15 32 Z" fill={hairM}/>
        {/* Baby tucked under arm, body pointing back */}
        <ellipse cx="105" cy="80" rx="35" ry="16" fill={blanket} transform="rotate(-8 105 80)"/>
        <circle cx="58" cy="68" r="15" fill={skinB} stroke="#E8A98A" strokeWidth="1"/>
        <path d="M 46 61 Q 58 53 70 61 Q 70 55 58 53 Q 46 55 46 61 Z" fill="#D4A574"/>
        <ellipse cx="48" cy="66" rx="6" ry="9" fill={skinM} opacity="0.95"/>
        {/* Mother arm supporting from below/side, baby legs toward back */}
        <path d="M 55 78 Q 95 95 130 88 Q 132 98 122 102 Q 85 100 55 88 Z" fill={skinM} opacity="0.9"/>
        <ellipse cx="128" cy="92" rx="9" ry="7" fill={skinB}/>
        <text x="80" y="125" textAnchor="middle" fontSize="11" fill="#5C3D2E" fontWeight="600">כדורגל (Football)</text>
      </svg>
    );
  }
  if(type==='sidelying'){
    return (
      <svg {...common}>
        {/* Bed/surface */}
        <rect x="10" y="95" width="140" height="30" rx="10" fill="#E0E0E0"/>
        {/* Mother lying on side */}
        <ellipse cx="85" cy="78" rx="58" ry="22" fill={shirt}/>
        <circle cx="30" cy="55" r="19" fill={skinM}/>
        <path d="M 12 55 Q 12 32 30 32 Q 52 32 52 55 Q 52 47 30 45 Q 14 45 12 55 Z" fill={hairM}/>
        {/* Baby lying facing mother */}
        <ellipse cx="78" cy="82" rx="32" ry="14" fill={blanket}/>
        <circle cx="55" cy="72" r="14" fill={skinB} stroke="#E8A98A" strokeWidth="1"/>
        <path d="M 44 65 Q 55 58 66 65 Q 66 60 55 58 Q 44 60 44 65 Z" fill="#D4A574"/>
        <ellipse cx="46" cy="70" rx="5" ry="8" fill={skinM} opacity="0.95"/>
        {/* Mother bottom arm under head, top arm relaxed */}
        <path d="M 95 70 Q 130 65 140 78 Q 138 88 122 88 Q 100 85 95 78 Z" fill={skinM} opacity="0.85"/>
        <text x="80" y="135" textAnchor="middle" fontSize="11" fill="#5C3D2E" fontWeight="600">שכיבה על הצד</text>
      </svg>
    );
  }
  if(type==='laidback'){
    return (
      <svg {...common}>
        {/* Mother reclined back, large torso */}
        <ellipse cx="75" cy="85" rx="62" ry="40" fill={shirt}/>
        <circle cx="35" cy="35" r="19" fill={skinM}/>
        <path d="M 17 35 Q 17 13 35 13 Q 56 13 56 35 Q 56 28 35 26 Q 19 26 17 35 Z" fill={hairM}/>
        {/* Baby lying tummy-down on mother's chest */}
        <ellipse cx="85" cy="78" rx="38" ry="20" fill={blanket} transform="rotate(-5 85 78)"/>
        <circle cx="62" cy="68" r="15" fill={skinB} stroke="#E8A98A" strokeWidth="1"/>
        <path d="M 50 61 Q 62 53 74 61 Q 74 55 62 53 Q 50 55 50 61 Z" fill="#D4A574"/>
        <ellipse cx="52" cy="66" rx="6" ry="9" fill={skinM} opacity="0.95"/>
        {/* Baby little arms/legs */}
        <ellipse cx="100" cy="88" rx="8" ry="5" fill={skinB} opacity="0.8"/>
        <ellipse cx="78" cy="95" rx="8" ry="5" fill={skinB} opacity="0.8"/>
        {/* Mother arms gently around baby */}
        <path d="M 30 70 Q 50 100 90 105 Q 100 95 95 88 Q 60 92 35 75 Z" fill={skinM} opacity="0.6"/>
        <text x="80" y="135" textAnchor="middle" fontSize="11" fill="#5C3D2E" fontWeight="600">הנקה ביולוגית</text>
      </svg>
    );
  }
  return null;
}

function BFDecisionTreeWidget({onClose}) {
  const [path,setPath]=useState(['start']);
  const current=path[path.length-1];
  const node=BF_DECISION_TREE[current];
  const endResult=BF_DECISION_END[current];

  function restart(){setPath(['start']);}

  return (
    <div style={{...card,border:`2px solid ${C.t}`,background:'white'}}>
      <div style={{display:'flex',justifyContent:'space-between',alignItems:'center',marginBottom:10}}>
        <div style={{...ttl,marginBottom:0}}>🌳 עץ אבחון</div>
        <button onClick={onClose} style={{background:'none',border:'none',cursor:'pointer',fontSize:18,color:C.txl}}>✕</button>
      </div>
      {endResult ? (
        <div>
          <div style={{textAlign:'center',marginBottom:10}}>
            <div style={{fontSize:36,marginBottom:6}}>{endResult.emoji}</div>
            <div style={{fontWeight:700,fontSize:16,color:C.br,marginBottom:6}}>{endResult.title}</div>
            <div style={{fontSize:13,color:C.txl,lineHeight:1.7}}>{endResult.desc}</div>
          </div>
          <button onClick={restart} style={{width:'100%',padding:10,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:14,cursor:'pointer'}}>🔄 התחילי מחדש</button>
        </div>
      ):(
        <div>
          <div style={{fontSize:15,fontWeight:600,color:C.br,marginBottom:12}}>{node.question}</div>
          <div style={{display:'flex',flexDirection:'column',gap:8}}>
            {node.options.map((opt,i)=>(
              <button key={i} onClick={()=>setPath(p=>[...p,opt.next])} style={{padding:'11px 14px',border:`1px solid ${C.cd}`,borderRadius:10,background:'white',cursor:'pointer',fontFamily:'inherit',fontSize:13,color:C.tx,textAlign:'right',display:'flex',justifyContent:'space-between',alignItems:'center'}}>
                <span>{opt.label}</span><span style={{color:C.t}}>←</span>
              </button>
            ))}
          </div>
          {path.length>1&&<button onClick={()=>setPath(p=>p.slice(0,-1))} style={{marginTop:10,width:'100%',padding:8,background:'none',border:`1px solid ${C.cd}`,borderRadius:10,fontFamily:'inherit',fontSize:12,color:C.txl,cursor:'pointer'}}>→ חזרה</button>}
        </div>
      )}
    </div>
  );
}

function Breastfeeding() {
  const [subTab,setSubTab]=useState('timer');
  const [timers,setTimers]=useState({R:{active:false,elapsed:0,start:null},L:{active:false,elapsed:0,start:null}});
  const [log,setLog]=useState([]);
  const [pumpLog,setPumpLog]=useState([]);
  const [pumpR,setPumpR]=useState('');const [pumpL,setPumpL]=useState('');
  const [stock,setStock]=useState([]);
  const [newStock,setNewStock]=useState({ml:'',date:'',frozen:false});
  const [foodSearch,setFoodSearch]=useState('');
  const [openTrouble,setOpenTrouble]=useState(null);
  const [showBFTree,setShowBFTree]=useState(false);
  const iRef=useRef(null);

  useEffect(()=>{iRef.current=setInterval(()=>{setTimers(p=>{const n={...p};['R','L'].forEach(side=>{if(n[side].active)n[side]={...n[side],elapsed:Math.floor((Date.now()-n[side].start)/1000)};});return n;});},1000);return()=>clearInterval(iRef.current);},[]);

  function toggle(side){setTimers(p=>{const t=p[side];if(!t.active)return{...p,[side]:{active:true,elapsed:t.elapsed,start:Date.now()-t.elapsed*1000}};const dur=t.elapsed;const o=side==='R'?'L':'R';const od=p[o].elapsed;if(dur>0||od>0)setLog(l=>[{id:Date.now(),time:new Date().toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'}),R:side==='R'?dur:od,L:side==='L'?dur:od},...l].slice(0,20));return{...p,[side]:{active:false,elapsed:0,start:null},[o]:{...p[o],active:false}};});}

  function addPump(){
    if(!pumpR&&!pumpL)return;
    setPumpLog(p=>[{id:Date.now(),date:new Date().toLocaleDateString('he-IL'),time:new Date().toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'}),R:+pumpR||0,L:+pumpL||0,total:(+pumpR||0)+(+pumpL||0)},...p].slice(0,30));
    setPumpR('');setPumpL('');
  }

  function addStock(){
    if(!newStock.ml)return;
    const expiry=new Date();expiry.setDate(expiry.getDate()+(newStock.frozen?180:4));
    setStock(p=>[{id:Date.now(),ml:+newStock.ml,date:newStock.date||new Date().toLocaleDateString('he-IL'),frozen:newStock.frozen,expiry:expiry.toLocaleDateString('he-IL')},...p]);
    setNewStock({ml:'',date:'',frozen:false});
  }

  const subTabs=[{id:'timer',lb:'⏱ טיימר'},{id:'latch',lb:'👄 חיבור'},{id:'trouble',lb:'🆘 אתגרים'},{id:'pump',lb:'🍼 שאיבה'},{id:'food',lb:'🥗 מזון/תרופות'},{id:'positions',lb:'🤱 תנוחות'}];

  const foodResult = foodSearch.trim().toLowerCase();
  const isSafe = foodResult && SAFE_FOODS_BF.safe.some(f=>f.toLowerCase().includes(foodResult));
  const isAvoid = foodResult && SAFE_FOODS_BF.avoid.some(f=>f.toLowerCase().includes(foodResult));
  const isGalact = foodResult && SAFE_FOODS_BF.galactagogues.some(f=>f.toLowerCase().includes(foodResult));
  const medMatches = foodResult ? BF_MEDICATIONS.filter(m=>m.name.toLowerCase().includes(foodResult)||m.category.toLowerCase().includes(foodResult)) : [];

  return (
    <div>
      <div style={{display:'flex',gap:6,marginBottom:16,flexWrap:'wrap'}}>{subTabs.map(t=><button key={t.id} onClick={()=>setSubTab(t.id)} style={{padding:'5px 10px',borderRadius:20,border:`1px solid ${subTab===t.id?C.t:C.cd}`,background:subTab===t.id?C.t:'white',color:subTab===t.id?'white':C.tx,cursor:'pointer',fontSize:11,fontFamily:'inherit'}}>{t.lb}</button>)}</div>

      {subTab==='timer'&&<div>
        <div style={card}><div style={ttl}>⏱ טיימר הנקה</div><div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:10,marginBottom:12}}>{[{id:'R',label:'ימין'},{id:'L',label:'שמאל'}].map(({id,label})=><div key={id} style={{background:C.cr,borderRadius:12,padding:14,textAlign:'center'}}><div style={{fontSize:13,color:C.txl,marginBottom:4}}>{label}</div><div style={{fontFamily:'Georgia,serif',fontSize:36,color:C.br}}>{fmt(timers[id].elapsed)}</div><button onClick={()=>toggle(id)} style={{width:'100%',padding:8,marginTop:8,border:'none',borderRadius:8,fontFamily:'inherit',fontSize:13,cursor:'pointer',background:timers[id].active?C.sg:C.sgl,color:timers[id].active?'white':C.br}}>{timers[id].active?'⏹ סיום':'▶ התחלה'}</button></div>)}</div></div>
        {log.length>0&&<div style={card}><div style={ttl}>📋 יומן הנקה</div>{log.slice(0,8).map(f=><div key={f.id} style={{display:'flex',justifyContent:'space-between',padding:'8px 0',borderBottom:`1px solid ${C.cd}`,fontSize:13}}><span style={{color:C.txl}}>{f.time}</span><span>ימין: {fmt(f.R)}</span><span>שמאל: {fmt(f.L)}</span></div>)}</div>}
      </div>}

      {subTab==='latch'&&<div>
        <div style={card}><div style={ttl}>👄 חיבור נכון</div>{BF_CONTENT.latch.map((l,i)=><div key={i} style={{display:'flex',gap:10,padding:'8px 0',borderBottom:`1px solid ${C.cd}`,fontSize:14}}><span style={{color:C.sg,fontSize:16}}>✓</span><span>{l}</span></div>)}<div style={{marginTop:12,padding:'10px 12px',background:'#FFF8E1',borderRadius:8,fontSize:13,color:'#5D4037'}}>💡 כאב חד = חיבור לקוי. שחרר בעדינות ונסי שנית.</div></div>
      </div>}

      {subTab==='trouble'&&<div>
        <div style={{...card,background:`linear-gradient(135deg,#E3F2FD,${C.cr})`,marginBottom:12}}>
          <div style={ttl}>🔍 לא בטוחה מה יש לך?</div>
          <div style={bdy}>עני על כמה שאלות קצרות ונעזור לך לזהות מה קורה</div>
          <button onClick={()=>setShowBFTree(true)} style={{width:'100%',padding:11,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:14,cursor:'pointer',marginTop:8}}>🌳 פתחי את עץ האבחון</button>
        </div>
        {showBFTree&&<BFDecisionTreeWidget onClose={()=>setShowBFTree(false)}/>}
        <div style={{...card,background:'#FFF8E1',marginBottom:12}}><div style={{fontSize:13,color:'#5D4037',lineHeight:1.7}}>⚠️ המידע להדרכה בלבד. בכל ספק – פני ליועצת הנקה מוסמכת.</div></div>
        {BF_TROUBLESHOOT.map((item,i)=>(
          <div key={i} style={{border:`2px solid ${item.urgent?'#FFCDD2':C.cd}`,borderRadius:12,overflow:'hidden',marginBottom:10}}>
            <div onClick={()=>setOpenTrouble(openTrouble===i?null:i)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:item.urgent?'#FFEBEE':'white'}}>
              <div style={{fontWeight:500,fontSize:14,color:item.urgent?'#C62828':C.br}}>{item.urgent?'⚠ ':''} {item.issue}</div>
              <span>{openTrouble===i?'▲':'▼'}</span>
            </div>
            {openTrouble===i&&<div style={{padding:'14px 16px',background:C.cr}}>
              {item.desc&&<div style={{marginBottom:10,padding:'10px 12px',background:'white',borderRadius:8,fontSize:13,color:C.tx,lineHeight:1.6}}>{item.desc}</div>}
              {item.steps.map((step,j)=>(
                <div key={j} style={{marginBottom:10,padding:'10px 12px',background:'white',borderRadius:8,borderRight:`3px solid ${step.heat===true?C.t:step.heat===false?'#90CAF9':C.sg}`}}>
                  <div style={{fontWeight:500,fontSize:13,color:C.br,marginBottom:4}}>{step.title}</div>
                  <div style={{fontSize:13,color:C.txl,lineHeight:1.6}}>{step.action}</div>
                  {step.heat===true&&<div style={{fontSize:11,color:C.t,marginTop:4}}>🌡️ טיפול חום</div>}
                  {step.heat===false&&<div style={{fontSize:11,color:'#1565C0',marginTop:4}}>❄️ טיפול קור</div>}
                </div>
              ))}
            </div>}
          </div>
        ))}
      </div>}

      {subTab==='pump'&&<div>
        <div style={{...card,background:'#E3F2FD',marginBottom:12}}>
          <div style={{...ttl,color:'#1565C0'}}>📌 כללי אצבע לשאיבה</div>
          {["לעולם לא לשאוב יותר מ-15 דקות לכל צד – שאיבה ארוכה יותר לא מגדילה תפוקה ויכולה לפגוע ברקמה","תמיד להתחיל בעיסוי קל של השד (1-2 דקות) לפני השאיבה – זה מעודד זרימת חלב","התחילי בעצימות נמוכה והגבירי בהדרגה לפי נוחות","אם החלב לא זורם – עיסוי קצר באמצע השאיבה יכול לעזור","שאיבה אחרי הנקה (לא במקומה) – יכולה להגביר ייצור בהדרגה"].map((t,i)=>(
            <div key={i} style={{display:'flex',gap:8,padding:'7px 0',borderBottom:i<4?`1px solid #BBDEFB`:'none',fontSize:13,color:'#1565C0'}}>
              <span style={{flexShrink:0}}>📍</span><span>{t}</span>
            </div>
          ))}
        </div>
        <div style={card}>
          <div style={ttl}>🍼 יומן שאיבות</div>
          <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:8,marginBottom:10}}>
            <div><div style={{fontSize:12,color:C.txl,marginBottom:4}}>ימין (מל)</div><input value={pumpR} onChange={e=>setPumpR(e.target.value)} type="number" placeholder="0" style={{width:'100%',padding:'8px 10px',border:`1px solid ${C.cd}`,borderRadius:8,fontFamily:'inherit',fontSize:14,background:C.cr,outline:'none'}}/></div>
            <div><div style={{fontSize:12,color:C.txl,marginBottom:4}}>שמאל (מל)</div><input value={pumpL} onChange={e=>setPumpL(e.target.value)} type="number" placeholder="0" style={{width:'100%',padding:'8px 10px',border:`1px solid ${C.cd}`,borderRadius:8,fontFamily:'inherit',fontSize:14,background:C.cr,outline:'none'}}/></div>
          </div>
          <button onClick={addPump} style={{width:'100%',padding:10,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:14,cursor:'pointer'}}>+ הוסיפי שאיבה</button>
          {pumpLog.length>0&&<div style={{marginTop:12}}>{pumpLog.slice(0,5).map(p=><div key={p.id} style={{display:'flex',justifyContent:'space-between',padding:'8px 0',borderBottom:`1px solid ${C.cd}`,fontSize:13}}><span style={{color:C.txl}}>{p.time}</span><span>ימין: {p.R}מל</span><span>שמאל: {p.L}מל</span><span style={{fontWeight:500,color:C.br}}>סהכ: {p.total}</span></div>)}</div>}
        </div>
        <div style={card}>
          <div style={ttl}>*  מלאי חלב</div>
          <div style={{display:'flex',gap:8,marginBottom:10,flexWrap:'wrap',alignItems:'center'}}>
            <input value={newStock.ml} onChange={e=>setNewStock(p=>({...p,ml:e.target.value}))} type="number" placeholder="כמות מל" style={{flex:1,minWidth:80,padding:'8px 10px',border:`1px solid ${C.cd}`,borderRadius:8,fontFamily:'inherit',fontSize:13,background:C.cr,outline:'none'}}/>
            <label style={{display:'flex',alignItems:'center',gap:4,fontSize:13,cursor:'pointer'}}>
              <input type="checkbox" checked={newStock.frozen} onChange={e=>setNewStock(p=>({...p,frozen:e.target.checked}))}/>
              *  הקפאה
            </label>
            <button onClick={addStock} style={{padding:'8px 14px',background:C.sg,color:'white',border:'none',borderRadius:8,fontFamily:'inherit',fontSize:13,cursor:'pointer'}}>+ הוסיפי</button>
          </div>
          <div style={{marginBottom:10}}>{MILK_STORAGE_RULES.map((r,i)=><div key={i} style={{display:'flex',justifyContent:'space-between',padding:'6px 0',borderBottom:`1px solid ${C.cd}`,fontSize:13}}><span>{r.emoji} {r.location}</span><span style={{fontWeight:500,color:C.br}}>{r.time}</span></div>)}</div>
          {stock.length>0&&<div>{stock.map(s=><div key={s.id} style={{display:'flex',justifyContent:'space-between',padding:'7px 10px',background:s.frozen?'#E3F2FD':C.cr,borderRadius:8,marginBottom:4,fontSize:12}}><span>{s.frozen?'*':'❄️'} {s.ml} מל</span><span style={{color:C.txl}}>הוסף: {s.date}</span><span style={{color:'#C62828'}}>פג: {s.expiry}</span></div>)}</div>}
        </div>
      </div>}

      {subTab==='food'&&<div>
        <div style={card}>
          <div style={ttl}>🔍 חיפוש תרופה / מזון</div>
          <input value={foodSearch} onChange={e=>setFoodSearch(e.target.value)} placeholder="הקלידי שם תרופה (לדוגמה: אדוויל, אקמול), מזון או צמח מרפא..." style={{width:'100%',padding:'11px 14px',border:`1px solid ${C.cd}`,borderRadius:10,fontFamily:'inherit',fontSize:14,background:C.cr,outline:'none',marginBottom:10}}/>
          {foodResult&&(
            <div>
              {medMatches.length>0 ? medMatches.map((m,i)=>(
                <div key={i} style={{padding:'12px 14px',borderRadius:10,marginBottom:8,background:m.verdict==='avoid'?'#FFEBEE':m.verdict==='caution'?'#FFF8E1':'#E8F5E9',border:`1px solid ${m.verdict==='avoid'?'#FFCDD2':m.verdict==='caution'?'#FFE082':'#A5D6A7'}`}}>
                  <div style={{fontWeight:700,color:C.br,fontSize:14,marginBottom:2}}>{m.name}</div>
                  <div style={{fontSize:11,color:C.txl,marginBottom:6}}>קטגוריה: {m.category}</div>
                  <div style={{fontWeight:600,fontSize:13,marginBottom:4,color:m.verdict==='avoid'?'#C62828':m.verdict==='caution'?'#E65100':'#2E7D32'}}>
                    {m.verdict==='avoid'?'❌ להימנע בהנקה':m.verdict==='caution'?'⚠️ בזהירות / לטווח קצר':'✅ בטוח להנקה'}
                  </div>
                  <div style={{fontSize:12,color:C.tx,lineHeight:1.6}}>{m.note}</div>
                </div>
              )) : (
                <div style={{padding:'12px 14px',borderRadius:10,background:isAvoid?'#FFEBEE':isSafe||isGalact?'#E8F5E9':'#FFF8E1',border:`1px solid ${isAvoid?'#FFCDD2':isSafe||isGalact?'#A5D6A7':'#FFE082'}`}}>
                  {isAvoid&&<div style={{color:'#C62828',fontWeight:500}}>⚠️ יש להגביל / להימנע בהנקה</div>}
                  {isSafe&&!isGalact&&<div style={{color:'#2E7D32',fontWeight:500}}>✅ בטוח להנקה</div>}
                  {isGalact&&<div style={{color:'#2E7D32',fontWeight:500}}>✅ בטוח – ועשוי לעזור לייצור חלב!</div>}
                  {!isAvoid&&!isSafe&&!isGalact&&<div style={{color:'#5D4037'}}>🔎 לא נמצא במאגר. לבדיקה מדויקת – פני למכון הטרטולוגי או לרופאה.</div>}
                </div>
              )}
            </div>
          )}
          <div style={{marginTop:10,padding:'10px 12px',background:'#E3F2FD',borderRadius:8,fontSize:12,color:'#1565C0',lineHeight:1.6}}>
            💊 לכל שאלה בנושא תרופות בהנקה – ניתן לפנות למכון הטרטולוגי (מרכז ייעוץ ארצי בנושא תרופות, קרינה וחומרים בהריון והנקה), בטלפון או דרך בית החולים הקרוב.
          </div>
          <div style={{marginTop:12}}>
            <div style={{fontWeight:500,color:C.br,marginBottom:8,fontSize:14}}>🌿 מגבירי ייצור (Galactagogues):</div>
            {SAFE_FOODS_BF.galactagogues.map((f,i)=><div key={i} style={{display:'flex',gap:8,padding:'6px 0',borderBottom:`1px solid ${C.cd}`,fontSize:13}}><span style={{color:C.sg}}>✓</span><span>{f}</span></div>)}
          </div>
        </div>
      </div>}

      {subTab==='positions'&&(
        <div>
          {BF_CONTENT.positions.map((p,i)=>(
            <div key={i} style={card}>
              <div style={{display:'flex',gap:14,alignItems:'center'}}>
                <div style={{flexShrink:0,background:C.cr,borderRadius:12,padding:6}}><BFPositionIcon type={p.icon}/></div>
                <div style={{flex:1}}>
                  <div style={{fontFamily:'inherit',fontSize:15,fontWeight:700,color:C.br,marginBottom:6}}>{p.name}</div>
                  <div style={bdy}>{p.desc}</div>
                </div>
              </div>
            </div>
          ))}
        </div>
      )}
    </div>
  );
}

function InductionList({items, open, setOpen}) {
  return (
    <div>
      {items.map((item,i)=>(
        <div key={i} style={{border:`1px solid ${C.cd}`,borderRadius:12,overflow:'hidden',marginBottom:10}}>
          <div onClick={()=>setOpen(open===i?null:i)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:open===i?C.cr:'white'}}>
            <div><div style={{fontSize:15,fontWeight:500,color:C.br}}>{item.emoji} {item.method}</div><div style={{fontSize:12,color:C.txl,marginTop:2}}>{item.type}</div></div>
            <span style={{color:C.txl}}>{open===i?'▲':'▼'}</span>
          </div>
          {open===i&&<div style={{padding:'14px 16px',background:C.cr,fontSize:13,lineHeight:1.7}}>
            <p style={{marginBottom:12,color:C.tx}}>{item.desc}</p>
            <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:10,marginBottom:12}}>
              <div style={{background:'#E8F5E9',borderRadius:8,padding:'8px 10px'}}><div style={{fontSize:11,fontWeight:500,color:'#2E7D32',marginBottom:4}}>✅ יתרונות</div>{item.pros.map((p,j)=><div key={j} style={{fontSize:12,color:C.txl,marginBottom:2}}>• {p}</div>)}</div>
              <div style={{background:'#FFEBEE',borderRadius:8,padding:'8px 10px'}}><div style={{fontSize:11,fontWeight:500,color:'#C62828',marginBottom:4}}>⚠️ חסרונות</div>{item.cons.map((c,j)=><div key={j} style={{fontSize:12,color:C.txl,marginBottom:2}}>• {c}</div>)}</div>
            </div>
            <div style={{background:'#E3F2FD',borderRadius:8,padding:'8px 12px',fontSize:12}}><strong style={{color:'#1565C0'}}>מתאים ל:</strong> <span style={{color:C.txl}}>{item.who}</span></div>
          </div>}
        </div>
      ))}
    </div>
  );
}

function DecisionTree() {
  const [path,setPath]=useState(['start']);
  const current=DECISION_TREE[path[path.length-1]];

  function goTo(next){
    if(next.startsWith('END_')){
      setPath(p=>[...p,next]);
      return;
    }
    setPath(p=>[...p,next]);
  }
  function restart(){setPath(['start']);}
  function back(){if(path.length>1)setPath(p=>p.slice(0,-1));}

  const lastNode=path[path.length-1];

  if(lastNode==='END_PREECLAMPSIA'){
    return (
      <div style={card}>
        <div style={ttl}>🩺 רעלת הריון</div>
        <div style={bdy}>למידע מפורט על רעלת הריון, תסמינים ומה לעשות – ראי את הסקשן "מצבים רפואיים" בתפריט הריון.</div>
        <button onClick={restart} style={{marginTop:12,width:'100%',padding:10,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:14,cursor:'pointer'}}>🔄 התחילי מחדש</button>
      </div>
    );
  }
  if(lastNode==='END_QUESTIONS'){
    return (
      <div style={card}>
        <div style={ttl}>❓ שאלות לשאול את הרופאה</div>
        {["מדוע מומלץ זירוז עכשיו ולא לחכות?","מה הסיכונים הספציפיים במצב שלי אם נחכה?","איזו שיטת זירוז מתאימה למצבי?","האם יש אפשרות לנסות שיטה פחות פולשנית קודם?","מה קורה אם הזירוז לא 'יתפוס'?","כמה זמן ניתן לשיטה לעבוד לפני שעוברים לשיטה הבאה?"].map((q,i)=>(
          <div key={i} style={{display:'flex',gap:8,padding:'8px 0',borderBottom:`1px solid ${C.cd}`,fontSize:14}}>
            <span style={{color:C.t,flexShrink:0}}>{i+1}.</span><span>{q}</span>
          </div>
        ))}
        <button onClick={restart} style={{marginTop:12,width:'100%',padding:10,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:14,cursor:'pointer'}}>🔄 התחילי מחדש</button>
      </div>
    );
  }
  if(lastNode==='END_INDUCTION_PAGE'){
    return (
      <div style={card}>
        <div style={ttl}>📋 מידע מפורט</div>
        <div style={bdy}>למידע מפורט על כל שיטות ההתערבות – רפואיות וטבעיות – עברי ללשוניות רפואיים וטבעיים בעמוד זה.</div>
        <button onClick={restart} style={{marginTop:12,width:'100%',padding:10,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:14,cursor:'pointer'}}>🔄 התחילי מחדש</button>
      </div>
    );
  }

  return (
    <div>
      <div style={{...card,background:`linear-gradient(135deg,#E3F2FD,${C.cr})`}}>
        <div style={ttl}>🌳 עץ החלטות – הציעו לי התערבות</div>
        <div style={bdy}>עני על השאלות כדי להבין את האפשרויות שלך. המידע אינו תחליף לשיחה עם הרופאה.</div>
      </div>
      <div style={card}>
        <div style={{fontFamily:'inherit',fontSize:17,fontWeight:700,color:C.br,marginBottom:current.info?12:16}}>{current.question}</div>
        {current.info&&<div style={{background:'#FFF8E1',borderRadius:10,padding:'12px 14px',fontSize:13,lineHeight:1.7,color:'#5D4037',marginBottom:16}}>{current.info}</div>}
        <div style={{display:'flex',flexDirection:'column',gap:8}}>
          {current.options.map((opt,i)=>(
            <button key={i} onClick={()=>goTo(opt.next)} style={{padding:'12px 16px',border:`1px solid ${C.cd}`,borderRadius:10,background:'white',cursor:'pointer',fontFamily:'inherit',fontSize:14,color:C.tx,textAlign:'right',display:'flex',justifyContent:'space-between',alignItems:'center'}}>
              <span>{opt.label}</span><span style={{color:C.t}}>←</span>
            </button>
          ))}
        </div>
        {path.length>1&&(
          <button onClick={back} style={{marginTop:12,width:'100%',padding:9,background:'none',border:`1px solid ${C.cd}`,borderRadius:10,fontFamily:'inherit',fontSize:13,color:C.txl,cursor:'pointer'}}>→ חזרה</button>
        )}
      </div>
    </div>
  );
}

function PostTermGuide() {
  const [open,setOpen]=useState(null);
  const d=POSTTERM_DATA;
  return (
    <div>
      <div style={{...card,background:`linear-gradient(135deg,#FFF3E0,${C.cr})`}}>
        <div style={ttl}>📅 הריון עודף – מה עכשיו?</div>
        <div style={bdy}>{d.intro}</div>
      </div>
      <div style={card}>
        <div style={ttl}>🗓️ ציר זמן ומעקב</div>
        {d.timeline.map((t,i)=>(
          <div key={i} style={{display:'flex',gap:10,marginBottom:14}}>
            <div style={{flexShrink:0,width:36,height:36,borderRadius:'50%',background:C.t,color:'white',display:'flex',alignItems:'center',justifyContent:'center',fontSize:12,fontWeight:700}}>{i+1}</div>
            <div style={{flex:1}}>
              <div style={{fontWeight:700,color:C.br,fontSize:13,marginBottom:2}}>{t.week} – {t.title}</div>
              <div style={{fontSize:12,color:C.txl,marginBottom:4,lineHeight:1.6}}>{t.desc}</div>
              <div style={{fontSize:12,background:'#E3F2FD',color:'#1565C0',borderRadius:6,padding:'4px 8px',display:'inline-block'}}>📌 {t.action}</div>
            </div>
          </div>
        ))}
      </div>
      <div style={card}>
        <div style={ttl}>🔬 בדיקות מעקב נדרשות</div>
        {d.monitoring.map((m,i)=>(
          <div key={i} style={{padding:'10px 0',borderBottom:i<d.monitoring.length-1?`1px solid ${C.cd}`:'none'}}>
            <div style={{fontWeight:600,color:C.br,fontSize:13,marginBottom:3}}>{m.name}</div>
            <div style={{fontSize:12,color:C.txl,marginBottom:3,lineHeight:1.6}}>{m.desc}</div>
            <div style={{fontSize:11,color:C.sg}}>📍 {m.where}</div>
          </div>
        ))}
        <div style={{marginTop:8,padding:'10px 12px',background:'#FFEBEE',borderRadius:8,fontSize:12,color:'#C62828'}}>
          ⚠️ חובה לתאם בדיקות אלו עם קופח / בית היולדות – לרוב יוזמנו אוטומטית מ-שבוע 41.
        </div>
      </div>
      <div style={card}>
        <div style={ttl}>🌿 מה אפשר לעשות (טבעי)</div>
        <div style={{display:'flex',flexWrap:'wrap',gap:8}}>
          {d.naturalTips.map((t,i)=><span key={i} style={{background:'#E8F4E8',color:'#2E7D32',borderRadius:15,padding:'6px 12px',fontSize:12}}>{t}</span>)}
        </div>
      </div>
      <div style={{...card,background:'#FCE4EC'}}>
        <div style={{...ttl,color:'#AD1457'}}>💜 איך מרגישים בזמן הזה</div>
        <div style={{fontSize:13,lineHeight:1.7,color:C.tx}}>{d.emotional}</div>
      </div>
    </div>
  );
}

function Induction() {
  const [mainTab,setMainTab]=useState('tree');
  const [subTab,setSubTab]=useState('medical');
  const medical=INDUCTION_DATA.filter(x=>x.type!=='טבעי'&&x.type!=='לא רפואי');
  const natural=INDUCTION_DATA.filter(x=>x.type==='טבעי'||x.type==='לא רפואי');
  const [openM,setOpenM]=useState(null);
  const [openN,setOpenN]=useState(null);

  const mainTabs=[
    {id:'tree',lb:'🌳 עץ החלטות'},
    {id:'methods',lb:'💉 שיטות'},
    {id:'postterm',lb:'📅 הריון עודף'}
  ];

  return (
    <div>
      <div style={{display:'flex',gap:6,marginBottom:16}}>
        {mainTabs.map(t=>(
          <button key={t.id} onClick={()=>setMainTab(t.id)} style={{flex:1,padding:'9px 4px',border:`1px solid ${mainTab===t.id?C.t:C.cd}`,borderRadius:10,background:mainTab===t.id?C.t:'white',color:mainTab===t.id?'white':C.tx,cursor:'pointer',fontFamily:'inherit',fontSize:12,fontWeight:mainTab===t.id?600:400}}>{t.lb}</button>
        ))}
      </div>

      {mainTab==='tree'&&<DecisionTree/>}

      {mainTab==='methods'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#FFF3E0,${C.cr})`}}><div style={ttl}>💉 מדריך התערבויות</div><div style={bdy}>התערבות בלידה היא תהליך רפואי. חשוב לשאול שאלות ולהבין את האפשרויות.</div></div>
          <div style={{display:'flex',gap:8,marginBottom:16}}>
            <button onClick={()=>setSubTab('medical')} style={{flex:1,padding:10,border:`2px solid ${subTab==='medical'?C.t:C.cd}`,borderRadius:10,background:subTab==='medical'?'#FFF3E0':'white',cursor:'pointer',fontFamily:'inherit',fontSize:14,fontWeight:subTab==='medical'?500:400}}>💉 רפואיים</button>
            <button onClick={()=>setSubTab('natural')} style={{flex:1,padding:10,border:`2px solid ${subTab==='natural'?C.sg:C.cd}`,borderRadius:10,background:subTab==='natural'?'#E8F4E8':'white',cursor:'pointer',fontFamily:'inherit',fontSize:14,fontWeight:subTab==='natural'?500:400}}>🌿 טבעיים</button>
          </div>
          {subTab==='medical'&&<InductionList items={medical} open={openM} setOpen={setOpenM}/>}
          {subTab==='natural'&&(
            <div>
              <div style={{...card,background:'#E8F4E8',marginBottom:12}}>
                <div style={{fontSize:13,color:'#2E7D32',lineHeight:1.7}}>🌿 <strong>התערבויות טבעיות</strong> יכולות לתמוך בהכנת הגוף ללידה. חלקם עם ראיות מדעיות, חלקם מסורתיים. תמיד בייעוץ עם מטפל מוסמך!</div>
              </div>
              <InductionList items={natural} open={openN} setOpen={setOpenN}/>
            </div>
          )}
          <div style={card}><div style={ttl}>❓ שאלות לשאול לפני התערבות</div>{["מדוע התערבות נחוצה עכשיו?","מה הסיכונים לי ולתינוק?","מה יקרה אם נחכה?","איזו שיטה מתאימה לי?","האם ניתן לנסות פחות פולשני קודם?"].map((q,i)=><div key={i} style={{display:'flex',gap:8,padding:'8px 0',borderBottom:`1px solid ${C.cd}`,fontSize:14}}><span style={{color:C.t}}>?</span><span>{q}</span></div>)}</div>
        </div>
      )}

      {mainTab==='postterm'&&<PostTermGuide/>}
    </div>
  );
}
function Rights() {
  const [open,setOpen]=useState(null);
  return (
    <div>
      <div style={{...card,background:`linear-gradient(135deg,#E8F4E8,${C.cr})`}}><div style={ttl}>⚖️ זכויות האישה היולדת</div><div style={bdy}>ידע הוא כוח. הכרת זכויותייך מאפשרת לך לקחת חלק פעיל בהחלטות.</div></div>
      {RIGHTS_DATA.map((cat,i)=>(
        <div key={i} style={{border:`1px solid ${C.cd}`,borderRadius:12,overflow:'hidden',marginBottom:10}}>
          <div onClick={()=>setOpen(open===i?null:i)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:open===i?C.cr:'white'}}>
            <div style={{fontSize:15,fontWeight:500,color:C.br}}>{cat.emoji} {cat.category}</div>
            <span style={{color:C.txl}}>{open===i?'▲':'▼'}</span>
          </div>
          {open===i&&<div style={{padding:'14px 16px',background:C.cr}}>{cat.items.map((item,j)=><div key={j} style={{display:'flex',gap:8,padding:'8px 0',borderBottom:j<cat.items.length-1?`1px solid ${C.cd}`:'none',fontSize:13,lineHeight:1.5}}><span style={{color:C.sg,flexShrink:0}}>✓</span><span>{item}</span></div>)}</div>}
        </div>
      ))}
    </div>
  );
}

function Checklists() {
  const [tab,setTab]=useState('מה לקנות');
  const [checked,setChecked]=useState({});
  const toggle=(t,i)=>{const k=`${t}-${i}`;setChecked(p=>({...p,[k]:!p[k]}));};
  const items=CL[tab]||[];
  const done=items.filter((_,i)=>checked[`${tab}-${i}`]).length;
  const pct=items.length?Math.round(done/items.length*100):0;
  return (
    <div>
      <div style={{display:'flex',gap:6,marginBottom:16,flexWrap:'wrap'}}>
        {Object.keys(CL).map(t=><button key={t} onClick={()=>setTab(t)} style={{padding:'5px 11px',borderRadius:20,border:`1px solid ${tab===t?C.t:C.cd}`,background:tab===t?C.t:'white',color:tab===t?'white':C.tx,cursor:'pointer',fontSize:12,fontFamily:'inherit'}}>{t}</button>)}
      </div>
      <div style={card}>
        <div style={{display:'flex',justifyContent:'space-between',marginBottom:8,fontSize:13,color:C.txl}}><span>התקדמות</span><span>{done}/{items.length} ({pct}%)</span></div>
        <div style={{background:C.cd,borderRadius:10,height:8,marginBottom:16,overflow:'hidden'}}><div style={{height:'100%',background:`linear-gradient(to left,${C.t},${C.tl})`,borderRadius:10,width:`${pct}%`,transition:'width 0.4s'}}/></div>
        {items.map((item,i)=>{const k=`${tab}-${i}`;return(<div key={i} onClick={()=>toggle(tab,i)} style={{display:'flex',alignItems:'flex-start',gap:10,padding:'10px 0',borderBottom:i<items.length-1?`1px solid ${C.cd}`:'none',cursor:'pointer'}}><div style={{width:20,height:20,borderRadius:5,border:`2px solid ${checked[k]?C.t:C.cd}`,background:checked[k]?C.t:'white',display:'flex',alignItems:'center',justifyContent:'center',flexShrink:0,marginTop:1,color:'white',fontSize:12}}>{checked[k]&&'✓'}</div><div style={{fontSize:14,lineHeight:1.5,textDecoration:checked[k]?'line-through':'none',color:checked[k]?C.txl:C.tx}}>{item}</div></div>);})}
      </div>
    </div>
  );
}

function Complications() {
  const [open,setOpen]=useState(null);
  const urgStyle={immediate:{bg:'#FFEBEE',c:'#C62828'},soon:{bg:'#FFF3E0',c:'#E65100'},routine:{bg:'#E8F5E9',c:'#2E7D32'}};
  return (
    <div>
      <div style={{background:`linear-gradient(135deg,#FFF8E1,${C.cr})`,borderRadius:16,padding:16,marginBottom:12,border:`1px solid #FFE082`}}>
        <div style={ttl}>🩺 מדריך מצבים רפואיים</div>
        <div style={bdy}>מידע כללי בלבד. בכל חשש רפואי – פני לרופא/חדר מיון. לחצי על כל מצב לפרטים.</div>
      </div>
      {COMP.map((c,i)=>(
        <div key={i} style={{border:`1px solid ${urgStyle[c.u].bg}`,borderRadius:14,overflow:'hidden',marginBottom:10,boxShadow:'0 2px 8px rgba(0,0,0,0.05)'}}>
          <div onClick={()=>setOpen(open===i?null:i)} style={{padding:'14px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:open===i?urgStyle[c.u].bg+'44':'white'}}>
            <div>
              <div style={{fontSize:14,fontWeight:600,color:C.br}}>{c.n}</div>
              <div style={{fontSize:11,color:C.txl,marginTop:2}}>{c.d.slice(0,50)}...</div>
            </div>
            <div style={{display:'flex',flexDirection:'column',alignItems:'flex-end',gap:4}}>
              <span style={{fontSize:11,padding:'3px 10px',borderRadius:10,background:urgStyle[c.u].bg,color:urgStyle[c.u].c,fontWeight:500}}>{c.ul}</span>
              <span style={{color:C.txl,fontSize:14}}>{open===i?'▲':'▼'}</span>
            </div>
          </div>
          {open===i&&<div style={{background:C.cr}}>
            <div style={{padding:'12px 16px',borderBottom:`1px solid ${C.cd}`,fontSize:13,lineHeight:1.7,color:C.tx}}>{c.d}</div>
            {c.details&&<div style={{padding:'10px 16px',background:'white',borderBottom:`1px solid ${C.cd}`,fontSize:12,lineHeight:1.7,color:C.txl}}><strong style={{color:C.br}}>📖 פרטים:</strong><br/>{c.details}</div>}
            <div style={{padding:'10px 16px',borderBottom:`1px solid ${C.cd}`}}>
              <div style={{fontSize:12,fontWeight:600,color:C.br,marginBottom:6}}>🔍 תסמינים לשים לב:</div>
              <div style={{display:'flex',flexWrap:'wrap',gap:6}}>{c.s.map((sym,j)=><span key={j} style={{background:'white',border:`1px solid ${urgStyle[c.u].bg}`,borderRadius:8,padding:'4px 10px',fontSize:12,color:urgStyle[c.u].c}}>{sym}</span>)}</div>
            </div>
            <div style={{padding:'10px 16px',background:urgStyle[c.u].bg+'22'}}>
              <div style={{fontSize:13,fontWeight:600,color:urgStyle[c.u].c,marginBottom:4}}>🔹 מה לעשות:</div>
              <div style={{fontSize:13,color:C.tx}}>{c.a}</div>
              {c.afterbirth&&<div style={{marginTop:6,fontSize:12,color:C.txl}}>👶 אחרי לידה: {c.afterbirth}</div>}
            </div>
          </div>}
        </div>
      ))}
    </div>
  );
}

// ===== TOOLS (עזרים) =====
function Tools() {
  const [subTab,setSubTab]=useState('meditation');
  const [gratitude,setGratitude]=useState('');
  const [gratitudeLog,setGratitudeLog]=useState([]);
  const [breathPhase,setBreathPhase]=useState(null);
  const [breathCount,setBreathCount]=useState(0);
  const [rxSelected,setRxSelected]=useState(null);
  const breathRef=useRef(null);
  const [playing,setPlaying]=useState(null);
  const nodesRef=useRef({});
  function playSound(soundId){
    if(playing===soundId){
      if(nodesRef.current[soundId]){try{nodesRef.current[soundId].src.stop();}catch(e){}delete nodesRef.current[soundId];}
      setPlaying(null);return;
    }
    if(playing&&nodesRef.current[playing]){try{nodesRef.current[playing].src.stop();}catch(e){}delete nodesRef.current[playing];}
    try{
      const ctx=new(window.AudioContext||window.webkitAudioContext)();
      const graph=buildNoiseGraph(ctx,soundId);
      graph.src.start();
      nodesRef.current[soundId]={src:graph.src,ctx};
      setPlaying(soundId);
    }catch(e){alert('לא ניתן להפעיל שמע');}
  }
  useEffect(()=>()=>{Object.values(nodesRef.current).forEach(n=>{try{n.src.stop();}catch(e){}});},[]);

  function startBreath() {
    let phase=0;
    const phases=['שאפי...','החזיקי...','נשפי...','החזיקי...'];
    const times=[4000,4000,6000,2000];
    function next(){
      setBreathPhase(phases[phase]);
      setBreathCount(c=>c+1);
      breathRef.current=setTimeout(()=>{phase=(phase+1)%4;next();},times[phase]);
    }
    next();
  }
  function stopBreath(){clearTimeout(breathRef.current);setBreathPhase(null);setBreathCount(0);}
  useEffect(()=>()=>clearTimeout(breathRef.current),[]);

  const subTabs=[{id:'general',lb:'🌿 כללי'},{id:'meditation',lb:'🧘 5 דקות'},{id:'rx_map',lb:'👣 רפלקסולוגיה'},{id:'books',lb:'📚 ספרים'},{id:'podcasts',lb:'🎙️ פודקאסטים'},{id:'videos',lb:'🎬 סרטים'}];
  return (
    <div>
      <div style={{display:'flex',gap:6,marginBottom:16,flexWrap:'wrap'}}>
        {subTabs.map(t=><button key={t.id} onClick={()=>setSubTab(t.id)} style={{padding:'6px 11px',borderRadius:20,border:`1px solid ${subTab===t.id?C.t:C.cd}`,background:subTab===t.id?C.t:'white',color:subTab===t.id?'white':C.tx,cursor:'pointer',fontSize:12,fontFamily:'inherit'}}>{t.lb}</button>)}
      </div>

      {subTab==='general'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#E8F4E8,${C.cr})`}}>
            <div style={ttl}>🌿 בריאות בהריון – כללי</div>
            <div style={bdy}>מה עוזר לכל תסמין נפוץ</div>
          </div>
          {[
            {title:"בחילות",emoji:"🤢",tips:["אכלי משהו יבש לפני קימה (ביסקוויט, פיתה)","ארוחות קטנות ותכופות – כל 2-3 שעות","הימנעי מריחות חזקים","שרוות זנגביל טבעי","P6 – לחצי 2 סמ מתחת לכרית כף היד","B6 (ויטמין) – שאלי רופאה","חמוצים קלים לפעמים עוזרים!"]},
            {title:"כאבי גב",emoji:"🦴",tips:["כרית הריון בין הברכיים בלילה","נעליים שטוחות עם תמיכה – לא עקבים","תרגילי חיזוק גב וקור של אגן","שחייה – הכי טובה לגב בהריון","עיסוי הריון עם מטפלת מוסמכת","רפלקסולוגיה – עמוד שדרה בצד פנימי של הרגל","חיזוק קדמי-בטן: Pelvic Tilts בעמידה"]},
            {title:"פעילות גופנית",emoji:"🏃",tips:["30 דקות ביום – הליכה, שחייה, יוגה להריון","הימנעי מפעילות גבוהת עצימות מ-שב 20","קגל כל יום – 3 סטים 10 כיווצים","לא לשכב על הגב מ-שב 20 (יוגה/פילאטיס – שינויי תנוחה)","פעילות מים מצוינת – מפחיתה עומס על המפרקים","עצרי אם יש כאב, קוצר נשימה, דמם"]},
            {title:"תזונה",emoji:"🥗",tips:["חומצה פולית עד שב 12 לפחות – ממשיכה כל ההריון","ברזל: בשר אדום, קטניות + ויטמין C לספיגה","סידן: מוצרי חלב, ברוקולי, טחינה","אומגה 3: דגים (לא כבד דגים), אגוזי מלך","הימנעי: סושי נא, גבינות לא מפוסטרות, כבד, כוהל","קפה: עד 200 מג קפאין ביום (כ-2 כוסות)","שתיה: 8-10 כוסות מים ביום"]}
          ].map((sec,i)=>(
            <div key={i} style={card}>
              <div style={{fontFamily:"Georgia,serif",fontSize:17,color:C.br,marginBottom:10}}>{sec.emoji} {sec.title}</div>
              {sec.tips.map((t,j)=>(
                <div key={j} style={{display:'flex',gap:8,padding:'6px 0',borderBottom:j<sec.tips.length-1?`1px solid ${C.cd}`:'none',fontSize:13,lineHeight:1.5}}>
                  <span style={{color:C.t,flexShrink:0}}>•</span><span>{t}</span>
                </div>
              ))}
            </div>
          ))}
        </div>
      )}
      {subTab==='meditation'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#EDE7F6,${C.cr})`}}>
            <div style={ttl}>🧘 5 דקות לעצמך</div>
            <div style={bdy}>פינה של הפוגה. נשמי, כתבי, הרגיעי.</div>
          </div>
          <div style={card}>
            <div style={{fontFamily:'Georgia,serif',fontSize:17,color:C.br,marginBottom:12}}>🫁 תרגיל נשימה 4-4-6</div>
            {!breathPhase?(
              <button onClick={startBreath} style={{width:'100%',padding:13,background:`linear-gradient(135deg,#EDE7F6,#D1C4E9)`,border:'none',borderRadius:12,fontFamily:'inherit',fontSize:15,cursor:'pointer',color:'#4527A0'}}>▶ התחילי תרגיל נשימה</button>
            ):(
              <div style={{textAlign:'center'}}>
                <div style={{fontSize:48,marginBottom:8}}>
                  <span style={{fontSize:48,display:'block',marginBottom:8}}>{'~'}</span>
                </div>
                <div style={{fontFamily:'Georgia,serif',fontSize:28,color:'#4527A0',marginBottom:4}}>{breathPhase}</div>
                <div style={{fontSize:13,color:C.txl,marginBottom:16}}>מחזור {Math.ceil(breathCount/4)}</div>
                <button onClick={stopBreath} style={{padding:'10px 24px',background:'none',border:`1px solid ${C.cd}`,borderRadius:20,fontFamily:'inherit',fontSize:14,cursor:'pointer',color:C.txl}}>עצרי</button>
              </div>
            )}
          </div>
          <div style={card}>
            <div style={ttl}>🎵 צלילים מרגיעים</div>
            <div style={{fontSize:13,color:C.txl,marginBottom:12}}>לחצי על ▶ להשמעה – נוצר ישירות באפליקציה, אין צורך באינטרנט</div>
            {playing&&<div style={{marginBottom:8,padding:'6px 12px',background:'#E8F5E9',borderRadius:8,fontSize:13,color:'#2E7D32',textAlign:'center'}}>▶️ מתנגן כעת</div>}
            {[
              {id:"rain",name:"גשם ויער",emoji:"🌧️"},
              {id:"ocean",name:"גלי אוקיינוס",emoji:"🌊"},
              {id:"chimes",name:"צלילים רגועים",emoji:"🎹"},
              {id:"womb",name:"צלילי רחם",emoji:"🌸"}
            ].map((m,i)=>(
              <div key={i} onClick={()=>playSound(m.id)} style={{display:'flex',alignItems:'center',gap:10,background:playing===m.id?'#FFF0EB':C.cr,borderRadius:10,padding:'12px 14px',marginBottom:8,cursor:'pointer',border:`2px solid ${playing===m.id?C.t:'transparent'}`}}>
                <span style={{fontSize:22}}>{playing===m.id?'⏸':'▶'}</span>
                <span style={{fontSize:13,color:C.tx,flex:1}}>{m.emoji} {m.name}</span>
              </div>
            ))}
          </div>
          <div style={card}>
            <div style={ttl}>💭 דמיון מודרך – טקסט לקריאה</div>
            <div style={{fontSize:13,color:C.txl,marginBottom:12}}>קראי לאט, בעצמך או בעזרת מישהו שמקריא לך</div>
            {[
              {title:"חוף שלווה",text:"דמיינו שאתן הולכות לאיטכן על חוף חמים. החול רך מתחת לרגליים, גלים נשברים בקצב שווה. עם כל נשיפה, תני לעצמך לשקוע עוד קצת לתוך הרוגע הזה."},
              {title:"שיח עם התינוק",text:"הניחו ידיים על הבטן. נשמו עמוק. דמיינו את התינוק, שומע את הקול שלכן, מרגיש את החום מהידיים. אפשר ללחוש לו משהו – ברכה, הבטחה, או פשוט 'אני כאן'."},
              {title:"מדיטציית שינה",text:"שכבי בנוחות. סרקי את הגוף מהראש לכפות הרגליים, ושחררי כל אזור שמרגיש מתוח. נשימה איטית, עמוקה. תני לגוף להיכבד ולהתמסר למיטה."}
            ].map((g,i)=>(
              <div key={i} style={{background:C.cr,borderRadius:10,padding:12,marginBottom:8}}>
                <div style={{fontWeight:600,color:C.br,fontSize:13,marginBottom:6}}>💭 {g.title}</div>
                <div style={{fontSize:13,color:C.tx,lineHeight:1.8}}>{g.text}</div>
              </div>
            ))}
          </div>
          <div style={card}>
            <div style={{fontFamily:'Georgia,serif',fontSize:17,color:C.br,marginBottom:12}}>🙏 יומן תודות</div>
            <div style={{fontSize:13,color:C.txl,marginBottom:10}}>על מה את אסירת תודה היום?</div>
            <textarea value={gratitude} onChange={e=>setGratitude(e.target.value)} placeholder="הכנסי משהו אחד קטן שמישהו אסירה תודה עליו..." style={{width:'100%',minHeight:80,padding:12,border:`1px solid ${C.cd}`,borderRadius:10,fontFamily:'inherit',fontSize:14,background:C.cr,resize:'vertical',outline:'none'}}/>
            <button onClick={()=>{if(gratitude.trim()){setGratitudeLog(p=>[{id:Date.now(),text:gratitude.trim(),date:new Date().toLocaleDateString('he-IL')},...p].slice(0,20));setGratitude('');}}} style={{width:'100%',padding:11,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:14,cursor:'pointer',marginTop:10}}>💾 שמרי</button>
            {gratitudeLog.length>0&&<div style={{marginTop:12}}>{gratitudeLog.slice(0,5).map(e=><div key={e.id} style={{background:C.cr,borderRadius:8,padding:'8px 12px',marginBottom:6,borderRight:`3px solid ${C.tl}`}}><div style={{fontSize:11,color:C.txl,marginBottom:3}}>{e.date}</div><div style={{fontSize:13}}>{e.text}</div></div>)}</div>}
          </div>
          <div style={{...card,background:'#E8F4E8'}}>
            <div style={{fontFamily:'Georgia,serif',fontSize:17,color:C.br,marginBottom:10}}>💚 אפירמציות</div>
            {["גופי יודע איך ללדת","אני חזקה יותר ממה שאני חושבת","כל ציר מקרב אותי לתינוק שלי","אני בטוחה, תינוקי בטוח","אני יכולה לעשות קשה"].map((a,i)=><div key={i} style={{padding:'8px 0',borderBottom:i<4?`1px solid #C8E6C9`:'none',fontSize:14,color:'#2E7D32',lineHeight:1.5}}>✨ {a}</div>)}
          </div>
        </div>
      )}

      {subTab==='rx_map'&&(
        <div>
          <div style={{...card,marginBottom:12}}>
            <div style={ttl}>👣 מפת רפלקסולוגיה אינטראקטיבית</div>
            <div style={bdy}>מה מציק לך? בחרי תסמין וקבלי הנחיה לנקודת הלחיצה.</div>
          </div>
          <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:8,marginBottom:12}}>
            {RX_POINTS.map(pt=>(
              <div key={pt.id} onClick={()=>setRxSelected(rxSelected===pt.id?null:pt.id)} style={{background:rxSelected===pt.id?pt.color:'white',borderRadius:12,padding:12,cursor:'pointer',border:`2px solid ${rxSelected===pt.id?pt.tc:C.cd}`,textAlign:'center'}}>
                <div style={{fontSize:24,marginBottom:4}}>{pt.emoji}</div>
                <div style={{fontSize:13,fontWeight:500,color:rxSelected===pt.id?pt.tc:C.br}}>{pt.label}</div>
              </div>
            ))}
          </div>
          {rxSelected&&(()=>{
            const pt=RX_POINTS.find(p=>p.id===rxSelected);
            return (
              <div style={{background:pt.color,borderRadius:16,padding:16,border:`1px solid ${pt.tc}44`}}>
                <div style={{fontFamily:'Georgia,serif',fontSize:18,color:pt.tc,marginBottom:8}}>{pt.emoji} {pt.label}</div>
                {/* Simple foot diagram */}
                <div style={{background:'white',borderRadius:12,padding:12,marginBottom:12,textAlign:'center',position:'relative'}}>
                  <svg viewBox="0 0 100 120" width="120" height="144" style={{display:'block',margin:'0 auto'}}>
                    <ellipse cx="50" cy="85" rx="28" ry="35" fill="#FAD7C0" stroke="#C4785A" strokeWidth="1.5"/>
                    <ellipse cx="50" cy="50" rx="22" ry="28" fill="#FAD7C0" stroke="#C4785A" strokeWidth="1.5"/>
                    {[{cx:38,cy:16,r:5},{cx:46,cy:12,r:5.5},{cx:55,cy:12,r:5},{cx:64,cy:15,r:4.5},{cx:71,cy:20,r:4}].map((t,i)=><ellipse key={i} cx={t.cx} cy={t.cy} rx={t.r} ry={t.r*0.8} fill="#FAD7C0" stroke="#C4785A" strokeWidth="1.2"/>)}
                    <circle cx={pt.foot.x} cy={pt.foot.y} r={pt.foot.r} fill={pt.tc} opacity="0.7"/>
                    <circle cx={pt.foot.x} cy={pt.foot.y} r={pt.foot.r*0.5} fill={pt.tc}/>
                    <circle cx={pt.foot.x} cy={pt.foot.y} r={2} fill="white"/>
                  </svg>
                  <div style={{fontSize:11,color:C.txl,marginTop:4}}>הנקודה המסומנת</div>
                </div>
                <div style={{fontSize:13,lineHeight:1.8,color:C.tx}}>{pt.desc}</div>
                <div style={{marginTop:10,padding:'8px 12px',background:'white',borderRadius:8,fontSize:12,color:'#5D4037'}}>⚠️ המידע לצורכי מידע בלבד. עבדי עם דולה/רפלקסולוגית מוסמכת לתוצאות מיטביות.</div>
              </div>
            );
          })()}
        </div>
      )}

      {subTab==='books'&&<div>{RESOURCES.books.map((b,i)=><div key={i} style={card}><div style={{fontFamily:'Georgia,serif',fontSize:16,color:C.br,marginBottom:4}}>{b.title}</div><div style={{fontSize:12,color:C.t,marginBottom:8}}>✍️ {b.author}</div><div style={bdy}>{b.desc}</div></div>)}</div>}
      {subTab==='podcasts'&&<div>{RESOURCES.podcasts.map((p,i)=><div key={i} style={card}><div style={{fontFamily:'Georgia,serif',fontSize:16,color:C.br,marginBottom:4}}>{p.title}</div><div style={{fontSize:12,color:C.t,marginBottom:8}}>🎙️ {p.host}</div><div style={bdy}>{p.desc}</div></div>)}</div>}
      {subTab==='videos'&&<div>{RESOURCES.videos.map((v,i)=><div key={i} style={card}><div style={{fontFamily:'Georgia,serif',fontSize:16,color:C.br,marginBottom:4}}>{v.title}</div><div style={{fontSize:12,color:C.t,marginBottom:8}}>🎬 {v.type}</div><div style={bdy}>{v.desc}</div></div>)}</div>}
    </div>
  );
}

// ===== POSTPARTUM =====
function PostpartumRecovery() {
  const [subTab,setSubTab]=useState('checklist');
  const [momChecked,setMomChecked]=useState({});
  const [babyChecked,setBabyChecked]=useState({});
  const [answers,setAnswers]=useState({});

  const [bleedingLog,setBleedingLog]=useState([]);
  const [bleedingLevel,setBleedingLevel]=useState('medium');
  const [painLog,setPainLog]=useState([]);
  const [painLevel,setPainLevel]=useState(3);
  const [moodLog,setMoodLog]=useState([]);

  const subTabs=[{id:'checklist',lb:"✅ צקליסטים"},{id:'emotions',lb:'💜 רגשות'},{id:'tracking',lb:'📊 מעקב'}];

  function getEmotionResult(){
    const reds=[answers[2]==='כן',answers[3]==='כן, רוב הזמן',answers[4]==='כן'];
    const yellows=[answers[0]==='כן, הרבה',answers[1]==='לא כלל',answers[3]==='לפעמים'];
    if(reds.filter(Boolean).length>=1)return{level:'red',msg:'חשוב מאוד לפנות לרופאה/פסיכולוגית בהקדם. מה שאת חווה עשוי להיות דיכאון אחרי לידה – ניתן לטפל!'};
    if(yellows.filter(Boolean).length>=2)return{level:'yellow',msg:'יש כמה סימנים שכדאי לשים לב אליהם. דברי עם הרופאה. זה נפוץ ועוזר לדבר.'};
    return{level:'green',msg:'נראה שאת מתמודדת יפה! "בייבי בלוז" בשבועיים הראשונים הוא נורמלי לחלוטין.'};
  }
  const resColors={red:'#FFEBEE',yellow:'#FFF8E1',green:'#E8F5E9'};
  const resTextColors={red:'#C62828',yellow:'#E65100',green:'#2E7D32'};

  return (
    <div>
      <div style={{background:`linear-gradient(135deg,#FCE4EC,${C.cr})`,borderRadius:16,padding:20,marginBottom:16,textAlign:'center'}}>
        <div style={{fontSize:36}}>🌺</div>
        <div style={{fontFamily:'Georgia,serif',fontSize:22,color:C.br,marginTop:6}}>התאוששות אחרי לידה</div>
        <div style={{fontSize:13,color:C.txl,marginTop:4}}>משכב לידה, מעקב רגשי, חיסונים ועוד</div>
      </div>
      <div style={{display:'flex',gap:6,marginBottom:16,flexWrap:'wrap'}}>
        {subTabs.map(t=><button key={t.id} onClick={()=>setSubTab(t.id)} style={{padding:'6px 11px',borderRadius:20,border:`1px solid ${subTab===t.id?C.t:C.cd}`,background:subTab===t.id?C.t:'white',color:subTab===t.id?'white':C.tx,cursor:'pointer',fontSize:12,fontFamily:'inherit'}}>{t.lb}</button>)}
      </div>

      {subTab==='checklist'&&(
        <div>
          <div style={card}><div style={ttl}>👩 צקליסט לאמא – בית החולים</div>{POSTPARTUM_MOM_CL.map((item,i)=>{const k=`mom-${i}`;return(<div key={i} onClick={()=>setMomChecked(p=>({...p,[k]:!p[k]}))} style={{display:'flex',gap:10,padding:'9px 0',borderBottom:`1px solid ${C.cd}`,cursor:'pointer'}}><div style={{width:20,height:20,borderRadius:5,border:`2px solid ${momChecked[k]?C.t:C.cd}`,background:momChecked[k]?C.t:'white',display:'flex',alignItems:'center',justifyContent:'center',flexShrink:0,color:'white',fontSize:12}}>{momChecked[k]&&'✓'}</div><div style={{fontSize:13,lineHeight:1.5,textDecoration:momChecked[k]?'line-through':'none',color:momChecked[k]?C.txl:C.tx}}>{item}</div></div>);})}</div>
          <div style={card}><div style={ttl}>👶 צקליסט לתינוק – בית החולים</div>{POSTPARTUM_BABY_CL.map((item,i)=>{const k=`baby-${i}`;return(<div key={i} onClick={()=>setBabyChecked(p=>({...p,[k]:!p[k]}))} style={{display:'flex',gap:10,padding:'9px 0',borderBottom:`1px solid ${C.cd}`,cursor:'pointer'}}><div style={{width:20,height:20,borderRadius:5,border:`2px solid ${babyChecked[k]?C.sg:C.cd}`,background:babyChecked[k]?C.sg:'white',display:'flex',alignItems:'center',justifyContent:'center',flexShrink:0,color:'white',fontSize:12}}>{babyChecked[k]&&'✓'}</div><div style={{fontSize:13,lineHeight:1.5,textDecoration:babyChecked[k]?'line-through':'none',color:babyChecked[k]?C.txl:C.tx}}>{item}</div></div>);})}</div>
          <div style={{...card,background:'#E3F2FD'}}><div style={{fontSize:14,color:'#1565C0',lineHeight:1.8}}><strong>⏰ זמן אשפוז:</strong><br/>• לידה רגילה: 48-72 שעות<br/>• קיסרי: 72-96 שעות<br/>• שחרור מוקדם: 25+ שעות לאחר לידה רגילה</div></div>
        </div>
      )}

      {subTab==='emotions'&&(
        <div>
          <div style={card}><div style={ttl}>💜 ניטור רגשי</div><div style={bdy}>מבוסס על Edinburgh Postnatal Depression Scale. אינו מחליף אבחון רפואי.</div></div>
          {EMOTIONS_QS.map((q,i)=>(
            <div key={i} style={card}>
              <div style={{fontSize:14,fontWeight:500,color:C.br,marginBottom:10}}>{i+1}. {q.q}</div>
              <div style={{display:'flex',gap:8,flexWrap:'wrap'}}>{q.opts.map(opt=><button key={opt} onClick={()=>setAnswers(p=>({...p,[i]:opt}))} style={{padding:'7px 14px',borderRadius:20,border:`2px solid ${answers[i]===opt?C.t:C.cd}`,background:answers[i]===opt?'#FFF0EB':'white',cursor:'pointer',fontSize:13,fontFamily:'inherit',color:answers[i]===opt?C.t:C.tx}}>{opt}</button>)}</div>
            </div>
          ))}
          {Object.keys(answers).length===EMOTIONS_QS.length&&(()=>{const r=getEmotionResult();return(<div style={{background:resColors[r.level],borderRadius:12,padding:16,border:`1px solid ${resTextColors[r.level]}44`}}><div style={{fontSize:14,color:resTextColors[r.level],lineHeight:1.7}}>{r.msg}</div>{r.level!=='green'&&<div style={{marginTop:10,fontSize:13,color:C.txl}}>📞 ערן 1201 | רופאת קופת חולים | יועצת פסיכולוגית</div>}</div>);})()} 
          <div style={{...card,marginTop:8,background:'#FFF8E1'}}><div style={{fontSize:14,color:'#5D4037',lineHeight:1.8}}><strong>בייבי בלוז לעומת דיכאון:</strong><br/>🟡 <strong>בייבי בלוז:</strong> ימים 3-10, בכי, עצב, חולף לבד<br/>🔴 <strong>דיכאון אחרי לידה:</strong> מעל 2 שבועות, דורש טיפול<br/>🆘 <strong>פסיכוזה אחרי לידה:</strong> נדיר, דחוף – פנה למיון</div></div>
        </div>
      )}

      {subTab==='tracking'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#FCE4EC,${C.cr})`}}>
            <div style={ttl}>📊 מעקב התאוששות יומי</div>
            <div style={bdy}>תעדי דימום, כאב ומצב רוח – עוזר לך ולרופאה לדעת שהכל מתקדם כמו שצריך</div>
          </div>

          <div style={card}>
            <div style={{...ttl,fontSize:15}}>🩸 דימום (לוכיה)</div>
            <div style={{display:'flex',gap:6,marginBottom:10,flexWrap:'wrap'}}>
              {[['light','קל – כתמים'],['medium','בינוני – כמו וסת'],['heavy','כבד – ספיגה תוך שעה'],['clots','קרישים גדולים']].map(([k,l])=>(
                <button key={k} onClick={()=>setBleedingLevel(k)} style={{padding:'6px 12px',borderRadius:20,border:`1px solid ${bleedingLevel===k?C.t:C.cd}`,background:bleedingLevel===k?'#FFF0EB':'white',cursor:'pointer',fontSize:12,fontFamily:'inherit',color:bleedingLevel===k?C.t:C.tx}}>{l}</button>
              ))}
            </div>
            <button onClick={()=>setBleedingLog(p=>[{id:Date.now(),level:bleedingLevel,date:new Date().toLocaleDateString('he-IL'),time:new Date().toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'})},...p].slice(0,30))} style={{width:'100%',padding:10,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:13,cursor:'pointer'}}>+ הוסיפי רישום</button>
            {bleedingLog.some(b=>b.level==='heavy'||b.level==='clots')&&(
              <div style={{marginTop:10,padding:'10px 12px',background:'#FFEBEE',borderRadius:8,fontSize:12,color:'#C62828'}}>
                ⚠️ דימום כבד או קרישים גדולים – אם זה ממשיך או מחמיר, פני לרופאה/מיון מיד.
              </div>
            )}
            {bleedingLog.length>0&&(
              <div style={{marginTop:10}}>
                {bleedingLog.slice(0,5).map(b=>(
                  <div key={b.id} style={{display:'flex',justifyContent:'space-between',padding:'5px 0',borderBottom:`1px solid ${C.cd}`,fontSize:12}}>
                    <span style={{color:C.txl}}>{b.date} {b.time}</span>
                    <span style={{color:b.level==='heavy'||b.level==='clots'?'#C62828':C.tx}}>{({light:'קל',medium:'בינוני',heavy:'כבד',clots:'קרישים'})[b.level]}</span>
                  </div>
                ))}
              </div>
            )}
            <div style={{marginTop:8,fontSize:11,color:C.txl}}>💡 דימום הולך ופוחת תוך 4-6 שבועות. עלייה בעצימות = פני לרופאה.</div>
          </div>

          <div style={card}>
            <div style={{...ttl,fontSize:15}}>🤕 רמת כאב</div>
            <div style={{display:'flex',alignItems:'center',gap:10,marginBottom:10}}>
              <span style={{fontSize:12,color:C.txl}}>קל</span>
              <input type="range" min={0} max={10} value={painLevel} onChange={e=>setPainLevel(+e.target.value)} style={{flex:1,accentColor:C.t}}/>
              <span style={{fontSize:12,color:C.txl}}>חזק</span>
            </div>
            <div style={{textAlign:'center',marginBottom:10}}>
              <span style={{fontSize:24,fontWeight:700,color:C.t}}>{painLevel}</span><span style={{fontSize:13,color:C.txl}}>/10</span>
            </div>
            <button onClick={()=>setPainLog(p=>[{id:Date.now(),level:painLevel,date:new Date().toLocaleDateString('he-IL'),time:new Date().toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'})},...p].slice(0,30))} style={{width:'100%',padding:10,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:13,cursor:'pointer'}}>+ הוסיפי רישום</button>
            {painLog.length>0&&(
              <div style={{marginTop:10}}>
                {painLog.slice(0,5).map(p=>(
                  <div key={p.id} style={{display:'flex',justifyContent:'space-between',padding:'5px 0',borderBottom:`1px solid ${C.cd}`,fontSize:12}}>
                    <span style={{color:C.txl}}>{p.date} {p.time}</span>
                    <span style={{color:p.level>=7?'#C62828':p.level>=4?'#E65100':'#2E7D32',fontWeight:600}}>{p.level}/10</span>
                  </div>
                ))}
              </div>
            )}
            <div style={{marginTop:8,fontSize:11,color:C.txl}}>💡 כאב שמתגבר (במיוחד באזור חתך/תפרים) עם חום – פני לרופאה.</div>
          </div>

          <div style={card}>
            <div style={{...ttl,fontSize:15}}>💜 מצב רוח יומי</div>
            <div style={{display:'flex',gap:8,marginBottom:10,flexWrap:'wrap'}}>
              {['😊','😐','😢','😰','😴','🥰'].map(m=>(
                <button key={m} onClick={()=>setMoodLog(p=>[{id:Date.now(),mood:m,date:new Date().toLocaleDateString('he-IL')},...p].slice(0,30))} style={{padding:'8px 14px',borderRadius:12,border:`1px solid ${C.cd}`,background:'white',cursor:'pointer',fontSize:20}}>{m}</button>
              ))}
            </div>
            {moodLog.length>0&&(
              <div style={{display:'flex',gap:6,flexWrap:'wrap'}}>
                {moodLog.slice(0,10).map(m=>(
                  <div key={m.id} style={{textAlign:'center'}}>
                    <div style={{fontSize:18}}>{m.mood}</div>
                    <div style={{fontSize:9,color:C.txl}}>{m.date.slice(0,5)}</div>
                  </div>
                ))}
              </div>
            )}
            <div style={{marginTop:8,fontSize:11,color:C.txl}}>💡 תנודות במצב הרוח נפוצות (בייבי בלוז). אם רוב הימים קשים – שתפי את הרופאה.</div>
          </div>
        </div>
      )}
    </div>
  );
}


function WeatherDressing() {
  const [temp,setTemp]=useState(20);
  const [loading,setLoading]=useState(false);
  const [realTemp,setRealTemp]=useState(null);
  async function fetchWeather(){setLoading(true);try{const res=await fetch('https://wttr.in/?format=j1');const data=await res.json();const t=parseInt(data.current_condition[0].temp_C);setRealTemp(t);setTemp(t);}catch(e){}finally{setLoading(false);}}
  function getDressingAdvice(t){
    if(t<=10)return{layers:"3-4 שכבות",items:["בגד גוף תרמי","פיגמה חמה/צמר","שמיכה עבה בעגלה","כובע וכפפות"],emoji:"🧥❄️",color:'#E3F2FD'};
    if(t<=16)return{layers:"2-3 שכבות",items:["בגד גוף","סרבל שרוולים ארוכים","שמיכה קלה","כובע"],emoji:"🧤🌥️",color:'#E8F4E8'};
    if(t<=22)return{layers:"2 שכבות",items:["בגד גוף","בגד עליון דק","שמיכה דקה בעגלה"],emoji:"🌤️",color:'#FFF8E1'};
    if(t<=27)return{layers:"שכבה אחת",items:["בגד גוף דק / רומפר","כובע קל","מסנן שמש"],emoji:"☀️",color:'#FFF3E0'};
    return{layers:"מינימום",items:["גופייה / בגד גוף קצר","כובע בד","הצל מהשמש!","נוזלים!"],emoji:"🌡️🔥",color:'#FFEBEE'};
  }
  const adv=getDressingAdvice(temp);
  return (
    <div style={card}>
      <div style={ttl}>🌤️ מדריך לבוש לתינוק</div>
      <button onClick={fetchWeather} disabled={loading} style={{width:'100%',padding:10,background:C.sg,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:13,cursor:'pointer',marginBottom:16}}>{loading?'מביאה תחזית...':'📍 קבלי תחזית אוטומטית'}</button>
      {realTemp&&<div style={{textAlign:'center',fontSize:13,color:C.sg,marginBottom:8}}>📍 טמפרטורה כרגע: {realTemp}°C</div>}
      <div style={{display:'flex',alignItems:'center',gap:12,marginBottom:16}}>
        <span style={{fontSize:13,color:C.txl,flexShrink:0}}>טמפרטורה</span>
        <input type="range" min={0} max={40} value={temp} onChange={e=>setTemp(+e.target.value)} style={{flex:1,accentColor:C.t}}/>
        <div style={{background:C.t,color:'white',borderRadius:20,padding:'4px 12px',fontSize:14,fontWeight:500,flexShrink:0}}>{temp}°C</div>
      </div>
      <div style={{background:adv.color,borderRadius:12,padding:16}}>
        <div style={{fontSize:24,marginBottom:6}}>{adv.emoji}</div>
        <div style={{fontFamily:'Georgia,serif',fontSize:16,color:C.br,marginBottom:8}}>{adv.layers}</div>
        {adv.items.map((item,i)=><div key={i} style={{display:'flex',gap:8,marginBottom:4,fontSize:13}}><span style={{color:C.t}}>•</span><span>{item}</span></div>)}
        <div style={{marginTop:10,padding:'8px 10px',background:'rgba(255,255,255,0.6)',borderRadius:8,fontSize:12,color:C.txl}}>💡 כלל אצבע: תינוק צריך שכבה אחת יותר ממה שאת לובשת</div>
      </div>
    </div>
  );
}

// ===== BABY WORLD =====

// ===== DAFNA BOOKING =====
function DafnaBooking() {
  const SERVICES = [
    {name:"קורס הכנה ללידה",emoji:"🎓",desc:"מפגש אחד (3 שעות) – פרטי או קבוצתי. כל מה שצריך לדעת על הריון, לידה והכנה ליום הגדול.",duration:"מפגש אחד · 3 שעות · פרטי/קבוצתי"},
    {name:"רפלקסולוגיה לנשים",emoji:"👣",desc:"רפלקסולוגיה לכל אישה – עם התמחות בהריון ופוריות. הקלה על בחילות, כאבי גב, נדודי שינה ועוד.",duration:"60 דקות"},
    {name:"דיקור סיני בהריון",emoji:"🌿",desc:"דיקור מותאם לכל שלב. הכנה ללידה, הפחתת כאב, איזון הורמונלי.",duration:"45-60 דקות"},
    {name:"הכנה ויעוץ הנקה",emoji:"🤱",desc:"פגישת הכנה לפני הלידה + תמיכה לאחר הלידה. חיבור נכון, תנוחות, פתרון בעיות.",duration:"60-90 דקות"},
    {name:"ליווי לידה (דולה)",emoji:"🌸",desc:"ליווי אישי מלא בחדר הלידה. תמיכה פיזית ורגשית לך ולבן/בת הזוג.",duration:"כל הלידה"},
    {name:"פמה (שיקום גוף אחרי לידה)",emoji:"💪",desc:"טיפול גוף הוליסטי אחרי לידה. שיקום רצפת אגן, חיזוק הגוף, ריפוי.",duration:"90-120 דקות"},
    {name:"עיסוי תינוקות",emoji:"👶",desc:"קורס עיסוי לאמא/אבא. לחיזוק קשר עם התינוק, הקלה על גזים וקוליק.",duration:"מפגש אחד"},
    {name:"עיסוי נשים בהריון",emoji:"🌺",desc:"עיסוי מותאם הריון. הקלה על כאבים, נפיחות, שיפור שינה והרגעה.",duration:"90 דקות"}
  ];

  const waNumber = "972544521285";
  function openWhatsApp(service) {
    const msg = encodeURIComponent(`שלום דפנה! אני מעוניינת לקבוע טיפול: ${service}. אשמח לשמוע על זמינות ומחירים. תודה!`);
    window.open(`https://wa.me/${waNumber}?text=${msg}`, '_blank');
  }

  return (
    <div>
      <div style={{background:`linear-gradient(135deg,${C.br},${C.t})`,borderRadius:16,padding:24,marginBottom:16,textAlign:'center',color:'white'}}>
        <div style={{fontSize:48,marginBottom:8}}>🌸</div>
        <div style={{fontFamily:'inherit',fontSize:24,fontWeight:700,marginBottom:4}}>דפנה – דולה ומטפלת הוליסטית</div>
        <div style={{fontSize:13,opacity:0.85,lineHeight:1.6}}>דולה מוסמכת | רפלקסולוגיה | דיקור סיני<br/>ייעוץ הנקה | פמה | עיסוי</div>
        <div style={{marginTop:12,padding:'8px 16px',background:'rgba(255,255,255,0.15)',borderRadius:20,fontSize:13,display:'inline-block'}}>
          📍 dafnadoula.co.il
        </div>
      </div>
      <div onClick={()=>window.open('https://instagram.com/dafnadoula','_blank')} style={{...card,cursor:'pointer',background:`linear-gradient(135deg,#F58529,#DD2A7B,#8134AF)`,color:'white',textAlign:'center',padding:18}}>
        <div style={{display:'flex',alignItems:'center',justifyContent:'center',gap:10,marginBottom:6}}>
          <svg width="26" height="26" viewBox="0 0 24 24" fill="white"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0 5.838a4 4 0 100 8 4 4 0 000-8zm6.406-2.812a1.44 1.44 0 100 2.88 1.44 1.44 0 000-2.88z"/></svg>
          <span style={{fontSize:17,fontWeight:700}}>@dafnadoula</span>
        </div>
        <div style={{fontSize:12,opacity:0.9,marginBottom:8}}>טיפים יומיים, תוכן על הריון ולידה, ועדכונים שוטפים</div>
        <div style={{display:'inline-block',background:'rgba(255,255,255,0.2)',borderRadius:20,padding:'6px 18px',fontSize:13,fontWeight:600}}>
          ➕ עקבי כדי לא לפספס תוכן חדש
        </div>
      </div>
      <div style={{...card,background:'#E8F4E8',marginBottom:12}}>
        <div style={{fontSize:13,color:'#2E7D32',lineHeight:1.7,textAlign:'center'}}>
          💬 לחצי על כל שירות לפתיחת WhatsApp עם הודעה מוכנה!
        </div>
      </div>
      {SERVICES.map((svc,i)=>(
        <div key={i} style={{...card,cursor:'pointer',border:`1px solid ${C.cd}`}} onClick={()=>openWhatsApp(svc.name)}>
          <div style={{display:'flex',alignItems:'flex-start',gap:12}}>
            <div style={{fontSize:36,flexShrink:0}}>{svc.emoji}</div>
            <div style={{flex:1}}>
              <div style={{fontFamily:'Georgia,serif',fontSize:17,color:C.br,marginBottom:4}}>{svc.name}</div>
              <div style={{fontSize:13,color:C.txl,lineHeight:1.6,marginBottom:6}}>{svc.desc}</div>
              <div style={{display:'flex',alignItems:'center',justifyContent:'space-between'}}>
                <span style={{fontSize:12,color:C.sg}}>⏱ {svc.duration}</span>
                <div style={{display:'flex',alignItems:'center',gap:6,background:'#25D366',color:'white',borderRadius:20,padding:'5px 12px',fontSize:12,fontWeight:500}}>
                  <span>💬</span><span>קביעת תור בWhatsApp</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      ))}
      <div style={{...card,background:`linear-gradient(135deg,#FFF3E0,#FCE4EC)`,textAlign:'center'}}>
        <div style={{fontSize:14,color:C.br,lineHeight:1.8}}>
          <strong>📞 יצירת קשר ישיר:</strong><br/>
          <button onClick={()=>window.open('https://wa.me/'+waNumber,'_blank')} style={{marginTop:10,padding:'12px 28px',background:'#25D366',color:'white',border:'none',borderRadius:25,fontFamily:'inherit',fontSize:15,fontWeight:500,cursor:'pointer'}}>
            💬 WhatsApp – דפנה דולה
          </button>
        </div>
      </div>
      <div style={{background:'#FFF8E1',borderRadius:12,padding:12,marginBottom:16,border:'1px solid #FFE082'}}>
        <div style={{fontSize:11,color:'#5D4037',textAlign:'center',lineHeight:1.6}}>
          ⚠️ <strong>הבהרה חשובה:</strong> אפליקציה זו לצורכי מידע בלבד ואינה מחליפה ייעוץ רפואי מקצועי. בכל בעיה רפואית פני לרופא/ה.
        </div>
      </div>
    </div>
  );
}

// ===== MEDICAL WALLET =====
function MedicalWallet() {
  const [docs,setDocs]=useState([]);
  const [newDoc,setNewDoc]=useState({name:'',category:'',note:''});
  const fileRef=useRef(null);
  const CATS=["אולטרסאונד","בדיקות דם","מי שפיר","לחץ דם","סוכרת","אחר"];

  function handleFile(e) {
    const file = e.target.files[0];
    if(!file) return;
    const reader = new FileReader();
    reader.onload = (ev) => {
      setDocs(p=>[{id:Date.now(),name:newDoc.name||file.name,category:newDoc.category||'אחר',note:newDoc.note,date:new Date().toLocaleDateString('he-IL'),dataUrl:ev.target.result,type:file.type},...p]);
      setNewDoc({name:'',category:'',note:''});
    };
    reader.readAsDataURL(file);
  }

  return (
    <div>
      <div style={{...card,background:`linear-gradient(135deg,#E3F2FD,${C.cr})`}}>
        <div style={ttl}>📋 תיק רפואי דיגיטלי</div>
        <div style={bdy}>צלמי ושמרי בדיקות, סקירות ותוצאות. הכל מסודר ונגיש תמיד – גם במיון.</div>
      </div>
      <div style={card}>
        <div style={{fontFamily:'Georgia,serif',fontSize:16,color:C.br,marginBottom:12}}>+ הוספת מסמך</div>
        <input value={newDoc.name} onChange={e=>setNewDoc(p=>({...p,name:e.target.value}))} placeholder="שם המסמך (למשל: סקירה מחצית)" style={{width:'100%',padding:'9px 12px',border:`1px solid ${C.cd}`,borderRadius:8,fontFamily:'inherit',fontSize:13,background:C.cr,outline:'none',marginBottom:8}}/>
        <div style={{display:'flex',gap:6,marginBottom:8,flexWrap:'wrap'}}>
          {CATS.map(cat=><button key={cat} onClick={()=>setNewDoc(p=>({...p,category:cat}))} style={{padding:'5px 10px',borderRadius:15,border:`1px solid ${newDoc.category===cat?C.t:C.cd}`,background:newDoc.category===cat?'#FFF0EB':'white',cursor:'pointer',fontSize:12,fontFamily:'inherit'}}>{cat}</button>)}
        </div>
        <input value={newDoc.note} onChange={e=>setNewDoc(p=>({...p,note:e.target.value}))} placeholder="הערה קצרה (אופציונלי)" style={{width:'100%',padding:'9px 12px',border:`1px solid ${C.cd}`,borderRadius:8,fontFamily:'inherit',fontSize:13,background:C.cr,outline:'none',marginBottom:8}}/>
        <input ref={fileRef} type="file" accept="image/*,application/pdf" onChange={handleFile} style={{display:'none'}}/>
        <button onClick={()=>fileRef.current.click()} style={{width:'100%',padding:11,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:14,cursor:'pointer'}}>📷 צלמי / העלי קובץ</button>
      </div>
      {docs.length===0&&<div style={{...card,textAlign:'center',color:C.txl}}><div style={{fontSize:40,marginBottom:8}}>📂</div><div style={{fontSize:14}}>עדיין אין מסמכים. הוסיפי את הראשון!</div></div>}
      {docs.map(doc=>(
        <div key={doc.id} style={{...card,padding:14}}>
          <div style={{display:'flex',justifyContent:'space-between',alignItems:'flex-start',marginBottom:8}}>
            <div>
              <div style={{fontWeight:500,color:C.br,fontSize:14}}>{doc.name}</div>
              <div style={{fontSize:12,color:C.txl}}>{doc.category} | {doc.date}</div>
              {doc.note&&<div style={{fontSize:12,color:C.txl,marginTop:2}}>📝 {doc.note}</div>}
            </div>
            <button onClick={()=>setDocs(p=>p.filter(d=>d.id!==doc.id))} style={{background:'none',border:'none',cursor:'pointer',color:'#CCC',fontSize:18}}>✕</button>
          </div>
          {doc.type.startsWith('image')&&<img src={doc.dataUrl} alt={doc.name} style={{width:'100%',borderRadius:8,maxHeight:200,objectFit:'cover'}}/>}
          {doc.type==='application/pdf'&&<div style={{background:C.cr,borderRadius:8,padding:10,fontSize:13,color:C.txl,textAlign:'center'}}>📄 PDF שמור</div>}
        </div>
      ))}
    </div>
  );
}

// ===== NIGHT CHAT =====
function NightChat() {
  const [msgs,setMsgs]=useState([{id:1,text:'שלום, ערה גם אני 🌙 רק לציין שפתוחות לשתף בלי שיפוטיות. מה עובר עליך הלילה?',anon:'אמא בקהילה',time:'03:24'}]);
  const [input,setInput]=useState('');
  const night=isNightTime();

  function send(){
    if(!input.trim())return;
    setMsgs(p=>[...p,{id:Date.now(),text:input.trim(),anon:'את',time:new Date().toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'})}]);
    setInput('');
    setTimeout(()=>{
      const responses=["לא לבד! אני גם ערה 🌙","מחבקת אותך בלב 💜","גם אני בהנקה של 3 בלילה 😅","זה יעבור, את נדהמת! 💪","את עושה עבודה מדהימה ❤️"];
      setMsgs(p=>[...p,{id:Date.now()+1,text:responses[Math.floor(Math.random()*responses.length)],anon:'אמא אנונימית',time:new Date().toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'})}]);
    },1500);
  }

  if(!night) return (
    <div>
      <div style={{...card,textAlign:'center',background:`linear-gradient(135deg,#EDE7F6,${C.cr})`}}>
        <div style={{fontSize:60,marginBottom:12}}>🌙</div>
        <div style={{fontFamily:'Georgia,serif',fontSize:22,color:C.br,marginBottom:8}}>צאט ערות לילי</div>
        <div style={{fontSize:14,color:C.txl,lineHeight:1.7,marginBottom:12}}>הצאט פתוח רק בשעות הלילה<br/>(23:00 – 06:00)<br/>לאמהות שערות לבד ורוצות לדעת שהן לא לבד.</div>
        <div style={{padding:'12px 20px',background:'rgba(69,39,160,0.1)',borderRadius:12,fontSize:20,color:'#4527A0'}}>
          ⏰ עוד {23-new Date().getHours()} שעות בערך
        </div>
      </div>
    </div>
  );

  return (
    <div>
      <div style={{...card,background:`linear-gradient(135deg,#1A1A2E,#16213E)`,color:'white',textAlign:'center'}}>
        <div style={{fontSize:32,marginBottom:6}}>🌙 צאט ערות</div>
        <div style={{fontSize:13,opacity:0.7}}>פתוח 23:00–06:00 | אנונימי | לא לבד</div>
      </div>
      <div style={{background:'#1A1A2E',borderRadius:12,padding:14,marginBottom:12,minHeight:300,maxHeight:400,overflowY:'auto',display:'flex',flexDirection:'column',gap:10}}>
        {msgs.map(m=>(
          <div key={m.id} style={{maxWidth:'85%',alignSelf:m.anon==='את'?'flex-start':'flex-end'}}>
            <div style={{fontSize:11,color:'rgba(255,255,255,0.4)',marginBottom:2,textAlign:m.anon==='את'?'right':'left'}}>{m.anon} · {m.time}</div>
            <div style={{padding:'10px 14px',borderRadius:14,background:m.anon==='את'?C.t:'rgba(255,255,255,0.1)',color:'white',fontSize:14,lineHeight:1.6}}>{m.text}</div>
          </div>
        ))}
      </div>
      <div style={{display:'flex',gap:8}}>
        <input value={input} onChange={e=>setInput(e.target.value)} onKeyDown={e=>e.key==='Enter'&&send()} placeholder="כתבי מה על הלב..." style={{flex:1,padding:'11px 14px',border:`1px solid #333`,borderRadius:10,fontFamily:'inherit',fontSize:14,background:'#1A1A2E',color:'white',outline:'none'}}/>
        <button onClick={send} style={{padding:'11px 16px',background:C.t,color:'white',border:'none',borderRadius:10,cursor:'pointer',fontSize:16}}>➤</button>
      </div>
    </div>
  );
}

// ===== BABY MASSAGE & REFLEX ANIMATIONS =====
const BABY_MASSAGE_STEPS = [
  {step:"רגליים",emoji:"🦵",animation:["לחץ עדין","גלגול","שחרר"],desc:"גלגלי את כף הרגל בין כפות ידייך. לחץ מהעקב לאצבעות. 30 שניות כל רגל.",benefit:"מרגיע, זרימת דם, מקל על גזים",color:"#FFF3E0"},
  {step:"בטן",emoji:"🫃",animation:["I","L","U"],desc:"תנועת I-L-U! I = מלמטה למעלה בצד שמאל. L = מאמצע למטה ושמאלה. U = קשת מימין לשמאל.",benefit:"🌟 הכי יעיל לגזים וקוליק!",color:"#E8F5E9"},
  {step:"חזה",emoji:"💓",animation:["מרכז →","← חוצה","חזור"],desc:"מן המרכז החוצה – כמו פתיחת ספר. 5-6 פעמים. עדין ורציף.",benefit:"נשימה טובה יותר, חיבור עמוק",color:"#FCE4EC"},
  {step:"זרועות",emoji:"💪",animation:["גלגול","לחץ","שחרר"],desc:"גלגול זרוע מהכתף לאגרוף. פתיחת אצבעות אחת-אחת. 3 פעמים כל יד.",benefit:"מחזק קשר, מרגיע",color:"#E3F2FD"},
  {step:"גב",emoji:"🔙",animation:["עורף →","← ישבן","עיגולים"],desc:"שכב על הבטן (רק אם מחזיק ראש!). תנועות ארוכות מהעורף לישבן. עיגולים בצד עמוד השדרה.",benefit:"שינה עמוקה יותר",color:"#EDE7F6"}
];

const BABY_REFLEX_POINTS = [
  {area:"גזים וקוליק",emoji:"💨",color:"#E8F5E9",tc:"#2E7D32",
   foot:{cx:50,cy:60,r:13},
   desc:"מרכז כף הרגל = מעיים. עיגולים קלים בכיוון השעון, לחץ עדין. 10-15 שניות, 3-4 פעמים.",tip:"20 דקות אחרי הנקה"},
  {area:"שינה והרגעה",emoji:"😴",color:"#EDE7F6",tc:"#4527A0",
   foot:{cx:45,cy:15,r:10},
   desc:"פד האגודל = מוח וראש. לחץ עדין עם גלגול. גלגול מהפד לקצה האגודל.",tip:"בחדר חשוך, לפני אמבטיה"},
  {area:"שיניים (teething)",emoji:"🦷",color:"#FFF3E0",tc:"#E65100",
   foot:{cx:50,cy:10,r:8},
   desc:"קצות כל האצבעות = לסת ושיניים. לחץ עגול קל על פד כל אצבע. עיסוי מהבסיס לקצה.",tip:"מועיל גם לאחר חיסונים"},
  {area:"נזלת וצפצוף",emoji:"🤧",color:"#E3F2FD",tc:"#1565C0",
   foot:{cx:35,cy:30,r:9},
   desc:"מדיאלית לאצבע הקטנה = ריאות. תנועת V עדינה כלפי מטה. 3-5 דקות כל צד.",tip:"שמרי ראש גבוה לאחר"}
];

function BabyWorld() {
  const [subTab,setSubTab]=useState('massage');
  const [massageStep,setMassageStep]=useState(0);
  const [animFrame,setAnimFrame]=useState(0);
  const [rxSelected,setRxSelected]=useState(null);
  const [playing,setPlaying]=useState(null);
  const nodesRef=useRef({});
  const animRef=useRef(null);

  useEffect(()=>{
    animRef.current=setInterval(()=>setAnimFrame(f=>(f+1)%3),800);
    return()=>clearInterval(animRef.current);
  },[]);

  const [sleepLog,setSleepLog]=useState([]);
  const [sleepActive,setSleepActive]=useState(false);
  const [sleepStart,setSleepStart]=useState(null);
  const [sleepType,setSleepType]=useState('לילה');
  const [sleepElapsed,setSleepElapsed]=useState(0);
  const sleepRef=React.useRef(null);
  React.useEffect(()=>{
    if(sleepActive){sleepRef.current=setInterval(()=>setSleepElapsed(e=>e+1),1000);}
    else{clearInterval(sleepRef.current);}
    return()=>clearInterval(sleepRef.current);
  },[sleepActive]);
  function startSleep(){setSleepActive(true);setSleepStart(new Date());}
  function endSleep(){
    if(!sleepStart)return;
    const dur=sleepElapsed;
    setSleepLog(p=>[{id:Date.now(),type:sleepType,dur,start:sleepStart.toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'}),date:sleepStart.toLocaleDateString('he-IL')},...p].slice(0,30));
    setSleepActive(false);setSleepStart(null);setSleepElapsed(0);
  }
  function playNoise(noiseId){
    if(playing===noiseId){
      if(nodesRef.current[noiseId]){try{nodesRef.current[noiseId].src.stop();}catch(e){}delete nodesRef.current[noiseId];}
      setPlaying(null);return;
    }
    if(playing&&nodesRef.current[playing]){try{nodesRef.current[playing].src.stop();}catch(e){}delete nodesRef.current[playing];}
    try{
      const ctx=new(window.AudioContext||window.webkitAudioContext)();
      const graph=buildNoiseGraph(ctx,noiseId);
      graph.src.start();
      nodesRef.current[noiseId]={src:graph.src,ctx};
      setPlaying(noiseId);
    }catch(e){alert('לא ניתן להפעיל שמע');}
  }
  useEffect(()=>()=>{Object.values(nodesRef.current).forEach(n=>{try{n.src.stop();}catch(e){}});},[]);

  const step=BABY_MASSAGE_STEPS[massageStep];
  const [peeLog,setPeeLog]=useState([]);
  const [poopLog,setPoopLog]=useState([]);
  const [weightLog,setWeightLog]=useState([]);
  const [newWeight,setNewWeight]=useState('');
  const [openVax,setOpenVax]=useState(null);
  const today=new Date().toLocaleDateString('he-IL');
  const todayPee=peeLog.filter(p=>p.date===today).length;
  const todayPoop=poopLog.filter(p=>p.date===today).length;
  const subTabs=[{id:'massage',lb:'💆 עיסוי'},{id:'reflex',lb:'👣 רפלקסולוגיה'},{id:'bath',lb:'🛁 אמבטיה'},{id:'tracking',lb:'📊 מעקב'},{id:'poop',lb:'💩 מדריך קקי'},{id:'sleep',lb:'🌙 שינה'},{id:'vaccines',lb:'💉 חיסונים'},{id:'whitenoise',lb:'🔊 רעש לבן'},{id:'weather',lb:'🌤️ לבוש'}];

  return (
    <div>
      <div style={{background:`linear-gradient(135deg,#E8F4E8,${C.cr})`,borderRadius:16,padding:20,marginBottom:16,textAlign:'center'}}>
        <div style={{fontSize:36}}>👶</div>
        <div style={{fontFamily:'Georgia,serif',fontSize:22,color:C.br,marginTop:6}}>הכל לתינוק</div>
      </div>
      <div style={{display:'flex',gap:6,marginBottom:16,flexWrap:'wrap'}}>
        {subTabs.map(t=><button key={t.id} onClick={()=>setSubTab(t.id)} style={{padding:'6px 12px',borderRadius:20,border:`1px solid ${subTab===t.id?C.t:C.cd}`,background:subTab===t.id?C.t:'white',color:subTab===t.id?'white':C.tx,cursor:'pointer',fontSize:12,fontFamily:'inherit'}}>{t.lb}</button>)}
      </div>

      {subTab==='massage'&&(
        <div>
          <div style={{...card,background:'#E8F4E8'}}><div style={{fontSize:13,color:'#2E7D32',lineHeight:1.7}}><strong>💚 למה עיסוי?</strong> עיסוי יומי 15 דקות מגביר משקל, מקל על קוליק, משפר שינה ומחזק קשר – במיוחד לאבא!</div></div>
          <div style={card}>
            <div style={{display:'flex',gap:8,marginBottom:16,flexWrap:'wrap'}}>
              {BABY_MASSAGE_STEPS.map((s,i)=><button key={i} onClick={()=>setMassageStep(i)} style={{padding:'6px 12px',borderRadius:20,border:`1px solid ${massageStep===i?C.t:C.cd}`,background:massageStep===i?C.t:'white',color:massageStep===i?'white':C.tx,cursor:'pointer',fontSize:12,fontFamily:'inherit'}}>{s.emoji} {s.step}</button>)}
            </div>
            <div style={{background:step.color,borderRadius:14,padding:20,textAlign:'center',marginBottom:12}}>
              <div style={{fontSize:48,marginBottom:8}}>{step.emoji}</div>
              <div style={{fontFamily:'Georgia,serif',fontSize:22,color:C.br,marginBottom:12}}>{step.step}</div>
              <div style={{display:'flex',justifyContent:'center',gap:12,marginBottom:16}}>
                {step.animation.map((a,i)=>(
                  <div key={i} style={{padding:'8px 14px',borderRadius:10,background:animFrame===i?C.t:'rgba(255,255,255,0.7)',color:animFrame===i?'white':C.br,fontSize:14,fontWeight:animFrame===i?600:400,transition:'all 0.3s',transform:animFrame===i?'scale(1.1)':'scale(1)'}}>
                    {a}
                  </div>
                ))}
              </div>
              <div style={{fontSize:13,color:C.tx,lineHeight:1.7,textAlign:'right',marginBottom:8}}>{step.desc}</div>
              <div style={{background:'rgba(255,255,255,0.7)',borderRadius:8,padding:'6px 12px',fontSize:12,color:'#2E7D32'}}>✅ {step.benefit}</div>
            </div>
            <div style={{display:'flex',gap:10}}>
              <button onClick={()=>setMassageStep(p=>Math.max(0,p-1))} disabled={massageStep===0} style={{flex:1,padding:10,border:'none',borderRadius:10,background:massageStep===0?C.cd:C.sg,color:'white',cursor:massageStep===0?'default':'pointer',fontFamily:'inherit',fontSize:14}}>← הקודם</button>
              <button onClick={()=>setMassageStep(p=>Math.min(BABY_MASSAGE_STEPS.length-1,p+1))} disabled={massageStep===BABY_MASSAGE_STEPS.length-1} style={{flex:1,padding:10,border:'none',borderRadius:10,background:massageStep===BABY_MASSAGE_STEPS.length-1?C.cd:C.t,color:'white',cursor:massageStep===BABY_MASSAGE_STEPS.length-1?'default':'pointer',fontFamily:'inherit',fontSize:14}}>הבא →</button>
            </div>
          </div>
          <div style={{...card,background:'#FFF8E1'}}><div style={{fontSize:13,color:'#5D4037',lineHeight:1.8}}><strong>⏰ מתי?</strong> 45 דקות אחרי אוכל | תינוק ער ורגוע | לפני אמבטיה<br/><strong>🫙 שמן:</strong> קוקוס, שקדים, חמניות</div></div>
        </div>
      )}

      {subTab==='reflex'&&(
        <div>
          <div style={{...card,marginBottom:12}}><div style={ttl}>👣 רפלקסולוגיה לתינוקות</div><div style={bdy}>בחרי מה מציק לתינוק – ותראי בדיוק איפה ללחוץ.</div></div>
          <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:8,marginBottom:12}}>
            {BABY_REFLEX_POINTS.map(pt=>(
              <div key={pt.area} onClick={()=>setRxSelected(rxSelected===pt.area?null:pt.area)} style={{background:rxSelected===pt.area?pt.color:'white',borderRadius:12,padding:12,cursor:'pointer',border:`2px solid ${rxSelected===pt.area?pt.tc:C.cd}`,textAlign:'center'}}>
                <div style={{fontSize:24,marginBottom:4}}>{pt.emoji}</div>
                <div style={{fontSize:12,fontWeight:500,color:rxSelected===pt.area?pt.tc:C.br}}>{pt.area}</div>
              </div>
            ))}
          </div>
          {rxSelected&&(()=>{
            const pt=BABY_REFLEX_POINTS.find(p=>p.area===rxSelected);
            return (
              <div style={{background:pt.color,borderRadius:16,padding:16,border:`1px solid ${pt.tc}44`}}>
                <div style={{textAlign:'center',marginBottom:12}}>
                  <svg viewBox="0 0 100 130" width="110" height="143" style={{display:'block',margin:'0 auto'}}>
                    <ellipse cx="50" cy="90" rx="28" ry="38" fill="#FAD7C0" stroke="#C4785A" strokeWidth="1.5"/>
                    <ellipse cx="50" cy="55" rx="22" ry="30" fill="#FAD7C0" stroke="#C4785A" strokeWidth="1.5"/>
                    {[{cx:37,cy:18,r:5},{cx:46,cy:13,r:5.5},{cx:56,cy:13,r:5},{cx:65,cy:17,r:4.5},{cx:72,cy:23,r:4}].map((t,i)=><ellipse key={i} cx={t.cx} cy={t.cy} rx={t.r} ry={t.r*0.8} fill="#FAD7C0" stroke="#C4785A" strokeWidth="1.2"/>)}
                    <circle cx={pt.foot.cx} cy={pt.foot.cy} r={pt.foot.r} fill={pt.tc} opacity="0.5"/>
                    <circle cx={pt.foot.cx} cy={pt.foot.cy} r={pt.foot.r*0.55} fill={pt.tc} opacity="0.8"/>
                    <circle cx={pt.foot.cx} cy={pt.foot.cy} r={3} fill="white"/>
                    <text x={pt.foot.cx} y={pt.foot.cy+1} textAnchor="middle" dominantBaseline="middle" fontSize="5" fill="white">✓</text>
                  </svg>
                </div>
                <div style={{fontFamily:'Georgia,serif',fontSize:17,color:pt.tc,marginBottom:8,textAlign:'center'}}>{pt.emoji} {pt.area}</div>
                <div style={{fontSize:13,lineHeight:1.8,color:C.tx,marginBottom:8}}>{pt.desc}</div>
                <div style={{background:'rgba(255,255,255,0.7)',borderRadius:8,padding:'7px 10px',fontSize:12,color:pt.tc}}>💡 הכי יעיל: {pt.tip}</div>
              </div>
            );
          })()}
        </div>
      )}

      {subTab==='tracking'&&(
        <div>
          <div style={card}>
            <div style={ttl}>📊 מעקב פיפי וקקי – יומי</div>
            <div style={{display:'flex',gap:8,marginBottom:16}}>
              <button onClick={()=>setPeeLog(p=>[{id:Date.now(),time:new Date().toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'}),date:new Date().toLocaleDateString('he-IL')},...p].slice(0,60))} style={{flex:1,padding:10,border:'none',borderRadius:10,background:'#E3F2FD',cursor:'pointer',fontSize:13,fontFamily:'inherit'}}>💧 הוסיפי פיפי</button>
              <button onClick={()=>setPoopLog(p=>[{id:Date.now(),time:new Date().toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'}),date:new Date().toLocaleDateString('he-IL')},...p].slice(0,60))} style={{flex:1,padding:10,border:'none',borderRadius:10,background:'#FFF8E1',cursor:'pointer',fontSize:13,fontFamily:'inherit'}}>💩 הוסיפי קקי</button>
            </div>
            <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:10,marginBottom:12}}>
              <div style={{background:'#E3F2FD',borderRadius:10,padding:12,textAlign:'center'}}>
                <div style={{fontSize:24}}>💧</div>
                <div style={{fontSize:24,fontWeight:700,color:'#1565C0'}}>{todayPee}</div>
                <div style={{fontSize:12,color:C.txl}}>פיפי היום</div>
              </div>
              <div style={{background:'#FFF8E1',borderRadius:10,padding:12,textAlign:'center'}}>
                <div style={{fontSize:24}}>💩</div>
                <div style={{fontSize:24,fontWeight:700,color:'#E65100'}}>{todayPoop}</div>
                <div style={{fontSize:12,color:C.txl}}>קקי היום</div>
              </div>
            </div>
            <div style={{fontSize:12,color:C.txl,background:C.cr,borderRadius:8,padding:10,lineHeight:1.7}}>
              💧 פיפי: 6+ חיתולים רטובים מיום 5 ואילך הוא נורמה תקינה<br/>
              💩 קקי: מקוניום (ירוק/שחור) בימים 1-2, מתחיל להצהיב מיום 4-5
            </div>
            {(peeLog.length>0||poopLog.length>0)&&(
              <div style={{marginTop:12}}>
                <div style={{fontSize:12,fontWeight:600,color:C.br,marginBottom:6}}>היסטוריה אחרונה:</div>
                {[...peeLog.map(p=>({...p,kind:'pee'})),...poopLog.map(p=>({...p,kind:'poop'}))].sort((a,b)=>b.id-a.id).slice(0,8).map(e=>(
                  <div key={e.id} style={{display:'flex',justifyContent:'space-between',padding:'5px 0',borderBottom:`1px solid ${C.cd}`,fontSize:12}}>
                    {e.kind==='pee'?<span>💧 פיפי</span>:<span>💩 קקי</span>}
                    <span style={{color:C.txl}}>{e.date} · {e.time}</span>
                  </div>
                ))}
              </div>
            )}
          </div>
          <div style={card}>
            <div style={ttl}>⚖️ יומן משקל תינוק</div>
            <div style={{display:'flex',gap:8,marginBottom:12}}>
              <input value={newWeight} onChange={e=>setNewWeight(e.target.value)} placeholder="משקל בגרמים" type="number" style={{flex:1,padding:'9px 12px',border:`1px solid ${C.cd}`,borderRadius:8,fontFamily:'inherit',fontSize:14,background:C.cr,outline:'none'}}/>
              <button onClick={()=>{if(newWeight){setWeightLog(p=>[{id:Date.now(),w:+newWeight,date:new Date().toLocaleDateString('he-IL')},...p].slice(0,14));setNewWeight('');}}} style={{padding:'9px 14px',background:C.t,color:'white',border:'none',borderRadius:8,cursor:'pointer',fontFamily:'inherit',fontSize:14}}>הוסיפי</button>
            </div>
            {weightLog.map((entry,i)=><div key={entry.id} style={{display:'flex',justifyContent:'space-between',padding:'8px 0',borderBottom:`1px solid ${C.cd}`,fontSize:13}}><span style={{color:C.txl}}>{entry.date}</span><span style={{fontWeight:500,color:C.br}}>{entry.w}ג׳</span>{i>0&&<span style={{color:entry.w>=weightLog[i-1].w?'#2E7D32':'#C62828',fontSize:12}}>{entry.w>=weightLog[i-1].w?'↑':'↓'}{Math.abs(entry.w-weightLog[i-1].w)}ג׳</span>}</div>)}
            <div style={{fontSize:12,color:C.txl,marginTop:8}}>💡 ירידה עד 10% – נורמלי. חזרה למשקל לידה תוך 10-14 יום.</div>
          </div>
        </div>
      )}

      {subTab==='poop'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#FFF8E1,${C.cr})`}}>
            <div style={ttl}>💩 מדריך קקי לתינוק</div>
            <div style={bdy}>מה נורמלי ומה לא, לפי גיל וצבע</div>
          </div>
          <div style={{...card,background:'#E3F2FD'}}>
            <div style={{fontSize:13,color:'#1565C0',display:'flex',justifyContent:'space-between',alignItems:'center'}}>
              <span>📊 רוצה לתעד פיפי וקקי היום? עברי ללשונית "מעקב"</span>
              <button onClick={()=>setSubTab('tracking')} style={{padding:'6px 12px',background:'#1565C0',color:'white',border:'none',borderRadius:8,fontSize:12,cursor:'pointer',fontFamily:'inherit',flexShrink:0}}>מעקב ←</button>
            </div>
          </div>
          {[
            {age:"ימים 1-2 (מקוניום)",color:"#1A1A2E",textColor:'white',desc:"צבע שחור-ירקרק, מרוח, דביק כמו זפת. זה הקקי הראשון – נורמלי לחלוטין ומעיד שהמעי מתחיל לעבוד."},
            {age:"ימים 3-5 (מעבר)",color:"#6D4C41",textColor:'white',desc:"צבע ירוק-חום-צהבהב, פחות דביק. שלב מעבר בין מקוניום לקקי החלב."},
            {age:"מיום 5 (הנקה)",color:"#FBC02D",textColor:'#5D4037',desc:"צהוב-חרדלי, רך, גרגירי, לעיתים נוזלי. ריח קל-חמצמץ. זה הנורמה לתינוק יונק."},
            {age:"תינוק על תחליף",color:"#A1887F",textColor:'white',desc:"חום-צהבהב, סמיך יותר מתינוק יונק, ריח חזק יותר. תדירות נמוכה יותר."}
          ].map((p,i)=>(
            <div key={i} style={{display:'flex',gap:12,alignItems:'center',background:'white',borderRadius:12,padding:12,marginBottom:8,border:`1px solid ${C.cd}`}}>
              <div style={{width:44,height:44,borderRadius:12,background:p.color,flexShrink:0,display:'flex',alignItems:'center',justifyContent:'center',color:p.textColor,fontSize:18}}>💩</div>
              <div>
                <div style={{fontWeight:700,color:C.br,fontSize:13,marginBottom:2}}>{p.age}</div>
                <div style={{fontSize:12,color:C.txl,lineHeight:1.6}}>{p.desc}</div>
              </div>
            </div>
          ))}
          <div style={card}>
            <div style={ttl}>📅 תדירות תקינה</div>
            <div style={{fontSize:13,color:C.tx,lineHeight:1.8}}>
              <strong>שבועות 0-6:</strong> לרוב לאחר כל הנקה – אפילו 6-8 ביום, או לעיתים פעם ב-2-3 ימים (גם זה תקין אם רך).<br/>
              <strong>מ-שבוע 6:</strong> תדירות יכולה לרדת מאוד – פעם ביום עד פעם בכמה ימים, כל עוד הקקי רך וללא מאמץ.
            </div>
          </div>
          <div style={{...card,background:'#FFEBEE'}}>
            <div style={{...ttl,color:'#C62828'}}>🚨 מה לא נורמלי – פני לרופא/ה</div>
            <div style={{fontSize:13,color:C.tx,lineHeight:1.8}}>
              • קקי לבן/אפור – ייתכן בעיה בכבד, דורש בדיקה דחופה<br/>
              • קקי שחור אחרי גיל 2-3 ימים (ולא מקוניום)<br/>
              • דם בקקי (אדום או שחור-דביק)<br/>
              • שלשול חזק ומימי במיוחד<br/>
              • עצירות עם כדורי קקי קשים וכאב במאמץ
            </div>
          </div>
        </div>
      )}

      {subTab==='vaccines'&&(
        <div>
          <div style={card}><div style={ttl}>💉 לוח חיסונים</div></div>
          {VACCINE_SCHEDULE.map((v,i)=>(
            <div key={i} style={{border:`1px solid ${C.cd}`,borderRadius:12,overflow:'hidden',marginBottom:8}}>
              <div onClick={()=>setOpenVax(openVax===i?null:i)} style={{padding:'12px 16px',display:'flex',justifyContent:'space-between',alignItems:'center',cursor:'pointer',background:openVax===i?C.cr:'white'}}>
                <div style={{fontWeight:500,color:C.br,fontSize:14}}>{v.age}</div>
                <span style={{color:C.txl}}>{openVax===i?'▲':'▼'}</span>
              </div>
              {openVax===i&&<div style={{padding:'10px 16px',background:C.cr}}>{v.vaccines.map((vac,j)=><div key={j} style={{display:'flex',gap:8,padding:'6px 0',fontSize:13}}><span style={{color:C.sg}}>💉</span><span>{vac}</span></div>)}</div>}
            </div>
          ))}
        </div>
      )}

      {subTab==='sleep'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#1A1A2E,#16213E)`,marginBottom:12}}>
            <div style={{...ttl,color:'white'}}>🌙 מעקב שינה לתינוק</div>
            <div style={{fontSize:13,color:'rgba(255,255,255,0.7)'}}>תעדי כל שנת תינוק – תנומות ולילה</div>
          </div>
          <div style={card}>
            <div style={{display:'flex',gap:8,marginBottom:12}}>
              {['לילה','תנומה'].map(t=>(
                <button key={t} onClick={()=>setSleepType(t)} style={{flex:1,padding:9,border:`2px solid ${sleepType===t?C.t:C.cd}`,borderRadius:10,background:sleepType===t?'#FFF0EB':'white',cursor:'pointer',fontFamily:'inherit',fontSize:13,fontWeight:sleepType===t?600:400}}>
                  {t==='לילה'?'☾':'⏾'} {t}
                </button>
              ))}
            </div>
            {!sleepActive?(
              <button onClick={startSleep} style={{width:'100%',padding:14,background:'#1A1A2E',color:'white',border:'none',borderRadius:12,fontFamily:'inherit',fontSize:15,cursor:'pointer'}}>
                🌙 התחלת שינה
              </button>
            ):(
              <div style={{textAlign:'center',background:'#1A1A2E',borderRadius:12,padding:20}}>
                <div style={{fontSize:13,color:'rgba(255,255,255,0.6)',marginBottom:4}}>{sleepType} פעיל</div>
                <div style={{fontFamily:'inherit',fontSize:48,fontWeight:700,color:'white'}}>{fmt(sleepElapsed)}</div>
                <div style={{fontSize:12,color:'rgba(255,255,255,0.5)',marginTop:4}}>התחיל: {sleepStart?.toLocaleTimeString('he-IL',{hour:'2-digit',minute:'2-digit'})}</div>
                <button onClick={endSleep} style={{marginTop:12,padding:'10px 28px',background:C.sg,color:'white',border:'none',borderRadius:20,fontFamily:'inherit',fontSize:14,cursor:'pointer'}}>
                  ☀️ סיום שינה
                </button>
              </div>
            )}
          </div>
          {sleepLog.length>0&&(
            <div style={card}>
              <div style={ttl}>📊 יומן שינה</div>
              {(()=>{
                const today=sleepLog.filter(s=>s.date===new Date().toLocaleDateString('he-IL'));
                const totalToday=today.reduce((sum,s)=>sum+s.dur,0);
                const nights=today.filter(s=>s.type==='לילה').reduce((sum,s)=>sum+s.dur,0);
                const naps=today.filter(s=>s.type==='תנומה').reduce((sum,s)=>sum+s.dur,0);
                return (
                  <div style={{display:'grid',gridTemplateColumns:'1fr 1fr 1fr',gap:8,marginBottom:12}}>
                    {[['סהכ היום',fmt(totalToday),'#1A1A2E'],['שינת לילה',fmt(nights),'#3949AB'],['תנומות',fmt(naps),'#8A9E8C']].map(([l,v,c])=>(
                      <div key={l} style={{background:c,borderRadius:10,padding:'10px 6px',textAlign:'center'}}>
                        <div style={{fontSize:16,fontWeight:700,color:'white'}}>{v}</div>
                        <div style={{fontSize:10,color:'rgba(255,255,255,0.7)',marginTop:2}}>{l}</div>
                      </div>
                    ))}
                  </div>
                );
              })()}
              {sleepLog.slice(0,8).map(s=>(
                <div key={s.id} style={{display:'flex',justifyContent:'space-between',padding:'8px 0',borderBottom:`1px solid ${C.cd}`,fontSize:13,alignItems:'center'}}>
                  <span style={{color:C.txl,fontSize:11}}>{s.date} {s.start}</span>
                  <span style={{background:s.type==='לילה'?'#1A1A2E':'#E8F4E8',color:s.type==='לילה'?'white':'#2E7D32',borderRadius:10,padding:'2px 8px',fontSize:11}}>{s.type==='לילה'?'☾':'⏾'} {s.type}</span>
                  <span style={{fontWeight:600,color:C.br}}>{fmt(s.dur)}</span>
                </div>
              ))}
              <div style={{marginTop:8,fontSize:11,color:C.txl}}>
                💡 תינוק עד 3 חודשים: 14-17 שעות שינה ביממה
              </div>
            </div>
          )}
        </div>
      )}
      {subTab==='whitenoise'&&(
        <div>
          <div style={{...card,marginBottom:12}}>
            <div style={ttl}>🔊 רעש לבן מובנה</div>
            <div style={bdy}>כל צליל מיוצר בתדר שונה – מדוייק ואמיתי. לחצי להפעלה.</div>
            {playing&&<div style={{marginTop:8,padding:'6px 12px',background:'#E8F5E9',borderRadius:8,fontSize:13,color:'#2E7D32',textAlign:'center'}}>▶️ מתנגן: {WHITE_NOISES.find(n=>n.id===playing)?.name} – {WHITE_NOISES.find(n=>n.id===playing)?.desc}</div>}
          </div>
          <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:10}}>
            {WHITE_NOISES.map(n=>(
              <div key={n.id} onClick={()=>playNoise(n.id)} style={{background:playing===n.id?C.t:C.cr,borderRadius:14,padding:18,textAlign:'center',cursor:'pointer',border:`2px solid ${playing===n.id?C.br:C.cd}`,transition:'all 0.2s'}}>
                <div style={{fontSize:32,marginBottom:6}}>{n.emoji}</div>
                <div style={{fontSize:14,fontWeight:500,color:playing===n.id?'white':C.br}}>{n.name}</div>
                <div style={{fontSize:11,color:playing===n.id?'rgba(255,255,255,0.85)':C.txl,marginTop:4}}>{n.desc}</div>
                <div style={{fontSize:11,marginTop:6,padding:'3px 8px',borderRadius:10,display:'inline-block',background:playing===n.id?'rgba(255,255,255,0.2)':'white',color:playing===n.id?'white':C.t}}>{playing===n.id?'⏹ עצרי':'▶ הפעילי'}</div>
              </div>
            ))}
          </div>
          <div style={{...card,marginTop:8,background:'#E8F4E8'}}><div style={{fontSize:13,color:'#2E7D32',lineHeight:1.8}}><strong>💚 טיפים:</strong><br/>• עוצמה: כ-50-60 dB<br/>• מרחק: לפחות 2 מטר<br/>• לא כל הלילה – הפחיתי בהדרגה</div></div>
        </div>
      )}
      {subTab==='bath'&&(
        <div>
          <div style={{...card,background:`linear-gradient(135deg,#E3F2FD,${C.cr})`,marginBottom:12}}>
            <div style={ttl}>🛁 אמבטיה לתינוק</div>
            <div style={bdy}>מדריך מלא – ממתי, איך ולמה אמבטיה היא הרבה יותר מסתם רחיצה!</div>
          </div>
          {BABY_BATH.map((item,i)=>(
            <div key={i} style={{...card,padding:14}}>
              <div style={{display:'flex',alignItems:'flex-start',gap:10}}>
                <div style={{fontSize:28,flexShrink:0}}>{item.emoji}</div>
                <div>
                  <div style={{fontFamily:'Georgia,serif',fontSize:15,color:C.br,marginBottom:6}}>{item.title}</div>
                  <div style={{fontSize:13,lineHeight:1.7,color:C.txl}}>{item.desc}</div>
                </div>
              </div>
            </div>
          ))}
        </div>
      )}
      {subTab==='weather'&&<WeatherDressing/>}
    </div>
  );
}


function Journal() {
  const [tab,setTab]=useState('entries');
  const [entries,setEntries]=useState([{id:1,date:'לפני 3 ימים',week:26,mood:'😊',text:'הרגשתי את התינוק מתהפך הלילה!'}]);
  const [text,setText]=useState('');
  const [mood,setMood]=useState('');
  const [week,setWeek]=useState(28);
  const [weights,setWeights]=useState([]);
  const [newWt,setNewWt]=useState('');
  const [newWtWeek,setNewWtWeek]=useState(20);
  const [bellyWeek,setBellyWeek]=useState(20);
  const [bellyPhotos,setBellyPhotos]=useState({});
  const moods=['😊','😴','😰','🥰','😤','😢','✨'];

  function add(){if(!text.trim())return;setEntries(p=>[{id:Date.now(),date:'עכשיו',week,mood:mood||'📝',text:text.trim()},...p]);setText('');setMood('');}
  function addWt(){if(!newWt)return;setWeights(p=>[...p,{id:Date.now(),week:newWtWeek,kg:+newWt}].sort((a,b)=>a.week-b.week));setNewWt('');}

  const jTabs=[{id:'entries',lb:'📝 יומן'},{id:'belly',lb:'🤰 תמונות בטן'},{id:'weight',lb:'⚖️ משקל'}];

  // Belly size data per week (fun visual)
  const bellyStages={
    4:'🌱',8:'🌿',12:'🍀',16:'💫',20:'🌸',24:'🌺',28:'🌷',32:'🌼',36:'🌻',40:'🌹'
  };
  const getBelly=(w)=>{const ks=Object.keys(bellyStages).map(Number).sort((a,b)=>a-b);let b=ks[0];for(const k of ks){if(k<=w)b=k;}return bellyStages[b];};
  const getBellySize=(w)=>{
    if(w<=8)return{desc:"בטן כמעט לא נראית",r:18};
    if(w<=12)return{desc:"הרחם עולה מעל האגן",r:24};
    if(w<=16)return{desc:"בליטה קטנה מתחת לטבור",r:30};
    if(w<=20)return{desc:"הבטן מורגשת בבירור",r:38};
    if(w<=24)return{desc:"בטן עגולה וברורה",r:46};
    if(w<=28)return{desc:"הטבור מתחיל לצאת",r:54};
    if(w<=32)return{desc:"בטן גדולה ומלאה",r:62};
    if(w<=36)return{desc:"ירידה קלה – הראש יורד",r:66};
    return{desc:"בטן בשיא – כמעט שם!",r:70};
  };
  const bs=getBellySize(bellyWeek);

  return (
    <div>
      <div style={{display:'flex',gap:6,marginBottom:16}}>
        {jTabs.map(t=><button key={t.id} onClick={()=>setTab(t.id)} style={{flex:1,padding:'8px 4px',border:`1px solid ${tab===t.id?C.t:C.cd}`,borderRadius:10,background:tab===t.id?C.t:'white',color:tab===t.id?'white':C.tx,cursor:'pointer',fontFamily:'inherit',fontSize:12,fontWeight:tab===t.id?600:400}}>{t.lb}</button>)}
      </div>

      {tab==='entries'&&(
        <div>
          <div style={card}>
            <div style={ttl}>✍️ כתיבה חדשה</div>
            <div style={{display:'flex',alignItems:'center',gap:10,marginBottom:10}}>
              <span style={{fontSize:13,color:C.txl}}>שבוע</span>
              <input type="number" min={4} max={42} value={week} onChange={e=>setWeek(+e.target.value)} style={{width:60,padding:'6px 8px',border:`1px solid ${C.cd}`,borderRadius:8,fontFamily:'inherit',fontSize:14,background:C.cr,outline:'none'}}/>
            </div>
            <div style={{display:'flex',gap:8,marginBottom:10,flexWrap:'wrap'}}>
              {moods.map(m=><button key={m} onClick={()=>setMood(m)} style={{padding:'6px 12px',borderRadius:20,border:`2px solid ${mood===m?C.t:C.cd}`,background:mood===m?'#FFF0EB':'white',cursor:'pointer',fontSize:14}}>{m}</button>)}
            </div>
            <textarea value={text} onChange={e=>setText(e.target.value)} placeholder="מה עובר עליך היום?..." style={{width:'100%',minHeight:120,padding:12,border:`1px solid ${C.cd}`,borderRadius:10,fontFamily:'inherit',fontSize:14,background:C.cr,resize:'vertical',outline:'none'}}/>
            <button onClick={add} style={{width:'100%',padding:12,background:C.t,color:'white',border:'none',borderRadius:10,fontFamily:'inherit',fontSize:14,cursor:'pointer',marginTop:10}}>💾 שמרי</button>
          </div>
          {entries.map(e=>(
            <div key={e.id} style={{background:C.cr,borderRadius:10,padding:14,marginBottom:10,borderRight:`3px solid ${C.tl}`}}>
              <div style={{display:'flex',justifyContent:'space-between',marginBottom:6,fontSize:12,color:C.txl}}>
                <span>{e.mood} שבוע {e.week}</span>
                <div style={{display:'flex',gap:8,alignItems:'center'}}>
                  <span>{e.date}</span>
                  <button onClick={()=>setEntries(p=>p.filter(x=>x.id!==e.id))} style={{background:'none',border:'none',cursor:'pointer',color:'#CCC',fontSize:16}}>✕</button>
                </div>
              </div>
              <div style={{fontSize:14,lineHeight:1.6}}>{e.text}</div>
            </div>
          ))}
        </div>
      )}

      {tab==='belly'&&(
        <div>
          <div style={card}>
            <div style={ttl}>🤰 תמונות בטן לפי שבוע</div>
            <div style={{fontSize:13,color:C.txl,marginBottom:12}}>העלי תמונת בטן כל שבוע ובני גלריה של המסע שלך</div>
            <div style={{display:'flex',alignItems:'center',gap:12,marginBottom:16}}>
              <span style={{fontSize:13,color:C.txl,flexShrink:0}}>שבוע</span>
              <input type="range" min={4} max={40} value={bellyWeek} onChange={e=>setBellyWeek(+e.target.value)} style={{flex:1,accentColor:C.t}}/>
              <div style={{background:C.t,color:'white',borderRadius:20,padding:'4px 12px',fontSize:14,fontWeight:500,flexShrink:0}}>שב׳ {bellyWeek}</div>
            </div>
            <div style={{marginBottom:16}}>
              <input type="file" accept="image/*" id="belly-upload" style={{display:'none'}} onChange={e=>{
                const file=e.target.files[0];if(!file)return;
                const reader=new FileReader();
                reader.onload=ev=>setBellyPhotos(p=>({...p,[bellyWeek]:ev.target.result}));
                reader.readAsDataURL(file);
              }}/>
              {bellyPhotos[bellyWeek]?(
                <div style={{position:'relative',textAlign:'center'}}>
                  <img src={bellyPhotos[bellyWeek]} alt={`שבוע ${bellyWeek}`} style={{width:'100%',maxHeight:280,objectFit:'cover',borderRadius:12}}/>
                  <div style={{marginTop:6,fontSize:12,color:C.txl}}>שבוע {bellyWeek} ❤️</div>
                  <label htmlFor="belly-upload" style={{display:'inline-block',marginTop:6,padding:'6px 14px',background:C.cd,borderRadius:15,fontSize:12,cursor:'pointer',color:C.txl}}>החלפי תמונה</label>
                </div>
              ):(
                <label htmlFor="belly-upload" style={{display:'flex',flexDirection:'column',alignItems:'center',justifyContent:'center',gap:8,border:`2px dashed ${C.tl}`,borderRadius:12,padding:24,cursor:'pointer',background:'#FFF8F5'}}>
                  <div style={{fontSize:40}}>📷</div>
                  <div style={{fontSize:14,fontWeight:600,color:C.br}}>העלי תמונת בטן לשבוע {bellyWeek}</div>
                  <div style={{fontSize:12,color:C.txl}}>לחצי כדי לבחור תמונה מהגלריה</div>
                </label>
              )}
            </div>
            {Object.keys(bellyPhotos).length>0&&(
              <div style={{marginBottom:12}}>
                <div style={{fontSize:13,fontWeight:600,color:C.br,marginBottom:8}}>הגלריה שלך ({Object.keys(bellyPhotos).length} תמונות)</div>
                <div style={{display:'flex',gap:8,overflowX:'auto',paddingBottom:4}}>
                  {Object.entries(bellyPhotos).sort(([a],[b])=>+a-+b).map(([w,src])=>(
                    <div key={w} onClick={()=>setBellyWeek(+w)} style={{flexShrink:0,textAlign:'center',cursor:'pointer'}}>
                      <img src={src} alt={`שב׳ ${w}`} style={{width:70,height:70,objectFit:'cover',borderRadius:10,border:`2px solid ${+w===bellyWeek?C.t:C.cd}`}}/>
                      <div style={{fontSize:10,color:+w===bellyWeek?C.t:C.txl,marginTop:2}}>שב׳ {w}</div>
                    </div>
                  ))}
                </div>
              </div>
            )}
            <div style={{textAlign:'center',padding:'20px 0'}}>
              <svg viewBox="0 0 200 220" width="200" height="220" style={{display:'block',margin:'0 auto'}}>
                {/* Body silhouette */}
                <ellipse cx="100" cy="32" rx="22" ry="22" fill="#FAD7C0" stroke="#C4785A" strokeWidth="1.5"/>
                <ellipse cx="100" cy="30" rx="14" ry="10" fill="#8B5E52" opacity="0.6"/>
                {/* Torso */}
                <path d={`M 68 52 Q 100 46 132 52 L 134 ${100+Math.min(bs.r*0.3,25)} Q 100 ${108+Math.min(bs.r*0.35,28)} 66 ${100+Math.min(bs.r*0.3,25)} Z`} fill="#C4785A" opacity="0.8"/>
                {/* Belly */}
                <ellipse cx={102} cy={110+bs.r*0.4} rx={bs.r} ry={bs.r*0.85} fill="#FAD7C0" stroke="#C4785A" strokeWidth="1.5"/>
                {/* Belly button */}
                {bellyWeek>=20&&<ellipse cx={104} cy={104+bs.r*0.2} rx={3} ry={bellyWeek>=32?4:2} fill="#C4785A" opacity="0.5"/>}
                {/* Legs */}
                <line x1="82" y1={145+Math.min(bs.r*0.4,28)} x2="72" y2="210" stroke="#FAD7C0" strokeWidth="14" strokeLinecap="round"/>
                <line x1="118" y1={145+Math.min(bs.r*0.4,28)} x2="128" y2="210" stroke="#FAD7C0" strokeWidth="14" strokeLinecap="round"/>
                {/* Arms */}
                {bellyWeek>=24&&<path d="M 68 70 Q 48 90 44 115 Q 58 125 66 118 Q 68 100 72 88Z" fill="#FAD7C0"/>}
                {bellyWeek>=24&&<path d="M 132 70 Q 152 90 156 115 Q 142 125 134 118 Q 132 100 128 88Z" fill="#FAD7C0"/>}
              </svg>
              <div style={{marginTop:8}}>
                <div style={{fontSize:36,marginBottom:4}}>{getBelly(bellyWeek)}</div>
                <div style={{fontFamily:'inherit',fontSize:16,fontWeight:700,color:C.br}}>שבוע {bellyWeek}</div>
                <div style={{fontSize:13,color:C.txl,marginTop:4}}>{bs.desc}</div>
              </div>
            </div>
            <div style={{background:C.cr,borderRadius:10,padding:12,marginTop:8,fontSize:12,color:C.txl,textAlign:'center'}}>
              💡 שמרי תמונה אמיתית מהגלריה כדי להשוות! בכל שבוע מאותה תנוחה ובאותה בגד.
            </div>
          </div>
        </div>
      )}

      {tab==='weight'&&(
        <div>
          <div style={card}>
            <div style={ttl}>⚖️ מעקב משקל בהריון</div>
            <div style={{display:'flex',gap:8,marginBottom:12,alignItems:'flex-end'}}>
              <div style={{flex:1}}>
                <div style={{fontSize:11,color:C.txl,marginBottom:4}}>שבוע</div>
                <input type="number" min={4} max={42} value={newWtWeek} onChange={e=>setNewWtWeek(+e.target.value)} style={{width:'100%',padding:'8px 10px',border:`1px solid ${C.cd}`,borderRadius:8,fontFamily:'inherit',fontSize:14,background:C.cr,outline:'none'}}/>
              </div>
              <div style={{flex:1}}>
                <div style={{fontSize:11,color:C.txl,marginBottom:4}}>משקל (קג)</div>
                <input type="number" min={40} max={150} step={0.1} value={newWt} onChange={e=>setNewWt(e.target.value)} placeholder="65.5" style={{width:'100%',padding:'8px 10px',border:`1px solid ${C.cd}`,borderRadius:8,fontFamily:'inherit',fontSize:14,background:C.cr,outline:'none'}}/>
              </div>
              <button onClick={addWt} style={{padding:'9px 14px',background:C.t,color:'white',border:'none',borderRadius:8,cursor:'pointer',fontFamily:'inherit',fontSize:14,flexShrink:0}}>+</button>
            </div>
            {weights.length>=2&&(
              <div style={{background:C.cr,borderRadius:10,padding:12,marginBottom:12}}>
                <div style={{position:'relative',height:120,marginBottom:8}}>
                  <div style={{position:'absolute',bottom:0,left:0,right:0,height:1,background:C.cd}}/>
                  {weights.map((w,i)=>{
                    const minW=Math.min(...weights.map(x=>x.kg));
                    const maxW=Math.max(...weights.map(x=>x.kg));
                    const range=maxW-minW||1;
                    const x=(i/(weights.length-1))*90+5;
                    const y=100-((w.kg-minW)/range)*80;
                    return(
                      <div key={w.id} style={{position:'absolute',bottom:100-y,left:`${x}%`,transform:'translateX(-50%)'}}>
                        <div style={{width:8,height:8,background:C.t,borderRadius:'50%'}}/>
                        <div style={{fontSize:9,color:C.txl,textAlign:'center',marginTop:2}}>{w.kg}</div>
                      </div>
                    );
                  })}
                </div>
                <div style={{fontSize:12,color:C.txl,textAlign:'center'}}>
                  עלייה כוללת: <strong style={{color:C.br}}>{(weights[weights.length-1].kg-weights[0].kg).toFixed(1)} קג</strong>
                </div>
              </div>
            )}
            {weights.map((w,i)=>(
              <div key={w.id} style={{display:'flex',justifyContent:'space-between',padding:'8px 0',borderBottom:`1px solid ${C.cd}`,fontSize:13,alignItems:'center'}}>
                <span style={{color:C.txl}}>שב׳ {w.week}</span>
                <span style={{fontWeight:600,color:C.br}}>{w.kg} קג</span>
                {i>0&&<span style={{fontSize:12,color:w.kg>=weights[i-1].kg?'#E65100':'#2E7D32'}}>
                  {w.kg>=weights[i-1].kg?'+':''}{(w.kg-weights[i-1].kg).toFixed(1)}
                </span>}
                <button onClick={()=>setWeights(p=>p.filter(x=>x.id!==w.id))} style={{background:'none',border:'none',cursor:'pointer',color:'#CCC',fontSize:14}}>✕</button>
              </div>
            ))}
            {weights.length===0&&<div style={{color:C.txl,fontSize:13,textAlign:'center',padding:16}}>הוסיפי את המשקל הראשון שלך</div>}
            <div style={{marginTop:10,background:'#E8F4E8',borderRadius:8,padding:'8px 12px',fontSize:12,color:'#2E7D32'}}>
              <strong>עלייה מומלצת:</strong><br/>
              שב׳ 1-12: 1-2 קג | שב׳ 13-28: 0.5 קג/שבוע | שב׳ 29-40: 0.3 קג/שבוע
            </div>
          </div>
        </div>
      )}
    </div>
  );
}

function AIChat() {
  const [msgs,setMsgs]=useState([{r:'ai',t:'שלום! אני דפנה, הדולה הדיגיטלית שלך. שאלי אותי כל מה שעל הלב 💕'}]);
  const [input,setInput]=useState('');const [loading,setLoading]=useState(false);const endRef=useRef(null);
  useEffect(()=>{endRef.current?.scrollIntoView({behavior:'smooth'});},[msgs]);
  async function send(){
    if(!input.trim()||loading)return;
    const txt=input.trim();setInput('');setMsgs(p=>[...p,{r:'user',t:txt}]);setLoading(true);
    try{const history=msgs.map(m=>({role:m.r==='user'?'user':'assistant',content:m.t}));const res=await fetch('https://api.anthropic.com/v1/messages',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({model:'claude-sonnet-4-6',max_tokens:1000,system:'אתה דפנה, דולה ורפלקסולוגית מנוסה. עני בעברית, בחמימות. תשובות קצרות עד 150 מילים. תמיד הדגש שאין להחליף ייעוץ רפואי.',messages:[...history,{role:'user',content:txt}]})});const data=await res.json();setMsgs(p=>[...p,{r:'ai',t:data.content?.[0]?.text||'מצטערת, שגיאה.'}]);}catch(e){setMsgs(p=>[...p,{r:'ai',t:'אופס, שגיאה. נסי שוב 🙏'}]);}finally{setLoading(false);}
  }
  return (
    <div style={card}>
      <div style={ttl}>🤖 שאלי את דפנה AI</div>
      <div style={{minHeight:300,maxHeight:400,overflowY:'auto',background:C.cr,borderRadius:12,padding:14,marginBottom:12,display:'flex',flexDirection:'column',gap:10}}>
        {msgs.map((m,i)=><div key={i} style={{maxWidth:'85%',padding:'10px 14px',borderRadius:14,fontSize:14,lineHeight:1.6,background:m.r==='user'?C.t:'white',color:m.r==='user'?'white':C.tx,alignSelf:m.r==='user'?'flex-start':'flex-end',boxShadow:m.r==='ai'?'0 1px 6px rgba(0,0,0,0.08)':'none'}}>{m.t}</div>)}
        {loading&&<div style={{maxWidth:'85%',padding:'10px 14px',borderRadius:14,background:'white',alignSelf:'flex-end',fontSize:14,color:C.txl}}>מקלידה...</div>}
        <div ref={endRef}/>
      </div>
      <div style={{display:'flex',gap:8}}>
        <input value={input} onChange={e=>setInput(e.target.value)} onKeyDown={e=>e.key==='Enter'&&send()} placeholder='שאלי כל שאלה...' style={{flex:1,padding:'11px 14px',border:`1px solid ${C.cd}`,borderRadius:10,fontFamily:'inherit',fontSize:14,background:C.cr,outline:'none'}}/>
        <button onClick={send} disabled={loading} style={{padding:'11px 16px',background:C.t,color:'white',border:'none',borderRadius:10,cursor:'pointer',fontSize:16,flexShrink:0,opacity:loading?0.5:1}}>➤</button>
      </div>
      <div style={{fontSize:11,color:C.txl,textAlign:'center',marginTop:8}}>* המידע לצורכי מידע בלבד ואינו מחליף ייעוץ רפואי</div>
    </div>
  );
}

function BabyNames() {
  const [gender, setGender] = useState('girls');
  const [category, setCategory] = useState('classic');
  const [favorites, setFavorites] = useState([]);
  const [selectedName, setSelectedName] = useState(null);
  const [search, setSearch] = useState('');
  const [lengthFilter, setLengthFilter] = useState('all');
  const [tagFilter, setTagFilter] = useState('all');

  const catLabels = {classic:'קלאסיים', modern:'מודרניים', nature:'טבע', international:'בינלאומיים'};
  const lengthLabels = {all:'הכל', short:'קצרים (2-3)', long:'ארוכים (4+)'};
  const tagLabels = {all:'הכל', biblical:'תנכי׳ים', popular:'פופולריים 2025-26'};

  let names = BABY_NAMES[gender][category] || [];
  if(search) names = names.filter(n => n.includes(search));
  if(lengthFilter==='short') names = names.filter(n => n.length<=3);
  if(lengthFilter==='long') names = names.filter(n => n.length>=4);
  if(tagFilter==='biblical') names = names.filter(n => BIBLICAL_NAMES.includes(n));
  if(tagFilter==='popular') names = names.filter(n => POPULAR_NAMES_2025.includes(n));

  function toggleFav(name) {
    setFavorites(p => p.includes(name) ? p.filter(n=>n!==name) : [...p, name]);
  }

  return (
    <div>
      <div style={{background:`linear-gradient(135deg,${C.br},${C.t})`,borderRadius:16,padding:20,marginBottom:16,textAlign:'center',color:'white'}}>
        <div style={{fontSize:40,marginBottom:6}}>👶✨</div>
        <div style={{fontFamily:'inherit',fontSize:22,fontWeight:700,marginBottom:4}}>רעיונות לשמות</div>
        <div style={{fontSize:13,opacity:0.85}}>סננו, חפשו ולחצו ❤️ על שמות שאהבתם</div>
      </div>

      <div style={{...card,marginBottom:12}}>
        <input value={search} onChange={e=>setSearch(e.target.value)} placeholder="🔍 חיפוש שם..." style={{width:'100%',padding:'10px 14px',border:`1px solid ${C.cd}`,borderRadius:10,fontFamily:'inherit',fontSize:14,background:C.cr,outline:'none',marginBottom:12}}/>
        <div style={{display:'flex',gap:8,marginBottom:10}}>
          <button onClick={()=>setGender('girls')} style={{flex:1,padding:10,border:`2px solid ${gender==='girls'?'#E91E63':C.cd}`,borderRadius:10,background:gender==='girls'?'#FCE4EC':'white',cursor:'pointer',fontFamily:'inherit',fontSize:14,color:gender==='girls'?'#C62828':C.tx}}>👧 בנות</button>
          <button onClick={()=>setGender('boys')} style={{flex:1,padding:10,border:`2px solid ${gender==='boys'?'#1976D2':C.cd}`,borderRadius:10,background:gender==='boys'?'#E3F2FD':'white',cursor:'pointer',fontFamily:'inherit',fontSize:14,color:gender==='boys'?'#1565C0':C.tx}}>👦 בנים</button>
        </div>
        <div style={{fontSize:11,color:C.txl,marginBottom:4,fontWeight:600}}>סטייל</div>
        <div style={{display:'flex',gap:6,flexWrap:'wrap',marginBottom:10}}>
          {Object.entries(catLabels).map(([k,v])=>(
            <button key={k} onClick={()=>setCategory(k)} style={{padding:'5px 12px',borderRadius:20,border:`1px solid ${category===k?C.t:C.cd}`,background:category===k?C.t:'white',color:category===k?'white':C.tx,cursor:'pointer',fontSize:12,fontFamily:'inherit'}}>{v}</button>
          ))}
        </div>
        <div style={{fontSize:11,color:C.txl,marginBottom:4,fontWeight:600}}>אורך השם</div>
        <div style={{display:'flex',gap:6,flexWrap:'wrap',marginBottom:10}}>
          {Object.entries(lengthLabels).map(([k,v])=>(
            <button key={k} onClick={()=>setLengthFilter(k)} style={{padding:'5px 12px',borderRadius:20,border:`1px solid ${lengthFilter===k?C.sg:C.cd}`,background:lengthFilter===k?'#E8F4E8':'white',color:lengthFilter===k?'#2E7D32':C.tx,cursor:'pointer',fontSize:12,fontFamily:'inherit'}}>{v}</button>
          ))}
        </div>
        <div style={{fontSize:11,color:C.txl,marginBottom:4,fontWeight:600}}>מאפיין נוסף</div>
        <div style={{display:'flex',gap:6,flexWrap:'wrap'}}>
          {Object.entries(tagLabels).map(([k,v])=>(
            <button key={k} onClick={()=>setTagFilter(k)} style={{padding:'5px 12px',borderRadius:20,border:`1px solid ${tagFilter===k?'#1976D2':C.cd}`,background:tagFilter===k?'#E3F2FD':'white',color:tagFilter===k?'#1565C0':C.tx,cursor:'pointer',fontSize:12,fontFamily:'inherit'}}>{v}</button>
          ))}
        </div>
      </div>

      {names.length===0 ? (
        <div style={{...card,textAlign:'center',color:C.txl,fontSize:13}}>לא נמצאו שמות התואמים את הסינון. נסי לשנות קריטריונים 🙂</div>
      ) : (
        <div style={{display:'grid',gridTemplateColumns:'1fr 1fr 1fr',gap:8,marginBottom:12}}>
          {names.map((name,i)=>(
            <div key={i} onClick={()=>setSelectedName(name)} style={{background:selectedName===name?'#FFF0EB':favorites.includes(name)?'#FCE4EC':'white',borderRadius:10,padding:'10px 6px',textAlign:'center',cursor:'pointer',border:`2px solid ${selectedName===name?C.t:favorites.includes(name)?'#E91E63':C.cd}`,transition:'all 0.15s'}}>
              <div style={{fontSize:15,fontWeight:favorites.includes(name)?600:400,color:favorites.includes(name)?'#C62828':C.br}}>{name}</div>
              <div style={{display:'flex',justifyContent:'center',gap:3,marginTop:3}}>
                {BIBLICAL_NAMES.includes(name)&&<span style={{fontSize:9}}>📖</span>}
                {POPULAR_NAMES_2025.includes(name)&&<span style={{fontSize:9}}>🔥</span>}
                {favorites.includes(name)&&<span style={{fontSize:12}}>❤️</span>}
              </div>
            </div>
          ))}
        </div>
      )}

      {selectedName && (
        <div style={{...card,border:`2px solid ${C.t}`,marginBottom:16}}>
          <div style={{display:'flex',justifyContent:'space-between',alignItems:'center',marginBottom:6}}>
            <div style={{fontSize:20,fontWeight:700,color:C.br}}>{selectedName}</div>
            <button onClick={()=>toggleFav(selectedName)} style={{background:'none',border:'none',cursor:'pointer',fontSize:22}}>{favorites.includes(selectedName)?'❤️':'🤍'}</button>
          </div>
          <div style={{fontSize:13,color:C.tx,lineHeight:1.7,marginBottom:8}}>
            {NAME_MEANINGS[selectedName] || 'אין לנו עדיין מידע מפורט על משמעות השם הזה, אך זה לא הופך אותו לפחות מיוחד!'}
          </div>
          <div style={{display:'flex',gap:6,flexWrap:'wrap'}}>
            {BIBLICAL_NAMES.includes(selectedName)&&<span style={{fontSize:11,background:'#E3F2FD',color:'#1565C0',borderRadius:8,padding:'3px 10px'}}>📖 שם ממקור תנכי</span>}
            {POPULAR_NAMES_2025.includes(selectedName)&&<span style={{fontSize:11,background:'#FFF3E0',color:'#E65100',borderRadius:8,padding:'3px 10px'}}>🔥 פופולרי 2025-26</span>}
          </div>
        </div>
      )}

      <div style={{display:'flex',gap:12,justifyContent:'center',marginBottom:12,fontSize:11,color:C.txl}}>
        <span>📖 = מקור תנכי</span>
        <span>🔥 = פופולרי 2025-26</span>
      </div>

      {favorites.length > 0 && (
        <div style={card}>
          <div style={ttl}>❤️ השמות שאהבת ({favorites.length})</div>
          <div style={{display:'flex',flexWrap:'wrap',gap:8,marginBottom:12}}>
            {favorites.map(name=>(
              <div key={name} style={{display:'flex',alignItems:'center',gap:6,background:'#FCE4EC',borderRadius:20,padding:'6px 12px',border:'1px solid #F48FB1'}}>
                <span style={{fontSize:14,color:'#C62828',fontWeight:500}}>{name}</span>
                <button onClick={()=>toggleFav(name)} style={{background:'none',border:'none',cursor:'pointer',color:'#E91E63',fontSize:14,padding:0}}>✕</button>
              </div>
            ))}
          </div>
          {favorites.map(name => NAME_MEANINGS[name] && (
            <div key={name} style={{padding:'6px 0',borderBottom:`1px solid ${C.cd}`,fontSize:13}}>
              <strong style={{color:C.br}}>{name}:</strong> <span style={{color:C.txl}}>{NAME_MEANINGS[name]}</span>
            </div>
          ))}
        </div>
      )}

    </div>
  );
}

const COUPONS_DATA = [
  {discount:"10% הנחה",service:"רפלקסולוגיה לנשים",desc:"קוד הנחה לטיפול רפלקסולוגיה ראשון – מתאים גם בהריון וגם לכל אישה.",valid:"בתוקף עד מימוש",code:"BLOOM10",used:false},
  {discount:"15% הנחה",service:"ליווי לידה (דולה)",desc:"הזמינו ליווי לידה מלא וקבלו הנחה על השירות.",valid:"בתוקף עד מימוש",code:"BLOOM15",used:false},
  {discount:"מתנה: עיסוי תינוקות",service:"קורס הכנה ללידה",desc:"בהרשמה לקורס הכנה ללידה – מפגש עיסוי תינוקות מתנה.",valid:"בתוקף עד מימוש",code:"BLOOMBABY",used:false},
  {discount:"5% הנחה",service:"פמה (שיקום גוף אחרי לידה)",desc:"הנחה על טיפול פמה לשיקום הגוף אחרי הלידה.",valid:"בתוקף עד מימוש",code:"BLOOMPEMA",used:false}
];

function Coupons() {
  const [coupons, setCoupons] = useState(COUPONS_DATA.map((c,i)=>({...c,id:i})));
  const [copied, setCopied] = useState(null);

  function copyCode(code, id) {
    navigator.clipboard?.writeText(code).catch(()=>{});
    setCopied(id);
    setTimeout(()=>setCopied(null), 2000);
  }

  const waNumber = "972544521285";

  return (
    <div>
      <div style={{background:`linear-gradient(135deg,#FFF3E0,#FCE4EC)`,borderRadius:16,padding:20,marginBottom:16,textAlign:'center',border:`1px solid ${C.tl}`}}>
        <div style={{fontSize:40,marginBottom:6}}>🎁</div>
        <div style={{fontFamily:'Georgia,serif',fontSize:22,color:C.br,marginBottom:4}}>קופונים והטבות</div>
        <div style={{fontSize:13,color:C.txl}}>הטבות בלעדיות ללקוחות האפליקציה</div>
      </div>
      {coupons.map(c=>(
        <div key={c.id} style={{...card,opacity:c.used?0.6:1,border:`1px solid ${c.used?C.cd:C.tl}`}}>
          <div style={{display:'flex',justifyContent:'space-between',alignItems:'flex-start',marginBottom:10}}>
            <div>
              <div style={{fontFamily:'Georgia,serif',fontSize:18,color:c.used?C.txl:C.br,textDecoration:c.used?'line-through':'none'}}>{c.discount}</div>
              <div style={{fontSize:13,color:C.t,fontWeight:500,marginTop:2}}>{c.service}</div>
            </div>
            <div style={{background:c.used?C.cd:'#FFF3E0',border:`1px solid ${c.used?C.cd:C.tl}`,borderRadius:8,padding:'4px 10px',fontSize:11,color:c.used?C.txl:'#E65100',fontWeight:500}}>{c.used?'נוצל':'פעיל ✓'}</div>
          </div>
          <div style={{fontSize:13,color:C.txl,marginBottom:10,lineHeight:1.6}}>{c.desc}</div>
          <div style={{fontSize:11,color:C.sg,marginBottom:10}}>⏰ {c.valid}</div>
          <div style={{background:C.cr,borderRadius:10,padding:'10px 14px',display:'flex',alignItems:'center',justifyContent:'space-between',marginBottom:10}}>
            <div style={{fontFamily:'monospace',fontSize:18,fontWeight:700,letterSpacing:2,color:C.br}}>{c.code}</div>
            <button onClick={()=>copyCode(c.code,c.id)} style={{padding:'6px 14px',background:copied===c.id?C.sg:C.t,color:'white',border:'none',borderRadius:8,cursor:'pointer',fontFamily:'inherit',fontSize:13,transition:'all 0.2s'}}>{copied===c.id?'✓ הועתק!':'📋 העתקי'}</button>
          </div>
          <div style={{display:'flex',gap:8}}>
            <button onClick={()=>window.open('https://dafnadoula.co.il','_blank')} style={{flex:1,padding:9,background:C.t,color:'white',border:'none',borderRadius:8,cursor:'pointer',fontFamily:'inherit',fontSize:13}}>🌐 מימוש באתר</button>
          </div>
        </div>
      ))}
      <div style={{...card,background:'#E8F4E8',textAlign:'center'}}>
        <div style={{fontSize:13,color:'#2E7D32',lineHeight:1.8}}>
          <strong>🎁 קוד חבר מביאה חבר</strong><br/>
          הפניי חברה לאפליקציה – שתיכן תקבלנה הנחה של 5% על טיפול הבא!<br/>
          <button onClick={()=>{const msg=encodeURIComponent('שלום! ממליצה על אפליקציית דפנה דולה – מלווה הריון ולידה. מדהים! 🌸'); window.open('https://wa.me/?text='+msg,'_blank');}} style={{marginTop:8,padding:'8px 20px',background:'#2E7D32',color:'white',border:'none',borderRadius:20,fontFamily:'inherit',fontSize:13,cursor:'pointer'}}>💚 שתפי חברה</button>
        </div>
      </div>
    </div>
  );
}


const BABY_BATH = [
  {title:"מתי להתחיל לרחוץ?",emoji:"📅",desc:"לפני נפילת גדם חבל הטבור (7-14 יום) – אמבטיית ספוג בלבד. אחרי שהגדם נפל – אמבטייה מלאה."},
  {title:"טמפרטורת המים",emoji:"🌡️",desc:"37-38 מעלות – כמו חום גוף. בדקי עם פרק כף היד, לא אצבעות. מדחום אמבטיה מומלץ."},
  {title:"כמה פעמים בשבוע?",emoji:"📆",desc:"2-3 פעמים בשבוע מספיק לתינוק. רחיצה יומיומית מייבשת עור רך. הכי חשוב: נקיון קפלים ואזור חיתול."},
  {title:"סדר הרחיצה",emoji:"📋",desc:"1. פנים ועיניים (מגבון נפרד לכל עין מהפנים לחוץ) 2. ראש ושיער 3. גוף 4. אזור חיתול אחרון."},
  {title:"מה צריך מוכן?",emoji:"🛁",desc:"מגבת חמה קרובה, חיתול נקי פתוח, בגד מוכן, שמן גוף, שמפו עדין לתינוקות. הכי חשוב: לא לעזוב לרגע!"},
  {title:"שמפו ושמן",emoji:"🧴",desc:"שמפו ללא דמעות, שמן קוקוס או שמן שקדים לאחר הרחיצה. לא סבון רגיל – pH שונה לעור תינוק."},
  {title:"אחרי הרחיצה",emoji:"💆",desc:"ייבוש עדין בטפיחות, לא שפשוף. שמן/קרם בזמן עיסוי קצר. תשומת לב לקפלי צוואר, בית שחי, מפשעה."},
  {title:"רחיצה מרגיעה – טיפ",emoji:"🌙",desc:"אמבטיה חמה שעה לפני שינה = אחת ממערכות השינה הטובות ביותר! הגוף מתקרר אחרי והמוח מבין: זמן שינה."}
];
const NAV_CATS = [
  {
    id:'pregnancy', label:'🤰 הריון', color:'#C4785A',
    tabs:[
      {id:'w',lb:'📅 תוכן שבועי'},
      {id:'spinning',lb:'🧣 Spinning Babies'},
      {id:'booking',lb:'🌸 קביעת טיפול'},
      {id:'cl',lb:'✅ צקליסטים'},
      {id:'cx',lb:'🩺 מצבים רפואיים'},
      {id:'rights',lb:'⚖️ זכויות'},
      {id:'tools',lb:'🛠️ עזרים'},
      {id:'names',lb:'✨ שמות'},
      {id:'wallet',lb:'📋 תיק רפואי'},
      {id:'j',lb:'📝 יומן'},
      {id:'ai',lb:'🤖 AI'},
    ]
  },
  {
    id:'birth', label:'🌊 לידה', color:'#5C3D2E',
    tabs:[
      {id:'stages',lb:'🌊 שלבי לידה'},
      {id:'c',lb:'⏱ טיימר צירים'},
      {id:'bp',lb:'📋 תוכנית לידה'},
      {id:'birthtypes',lb:'🌸 סוגי לידות'},
      {id:'hospitals',lb:'🏥 בית יולדות'},
      {id:'induction',lb:'💉 התערבויות'},
      {id:'birthtools',lb:'🛠️ עזרים ללידה'},
    ]
  },
  {
    id:'postbirth', label:'👶 אחרי לידה', color:'#8A9E8C',
    tabs:[
      {id:'bf',lb:'🤱 הנקה ואחרי לידה'},
      {id:'postpartum',lb:'🌺 התאוששות'},
      {id:'baby',lb:'👶 הכל לתינוק'},
      {id:'nightchat',lb:'🌙 ערות לילה'},
      {id:'coupons',lb:'🎁 קופונים'},
    ]
  }
];
const TABS = NAV_CATS.flatMap(c => c.tabs);


function HamburgerNav({tab, setTab}) {
  const [open, setOpen] = React.useState(false);
  const [activeCat, setActiveCat] = React.useState('pregnancy');

  function handleTab(id) {
    setTab(id);
    setOpen(false);
  }

  const currentCat = NAV_CATS.find(c => c.tabs.some(t => t.id === tab));
  const currentTab = TABS.find(t => t.id === tab);

  return (
    <div style={{position:'sticky',top:64,zIndex:90,background:'white',borderBottom:`1px solid #F0E8DC`}}>
      <div style={{display:'flex',alignItems:'center',justifyContent:'space-between',padding:'10px 16px'}}>
        <div style={{display:'flex',alignItems:'center',gap:8}}>
          <button onClick={()=>setOpen(!open)} style={{background:'none',border:'none',cursor:'pointer',padding:4,display:'flex',flexDirection:'column',gap:4}}>
            <div style={{width:22,height:2,background:'#5C3D2E',borderRadius:2,transition:'all 0.2s',transform:open?'rotate(45deg) translate(4px,4px)':'none'}}/>
            <div style={{width:22,height:2,background:'#5C3D2E',borderRadius:2,opacity:open?0:1,transition:'all 0.2s'}}/>
            <div style={{width:22,height:2,background:'#5C3D2E',borderRadius:2,transition:'all 0.2s',transform:open?'rotate(-45deg) translate(4px,-4px)':'none'}}/>
          </button>
          <button onClick={()=>{setTab('home');setOpen(false);}} style={{display:'flex',alignItems:'center',gap:4,background:tab==='home'?'#FFF0EB':'none',border:'none',cursor:'pointer',borderRadius:8,padding:'4px 8px',fontFamily:'inherit'}}>
            <span style={{fontSize:16}}>🏠</span>
            <span style={{fontSize:13,color:tab==='home'?'#C4785A':'#6B5C54',fontWeight:tab==='home'?600:400}}>בית</span>
          </button>
          {tab!=='home'&&<div style={{fontSize:13,color:'#6B5C54'}}>
            {currentCat&&<span style={{color:currentCat.color,fontWeight:500}}>{currentCat.label}</span>}
            {currentTab&&<span style={{color:'#3A2E28'}}> › {currentTab.lb}</span>}
          </div>}
        </div>
        <div style={{display:'flex',gap:6}}>
          {NAV_CATS.map(cat=>(
            <button key={cat.id} onClick={()=>{setActiveCat(cat.id);if(!open)setOpen(true);}} style={{padding:'5px 10px',borderRadius:15,border:`1px solid ${activeCat===cat.id&&open?cat.color:'#F0E8DC'}`,background:activeCat===cat.id&&open?cat.color+'22':'white',cursor:'pointer',fontFamily:'inherit',fontSize:11,color:activeCat===cat.id&&open?cat.color:'#6B5C54',fontWeight:activeCat===cat.id&&open?500:400}}>
              {cat.label.split(' ')[0]}
            </button>
          ))}
        </div>
      </div>
      {open&&(
        <div style={{background:'white',borderTop:`1px solid #F0E8DC`,boxShadow:'0 4px 20px rgba(92,61,46,0.12)'}}>
          <div style={{display:'flex',borderBottom:`1px solid #F0E8DC`}}>
            {NAV_CATS.map(cat=>(
              <button key={cat.id} onClick={()=>setActiveCat(cat.id)} style={{flex:1,padding:'10px 4px',border:'none',borderBottom:`3px solid ${activeCat===cat.id?cat.color:'transparent'}`,background:'none',cursor:'pointer',fontFamily:'inherit',fontSize:12,color:activeCat===cat.id?cat.color:'#6B5C54',fontWeight:activeCat===cat.id?600:400}}>
                {cat.label}
              </button>
            ))}
          </div>
          <div style={{display:'grid',gridTemplateColumns:'1fr 1fr',gap:0}}>
            {NAV_CATS.find(c=>c.id===activeCat)?.tabs.map(t=>(
              <button key={t.id} onClick={()=>handleTab(t.id)} style={{padding:'12px 14px',border:'none',borderBottom:`1px solid #F0E8DC`,borderLeft:`1px solid #F0E8DC`,background:tab===t.id?'#FFF0EB':'white',cursor:'pointer',fontFamily:'inherit',fontSize:13,color:tab===t.id?'#C4785A':'#3A2E28',fontWeight:tab===t.id?600:400,textAlign:'right'}}>
                {t.lb}
              </button>
            ))}
          </div>
        </div>
      )}
    </div>
  );
}


function App() {
  const [tab,setTab]=useState('home');
  function screen(){
    if(tab==='home')return <Home go={setTab}/>;
    if(tab==='w')return <Weekly/>;
    if(tab==='c')return <Contractions/>;
    if(tab==='stages')return <BirthStages/>;
    if(tab==='spinning')return <SpinningBabies/>;
    if(tab==='bp')return <BirthPlan/>;
    if(tab==='bf')return <Breastfeeding/>;
    if(tab==='induction')return <Induction/>;
    if(tab==='rights')return <Rights/>;
    if(tab==='cl')return <Checklists/>;
    if(tab==='cx')return <Complications/>;
    if(tab==='postpartum')return <PostpartumRecovery/>;
    if(tab==='baby')return <BabyWorld/>;
    if(tab==='tools')return <Tools/>;
    if(tab==='wallet')return <MedicalWallet/>;
    if(tab==='nightchat')return <NightChat/>;
    if(tab==='booking')return <DafnaBooking/>;
    if(tab==='names')return <BabyNames/>;
    if(tab==='coupons')return <Coupons/>;
    if(tab==='birthtypes')return <BirthTypesScreen/>;
    if(tab==='hospitals')return <HospitalGuide/>;
    if(tab==='birthtools')return <BirthTools/>;
    if(tab==='j')return <Journal/>;
    if(tab==='ai')return <AIChat/>;
    return null;
  }
  return (
    <div style={{maxWidth:480,margin:'0 auto',minHeight:'100vh',display:'flex',flexDirection:'column',fontFamily:'"Assistant","Heebo",sans-serif',background:C.cr,direction:'rtl'}}>
      <style>{`@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@300;400;600;700&display=swap');`}</style>
      <div style={{background:C.br,color:C.cr,padding:'14px 20px',display:'flex',alignItems:'center',justifyContent:'space-between',position:'sticky',top:0,zIndex:100}}>
        <div style={{display:'flex',alignItems:'center',gap:10}}>
          <div style={{width:36,height:36,borderRadius:'50%',background:C.t,display:'flex',alignItems:'center',justifyContent:'center',fontSize:18}}>🌸</div>
          <div>
            <div style={{fontFamily:'"Assistant",sans-serif',fontSize:20,fontWeight:700,letterSpacing:'-0.5px'}}>Bloom</div>
            <div style={{fontSize:10,color:C.tl,letterSpacing:'0.5px'}}>מלווה הריון ולידה</div>
          </div>
        </div>
      </div>
      <HamburgerNav tab={tab} setTab={setTab}/>
      <div style={{flex:1,padding:20,paddingBottom:40}}>{screen()}</div>
      <div style={{background:'#FFF8E1',padding:'10px 16px',textAlign:'center',borderTop:`1px solid ${C.cd}`}}>
        <div style={{fontSize:10,color:'#5D4037',lineHeight:1.5}}>⚠️ אפליקציה זו לצורכי מידע בלבד ואינה מחליפה ייעוץ רפואי מקצועי. © Bloom – דפנה דולה</div>
      </div>
    </div>
  );
}
