const { useState, useEffect, useRef, useCallback } = React;
// Framer Motion from CDN (window.Motion is the UMD global name)
const _FM = window.Motion || {};
const motion = _FM.motion || {};
const AnimatePresence = _FM.AnimatePresence || (({ children }) => children);

// ─── BIBLE DATA ───────────────────────────────────────────────────────────────
const BG_API = "https://bible-api.com";
const API_VERSIONS = ["kjv","asv","web","ylt","darby","oeb-us","webbe"];

const BIBLE_VERSIONS = [
  { code: "kjv",   name: "King James Version",               lang: "EN", api: true },
  { code: "asv",   name: "American Standard Version",        lang: "EN", api: true },
  { code: "web",   name: "World English Bible",              lang: "EN", api: true },
  { code: "ylt",   name: "Young's Literal Translation",      lang: "EN", api: true },
  { code: "darby", name: "Darby Translation",                lang: "EN", api: true },
  { code: "oeb-us",name: "Open English Bible (US Ed.)",      lang: "EN", api: true },
  { code: "webbe", name: "World English Bible British Ed.",  lang: "EN", api: true },
  { code: "AMP",   name: "Amplified Bible",                  lang: "EN", api: false },
  { code: "CSB",   name: "Christian Standard Bible",         lang: "EN", api: false },
  { code: "CJB",   name: "Complete Jewish Bible",            lang: "EN", api: false },
  { code: "DRA",   name: "Douay-Rheims (Apocrypha incl.)",  lang: "EN", api: false },
  { code: "ESV",   name: "English Standard Version",         lang: "EN", api: false },
  { code: "GNV",   name: "1599 Geneva Bible",                lang: "EN", api: false },
  { code: "HCSB",  name: "Holman Christian Standard",        lang: "EN", api: false },
  { code: "NABRE", name: "New American Bible (Rev. Ed.)",    lang: "EN", api: false },
  { code: "NASB",  name: "New American Standard Bible",      lang: "EN", api: false },
  { code: "NIV",   name: "New International Version",        lang: "EN", api: false },
  { code: "NKJV",  name: "New King James Version",           lang: "EN", api: false },
  { code: "NLT",   name: "New Living Translation",           lang: "EN", api: false },
  { code: "MSG",   name: "The Message",                      lang: "EN", api: false },
  { code: "RVR60", name: "Reina-Valera 1960",                lang: "ES", api: false },
  { code: "NVI",   name: "Nueva Versión Internacional",      lang: "ES", api: false },
];

const OT_BOOKS = [
  {name:"Genesis",ch:50},{name:"Exodus",ch:40},{name:"Leviticus",ch:27},{name:"Numbers",ch:36},
  {name:"Deuteronomy",ch:34},{name:"Joshua",ch:24},{name:"Judges",ch:21},{name:"Ruth",ch:4},
  {name:"1 Samuel",ch:31},{name:"2 Samuel",ch:24},{name:"1 Kings",ch:22},{name:"2 Kings",ch:25},
  {name:"1 Chronicles",ch:29},{name:"2 Chronicles",ch:36},{name:"Ezra",ch:10},{name:"Nehemiah",ch:13},
  {name:"Esther",ch:10},{name:"Job",ch:42},{name:"Psalms",ch:150},{name:"Proverbs",ch:31},
  {name:"Ecclesiastes",ch:12},{name:"Song of Solomon",ch:8},{name:"Isaiah",ch:66},{name:"Jeremiah",ch:52},
  {name:"Lamentations",ch:5},{name:"Ezekiel",ch:48},{name:"Daniel",ch:12},{name:"Hosea",ch:14},
  {name:"Joel",ch:3},{name:"Amos",ch:9},{name:"Obadiah",ch:1},{name:"Jonah",ch:4},{name:"Micah",ch:7},
  {name:"Nahum",ch:3},{name:"Habakkuk",ch:3},{name:"Zephaniah",ch:3},{name:"Haggai",ch:2},
  {name:"Zechariah",ch:14},{name:"Malachi",ch:4},
];
const NT_BOOKS = [
  {name:"Matthew",ch:28},{name:"Mark",ch:16},{name:"Luke",ch:24},{name:"John",ch:21},
  {name:"Acts",ch:28},{name:"Romans",ch:16},{name:"1 Corinthians",ch:16},{name:"2 Corinthians",ch:13},
  {name:"Galatians",ch:6},{name:"Ephesians",ch:6},{name:"Philippians",ch:4},{name:"Colossians",ch:4},
  {name:"1 Thessalonians",ch:5},{name:"2 Thessalonians",ch:3},{name:"1 Timothy",ch:6},
  {name:"2 Timothy",ch:4},{name:"Titus",ch:3},{name:"Philemon",ch:1},{name:"Hebrews",ch:13},
  {name:"James",ch:5},{name:"1 Peter",ch:5},{name:"2 Peter",ch:3},{name:"1 John",ch:5},
  {name:"2 John",ch:1},{name:"3 John",ch:1},{name:"Jude",ch:1},{name:"Revelation",ch:22},
];
const APOCRYPHA_BOOKS = [
  {name:"1 Esdras",ch:9,note:"Also 3 Ezra"},{name:"2 Esdras",ch:16,note:"Apocalypse of Ezra"},
  {name:"Tobit",ch:14,note:"Deuterocanonical"},{name:"Judith",ch:16,note:"Deuterocanonical"},
  {name:"Wisdom of Solomon",ch:19,note:"Book of Wisdom"},{name:"Sirach",ch:51,note:"Ben Sira / Ecclesiasticus"},
  {name:"Baruch",ch:6,note:"Incl. Letter of Jeremiah"},{name:"1 Maccabees",ch:16,note:"Deuterocanonical"},
  {name:"2 Maccabees",ch:15,note:"Deuterocanonical"},{name:"3 Maccabees",ch:7,note:"Orthodox canon"},
  {name:"4 Maccabees",ch:18,note:"Orthodox traditions"},{name:"1 Enoch",ch:108,note:"Ethiopian Orthodox / DSS"},
  {name:"2 Enoch",ch:73,note:"Slavonic Enoch"},{name:"Jubilees",ch:50,note:"Ethiopian Orthodox / DSS"},
  {name:"Prayer of Manasseh",ch:1,note:"Bible appendix"},{name:"Psalm 151",ch:1,note:"Septuagint"},
  {name:"Psalms of Solomon",ch:18,note:"Pseudepigraphal"},{name:"Odes of Solomon",ch:42,note:"Early Christian"},
  {name:"Ascension of Isaiah",ch:11,note:"Ethiopian canon"},
];

const FEATURED_PASSAGES = {
  "genesis 1":{ref:"Genesis 1",cat:"OT",verses:[{v:1,t:"In the beginning God created the heaven and the earth."},{v:2,t:"And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters."},{v:3,t:"And God said, Let there be light: and there was light."},{v:26,t:"And God said, Let us make man in our image, after our likeness."},{v:27,t:"So God created man in his own image, in the image of God created he him; male and female created he them."},{v:31,t:"And God saw every thing that he had made, and, behold, it was very good."}]},
  "exodus 20":{ref:"Exodus 20 (Ten Commandments)",cat:"OT",verses:[{v:1,t:"And God spake all these words, saying,"},{v:2,t:"I am the LORD thy God, which have brought thee out of the land of Egypt, out of the house of bondage."},{v:3,t:"Thou shalt have no other gods before me."},{v:8,t:"Remember the sabbath day, to keep it holy."},{v:12,t:"Honour thy father and thy mother: that thy days may be long upon the land which the LORD thy God giveth thee."}]},
  "deuteronomy 28":{ref:"Deuteronomy 28",cat:"OT",verses:[{v:1,t:"And it shall come to pass, if thou shalt hearken diligently unto the voice of the LORD thy God, to observe and to do all his commandments which I command thee this day, that the LORD thy God will set thee on high above all nations of the earth:"},{v:2,t:"And all these blessings shall come on thee, and overtake thee, if thou shalt hearken unto the voice of the LORD thy God."},{v:6,t:"Blessed shalt thou be when thou comest in, and blessed shalt thou be when thou goest out."},{v:15,t:"But it shall come to pass, if thou wilt not hearken unto the voice of the LORD thy God, to observe to do all his commandments and his statutes which I command thee this day; that all these curses shall come upon thee, and overtake thee:"}]},
  "psalm 23":{ref:"Psalm 23",cat:"OT",verses:[{v:1,t:"The LORD is my shepherd; I shall not want."},{v:2,t:"He maketh me to lie down in green pastures: he leadeth me beside the still waters."},{v:3,t:"He restoreth my soul: he leadeth me in the paths of righteousness for his name's sake."},{v:4,t:"Yea, though I walk through the valley of the shadow of death, I will fear no evil: for thou art with me; thy rod and thy staff they comfort me."},{v:5,t:"Thou preparest a table before me in the presence of mine enemies: thou anointest my head with oil; my cup runneth over."},{v:6,t:"Surely goodness and mercy shall follow me all the days of my life: and I will dwell in the house of the LORD for ever."}]},
  "psalm 91":{ref:"Psalm 91",cat:"OT",verses:[{v:1,t:"He that dwelleth in the secret place of the most High shall abide under the shadow of the Almighty."},{v:2,t:"I will say of the LORD, He is my refuge and my fortress: my God; in him will I trust."},{v:4,t:"He shall cover thee with his feathers, and under his wings shalt thou trust: his truth shall be thy shield and buckler."},{v:11,t:"For he shall give his angels charge over thee, to keep thee in all thy ways."}]},
  "psalm 119":{ref:"Psalm 119:1–16",cat:"OT",verses:[{v:1,t:"Blessed are the undefiled in the way, who walk in the law of the LORD."},{v:2,t:"Blessed are they that keep his testimonies, and that seek him with the whole heart."},{v:11,t:"Thy word have I hid in mine heart, that I might not sin against thee."},{v:105,t:"Thy word is a lamp unto my feet, and a light unto my path."}]},
  "proverbs 3":{ref:"Proverbs 3",cat:"OT",verses:[{v:5,t:"Trust in the LORD with all thine heart; and lean not unto thine own understanding."},{v:6,t:"In all thy ways acknowledge him, and he shall direct thy paths."},{v:7,t:"Be not wise in thine own eyes: fear the LORD, and depart from evil."}]},
  "isaiah 40":{ref:"Isaiah 40",cat:"OT",verses:[{v:28,t:"Hast thou not known? hast thou not heard, that the everlasting God, the LORD, the Creator of the ends of the earth, fainteth not, neither is weary?"},{v:29,t:"He giveth power to the faint; and to them that have no might he increaseth strength."},{v:31,t:"But they that wait upon the LORD shall renew their strength; they shall mount up with wings as eagles; they shall run, and not be weary; and they shall walk, and not faint."}]},
  "isaiah 58":{ref:"Isaiah 58",cat:"OT",verses:[{v:6,t:"Is not this the fast that I have chosen? to loose the bands of wickedness, to undo the heavy burdens, and to let the oppressed go free, and that ye break every yoke?"},{v:13,t:"If thou turn away thy foot from the sabbath, from doing thy pleasure on my holy day; and call the sabbath a delight, the holy of the LORD, honourable..."},{v:14,t:"Then shalt thou delight thyself in the LORD; and I will cause thee to ride upon the high places of the earth..."}]},
  "jeremiah 6":{ref:"Jeremiah 6:16",cat:"OT",verses:[{v:16,t:"Thus saith the LORD, Stand ye in the ways, and see, and ask for the old paths, where is the good way, and walk therein, and ye shall find rest for your souls. But they said, We will not walk therein."}]},
  "jeremiah 29":{ref:"Jeremiah 29:11–13",cat:"OT",verses:[{v:11,t:"For I know the thoughts that I think toward you, saith the LORD, thoughts of peace, and not of evil, to give you an expected end."},{v:12,t:"Then shall ye call upon me, and ye shall go and pray unto me, and I will hearken unto you."},{v:13,t:"And ye shall seek me, and find me, when ye shall search for me with all your heart."}]},
  "ezekiel 37":{ref:"Ezekiel 37 (Valley of Dry Bones)",cat:"OT",verses:[{v:3,t:"And he said unto me, Son of man, can these bones live? And I answered, O Lord GOD, thou knowest."},{v:4,t:"Again he said unto me, Prophesy upon these bones, and say unto them, O ye dry bones, hear the word of the LORD."},{v:14,t:"And shall put my spirit in you, and ye shall live, and I shall place you in your own land..."}]},
  "daniel 3":{ref:"Daniel 3 (Fiery Furnace)",cat:"OT",verses:[{v:17,t:"If it be so, our God whom we serve is able to deliver us from the burning fiery furnace, and he will deliver us out of thine hand, O king."},{v:18,t:"But if not, be it known unto thee, O king, that we will not serve thy gods, nor worship the golden image which thou hast set up."},{v:25,t:"He answered and said, Lo, I see four men loose, walking in the midst of the fire, and they have no hurt; and the form of the fourth is like the Son of God."}]},
  "zephaniah 1":{ref:"Zephaniah 1",cat:"OT",verses:[{v:14,t:"The great day of the LORD is near, it is near, and hasteth greatly, even the voice of the day of the LORD: the mighty man shall cry there bitterly."},{v:18,t:"Neither their silver nor their gold shall be able to deliver them in the day of the LORD's wrath; but the whole land shall be devoured by the fire of his jealousy."}]},
  "matthew 5":{ref:"Matthew 5 (Beatitudes)",cat:"NT",verses:[{v:3,t:"Blessed are the poor in spirit: for theirs is the kingdom of heaven."},{v:5,t:"Blessed are the meek: for they shall inherit the earth."},{v:8,t:"Blessed are the pure in heart: for they shall see God."},{v:17,t:"Think not that I am come to destroy the law, or the prophets: I am not come to destroy, but to fulfil."},{v:18,t:"For verily I say unto you, Till heaven and earth pass, one jot or one tittle shall in no wise pass from the law, till all be fulfilled."}]},
  "john 1":{ref:"John 1",cat:"NT",verses:[{v:1,t:"In the beginning was the Word, and the Word was with God, and the Word was God."},{v:3,t:"All things were made by him; and without him was not any thing made that was made."},{v:14,t:"And the Word was made flesh, and dwelt among us, (and we beheld his glory, the glory as of the only begotten of the Father,) full of grace and truth."}]},
  "john 3":{ref:"John 3",cat:"NT",verses:[{v:3,t:"Jesus answered and said unto him, Verily, verily, I say unto thee, Except a man be born again, he cannot see the kingdom of God."},{v:16,t:"For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life."},{v:17,t:"For God sent not his Son into the world to condemn the world; but that the world through him might be saved."}]},
  "john 9":{ref:"John 9:31",cat:"NT",verses:[{v:31,t:"Now we know that God heareth not sinners: but if any man be a worshipper of God, and doeth his will, him he heareth."}]},
  "romans 6":{ref:"Romans 6",cat:"NT",verses:[{v:2,t:"God forbid. How shall we, that are dead to sin, live any longer therein?"},{v:14,t:"For sin shall not have dominion over you: for ye are not under the law, but under grace."},{v:23,t:"For the wages of sin is death; but the gift of God is eternal life through Jesus Christ our Lord."}]},
  "hebrews 10":{ref:"Hebrews 10",cat:"NT",verses:[{v:10,t:"By the which will we are sanctified through the offering of the body of Jesus Christ once for all."},{v:24,t:"And let us consider one another to provoke unto love and to good works:"},{v:25,t:"Not forsaking the assembling of ourselves together, as the manner of some is; but exhorting one another: and so much the more, as ye see the day approaching."}]},
  "james 1":{ref:"James 1",cat:"NT",verses:[{v:2,t:"My brethren, count it all joy when ye fall into divers temptations;"},{v:3,t:"Knowing this, that the trying of your faith worketh patience."},{v:22,t:"But be ye doers of the word, and not hearers only, deceiving your own selves."}]},
  "james 2":{ref:"James 2",cat:"NT",verses:[{v:14,t:"What doth it profit, my brethren, though a man say he hath faith, and have not works? can faith save him?"},{v:17,t:"Even so faith, if it hath not works, is dead, being alone."},{v:26,t:"For as the body without the spirit is dead, so faith without works is dead also."}]},
  "1 peter 5":{ref:"1 Peter 5",cat:"NT",verses:[{v:6,t:"Humble yourselves therefore under the mighty hand of God, that he may exalt you in due time:"},{v:7,t:"Casting all your care upon him; for he careth for you."},{v:8,t:"Be sober, be vigilant; because your adversary the devil, as a roaring lion, walketh about, seeking whom he may devour:"}]},
  "revelation 1":{ref:"Revelation 1",cat:"NT",verses:[{v:7,t:"Behold, he cometh with clouds; and every eye shall see him, and they also which pierced him: and all kindreds of the earth shall wail because of him. Even so, Amen."},{v:8,t:"I am Alpha and Omega, the beginning and the ending, saith the Lord, which is, and which was, and which is to come, the Almighty."}]},
  "revelation 21":{ref:"Revelation 21",cat:"NT",verses:[{v:1,t:"And I saw a new heaven and a new earth: for the first heaven and the first earth were passed away; and there was no more sea."},{v:3,t:"And I heard a great voice out of heaven saying, Behold, the tabernacle of God is with men, and he will dwell with them, and they shall be his people..."},{v:4,t:"And God shall wipe away all tears from their eyes; and there shall be no more death, neither sorrow, nor crying, neither shall there be any more pain: for the former things are passed away."}]},
  "revelation 22":{ref:"Revelation 22 (Final Chapter)",cat:"NT",verses:[{v:13,t:"I am Alpha and Omega, the beginning and the end, the first and the last."},{v:17,t:"And the Spirit and the bride say, Come. And let him that heareth say, Come. And let him that is athirst come. And whosoever will, let him take the water of life freely."},{v:20,t:"He which testifieth these things saith, Surely I come quickly. Amen. Even so, come, Lord Jesus."},{v:21,t:"The grace of our Lord Jesus Christ be with you all. Amen."}]},
  "sirach 2":{ref:"Sirach 2",cat:"APO",verses:[{v:1,t:"My son, if thou come to serve the Lord, prepare thy soul for temptation."},{v:4,t:"Whatsoever is brought upon thee take cheerfully, and be patient when thou art changed to a low estate."},{v:6,t:"Trust in him, and he will help thee; order thy way aright, and trust in him."}]},
  "sirach 25":{ref:"Sirach 25",cat:"APO",verses:[{v:1,t:"In three things I was beautified, and stood up beautiful both before God and men: the unity of brethren, and the love of neighbours, a man and a wife that agree together."},{v:12,t:"The fear of the Lord is the beginning of love: and faith is the beginning of cleaving unto him."}]},
  "baruch 4":{ref:"Baruch 4",cat:"APO",verses:[{v:1,t:"This is the book of the commandments of God, and the law that endureth for ever: all they that keep it shall come to life; but such as leave it shall die."},{v:2,t:"Turn thee, O Jacob, and take hold of it: walk in the presence of the light thereof, that thou mayest be illuminated."},{v:28,t:"For as it was your mind to go astray from God: so, being returned, seek him ten times more."}]},
  "wisdom of solomon 3":{ref:"Wisdom of Solomon 3",cat:"APO",verses:[{v:1,t:"But the souls of the righteous are in the hand of God, and there shall no torment touch them."},{v:3,t:"In the sight of the unwise they seemed to die: and their departure is taken for misery."},{v:9,t:"They that put their trust in him shall understand the truth: and such as be faithful in love shall abide with him."}]},
  "tobit 4":{ref:"Tobit 4",cat:"APO",verses:[{v:5,t:"My son, be mindful of the Lord our God all thy days, and let not thy will be set to sin, or to transgress his commandments."},{v:7,t:"Give alms of thy substance; and when thou givest alms, let not thine eye be envious, neither turn thy face from any poor man..."},{v:15,t:"Do that to no man which thou hatest: drink not wine to make thee drunken."}]},
  "2 esdras 6":{ref:"2 Esdras 6",cat:"APO",verses:[{v:1,t:"And he said unto me, In the beginning, when the earth was made, before the borders of the world stood, or ever the winds blew,"},{v:6,t:"Before the innumerable multitude of angels were gathered together, or ever the heights of the air were lifted up..."},{v:55,t:"All this have I spoken before thee, O Lord, because thou madest the world for our sakes."}]},
  "1 enoch 1":{ref:"1 Enoch 1",cat:"APO",verses:[{v:1,t:"The words of the blessing of Enoch, wherewith he blessed the elect and righteous, who will be living in the day of tribulation..."},{v:9,t:"And behold! He cometh with ten thousands of His holy ones to execute judgment upon all, and to destroy all the ungodly..."}]},
  "jubilees 1":{ref:"Jubilees 1",cat:"APO",verses:[{v:1,t:"And it came to pass in the first year of the exodus of the children of Israel out of Egypt, in the third month, on the sixteenth day of the month, that God spake to Moses..."},{v:24,t:"And the LORD said unto Moses, I know their contrariness and their thoughts and their stiffneckedness, and they will not be obedient till they confess their own sin and the sin of their fathers."}]},
};

const FEATURED_GROUPS = [
  { label:"Old Testament", keys:["genesis 1","exodus 20","deuteronomy 28","psalm 23","psalm 91","psalm 119","proverbs 3","isaiah 40","isaiah 58","jeremiah 6","jeremiah 29","ezekiel 37","daniel 3","zephaniah 1"] },
  { label:"New Testament", keys:["matthew 5","john 1","john 3","john 9","romans 6","hebrews 10","james 1","james 2","1 peter 5","revelation 1","revelation 21","revelation 22"] },
  { label:"Apocrypha ✦",  keys:["sirach 2","sirach 25","baruch 4","wisdom of solomon 3","tobit 4","2 esdras 6","1 enoch 1","jubilees 1"] },
];

async function fetchPassageFromAPI(query, version = "kjv") {
  const v = API_VERSIONS.includes(version.toLowerCase()) ? version.toLowerCase() : "kjv";
  const res = await fetch(`${BG_API}/${encodeURIComponent(query)}?translation=${v}`);
  if (!res.ok) throw new Error("Not found");
  const data = await res.json();
  return { ref: data.reference, version: v.toUpperCase(), verses: data.verses.map(v2 => ({ v: v2.verse, t: v2.text.trim() })), fromAPI: true };
}

// ─── WEEKLY STUDY DATA ────────────────────────────────────────────────────────
// Rock Did It 15-Month Aligned · Spirit → Body → Mind order
const SEASON_COLORS = {
  "Phase 0 — Awakening":       "#C4893A",
  "Phase 1 — Identity":        "#6B8F5E",
  "Phase 2 — Execution":       "#7B5EA7",
  "Phase 3 — Expansion":       "#8B3A2A",
  "Phase 4 — Legacy":          "#1B3A5C",
};

// Shabbat class flow used by every lesson
const SHABBAT_FLOW = [
  { step:1, label:"Opening Prayer",    time:"5 min",  icon:"🙏" },
  { step:2, label:"Scripture Reading", time:"10 min", icon:"📖" },
  { step:3, label:"Teaching",          time:"20 min", icon:"🎙️" },
  { step:4, label:"Group Discussion",  time:"15 min", icon:"💬" },
  { step:5, label:"Testimony Sharing", time:"8 min",  icon:"✨" },
  { step:6, label:"Closing Prayer",    time:"5 min",  icon:"🕯️" },
];

// Live streaming platforms & schedule
const LIVE_STREAMS = [
  {
    id:"youtube", name:"YouTube Live", icon:"▶️",
    color:"#FF0000", handle:"@realrockdidit",
    url:"https://youtube.com/@realrockdidit?si=dGvLW3lX0OptVFC7",
    channelUrl:"https://youtube.com/@realrockdidit?si=dGvLW3lX0OptVFC7",
    embedBase:"https://www.youtube.com/embed/live_stream?channel=",
    channelId:"UCrealrockdidit",
    desc:"Full Shabbat class replay + archive",
    features:["Live chat","Replay archive","Auto-captions","Super Thanks"],
    subscribeUrl:"https://youtube.com/@realrockdidit?si=dGvLW3lX0OptVFC7",
  },
  {
    id:"facebook", name:"Facebook Live", icon:"📘",
    color:"#1877F2", handle:"GodDidItBibleClub",
    url:"https://www.facebook.com/GodDidItBibleClub/live",
    desc:"Community watch parties + comments",
    features:["Live reactions","Share to feed","Comment wall","Watch parties"],
  },
  {
    id:"instagram", name:"Instagram Live", icon:"📸",
    color:"#E1306C", handle:"@GodDidItBibleClub",
    url:"https://www.instagram.com/GodDidItBibleClub",
    desc:"Short clips + behind-the-scenes",
    features:["Live badges","Q&A sticker","Countdown","Collab live"],
  },
  {
    id:"zoom", name:"Zoom Shabbat Class", icon:"💻",
    color:"#2D8CFF", handle:"Members Only",
    url:"https://zoom.us/j/goddiditbibleclub", // replace with real link
    desc:"Interactive class with breakout rooms",
    features:["Breakout rooms","Hand raise Q&A","Whiteboard","Recording"],
  },
  {
    id:"rumble", name:"Rumble", icon:"🎬",
    color:"#85C742", handle:"GodDidItBibleClub",
    url:"https://rumble.com/c/GodDidItBibleClub",
    desc:"Uncensored archive & live streams",
    features:["No censorship","Monetization","RSS feed","Downloads"],
  },
];

// Weekly Shabbat class schedule
const SHABBAT_SCHEDULE = [
  { id:1, day:"Every Friday",     time:"7:00 PM CST",  title:"Erev Shabbat — Opening Prayer & Scripture Reading",  type:"prayer",    platforms:["zoom","youtube"],          reminder:"Set reminder 30 min before" },
  { id:2, day:"Every Saturday",   time:"10:00 AM CST", title:"Shabbat Morning Study — Full 60-Min Class",          type:"main",      platforms:["youtube","facebook","zoom"], reminder:"This is the main weekly class" },
  { id:3, day:"Every Saturday",   time:"12:00 PM CST", title:"Shabbat Q&A — Open Discussion",                      type:"qa",        platforms:["instagram","zoom"],          reminder:"Bring your questions" },
  { id:4, day:"Every Wednesday",  time:"8:00 PM CST",  title:"Midweek Prayer & Intercession",                      type:"prayer",    platforms:["zoom","youtube"],           reminder:"Corporate prayer call" },
  { id:5, day:"Monthly",          time:"First Saturday 2:00 PM CST", title:"Deep Study — Special Topic Session",   type:"special",   platforms:["youtube","facebook","zoom"], reminder:"Extended 90-minute session" },
];

// Color maps — defined early so HomePage and LiveStreamPage can both use them
const PLATFORM_COLORS = { youtube:"#FF0000", facebook:"#1877F2", instagram:"#E1306C", zoom:"#2D8CFF", rumble:"#85C742" };
const SCHEDULE_TYPE_COLORS = { main:"#C4893A", prayer:"#5A7A52", qa:"#7B5EA7", special:"#8B3A2A" };

const WEEKLY_STUDIES = [
  // ── PHASE 0: AWAKENING — Sept–Dec · Breaking the Old Identity ────────────────
  { week:"Week 1",  phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"September", title:"Awakening — Hearing the Call", anchor:"Isaiah 6 · Joel 2 · Romans 13:11 · Revelation 3:2", summary:"God awakens leaders when nations sleep. This opening study calls every member out of spiritual slumber and into covenant alertness. The call has come — the question is whether we will answer.", takeaways:["God awakens His leaders first — before He moves the nations.","Spiritual sleep is broken by the sound of the trumpet and the word.","Answering the call requires immediate movement, not delayed response."], topics:["awakening","call","prophecy","joel","isaiah","romans"], color:"#C4893A", teaching:"God awakens leaders when nations sleep.", reflection:"What has God been calling you toward that you have been putting off? What is the cost of continued sleep?", assignment:"Complete a personal life audit — write down 3 areas where you have been spiritually asleep and what awakening looks like in each.", action:"Do a full personal life audit this week. Write your findings before next Shabbat." },
  { week:"Week 2",  phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"September", title:"Awakening — The Sound That Moves Nations", anchor:"Joel 2:1–11 · Ezekiel 33:6 · Isaiah 58:1 · 2 Esdras 6", summary:"The prophetic alarm is not just a warning — it is an invitation to be positioned before the storm arrives. This study equips the remnant to hear, respond, and prepare.", takeaways:["The watchman sounds before judgment — not after.","Every great move of God was preceded by a prophetic alarm.","Position is not passive — it requires active preparation and prayer."], topics:["watchman","alarm","prophecy","preparation","remnant"], color:"#C4893A", teaching:"The watchman who hears and does not warn is held accountable.", reflection:"Are you positioned as a watchman in your family, community, or calling?", assignment:"Read Joel 2 in full. Write out 3 ways the trumpet call applies to your life right now.", action:"Begin a daily morning prayer practice this week — even 10 minutes before the household wakes." },
  { week:"Week 3",  phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"October", title:"Repentance — Returning to God", anchor:"Acts 3:19 · Psalm 51 · Joel 2:12–13 · Luke 15", summary:"Repentance restores authority. This is not a study on guilt — it is a study on power. The prodigal who returns receives a robe, a ring, and a feast. Covenant restoration begins with turning.", takeaways:["True repentance is not emotion — it is direction change.","Authority in the Kingdom flows through broken and contrite hearts.","Every covenant promise is unlocked by the act of genuine return."], topics:["repentance","return","authority","covenant","psalm 51","luke 15"], color:"#C4893A", teaching:"Repentance restores authority. The returning son receives a robe and a ring.", reflection:"Is there an area of your life where you have been trying to walk in authority without first walking in repentance?", assignment:"Write a repentance prayer using Psalm 51 as your framework — personalize every verse.", action:"Fast one meal this week in connection with your repentance prayer. Bring your written prayer to class." },
  { week:"Week 4",  phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"October", title:"Repentance — Covenant Reset", anchor:"Baruch 2 · Ezekiel 18 · Nehemiah 9 · Hosea 6:1", summary:"A national repentance framework drawn from the exile and return. This study examines how entire families and communities can reset their covenant standing through collective turning.", takeaways:["Individual repentance is powerful — corporate repentance is transformative.","The Nehemiah model shows how leaders carry the repentance of their people.","Covenant reset is not just spiritual — it reshapes daily habits and household order."], topics:["repentance","corporate","nehemiah","baruch","ezekiel","covenant reset"], color:"#C4893A", teaching:"Leaders carry the repentance of their people — Nehemiah stood in the gap.", reflection:"What would a family-level or community-level covenant reset look like for your household?", assignment:"Lead your household in a brief covenant reset prayer this week. If single, do this with a trusted covenant partner.", action:"Write out the covenant commitments your household is making for this season." },
  { week:"Week 5",  phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"October", title:"Identity — Who Are You?", anchor:"Genesis 1:26 · 1 Peter 2:9 · Deuteronomy 28 · Psalm 82:6", summary:"You were created to rule. Most people live beneath their assignment because they have accepted a false identity. This study dismantles the lies and restores the original image.", takeaways:["Identity confusion is the first weapon of the enemy against purpose.","You were made in the image of the Creator — not the image of the world.","Covenant identity must be chosen, declared, and defended."], topics:["identity","image","purpose","creation","calling","1 peter"], color:"#C4893A", teaching:"You were created to rule. Most people have accepted a counterfeit identity.", reflection:"What identity labels have you accepted from the world, family, or failure that contradict who God says you are?", assignment:"Write your God-given identity statement using Genesis 1:26 and 1 Peter 2:9 as your foundation. Read it aloud daily.", action:"Write and memorize your identity declaration this week. Be ready to share it in class." },
  { week:"Week 6",  phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"November", title:"Identity — Born to Lead", anchor:"Deuteronomy 28:13 · Romans 8:14–17 · Jeremiah 1:5 · Isaiah 49:1", summary:"Leadership is not a personality type — it is a covenant assignment. Every believer was born to lead in some sphere. This study rebuilds confidence, clarifies assignment, and removes the orphan mindset.", takeaways:["You are called to be the head and not the tail — this is covenant, not arrogance.","Orphan mindset produces followers; covenant mindset produces leaders.","Your assignment was determined before your birth — not by your circumstances."], topics:["leadership","assignment","calling","covenant","identity","romans 8"], color:"#C4893A", teaching:"Leadership is a covenant assignment — every believer is called to lead in some sphere.", reflection:"What sphere of leadership has God placed you in — family, business, community, ministry?", assignment:"Identify the 3 spheres of your life where you are called to lead. Write out what leadership looks like in each.", action:"Step into one leadership action this week that you have been avoiding." },
  { week:"Week 7",  phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"November", title:"Covenant — Walking With God", anchor:"Genesis 17 · Exodus 19 · Jeremiah 31 · Hebrews 8", summary:"Leadership begins with covenant. This study traces the Abrahamic, Mosaic, and New Covenant — and shows why every covenant has conditions, responsibilities, and blessings attached.", takeaways:["Covenant is not a feeling — it is a binding agreement with terms and consequences.","God does not move outside of covenant — He established it for our protection.","Understanding your covenant position unlocks access to covenant promises."], topics:["covenant","abraham","sinai","new covenant","jeremiah","hebrews"], color:"#C4893A", teaching:"Leadership begins with covenant. God does not move outside of covenant relationship.", reflection:"Which covenant promises are you standing on right now? Which covenant conditions are you neglecting?", assignment:"Study the three covenants (Abrahamic, Sinai, New) and write out what each one requires of you personally.", action:"Identify one covenant commitment you have been passive about and make a concrete decision to activate it this week." },
  { week:"Week 8",  phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"November", title:"Covenant — The Blood and the Oath", anchor:"Hebrews 9 · Genesis 15 · Matthew 26:26–28 · Exodus 24", summary:"The blood covenant is the highest form of agreement in scripture. This study explores what the blood means, what it covers, and how the Passover and the Last Supper are the same covenant in two acts.", takeaways:["The blood covenant is unbreakable — it demands everything and guarantees everything.","The Passover lamb and the Messiah are the same sacrificial pattern fulfilled.","Taking covenant seriously transforms how we approach prayer, obedience, and community."], topics:["blood covenant","passover","atonement","hebrews","genesis 15","exodus 24"], color:"#C4893A", teaching:"The blood covenant is the highest agreement in scripture — it demands and guarantees everything.", reflection:"Do you treat your relationship with the Most High as a casual religion or as a blood covenant?", assignment:"Read Hebrews 9 in full. Write out what the new covenant covers that the old could not.", action:"Observe the next Shabbat meal as a covenant meal — bread and cup — with your household." },
  { week:"Week 9",  phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"December", title:"Discipline — Order and Holiness", anchor:"Hebrews 12:5–11 · 1 Corinthians 9:24–27 · Proverbs 4:23 · Sirach 1", summary:"Discipline creates authority. Undisciplined people cannot be trusted with power. This study confronts every area of soft living and builds the case for structured, consistent, covenant discipline.", takeaways:["Discipline is not punishment — it is the father's love shaping the son for greatness.","The undisciplined life cannot produce Kingdom results.","Every area of lack in your life has an undisciplined habit at its root."], topics:["discipline","holiness","order","authority","proverbs","hebrews","1 corinthians 9"], color:"#C4893A", teaching:"Discipline creates authority. Those who master themselves can be trusted with power.", reflection:"What is the one area of your daily life where a lack of discipline is costing you the most?", assignment:"Design your personal discipline schedule — morning routine, prayer time, study time, physical training, meal discipline.", action:"Begin your designed routine this week. Track it for 7 days. Bring your results to class." },
  { week:"Week 10", phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"December", title:"Discipline — The Disciplined Body", anchor:"1 Corinthians 6:19–20 · Daniel 1:8–16 · Romans 12:1 · Sirach 37:27–31", summary:"Your body must serve your mission — not rule it. Daniel's physical discipline in the court of Babylon produced supernatural results. Spirit → Body → Mind: the body is the second front of the transformation.", takeaways:["What you eat, how you sleep, and how you train directly affects your spiritual clarity.","Daniel proved that physical discipline in enemy territory produces supernatural favor.","The body is the temple — what we do to it, we do to our calling."], topics:["body","health","fasting","daniel","temple","discipline","1 corinthians"], color:"#C4893A", teaching:"Your body must serve your mission. Daniel's discipline in enemy territory produced supernatural favor.", reflection:"Is your body currently serving your calling or competing with it?", assignment:"Begin a 7-day food and sleep audit. Write down everything you eat and every hour you sleep. Identify 3 changes.", action:"Remove one food or habit from your life this week that competes with your calling." },
  { week:"Week 11", phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"December", title:"Decision — Choose Life", anchor:"Deuteronomy 30:19 · Joshua 24:15 · Matthew 7:13–14 · Sirach 15:14–17", summary:"Destiny begins with decision. Every major season change in scripture is preceded by a decision. This study confronts spiritual indecision and calls the community to make a clear, definitive covenant choice.", takeaways:["Indecision is itself a decision — it chooses the default path.","God presents two paths in every generation. The remnant chooses the narrow road.","Your decision today determines the territory your children will inherit."], topics:["decision","destiny","deuteronomy 30","joshua","choice","narrow road"], color:"#C4893A", teaching:"Destiny begins with decision. Indecision is itself a choice — the default path.", reflection:"What decision have you been postponing that is blocking your next season?", assignment:"Write your formal covenant decision statement for this new season. Include what you are saying YES to and what you are saying NO to.", action:"Read your decision statement aloud before your household or a covenant partner this week." },
  { week:"Week 12", phase:"Phase 0 — Awakening", season:"Phase 0 — Awakening", months:"December", title:"Decision — Prepare for the Launch", anchor:"Nehemiah 2 · Luke 14:28–33 · Proverbs 16:3 · Habakkuk 2:2–3", summary:"Every great movement requires preparation before launch. Nehemiah did not run to the wall — he first prayed, assessed, planned, and counted the cost. This study prepares the community for January's transformation launch.", takeaways:["Assessment before action prevents wasted energy and broken momentum.","The vision must be written — vague vision produces vague results.","Preparation is not procrastination — it is the work that makes the launch sustainable."], topics:["preparation","launch","nehemiah","vision","planning","habakkuk"], color:"#C4893A", teaching:"Count the cost, write the vision, prepare for the launch. Nehemiah inspected the walls before he built them.", reflection:"What would the most prepared version of yourself look like entering the next phase?", assignment:"Write your vision for the next 90 days. Include spiritual goals, body goals, and mind goals aligned with Spirit → Body → Mind.", action:"Participants prepare vision boards for the January transformation launch." },

  // ── PHASE 1: IDENTITY — Jan–Feb · Becoming the New Person ────────────────────
  { week:"Week 13", phase:"Phase 1 — Identity", season:"Phase 1 — Identity", months:"January", title:"Renewing the Mind — Identity Change Precedes Success", anchor:"Romans 12:1–2 · Colossians 3:1–10 · Ephesians 4:22–24 · 2 Corinthians 5:17", summary:"Identity change precedes every outward success. You cannot build a new life with an old mind. This study attacks the root of every failed attempt — the unreformed thought life.", takeaways:["What you believe about yourself determines every outcome in your life.","Transformation begins in the mind — not in the circumstances.","Putting off the old man is not automatic — it requires deliberate, daily choice."], topics:["renewal","mind","identity","transformation","romans 12","colossians","new man"], color:"#6B8F5E", teaching:"Identity change precedes success. You cannot build a new life with an old mind.", reflection:"What old identity patterns are you still carrying that contradict who you are called to be?", assignment:"Write out 5 specific mind-renewal declarations using scripture. Speak them over yourself for 7 consecutive mornings.", action:"Begin the 9-Day Challenge this week — the transformation launch has begun." },
  { week:"Week 14", phase:"Phase 1 — Identity", season:"Phase 1 — Identity", months:"January", title:"Renewing the Mind — Destroying Strongholds", anchor:"2 Corinthians 10:3–5 · Isaiah 55:7–9 · Philippians 4:8 · Romans 8:5–6", summary:"Mental strongholds are thought patterns that have become fortresses of deception. This study teaches the believer to identify, target, and demolish every argument that exalts itself above the knowledge of God.", takeaways:["Strongholds are not broken by willpower — they are broken by the word of God applied repeatedly.","Every stronghold was once a seed — an agreement made with a lie.","Renewed thinking is not optimism; it is alignment with the thoughts of the Creator."], topics:["strongholds","spiritual warfare","mind","2 corinthians 10","philippians 4","truth"], color:"#6B8F5E", teaching:"Strongholds are not broken by willpower — they fall when the word is applied consistently.", reflection:"What is the dominant lie you have believed about yourself that has shaped your decisions most?", assignment:"Identify your top 3 mental strongholds. Write out the lie, find the counter-scripture, and write your daily declaration.", action:"Begin using your anti-stronghold declarations every morning this week." },
  { week:"Week 15", phase:"Phase 1 — Identity", season:"Phase 1 — Identity", months:"January", title:"Vision — Vision Attracts Provision", anchor:"Habakkuk 2:2–3 · Proverbs 29:18 · Genesis 37:5–7 · Ephesians 3:20", summary:"Vision attracts provision. Every Kingdom achievement began as a vision given by God. This study builds the scriptural framework for how vision works, why it must be written, and how to protect it.", takeaways:["A vision from God is always larger than your current capacity — that is how you know it is from Him.","Written vision creates accountability and attracts the resources needed to fulfill it.","Joseph did not abandon his vision in the pit or in prison — and neither should you."], topics:["vision","provision","calling","habakkuk","joseph","genesis 37","purpose"], color:"#6B8F5E", teaching:"Vision attracts provision. God never gives a vision without also preparing the resources.", reflection:"Can you describe your God-given vision clearly in one sentence? If not — that is your assignment.", assignment:"Write your vision in three layers: 1-year, 5-year, and legacy. Post it where you see it daily.", action:"Build your vision board this week. Include Spirit, Body, and Mind sections." },
  { week:"Week 16", phase:"Phase 1 — Identity", season:"Phase 1 — Identity", months:"January", title:"Vision — Protecting the Vision", anchor:"Proverbs 4:23 · Nehemiah 6:1–9 · Genesis 39 · Matthew 5:8", summary:"Not everyone can see your vision — and not everyone should. This study teaches how to guard your vision from distraction, discouragement, opposition, and premature disclosure.", takeaways:["Vision thieves rarely announce themselves — they come as advisors and friends.","Nehemiah refused to come down from the wall — your assignment requires the same focus.","The pure in heart see God's plan clearly; the distracted heart loses sight."], topics:["vision","protection","focus","nehemiah","distraction","genesis 39","proverbs 4"], color:"#6B8F5E", teaching:"Nehemiah refused to come down from the wall. Your vision requires that same focused refusal.", reflection:"Who or what in your life is consistently pulling you down from the wall of your assignment?", assignment:"Do a 'vision audit' — identify 3 distractors in your life and create a boundary for each.", action:"Remove or limit one distractor this week. Write down what you recaptured in time and focus." },
  { week:"Week 17", phase:"Phase 1 — Identity", season:"Phase 1 — Identity", months:"February", title:"Calling — Every Leader Has an Assignment", anchor:"Jeremiah 1:4–10 · Ephesians 2:10 · Matthew 4:18–20 · Romans 11:29", summary:"Every leader has an assignment — a specific work prepared in advance. This study uncovers the difference between a career, a calling, and an assignment, and how to align all three.", takeaways:["A career is chosen; a calling is received; an assignment is walked out daily.","God's gifts and calling are irrevocable — failure does not cancel assignment.","Jeremiah was called before he was formed — your calling predates your birth."], topics:["calling","assignment","purpose","jeremiah","ephesians","matthew","gifts"], color:"#6B8F5E", teaching:"Every leader has an assignment prepared in advance. Failure does not cancel calling.", reflection:"Can you distinguish between your career, your calling, and your specific assignment? Where are they aligned? Where are they in conflict?", assignment:"Write out your calling statement using Ephesians 2:10 as your framework: 'I was created in Messiah for ____________.'", action:"Share your calling statement with a covenant partner and invite them to hold you accountable to it." },
  { week:"Week 18", phase:"Phase 1 — Identity", season:"Phase 1 — Identity", months:"February", title:"Calling — Operating in Your Gifts", anchor:"1 Corinthians 12 · Romans 12:6–8 · 1 Peter 4:10–11 · Proverbs 18:16", summary:"Your gifts create influence — and open doors that no amount of networking can unlock. This study teaches how to identify, develop, and deploy your spiritual gifts in the service of the Kingdom.", takeaways:["Every gift is given for the common good — not for personal display.","Gifts without character create opportunity without sustainability.","The gift in your hand is the tool for the assignment in your heart."], topics:["gifts","calling","influence","1 corinthians 12","proverbs 18","romans 12","deployment"], color:"#6B8F5E", teaching:"Your gifts create influence. The gift in your hand is the tool for the assignment in your heart.", reflection:"What gift has God placed in you that you have been hiding, comparing, or underusing?", assignment:"Take a spiritual gifts inventory this week. Identify your top 3 gifts and write one practical way to deploy each.", action:"Begin inviting others into the 9-Day Challenge this week. Your gifts are already opening doors." },
  { week:"Week 19", phase:"Phase 1 — Identity", season:"Phase 1 — Identity", months:"February", title:"Purpose — Your Gifts Create Influence", anchor:"Ecclesiastes 11:4–6 · Matthew 25:14–30 · Luke 19:11–27 · Proverbs 22:29", summary:"Do not wait for perfect conditions before you deploy your gifts. The servant who buried his talent was not punished for failure — he was punished for inaction. This study breaks the paralysis of perfectionism.", takeaways:["Excuses and talents cannot occupy the same hand.","Excellence in small assignments is the gateway to large assignments.","The person who stands before kings is skilled in their work — not perfect."], topics:["purpose","excellence","diligence","matthew 25","luke 19","proverbs","perfectionism"], color:"#6B8F5E", teaching:"The servant was not punished for failure. He was punished for not trying. Begin now.", reflection:"Where have you been waiting for perfect conditions before taking action on your assignment?", assignment:"Identify one area where you have been withholding your gift. Take one concrete action this week to deploy it.", action:"Participants begin formally inviting others to the 9-Day Challenge. Purpose requires deployment." },
  { week:"Week 20", phase:"Phase 1 — Identity", season:"Phase 1 — Identity", months:"February", title:"Purpose — From Assignment to Impact", anchor:"Matthew 5:13–16 · Acts 1:8 · Daniel 12:3 · Isaiah 42:1–4", summary:"Impact is the visible result of a life fully aligned with assignment. This study closes the Identity Phase and challenges every member to move from self-development into Kingdom deployment.", takeaways:["Salt must come out of the shaker to do its work.","You are not your own — your assignment belongs to the generation that needs it.","The wise will shine — not for their own glory, but to lead others toward the light."], topics:["impact","influence","deployment","light","matthew 5","acts 1","daniel","assignment"], color:"#6B8F5E", teaching:"Salt must leave the shaker to do its work. Identity without deployment serves no one.", reflection:"Who is waiting for you to step into your full assignment? What generation needs what you carry?", assignment:"Write your personal impact statement: who you are called to serve, what transformation you carry, and what legacy you are building.", action:"Share your impact statement publicly — class, social media, or with your household." },

  // ── PHASE 2: EXECUTION — Mar–Jun · Spirit → Body → Mind ─────────────────────
  { week:"Week 21", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"March", title:"SPIRIT — Remain Connected to God", anchor:"Matthew 6:6–13 · John 15:4–5 · Psalm 1:1–3 · Galatians 5:16–25", summary:"The 90-Day Challenge begins. The execution phase opens with the Spirit — because nothing you build without connection to the vine will survive. This study establishes daily prayer discipline as the foundation of all progress.", takeaways:["The branch that abides in the vine bears fruit without straining.","Prayer is not a religious ritual — it is the oxygen of the Kingdom assignment.","Daily prayer discipline is the foundation that makes every other discipline sustainable."], topics:["prayer","spirit","connection","john 15","matthew 6","psalm 1","daily discipline"], color:"#7B5EA7", teaching:"Nothing built without connection to the vine will survive. Prayer is the oxygen of Kingdom work.", reflection:"What does your current prayer life look like? Is it producing the fruit of connection or the exhaustion of striving?", assignment:"Design your daily prayer structure — specific time, specific scripture, specific intercession. Write it out and commit to 30 days.", action:"Daily prayer discipline begins today. Post your prayer structure where you see it first thing every morning." },
  { week:"Week 22", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"March", title:"SPIRIT — The Fruit That Lasts", anchor:"Galatians 5:22–23 · John 15:16 · Matthew 7:16–20 · Colossians 1:10", summary:"Fruit is the evidence of abiding — not the result of effort. This study distinguishes between spiritual labor and spiritual fruit, and shows why character is the carrier of Kingdom impact.", takeaways:["Fruit is the overflow of a life connected — not the product of spiritual performance.","Character is the container that holds the anointing. Without it, the oil spills.","Lasting fruit comes from lasting connection — not from seasonal spiritual sprints."], topics:["fruit","character","abiding","galatians 5","john 15","colossians","spirit"], color:"#7B5EA7", teaching:"Fruit is the overflow of connection — not the result of striving. Character carries the anointing.", reflection:"What fruit is your current life producing? Is it the fruit of the Spirit or the fruit of pressure and performance?", assignment:"Do a fruit audit using Galatians 5:22–23. Rate yourself 1–10 in each area and identify the two lowest. Make them your focus this month.", action:"Choose one specific fruit area and create one daily habit that cultivates it." },
  { week:"Week 23", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"March", title:"SPIRIT — Intercession & the Prayer of Authority", anchor:"Matthew 6:9–13 · James 5:16–18 · 1 Timothy 2:1–2 · Daniel 9:3–19", summary:"Intercessory prayer is not begging — it is the exercise of covenant authority on behalf of others. This study trains the community in the prayer of authority, the prayer of agreement, and the prayer of Daniel.", takeaways:["Fervent prayer of a righteous person is not a request — it is a force.","Intercession is a covenant assignment — not a spiritual gift for the few.","Daniel's 21-day prayer broke through a principality. Your prayer moves territory."], topics:["intercession","authority","prayer","daniel 9","james 5","1 timothy 2","covenant"], color:"#7B5EA7", teaching:"Intercession is not begging — it is the exercise of covenant authority on behalf of others.", reflection:"Who are you currently interceding for? What territory are you believing God to move in through prayer?", assignment:"Build an intercession list — family, community, nation. Commit to praying through it every morning this week.", action:"Begin a 21-day prayer focus. Bring your intercession list to every Shabbat session this month." },
  { week:"Week 24", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"April", title:"SPIRIT — Fasting as a Weapon", anchor:"Isaiah 58:6–7 · Matthew 17:21 · Acts 13:2–3 · Daniel 1:8–16 · Joel 2:12", summary:"Fasting is not a diet — it is a weapon of mass spiritual destruction. This study teaches the purpose, power, and practice of covenant fasting, and how it breaks what prayer alone cannot.", takeaways:["Some things only break through combined prayer and fasting.","Fasting is not about hunger — it is about positioning and spiritual focus.","Every major breakthrough in Acts was preceded by fasting and prayer."], topics:["fasting","prayer","weapons","isaiah 58","matthew 17","acts","daniel","joel 2"], color:"#7B5EA7", teaching:"Fasting is a weapon. Some things only break under the combined force of prayer and fasting.", reflection:"When was the last time you fasted with a specific spiritual target? What did it produce?", assignment:"Plan a one-day fast this week with a specific spiritual focus. Write your target, your scripture, and your expectation.", action:"Participants begin the first group fast of the 90-Day Challenge. Bring testimony next week." },
  { week:"Week 25", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"April", title:"BODY — Your Body Must Serve Your Mission", anchor:"1 Corinthians 6:19–20 · 1 Timothy 4:8 · Daniel 1:8–16 · Romans 12:1 · Sirach 37:27–31", summary:"The 90-Day Challenge enters the Body front. Your body is not separate from your calling — it is the vehicle for your assignment. This study builds the theology and the practice of physical stewardship.", takeaways:["Bodily training has value — it is not a secular distraction from spiritual goals.","Daniel's physical discipline in enemy territory produced supernatural clarity and favor.","The body presented as a living sacrifice is an act of worship, not vanity."], topics:["body","health","discipline","daniel","1 corinthians","1 timothy","stewardship","mission"], color:"#7B5EA7", teaching:"Your body must serve your mission. Every great leader maintained physical discipline.", reflection:"Is your body currently an asset to your calling or a liability? What is one honest change required?", assignment:"Design your personal physical discipline plan — workouts, food protocol, sleep schedule. Begin this week.", action:"Participants begin body transformation protocol: workouts + fasting + detox discipline." },
  { week:"Week 26", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"April", title:"BODY — Fasting, Detox & Physical Discipline", anchor:"Leviticus 11 · Genesis 1:29 · Daniel 10:2–3 · Acts 27:33–34 · Sirach 31:19–22", summary:"Clean eating and periodic fasting are not modern wellness trends — they are ancient covenant practices. This study connects dietary law, physical detox, and spiritual clarity into one integrated framework.", takeaways:["What you eat is a covenant decision — not just a health decision.","Daniel's 21-day Daniel fast produced supernatural visions and physical vigor.","Physical detox clears the mind and prepares the body for greater spiritual sensitivity."], topics:["fasting","detox","food","leviticus 11","genesis","daniel 10","sirach","clean eating"], color:"#7B5EA7", teaching:"Clean eating is an ancient covenant practice — it protects the body and sharpens the spirit.", reflection:"What is in your daily diet that is working against your calling rather than for it?", assignment:"Begin a 7-day food log. Remove one unclean or harmful food per week for the next 4 weeks.", action:"Continue body transformation protocol. Share your 7-day food log with an accountability partner." },
  { week:"Week 27", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"May", title:"BODY — Strength, Rest & Restoration", anchor:"Isaiah 40:31 · Psalm 127:2 · 1 Kings 19:4–8 · Ecclesiastes 4:6 · Matthew 11:28–30", summary:"Rest is not the absence of discipline — it is one of its highest forms. Elijah collapsed under a juniper tree and the angel brought food twice before sending him onward. This study builds the biblical theology of recovery and sustainable strength.", takeaways:["Burning out for the Kingdom is not righteousness — it is poor stewardship.","Those who wait on the Lord renew their strength — waiting is an active, not passive posture.","Strategic rest multiplies output; neglected rest destroys it."], topics:["rest","restoration","strength","isaiah 40","psalm 127","1 kings","elijah","recovery"], color:"#7B5EA7", teaching:"Rest is not the absence of work — it is the discipline that makes the work sustainable.", reflection:"Are you running on empty? What rhythms of rest have you removed from your life that need to be restored?", assignment:"Design a weekly recovery rhythm — one day of genuine rest, one hour of silence daily, and one weekly nature walk.", action:"Protect your Shabbat this week as a full rest day. No work, no content, no striving." },
  { week:"Week 28", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"May", title:"MIND — Victory Is Won in the Mind", anchor:"Joshua 1:8 · Philippians 4:6–8 · 2 Corinthians 10:5 · Romans 8:5–6 · Isaiah 26:3", summary:"The 90-Day Challenge enters the Mind front. Every physical battle is won or lost first in the mind. This study establishes the scriptural foundation for mental victory and introduces the leadership training framework.", takeaways:["Perfect peace is promised to those whose minds are stayed on God — not on outcomes.","Casting down imaginations is not suppression — it is the active authority of the renewed mind.","Joshua's greatness was not military — it was the result of meditating on the law day and night."], topics:["mind","victory","mental strength","joshua 1","philippians 4","2 corinthians 10","isaiah 26"], color:"#7B5EA7", teaching:"Every battle is won or lost first in the mind. Joshua's greatness was the result of meditation.", reflection:"What mental battle are you currently fighting that you have not yet brought into the framework of scriptural truth?", assignment:"Begin a 'thought audit' — track your dominant thoughts for 3 days. Classify each as aligned or misaligned with Kingdom truth.", action:"Participants begin strategy and leadership training module. Mind transformation is the final front." },
  { week:"Week 29", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"May", title:"MIND — Strategy, Systems & Execution", anchor:"Proverbs 21:5 · Luke 14:28–33 · Nehemiah 2:11–18 · Ecclesiastes 10:10 · Proverbs 16:3", summary:"Strategy is not worldly — it is the wisdom of God applied to the practical challenges of the assignment. Nehemiah assessed, planned, assigned roles, and executed. This study trains leaders to think strategically.", takeaways:["Diligent plans lead to profit; hasty actions lead to poverty.","Strategy without prayer is business; prayer without strategy is wishful thinking.","Nehemiah proved that a 52-day impossible project becomes possible with God, a plan, and a team."], topics:["strategy","systems","execution","nehemiah","proverbs","planning","luke 14","leadership"], color:"#7B5EA7", teaching:"Strategy is not worldly wisdom — it is the practical application of divine wisdom to your assignment.", reflection:"Do you have a written strategy for your calling? Or are you moving by effort and reaction?", assignment:"Write a 90-day execution plan for your primary assignment. Break it into weekly milestones.", action:"Present your 90-day plan to your accountability partner for review and commitment." },
  { week:"Week 30", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"June", title:"MIND — Leadership Under Pressure", anchor:"Nehemiah 4:1–9 · Daniel 6 · Acts 27:21–26 · 2 Corinthians 4:8–9 · Psalm 46:1–3", summary:"True leadership is not revealed in success — it is revealed under pressure. This study examines how Nehemiah, Daniel, and Paul led with composure and faith when the enemy pressed hard.", takeaways:["Leaders set the emotional climate — if they panic, the people scatter.","Threats are a confirmation that you are close to breakthrough, not evidence of failure.","Courage under pressure is not the absence of fear — it is the presence of covenant confidence."], topics:["leadership","pressure","courage","nehemiah 4","daniel 6","acts 27","2 corinthians","composure"], color:"#7B5EA7", teaching:"True leadership is revealed under pressure. Composure under fire is a Kingdom skill.", reflection:"How do you respond under pressure? Do you lead the room or follow the fear?", assignment:"Identify a current pressure point in your life or assignment. Write out a leadership response using one of the biblical examples from this lesson.", action:"Practice composure discipline this week — when you feel pressure, pause, pray, then respond." },
  { week:"Week 31", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"June", title:"MIND — Decision Making & Wisdom in Action", anchor:"James 1:5 · Proverbs 11:14 · 1 Kings 3:9 · Sirach 32:19 · Ecclesiastes 8:5", summary:"Every great leader is ultimately defined by the quality of their decisions. This study builds a biblical decision-making framework — how to seek wisdom, how to use counsel, and how to move decisively when the time comes.", takeaways:["Wisdom for decisions is available — the requirement is asking in faith.","Solomon asked for wisdom above wealth because he understood that wisdom produces both.","Good decisions require good counsel — isolation is the enemy of sound judgment."], topics:["decision making","wisdom","counsel","james 1","1 kings 3","proverbs","sirach","judgment"], color:"#7B5EA7", teaching:"Every leader is ultimately defined by the quality of their decisions. Ask for wisdom — it is available.", reflection:"What is the most important decision you are currently facing? What biblical wisdom framework are you using to navigate it?", assignment:"Apply the James 1:5 principle to your current decision — ask, believe, wait, receive. Write out the decision and the process.", action:"Identify one trusted counsel in your life. Bring your top current decision to them this week." },
  { week:"Week 32", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"June", title:"MIND — Accountability, Mentorship & Iron Sharpening", anchor:"Proverbs 27:17 · Hebrews 10:24–25 · 2 Timothy 2:2 · Ecclesiastes 4:9–12 · Galatians 6:1–2", summary:"Iron sharpens iron. Lone wolves do not build legacies — covenant teams do. This study builds the case for accountability structures, mentorship relationships, and the power of submitted community.", takeaways:["You cannot sharpen yourself — you need the friction of another iron to reach your edge.","Accountability is not weakness; it is the structure that produces champions.","Every great biblical leader had a covering relationship — Moses had Jethro, Paul had Barnabas."], topics:["accountability","mentorship","iron","proverbs 27","2 timothy","hebrews","community","galatians"], color:"#7B5EA7", teaching:"Iron sharpens iron. No great leader was built in isolation. Accountability is the structure of champions.", reflection:"Who is currently sharpening you? Who are you currently sharpening?", assignment:"Identify your mentor, your peer accountability partner, and your mentee. Write one commitment to each relationship.", action:"Set a recurring weekly check-in with your accountability partner. Commit to 90 days." },
  { week:"Week 33", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"June", title:"MIND — Communication, Influence & The Power of Your Voice", anchor:"Proverbs 18:21 · Colossians 4:6 · Acts 2:14–41 · Nehemiah 2:17–18 · James 3:1–5", summary:"Leaders move people with words. Peter's Pentecost address, Nehemiah's night speech, Paul's epistles — the greatest movements in scripture were ignited by a leader who knew how to use their voice. This study trains Kingdom communicators.", takeaways:["Your voice is a tool — it can build or destroy, inspire or discourage.","Gracious speech seasoned with salt opens doors that credentials cannot.","Peter moved 3,000 in one address — not because of his education, but because of the Spirit on his words."], topics:["communication","influence","voice","proverbs 18","colossians 4","acts 2","nehemiah","james 3"], color:"#7B5EA7", teaching:"Leaders move people with words. Peter ignited a movement in one address. Your voice carries assignment.", reflection:"Are you currently using your voice to build the Kingdom or to narrate your struggles? What would change if you spoke with more intention?", assignment:"Write and deliver a 2-minute Kingdom declaration this week — your vision, your calling, your invitation. Practice it until it is natural.", action:"Deliver your declaration to your accountability partner or household. Record it if possible." },
  { week:"Week 34", phase:"Phase 2 — Execution", season:"Phase 2 — Execution", months:"June", title:"Execution Review — 90-Day Checkpoint", anchor:"Haggai 1:5–7 · Luke 15:17 · 1 Corinthians 3:12–15 · Ecclesiastes 5:4–5", summary:"The 90-Day Execution phase ends with a full covenant review. Consider your ways — what was built, what was burned, and what was laid as gold, silver, and precious stones. This study facilitates honest assessment and relaunch.", takeaways:["Self-examination is not self-condemnation — it is the precursor to elevation.","What you measure improves. Unexamined seasons repeat themselves.","Every commitment made before the community is a vow — and vows are taken seriously by God."], topics:["review","assessment","accountability","haggai","1 corinthians 3","vows","covenant","progress"], color:"#7B5EA7", teaching:"Consider your ways. Self-examination is not condemnation — it is the precursor to elevation.", reflection:"What did you build in the 90 days? What slipped? What must you carry forward with greater seriousness?", assignment:"Write a full 90-day review — Spirit front, Body front, Mind front. Be honest. Bring it to class.", action:"Community testimony and review session. Each member shares one win and one lesson from the 90-Day Challenge." },

  // ── PHASE 3: EXPANSION — Jul–Sep · Kingdom Leadership ────────────────────────
  { week:"Week 35", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"July", title:"Leadership — Leaders Build Systems", anchor:"Nehemiah 1–6 · Exodus 18:13–27 · Proverbs 11:14 · Ecclesiastes 4:9–12", summary:"Leaders do not just do the work — they build systems that allow the work to outlast them. Nehemiah built a wall in 52 days because he distributed the work strategically. Jethro showed Moses how to govern without burning out.", takeaways:["A leader who cannot delegate cannot scale.","Systems protect vision from the limitations of one person's capacity.","The goal is not to be needed — it is to be fruitful. Systems create fruitfulness."], topics:["leadership","systems","nehemiah","exodus 18","delegation","scalability","jethro"], color:"#8B3A2A", teaching:"Leaders build systems. Nehemiah finished the impossible in 52 days by delegating strategically.", reflection:"What is currently dependent on you alone that needs a system? What would break if you stepped away for 30 days?", assignment:"Map one key area of your calling or business. Identify every task and who or what could systematize it.", action:"Build or refine one system in your assignment this week — a process, a template, or a delegation." },
  { week:"Week 36", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"July", title:"Leadership — Building People, Not Just Projects", anchor:"Exodus 18 · John 15:12–17 · 1 Thessalonians 5:11 · Ephesians 4:11–12 · Acts 6:1–7", summary:"The greatest system any leader can build is a people system — a community of equipped, growing, trusted co-laborers. Jesus spent 3 years building 12 people who built the world.", takeaways:["You can build a project with tools — but you can only build a movement with people.","Equipping others multiplies your capacity beyond what any individual can achieve.","The deacons of Acts 6 freed the apostles to do what only they could do — this is the Kingdom multiplication model."], topics:["people building","leadership","equipping","john 15","ephesians 4","acts 6","multiplication","1 thessalonians"], color:"#8B3A2A", teaching:"Jesus spent 3 years building 12 people who built the world. Build people, not just projects.", reflection:"Who are you currently investing in? Who is growing because of your consistent input into their life?", assignment:"Identify 2–3 people in your sphere who need intentional investment. Design a simple discipleship or mentorship framework for each.", action:"Schedule your first intentional development meeting with each of those 2–3 people this month." },
  { week:"Week 37", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"July", title:"Influence — Light Attracts People", anchor:"Matthew 5:14–16 · Proverbs 11:30 · Daniel 12:3 · Isaiah 60:1–3 · Acts 5:12–16", summary:"You cannot pursue influence — you become it. Light does not chase darkness; it simply shines, and darkness flees. This study reveals how Kingdom leaders attract people, resources, and open doors by the quality of their character and consistency.", takeaways:["Influence is not built through marketing — it is built through manifested character.","The wise who turn many to righteousness will shine like stars forever.","Jerusalem's light in Isaiah 60 was not manufactured — it arose when the glory of the Lord came upon them."], topics:["influence","light","character","matthew 5","daniel 12","isaiah 60","acts 5","testimony"], color:"#8B3A2A", teaching:"You cannot pursue influence — you become it. Light does not chase darkness; it simply shines.", reflection:"What is the quality of your current influence? Are people drawn to your character or your content?", assignment:"Identify one area where your character is not yet matching your call to influence. Develop a 30-day character growth plan.", action:"Share one testimony of Kingdom impact from your life publicly this week — class, social, or community." },
  { week:"Week 38", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"August", title:"Influence — Integrity Under Scrutiny", anchor:"Daniel 6:4–5 · Proverbs 20:7 · Titus 2:7–8 · 1 Timothy 4:12 · Luke 16:10", summary:"Daniel's enemies could find no corruption in him. When you have public influence, scrutiny is inevitable. This study prepares Kingdom leaders to maintain integrity under pressure, opposition, and public examination.", takeaways:["Those who cannot find fault in your conduct will go after your convictions.","Integrity is not a public performance — it is the private practice that sustains the public platform.","Faithful in little is the covenant test for being trusted with much."], topics:["integrity","scrutiny","daniel 6","proverbs 20","titus","1 timothy","luke 16","public life"], color:"#8B3A2A", teaching:"Daniel's enemies could find no fault in his conduct — they went after his convictions. Build that kind of integrity.", reflection:"If your enemies audited your private life today — what would they find?", assignment:"Do a personal integrity audit — finances, speech, time, relationships. Identify one area that needs immediate correction.", action:"Make one integrity correction this week in your most vulnerable area. Tell your accountability partner." },
  { week:"Week 39", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"August", title:"Multiplication — Leaders Train Leaders", anchor:"2 Timothy 2:2 · Mark 3:14–15 · Acts 6:1–7 · Exodus 18 · Matthew 28:19–20", summary:"The multiplication mandate is the highest leadership assignment. This is not about adding — it is about multiplying. One person who trains 12 who each train 12 builds a movement that outlasts every building and institution.", takeaways:["What you deposit into others is your legacy — not what you achieved personally.","The Matthew 28 commission is not just about converts — it is about trained disciples who make disciples.","Every great revival in history traces back to one leader who invested deeply in a small group."], topics:["multiplication","discipleship","training","2 timothy","acts 6","matthew 28","exodus 18","legacy"], color:"#8B3A2A", teaching:"Multiplication is the highest leadership assignment. Add converts; multiply disciples.", reflection:"Who have you trained who could now train others? If the answer is no one — that is your next assignment.", assignment:"Design a simple 8-week discipleship curriculum you could personally deliver to 3–5 people. Draw from what you have learned in this program.", action:"Recruit your first 3–5 discipleship candidates this week." },
  { week:"Week 40", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"August", title:"Multiplication — Sending & Releasing", anchor:"Acts 13:1–3 · Luke 10:1–3 · Romans 10:15 · Isaiah 6:8 · John 17:18", summary:"The Antioch model: the church prayed, heard the Spirit, and sent their best. True Kingdom expansion requires leaders who release their people into greater assignments, even when it costs the local community.", takeaways:["Sending is the highest act of trust — it releases what you invested into a broader field.","The best leaders are always reproducers who send out what they built.","Antioch became the greatest sending church in history because they were willing to release their best."], topics:["sending","releasing","acts 13","luke 10","romans 10","isaiah 6","john 17","deployment"], color:"#8B3A2A", teaching:"Antioch became the greatest sending church by releasing their best. Senders build movements.", reflection:"Are you building a community that holds people or a community that sends them? What would it mean to begin releasing your best people?", assignment:"Identify one person in your community who is ready for a greater assignment. Write out a specific plan to release and support them.", action:"Have a formal commissioning conversation with that person this week." },
  { week:"Week 41", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"September", title:"Kingdom Economics — Wealth Is a Tool for Mission", anchor:"Luke 16:9–13 · Matthew 25:14–30 · Proverbs 13:22 · Deuteronomy 8:18 · Ecclesiastes 5:19", summary:"Wealth in the Kingdom is a stewardship assignment — not a personal destination. The Seven Streams of Income framework aligns with this principle: multiple streams, covenant management, and the mission as the purpose of the provision.", takeaways:["It is the power of God that gives the ability to get wealth — and the purpose is covenant, not comfort.","Mammon is a spirit, not just money — it competes for the devotion God requires.","A good man leaves an inheritance — generational wealth is a covenant assignment."], topics:["wealth","kingdom economics","stewardship","proverbs 13","deuteronomy 8","luke 16","matthew 25","seven streams"], color:"#8B3A2A", teaching:"Wealth is a tool for the mission, not the destination. It is God who gives the power to get wealth.", reflection:"Is money currently serving your mission or directing it? What is one financial discipline you need to implement?", assignment:"Map your current income streams. Identify one new stream you will develop in the next 90 days.", action:"This week aligns with Seven Streams Games. Begin your income stream development plan." },
  { week:"Week 42", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"September", title:"Kingdom Economics — Generosity, Seed & Harvest", anchor:"Luke 6:38 · 2 Corinthians 9:6–8 · Proverbs 11:24–25 · Malachi 3:10–12 · Mark 4:26–29", summary:"The Kingdom economy runs on the seed-harvest principle — not the scarcity mindset. Generosity is not a financial strategy; it is a covenant act that activates the Kingdom economic system.", takeaways:["The one who sows sparingly reaps sparingly — this is covenant law, not motivational advice.","Generosity breaks the grip of mammon more effectively than any financial plan.","The tithe is not taxation — it is the covenant acknowledgment that everything belongs to the Creator."], topics:["generosity","seed and harvest","tithe","malachi","2 corinthians 9","proverbs 11","covenant economics"], color:"#8B3A2A", teaching:"Generosity breaks the grip of mammon. The Kingdom economy runs on the seed-harvest principle.", reflection:"Are you currently sowing in proportion to the harvest you believe God for?", assignment:"Review your giving in the last 3 months. Set a specific generosity commitment for the next 90 days — tithe, offering, and one specific Kingdom seed.", action:"Plant one Kingdom seed this week — financial, time, or mentorship — with a specific prayer of expectation." },
  { week:"Week 43", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"September", title:"Kingdom Economics — Financial Stewardship & Building Generational Wealth", anchor:"Proverbs 13:22 · Luke 19:11–27 · Psalm 112:1–3 · 1 Timothy 5:8 · Proverbs 27:23–24", summary:"A good man leaves an inheritance. Generational wealth is built through covenant discipline, multiplied talents, and the refusal to consume everything earned. This study closes the Expansion Phase with a clear wealth-building mandate.", takeaways:["Wealth that is not managed is wealth that will be lost within one generation.","The parable of the minas is not a financial parable — it is a stewardship parable. The principle applies to everything.","Leaving an inheritance requires long vision — what you plant now, your children will harvest."], topics:["generational wealth","stewardship","proverbs 13","luke 19","psalm 112","inheritance","covenant finances"], color:"#8B3A2A", teaching:"Build for the generation that comes after you. Generational wealth is a covenant assignment.", reflection:"What are you currently building that will outlast you? What legacy are your financial decisions creating?", assignment:"Write a 3-generation financial vision statement. Include what you are building, who you are building it for, and the covenant principles guiding it.", action:"Open or review a savings or investment account this week. Name it with your legacy vision." },
  { week:"Week 44", phase:"Phase 3 — Expansion", season:"Phase 3 — Expansion", months:"September", title:"Kingdom Economics — Review & Relaunch", anchor:"Haggai 2:8–9 · Deuteronomy 28:1–14 · Isaiah 48:17 · Psalm 35:27 · Proverbs 3:9–10", summary:"The Expansion Phase closes with a financial and leadership review. This study declares the covenant wealth promises, examines what was built, and prepares the community for the Legacy Phase and the International Convention.", takeaways:["The silver is God's and the gold is God's — the latter glory will be greater than the former.","Covenant obedience is the gateway to the Deuteronomy 28 blessing package.","The God who teaches you to profit and leads you in the way you should go is still speaking."], topics:["covenant wealth","deuteronomy 28","haggai","isaiah 48","psalm 35","review","international convention"], color:"#8B3A2A", teaching:"The covenant promises of Deuteronomy 28 are not canceled — they are waiting on covenant alignment.", reflection:"Where are you standing in relation to the Deuteronomy 28 blessing framework? What covenant alignment is still needed?", assignment:"Write your full financial and leadership review for Phase 3. Include wins, lessons, and commitments for Phase 4.", action:"Prepare for the International Convention. Every participant should have a testimony of Kingdom expansion." },

  // ── PHASE 4: LEGACY — Oct–Nov · Global Leadership ────────────────────────────
  { week:"Week 45", phase:"Phase 4 — Legacy", season:"Phase 4 — Legacy", months:"October", title:"Stewardship — Faithful Leaders Manage Resources", anchor:"Genesis 41:33–36 · Luke 12:42–48 · Matthew 24:45–47 · Proverbs 27:23–24 · 1 Corinthians 4:2", summary:"Joseph was appointed because he could manage — not just because he could dream. This study builds the full stewardship theology: time, talent, treasure, and testimony are all Kingdom resources requiring faithful management.", takeaways:["The measure of a leader is not the size of their vision — it is the faithfulness of their management.","God promotes those who prove they can manage what has already been entrusted to them.","Stewardship is not about minimizing risk — it is about maximizing Kingdom return."], topics:["stewardship","joseph","genesis 41","luke 12","matthew 24","1 corinthians 4","management","faithfulness"], color:"#1B3A5C", teaching:"Joseph was appointed because he could manage. Faithful stewardship precedes promotion.", reflection:"What has God entrusted to you that is currently being managed at less than its full Kingdom potential?", assignment:"Do a full stewardship inventory — time, talent, treasure, relationships. Write out your highest-leverage stewardship opportunity.", action:"Identify and implement one stewardship upgrade this week — a system, a habit, or a resource allocation." },
  { week:"Week 46", phase:"Phase 4 — Legacy", season:"Phase 4 — Legacy", months:"October", title:"Stewardship — Managing Time as a Kingdom Resource", anchor:"Ephesians 5:15–16 · Psalm 90:12 · Colossians 4:5 · Proverbs 6:6–11 · Luke 12:20", summary:"Time is the one resource that cannot be reclaimed. This study confronts time poverty, time theft, and the undisciplined schedule — and rebuilds the covenant framework for managing your days as sacred assignments.", takeaways:["Teach us to number our days — this prayer in Psalm 90 is the foundation of time wisdom.","Redeeming the time means buying it back from entertainment, distraction, and passive living.","The person who manages their time manages their legacy."], topics:["time management","stewardship","ephesians 5","psalm 90","colossians","proverbs","luke 12"], color:"#1B3A5C", teaching:"Time is the only resource that cannot be reclaimed. Redeem it — buy it back from every thief.", reflection:"If you audited your time this week, what would you find? What would your calendar say your real priorities are?", assignment:"Map your 168 hours this week. Identify where your time is going and where it should be going. Make 3 specific changes.", action:"Implement your new time structure this week. Review with your accountability partner at the end of the week." },
  { week:"Week 47", phase:"Phase 4 — Legacy", season:"Phase 4 — Legacy", months:"October", title:"Authority — Leadership Carries Responsibility", anchor:"Romans 13:1–7 · Joshua 24:14–15 · Matthew 20:25–28 · 1 Peter 5:2–4 · Acts 20:28", summary:"Authority in the Kingdom comes with weight. This study examines how leaders govern — in the home, the community, and the broader society — and what happens when authority is exercised without integrity, accountability, or service.", takeaways:["Authority that does not carry accountability becomes tyranny.","Servant leadership is not weakness — it is the highest form of Kingdom power.","Every leader will give an account for what they did with the authority they were entrusted."], topics:["authority","governance","responsibility","romans 13","joshua","matthew 20","1 peter","accountability"], color:"#1B3A5C", teaching:"Authority carries weight. Every leader will give an account for how they used what they were given.", reflection:"Where in your life are you exercising authority? Are you governing with service, integrity, and accountability?", assignment:"Write out your personal governance covenant — how you commit to leading, deciding, and being accountable in every sphere of your authority.", action:"Share your governance covenant with your household or covenant team. Invite them to hold you to it." },
  { week:"Week 48", phase:"Phase 4 — Legacy", season:"Phase 4 — Legacy", months:"October", title:"Authority — The Weight of the Crown", anchor:"Joshua 24:15 · Esther 4:14 · Daniel 2:21 · Revelation 3:11 · Proverbs 8:15–16", summary:"The crown in Revelation 3:11 can be taken if you are not holding fast. This study challenges leaders to understand that authority is not a permanent possession — it is a stewardship maintained through faithfulness, courage, and alignment.", takeaways:["Esther's moment required her to act — someone would rise if she did not, but she would lose her purpose.","Authority without courage becomes a decoration — it must be exercised or it atrophies.","God deposes and appoints kings — all authority is ultimately His and on loan to those who steward it."], topics:["authority","crown","esther","daniel","revelation 3","proverbs","courage","stewardship"], color:"#1B3A5C", teaching:"Hold fast what you have so no one takes your crown. Authority requires active faithfulness, not passive possession.", reflection:"Is there a sphere of your authority where you have grown passive or fearful? What would holding fast look like?", assignment:"Identify one authority assignment where you need to exercise more courage this week. Write your plan and pray over it.", action:"Take one courageous authority action this week. Report the result to your accountability partner." },
  { week:"Week 49", phase:"Phase 4 — Legacy", season:"Phase 4 — Legacy", months:"November", title:"Kingdom Culture — Communities Create Impact", anchor:"Acts 2:42–47 · Psalm 133 · Isaiah 60:1–5 · Acts 4:32–35 · Jeremiah 29:7", summary:"The early church community in Acts 2 was not a Sunday gathering — it was a daily covenant culture. This study builds the framework for creating Kingdom communities that produce transformation in every sphere of society they touch.", takeaways:["The community of Acts 2 had a culture, not just a calendar — and it changed the world.","Unity does not mean uniformity — it means shared vision, shared covenant, and shared mission.","As Jerusalem rises, nations will come. Kingdom culture is the most powerful force of attraction."], topics:["community","culture","acts 2","psalm 133","isaiah 60","unity","impact","covenant community"], color:"#1B3A5C", teaching:"The community of Acts 2 had a culture, not just a calendar. Culture creates lasting Kingdom impact.", reflection:"What is the current culture of your community? What values does it transmit without being taught?", assignment:"Write a Kingdom culture document for your household, community, or organization — what values, rhythms, and practices define it.", action:"Implement one new Kingdom culture practice in your household or community this week." },
  { week:"Week 50", phase:"Phase 4 — Legacy", season:"Phase 4 — Legacy", months:"November", title:"Kingdom Culture — Building Covenant Community", anchor:"Acts 2:44–45 · Hebrews 10:24–25 · Galatians 6:2 · Romans 12:10–16 · 1 Corinthians 12:26", summary:"Covenant community is not a nice idea — it is the survival strategy of the remnant. When one member suffers, all suffer; when one is honored, all rejoice. This study builds the practical theology of mutual bearing, mutual building, and mutual accountability.", takeaways:["Bear one another's burdens — this is the economy of covenant community, not charity.","A community that only gathers and never bears is a social club, not a covenant family.","The strength of a covenant community is tested not in celebration but in crisis."], topics:["covenant community","bearing burdens","acts 2","hebrews","galatians 6","romans 12","1 corinthians 12"], color:"#1B3A5C", teaching:"Covenant community is the survival strategy of the remnant — not the nice-to-have of the comfortable.", reflection:"When was the last time your community bore someone's burden at personal cost? When were you last on the receiving end?", assignment:"Identify one person in your community who is currently in need — practically or spiritually. Design one specific way to bear their burden this week.", action:"Do it this week. Do not announce it — do it." },
  { week:"Week 51", phase:"Phase 4 — Legacy", season:"Phase 4 — Legacy", months:"November", title:"Legacy — Leaders Leave a Legacy", anchor:"Deuteronomy 6:4–9 · 2 Timothy 4:6–8 · Hebrews 11:1–40 · Proverbs 13:22 · Psalm 78:4–7", summary:"Legacy is not what you leave behind — it is what you send forward. This study draws from the Hebrews 11 cloud of witnesses, the Deuteronomy 6 command to transmit truth across generations, and Paul's final charge to Timothy.", takeaways:["The hall of faith in Hebrews 11 is not a museum — it is a cloud of witnesses surrounding your present race.","Generational legacy is built in the daily faithfulness of covenant living.","Paul's final words were not a regret — they were a declaration. Build a life that ends with that testimony."], topics:["legacy","generations","hebrews 11","deuteronomy 6","2 timothy","proverbs 13","psalm 78","faith"], color:"#1B3A5C", teaching:"Legacy is what you send forward, not what you leave behind. Build a life that ends with Paul's testimony.", reflection:"What will the generation after you say about how you lived? What are you currently building that will outlast you?", assignment:"Write your legacy letter to the next generation — what you are building, what you believe, what you want them to know and carry.", action:"Read your legacy letter to your household or record it. Seal it for your children." },
  { week:"Week 52", phase:"Phase 4 — Legacy", season:"Phase 4 — Legacy", months:"November", title:"Legacy — The Mission Continues", anchor:"Matthew 28:18–20 · Acts 1:8 · Isaiah 9:7 · 2 Timothy 2:2 · Revelation 5:9–10", summary:"The Kingdom has no retirement plan. The Great Commission is the final assignment — not the beginning of a chapter, but the continuation of a story that will fill the whole earth as the waters cover the sea. This study closes the 52-week cycle and launches the next.", takeaways:["The increase of His government and peace has no end — we are participating in an eternal mission.","Every generation of disciples is responsible for the next wave of the Kingdom advance.","This is not the end of a program — it is the beginning of a life fully deployed for the Kingdom."], topics:["great commission","mission","legacy","matthew 28","acts 1","isaiah 9","revelation","kingdom advance"], color:"#1B3A5C", teaching:"The Kingdom has no retirement plan. You are participating in a mission with no end.", reflection:"What does the next year of your Kingdom mission look like? Who will you take with you?", assignment:"Write your Kingdom mission statement for the coming year. Include who you will disciple, what you will build, and how you will multiply.", action:"Participants prepare for the International Convention. Come with your testimony, your mission statement, and your covenant team." },
];

// Hebrew Word of the Week
const HEBREW_WORDS = [
  { week:1,  word:"Qadosh",     meaning:"Holy / Set Apart",         verse:"Leviticus 11:44",    desc:"God commanded His people to be qadosh — not just morally clean but set apart for His purpose and use." },
  { week:2,  word:"Teshuvah",   meaning:"Repentance / Return",      verse:"Joel 2:12",          desc:"Teshuvah means to turn back. True repentance is not sorrow alone — it is a complete turning of direction." },
  { week:3,  word:"Emunah",     meaning:"Faith / Faithfulness",     verse:"Habakkuk 2:4",       desc:"Emunah is not blind belief. It is active, consistent faithfulness — the kind that holds steady under pressure." },
  { week:4,  word:"Shalom",     meaning:"Peace / Wholeness",        verse:"Isaiah 53:5",        desc:"Shalom means far more than the absence of conflict. It describes complete wholeness — spirit, body, community." },
  { week:5,  word:"Tefillah",   meaning:"Prayer / Intercession",    verse:"Psalm 102:1",        desc:"Tefillah is the Hebrew word for prayer — rooted in self-examination and aligning oneself with the will of God." },
  { week:6,  word:"Yirah",      meaning:"Fear / Reverence",         verse:"Proverbs 1:7",       desc:"Yirah does not mean terror. It is profound reverence — the awe that shapes behavior and produces wisdom." },
  { week:7,  word:"Emet",       meaning:"Truth / Faithfulness",     verse:"Psalm 119:142",      desc:"Emet means truth that is enduring, reliable, and tested. The Torah is emet — unchanging and absolute." },
  { week:8,  word:"Rachamim",   meaning:"Compassion / Mercies",     verse:"Lamentations 3:22",  desc:"Rachamim comes from the word for womb — describing the deep, maternal compassion the Most High has for His people." },
  { week:9,  word:"Binah",      meaning:"Understanding",            verse:"Proverbs 4:7",       desc:"Binah goes beyond knowing — it is the ability to discern, distinguish, and apply wisdom to real-life situations." },
  { week:10, word:"Lashon",     meaning:"Tongue / Language",        verse:"Proverbs 18:21",     desc:"Lashon (tongue) carries the power of life and death. Every word spoken is a spiritual act with lasting consequence." },
  { week:11, word:"Anavah",     meaning:"Humility / Meekness",      verse:"Psalm 22:26",        desc:"Anavah is the posture of one who knows their place before God — not lowly in self-worth, but rightly aligned in spirit." },
  { week:12, word:"Lev",        meaning:"Heart / Inner Man",        verse:"Proverbs 4:23",      desc:"Lev is the center of the person — will, thought, emotion, and intention. God looks at the lev above all else." },
  { week:13, word:"Tzara",      meaning:"Trouble / Affliction",     verse:"Psalm 91:15",        desc:"Tzara describes distress and trials. The promise is that God is present in the tzara and delivers those who call." },
  { week:14, word:"Chet",       meaning:"Sin / Missing the Mark",   verse:"Psalm 51:4",         desc:"Chet means to miss the intended mark. It is not inherent evil but a falling short of the path God designed." },
  { week:15, word:"Ruach",      meaning:"Spirit / Wind / Breath",   verse:"Ezekiel 36:26",      desc:"Ruach is the Spirit of God — the life-breath that was present at creation and that transforms the inner man." },
  { week:16, word:"Yasha",      meaning:"Salvation / Deliverance",  verse:"Psalm 118:14",       desc:"Yasha is the root of Yeshua (salvation). It means deliverance — not just from sin but from every form of bondage." },
  { week:17, word:"Milchamah",  meaning:"Battle / War",             verse:"Psalm 144:1",        desc:"Milchamah is warfare. The Most High trains His people for milchamah — spiritual battle requires preparation." },
  { week:18, word:"Sar",        meaning:"Leader / Prince",          verse:"Proverbs 8:16",      desc:"Sar describes a ruler or leader. True sar carries responsibility — authority without righteousness becomes oppression." },
  { week:19, word:"Berith",     meaning:"Covenant / Bond",          verse:"Genesis 15:18",      desc:"Berith is the Hebrew covenant — a binding agreement sealed in blood. It describes the relationship between God and Israel." },
  { week:20, word:"Ben",        meaning:"Son / Child",              verse:"Proverbs 22:6",      desc:"Ben means son or child. In covenant context, it carries both identity and inheritance — who you are and what you receive." },
  { week:21, word:"Amal",       meaning:"Toil / Labor",             verse:"Ecclesiastes 9:10",  desc:"Amal is productive labor — work done with the whole strength. It is both the burden and the dignity of a righteous life." },
  { week:22, word:"Osher",      meaning:"Wealth / Blessing",        verse:"Proverbs 3:16",      desc:"Osher is wealth and abundance. Scripture teaches that true wealth follows righteousness — not the other way around." },
  { week:23, word:"Mishpat",    meaning:"Justice / Judgment",       verse:"Micah 6:8",          desc:"Mishpat is right judgment — the social, moral, and legal dimension of covenant life. God requires mishpat from His people." },
  { week:24, word:"Achvah",     meaning:"Brotherhood / Unity",      verse:"Psalm 133:1",        desc:"Achvah is the bond of brotherhood. When brothers dwell together in unity, the scripture says it is like the holy anointing oil." },
  { week:25, word:"Nefesh",     meaning:"Soul / Being",             verse:"Genesis 2:7",        desc:"Nefesh is the entire being — not just the invisible soul but the whole living person. You do not have a nefesh; you are one." },
  { week:26, word:"Badal",      meaning:"Separation / Division",    verse:"Leviticus 20:26",    desc:"Badal means to set apart or separate. The covenant call of badal is not rejection of the world — it is distinction for purpose." },
  { week:27, word:"Dorot",      meaning:"Generations",              verse:"Psalm 78:4",         desc:"Dorot means generations. Covenant truth is designed to be transmitted through dorot — each generation handing it to the next." },
  { week:28, word:"Salachah",   meaning:"Forgiveness / Pardon",     verse:"Psalm 103:3",        desc:"Salachah is divine forgiveness — the cancellation of debt and removal of offense. God offers it; His people must extend it." },
  { week:29, word:"Zakar",      meaning:"Remember / Recall",        verse:"Deuteronomy 8:2",    desc:"Zakar means to remember actively. When God zakar — remembers His covenant — He acts. His people are commanded to do the same." },
  { week:30, word:"Pesach",     meaning:"Passover / Pass Over",     verse:"Exodus 12:27",       desc:"Pesach is the great deliverance feast — marking the night Israel was passed over and their exodus from bondage began." },
  { week:31, word:"Midbar",     meaning:"Wilderness / Desert",      verse:"Deuteronomy 8:2",    desc:"Midbar means wilderness — a place of testing, formation, and dependence. Every great covenant figure passed through a midbar." },
  { week:32, word:"Melek",      meaning:"King / Ruler",             verse:"Psalm 24:8",         desc:"Melek is king. The Most High is the true Melek — every earthly melek answers to divine authority and covenant standard." },
  { week:33, word:"Navi",       meaning:"Prophet / Spokesperson",   verse:"Deuteronomy 18:18",  desc:"Navi is a prophet — one who speaks the words of God to the people. The navi's role is not prediction but proclamation." },
  { week:34, word:"Galut",      meaning:"Exile / Captivity",        verse:"Lamentations 1:3",   desc:"Galut is exile — the condition of those removed from their land due to covenant unfaithfulness. Israel has lived galut for centuries." },
  { week:35, word:"She'erit",   meaning:"Remnant / Remainder",      verse:"Isaiah 10:21",       desc:"She'erit is the remnant — the faithful portion preserved through judgment. Every generation of apostasy has produced a she'erit." },
  { week:36, word:"Shuwb",      meaning:"Return / Restore",         verse:"Joel 2:12",          desc:"Shuwb means to return completely. It is the Hebrew concept behind restoration — a full turning back to covenant alignment." },
  { week:37, word:"Mashiach",   meaning:"Anointed One / Messiah",   verse:"Daniel 9:25",        desc:"Mashiach means the anointed one — prophet, priest, and king. Scripture describes the coming mashiach across hundreds of prophecies." },
  { week:38, word:"Torah",      meaning:"Instruction / Law",        verse:"Psalm 119:105",      desc:"Torah does not simply mean law — it means divine instruction for living. It is the covenant blueprint for every area of life." },
  { week:39, word:"Malkut",     meaning:"Kingdom / Reign",          verse:"Daniel 2:44",        desc:"Malkut is kingdom or dominion. The malkut of the Most High is eternal — it cannot be shaken, transferred, or overthrown." },
  { week:40, word:"Chesed",     meaning:"Lovingkindness / Mercy",   verse:"Lamentations 3:22",  desc:"Chesed is the covenant love of the Most High — steadfast, loyal, and unconditional in its faithfulness to His people." },
  { week:41, word:"Din",        meaning:"Judgment / Verdict",       verse:"Ecclesiastes 12:14", desc:"Din is judgment or legal verdict. The Most High is the ultimate judge. Every din will reflect the covenant standard of truth." },
  { week:42, word:"Techiyyah",  meaning:"Resurrection / Revival",   verse:"Ezekiel 37:5",       desc:"Techiyyah means revival or resurrection. The dry bones vision of Ezekiel 37 is a picture of national techiyyah for Israel." },
  { week:43, word:"Acharit",    meaning:"End / Latter Days",        verse:"Deuteronomy 4:30",   desc:"Acharit means the latter end or the last days. Scripture uses acharit hayamim — end of days — for the final prophetic season." },
  { week:44, word:"Chadash",    meaning:"New / Renewed",            verse:"Jeremiah 31:31",     desc:"Chadash means new or renewed. The new covenant of Jeremiah 31 is a chadash berith — not a replacement but a renewal." },
  { week:45, word:"Yerush.",    meaning:"Jerusalem / Inheritance",  verse:"Psalm 122:6",        desc:"Yerushalayim (Jerusalem) means City of Peace. It is the covenant city — the place where heaven and earth meet in prophecy." },
  { week:46, word:"Todah",      meaning:"Thanksgiving / Praise",    verse:"Psalm 100:4",        desc:"Todah is sacrificial thanksgiving — praise offered even before the answer arrives. It is a declaration of covenant trust." },
  { week:47, word:"Tsaphah",    meaning:"Watchman / Lookout",       verse:"Ezekiel 33:7",       desc:"Tsaphah is to watch or guard. The watchman (tsaphah) is stationed at the wall — responsible for warning before danger arrives." },
  { week:48, word:"Berachah",   meaning:"Blessing / Benediction",   verse:"Deuteronomy 28:2",   desc:"Berachah is blessing — the tangible overflow of covenant alignment. Berachot (blessings) are promised for obedience." },
  { week:49, word:"Chokmah",    meaning:"Wisdom",                   verse:"Proverbs 8:1",       desc:"Chokmah is the Hebrew word for wisdom — divine skill for living. It calls out from the heights and seeks those who will hear." },
  { week:50, word:"Goyim",      meaning:"Nations / Peoples",        verse:"Isaiah 2:4",         desc:"Goyim means the nations. Scripture describes both the judgment of the goyim and their eventual inclusion in covenant blessing." },
  { week:51, word:"Shekhinah",  meaning:"Divine Presence",          verse:"Exodus 40:34",       desc:"Shekhinah describes the dwelling presence of the Most High — the cloud that filled the tabernacle and will fill the New Jerusalem." },
  { week:52, word:"Olam",       meaning:"Eternity / Forever",       verse:"Isaiah 40:28",       desc:"Olam means eternity or the age. The Most High is El Olam — the eternal God. His covenant is an olam covenant that never ends." },
];

const DEVOTIONALS = [
  {
    day:"Day 1", stage:"Identity", stageNum:1, icon:"🔍", color:"#8B3A2A",
    title:"Remember Who You Are",
    subtitle:"You cannot return to what you do not know you left.",
    verse:"Hosea 1:9-10",
    text:"Then said God, Call his name Lo-ammi: for ye are not my people, and I will not be your God. Yet the number of the children of Israel shall be as the sand of the sea, which cannot be measured nor numbered; and it shall come to pass, that in the place where it was said unto them, Ye are not my people, there it shall be said unto them, Ye are the sons of the living God.",
    primaryScriptures:[
      { ref:"Hosea 1:9-10", text:"Then said God, Call his name Lo-ammi: for ye are not my people, and I will not be your God. Yet the number of the children of Israel shall be as the sand of the sea, which cannot be measured nor numbered." },
      { ref:"Deuteronomy 7:6", text:"For thou art an holy people unto the LORD thy God: the LORD thy God hath chosen thee to be a special people unto himself, above all people that are upon the face of the earth." },
      { ref:"Baruch 4:28", text:"For as it was your mind to go astray from God: so, being returned, seek him ten times more." },
      { ref:"Exodus 11:7", text:"But against any of the children of Israel shall not a dog move his tongue, against man or beast: that ye may know how that the LORD doth put a difference between the Egyptians and Israel." },
      { ref:"Isaiah 43:1", text:"But now thus saith the LORD that created thee, O Jacob, and he that formed thee, O Israel, Fear not: for I have redeemed thee, I have called thee by thy name; thou art mine." },
      { ref:"Baruch 2:30-32", text:"For I knew that they would not hear me, because it is a stiffnecked people: but in the land of their captivities they shall remember themselves." },
    ],
    explanation:"Lo-ammi means 'not my people' — a name YAHAWAH gave to signal covenant departure. But the very same chapter promises reversal: in the same place the curse was spoken, restoration will be declared. Exodus 11:7 reveals something important: YAHAWAH put a difference between Israel and the Egyptians. Identity loss is a covenant stage, not a permanent sentence.",
    whyMatters:"You cannot fix what you do not understand. Millions carry the weight of not knowing who they are — operating under wrong names, wrong histories, wrong spiritual frameworks. This study begins there: not with accusations but with scripture. YAHAWAH's diagnosis is the beginning of His healing.",
    relatedScriptures:["Hosea 1:9-10","Baruch 2:30-32","Deuteronomy 28:37","Hosea 2:23","Romans 9:25-26","1 Peter 2:9","Isaiah 44:1-2"],
    prayer:"YAHAWAH, I come before You with an open heart. I have carried names and identities that were given to me by systems that did not know You. Today I ask You to show me who I am in Your covenant — not through tradition or assumption, but through Your Word. Let identity begin here. In Yahawashi's name, Amein.",
    action:"Write out the names the world has given you (labels, limitations, shame). Then write what YAHAWAH calls you in Hosea 2:23 and 1 Peter 2:9. Keep the second list.",
    teachingCommentary:"Some covenant communities study identity through scripture prophecy and observable historical patterns. Approaches and conclusions vary — different teachers draw different lines between what is settled fact and what is interpretive tradition. This devotional is grounded in the scriptures themselves. Students are encouraged to study the primary texts carefully before adopting any specific framework.",
    goDeeper:["captivities","ai-tribes","deut28"],
  },
  {
    day:"Day 2", stage:"Covenant", stageNum:2, icon:"📜", color:"#C4893A",
    title:"The Covenant Contract",
    subtitle:"Covenant is not a suggestion. It is a binding agreement with two outcomes.",
    verse:"Deuteronomy 28:1",
    text:"And it shall come to pass, if thou shalt hearken diligently unto the voice of the LORD thy God, to observe and to do all his commandments which I command thee this day, that the LORD thy God will set thee on high above all nations of the earth.",
    primaryScriptures:[
      { ref:"Deuteronomy 28:1-2", text:"And it shall come to pass, if thou shalt hearken diligently unto the voice of the LORD thy God, to observe and to do all his commandments which I command thee this day, that the LORD thy God will set thee on high above all nations of the earth. And all these blessings shall come on thee, and overtake thee." },
      { ref:"Deuteronomy 28:15", text:"But it shall come to pass, if thou wilt not hearken unto the voice of the LORD thy God, to observe to do all his commandments and his statutes which I command thee this day; that all these curses shall come upon thee, and overtake thee." },
      { ref:"Deuteronomy 30:1-3", text:"And it shall come to pass, when all these things are come upon thee, the blessing and the curse, which I have set before thee, and thou shalt call them to mind among all the nations, whither the LORD thy God hath driven thee, And shalt return unto the LORD thy God, and shalt obey his voice according to all that I command thee this day, thou and thy children, with all thine heart, and with all thy soul; That then the LORD thy God will turn thy captivity, and have compassion upon thee." },
      { ref:"Leviticus 26:3-4", text:"If ye walk in my statutes, and keep my commandments, and do them; Then I will give you rain in due season, and the land shall yield her increase, and the trees of the field shall yield their fruit." },
      { ref:"Leviticus 26:14-16", text:"But if ye will not hearken unto me, and will not do all these commandments; And if ye shall despise my statutes, or if your soul abhor my judgments, so that ye will not do all my commandments, but that ye break my covenant: I also will do this unto you." },
    ],
    explanation:"Deuteronomy 28 is the most important legal document in the Bible for understanding Israel's history. Chapter 28 verses 1-14 describe the blessings of covenant obedience. Verses 15-68 describe the curses of covenant disobedience. Both sides came to pass exactly as written. Deuteronomy 30 then provides the restoration clause — when the people return, YAHAWAH turns the captivity.",
    whyMatters:"You cannot understand the last 2,700 years of history without reading Deuteronomy 28. Every major event — the Assyrian exile, the Babylonian captivity, the Roman dispersion — is described in these verses. The covenant was not theoretical. It was prophetic. And the restoration chapter is just as real.",
    relatedScriptures:["Deuteronomy 28:1-14","Deuteronomy 28:15-68","Deuteronomy 30:1-10","Leviticus 26:3-13","Leviticus 26:14-33","Jeremiah 11:3-4"],
    prayer:"YAHAWAH, I come before the covenant with reverence. I acknowledge that Your word is law — not metaphor, not history, but living covenant reality. Show me what it means to walk in obedience, not out of fear, but out of love and identity. I choose the covenant path today. In Yahawashi's name, Amein.",
    action:"Read Deuteronomy 28 in full today — all 68 verses. Circle every verse that describes something you have personally seen or experienced. Bring your notes to the next Shabbat class.",
    resources:[
      { type:"Scripture Source", label:"BibleGateway — Deuteronomy 28", url:"https://www.biblegateway.com/passage/?search=Deuteronomy+28&version=KJV" },
      { type:"Scripture Source", label:"BibleGateway — Leviticus 26", url:"https://www.biblegateway.com/passage/?search=Leviticus+26&version=KJV" },
    ],
    goDeeper:["deut28","captivities","reading"],
  },
  {
    day:"Day 3", stage:"Signs", stageNum:3, icon:"⛓️", color:"#6D4C41",
    title:"The Signs and Wonders of Judgment",
    subtitle:"These curses were called 'signs and wonders' — visible to all nations, upon the seed forever.",
    verse:"Deuteronomy 28:46",
    text:"And they shall be upon thee for a sign and for a wonder, and upon thy seed for ever.",
    primaryScriptures:[
      { ref:"Deuteronomy 28:46", text:"And they shall be upon thee for a sign and for a wonder, and upon thy seed for ever." },
      { ref:"Deuteronomy 28:48", text:"Therefore shalt thou serve thine enemies which the LORD shall send against thee, in hunger, and in thirst, and in nakedness, and in want of all things: and he shall put a yoke of iron upon thy neck, until he have destroyed thee." },
      { ref:"Deuteronomy 28:68", text:"And the LORD shall bring thee into Egypt again with ships, by the way whereof I spake unto thee, Thou shalt see it no more again: and there ye shall be sold unto your enemies for bondmen and bondwomen, and no man shall buy you." },
      { ref:"Deuteronomy 28:37", text:"And thou shalt become an astonishment, a proverb, and a byword, among all nations whither the LORD shall lead thee." },
      { ref:"Luke 21:24", text:"And they shall fall by the edge of the sword, and shall be led away captive into all nations: and Jerusalem shall be trodden down of the Gentiles, until the times of the Gentiles be fulfilled." },
      { ref:"Amos 3:1-2", text:"Hear this word that the LORD hath spoken against you, O children of Israel, against the whole family which I brought up from the land of Egypt, saying, You only have I known of all the families of the earth: therefore I will punish you for all your iniquities." },
    ],
    explanation:"Moses used the phrase 'sign and wonder' deliberately. The curses of Deuteronomy 28 were not private suffering — they were visible to all peoples. Three specific verses stand out: verse 46 (eternal signs upon the seed), verse 48 (yoke of iron), and verse 68 (captivity by ships). Luke 21:24 confirms: scattered among all nations until the times of the Gentiles be fulfilled.",
    whyMatters:"Understanding the signs of punishment does not produce despair — it produces clarity. When suffering makes sense within a covenant framework, it transforms from random tragedy to covenant consequence — which means it has a solution. The same God who described the punishment also described the return in Deuteronomy 30.",
    relatedScriptures:["Deuteronomy 28:46","Deuteronomy 28:48","Deuteronomy 28:68","Luke 21:24","Amos 3:1-2","Deuteronomy 28:37","Jeremiah 30:7"],
    prayer:"YAHAWAH, the history of my people carries pain that I have not always understood. Today I ask for covenant eyes — the ability to see suffering not as abandonment, but as the consequence of departure, and the predecessor to restoration. Give me understanding without bitterness, and grief without despair. In Yahawashi's name, Amein.",
    action:"Read Deuteronomy 28:48 and 28:68. Write in your journal: What historical events do these verses bring to mind for you? Bring your observations to Shabbat class this week.",
    teachingCommentary:"Some teachers and covenant study communities use Deuteronomy 28 — especially verses 46, 48, and 68 — as a framework for identifying historical patterns of punishment and connecting them to specific peoples. The concept of 'signs and wonders upon the seed' is used as an interpretive lens for understanding modern diaspora communities. These are teaching traditions within specific communities — students are encouraged to study the primary texts carefully and draw conclusions with prayer and discernment.",
    resources:[
      { type:"Scripture Source", label:"BibleGateway — Deuteronomy 28", url:"https://www.biblegateway.com/passage/?search=Deuteronomy+28&version=KJV" },
      { type:"Scripture Source", label:"BibleGateway — Luke 21", url:"https://www.biblegateway.com/passage/?search=Luke+21&version=KJV" },
      { type:"Historical Source", label:"Britannica — Transatlantic Slave Trade", url:"https://www.britannica.com/topic/transatlantic-slave-trade" },
    ],
    goDeeper:["captivities","deut28","ai-tribes"],
  },
  {
    day:"Day 4", stage:"Law", stageNum:4, icon:"⚖️", color:"#1B3A5C",
    title:"The Laws That Set Us Apart",
    subtitle:"The law was not abolished. It was fulfilled in Yahawashi — and still defines covenant life.",
    verse:"Matthew 5:17",
    text:"Think not that I am come to destroy the law, or the prophets: I am not come to destroy, but to fulfil.",
    primaryScriptures:[
      { ref:"Matthew 5:17", text:"Think not that I am come to destroy the law, or the prophets: I am not come to destroy, but to fulfil." },
      { ref:"Matthew 19:16-17", text:"And, behold, one came and said unto him, Good Master, what good thing shall I do, that I may have eternal life? And he said unto him, Why callest thou me good? there is none good but one, that is, God: but if thou wilt enter into life, keep the commandments." },
      { ref:"Deuteronomy 22:5", text:"The woman shall not wear that which pertaineth unto a man, neither shall a man put on a woman's garment: for all that do so are abomination unto the LORD thy God." },
      { ref:"Leviticus 11:2-3", text:"Speak unto the children of Israel, saying, These are the beasts which ye shall eat among all the beasts that are on the earth. Whatsoever parteth the hoof, and is clovenfooted, and cheweth the cud, among the beasts, that shall ye eat." },
      { ref:"Leviticus 23:2-3", text:"Speak unto the children of Israel, and say unto them, Concerning the feasts of the LORD, which ye shall proclaim to be holy convocations, even these are my feasts. Six days shall work be done: but the seventh day is the sabbath of rest, an holy convocation." },
      { ref:"Hebrews 13:4", text:"Marriage is honourable in all, and the bed undefiled: but whoremongers and adulterers God will judge." },
    ],
    explanation:"Yahawashi's own words confirm: He did not come to end the Torah. He came to fulfill the prophetic requirements of sacrifice and redemption. The laws governing daily life — food, dress, holy days, marriage, morality — were given as covenant markers that distinguished Israel from surrounding nations. They are still relevant because covenant identity is still relevant.",
    whyMatters:"In an age where culture is redefined daily, the covenant law provides an anchor. It tells you what to eat, how to dress, when to rest, how to treat your spouse, how to raise your children. It is not legalism — it is covenant infrastructure.",
    lawSections:[
      {
        heading:"Dress Code", color:"#6B1A4A",
        scriptures:[
          { ref:"Deuteronomy 22:5", text:"The woman shall not wear that which pertaineth unto a man, neither shall a man put on a woman's garment: for all that do so are abomination unto the LORD thy God." },
          { ref:"1 Timothy 2:9-10", text:"In like manner also, that women adorn themselves in modest apparel, with shamefacedness and sobriety; not with broided hair, or gold, or pearls, or costly array; But (which becometh women professing godliness) with good works." },
          { ref:"1 Peter 3:3-4", text:"Whose adorning let it not be that outward adorning of plaiting the hair, and of wearing of gold, or of putting on of apparel; But let it be the hidden man of the heart." },
          { ref:"Numbers 15:38-40", text:"Speak unto the children of Israel, and bid them that they make them fringes in the borders of their garments throughout their generations, and that they put upon the fringe of the borders a ribband of blue: And it shall be unto you for a fringe, that ye may look upon it, and remember all the commandments of the LORD, and do them." },
        ]
      },
      {
        heading:"Food Laws", color:"#2E7D32",
        scriptures:[
          { ref:"Leviticus 11:2-3", text:"These are the beasts which ye shall eat among all the beasts that are on the earth. Whatsoever parteth the hoof, and is clovenfooted, and cheweth the cud, among the beasts, that shall ye eat." },
          { ref:"Leviticus 11:7-8", text:"And the swine, though he divide the hoof, and be clovenfooted, yet he cheweth not the cud; he is unclean to you. Of their flesh shall ye not eat, and their carcase shall ye not touch; they are unclean to you." },
          { ref:"Leviticus 11:9-10", text:"These shall ye eat of all that are in the waters: whatsoever hath fins and scales in the waters, in the seas, and in the rivers, them shall ye eat. And all that have not fins and scales in the seas, and in the rivers, of all that move in the waters, and of any living thing which is in the waters, they shall be an abomination unto you." },
          { ref:"Deuteronomy 14:3", text:"Thou shalt not eat any abominable thing." },
          { ref:"Isaiah 66:17", text:"They that sanctify themselves, and purify themselves in the gardens behind one tree in the midst, eating swine's flesh, and the abomination, and the mouse, shall be consumed together, saith the LORD." },
        ]
      },
      {
        heading:"Holy Days & Feasts", color:"#C4893A",
        scriptures:[
          { ref:"Leviticus 23:2-3", text:"Concerning the feasts of the LORD, which ye shall proclaim to be holy convocations, even these are my feasts. Six days shall work be done: but the seventh day is the sabbath of rest, an holy convocation." },
          { ref:"Exodus 20:8-11", text:"Remember the sabbath day, to keep it holy. Six days shalt thou labour, and do all thy work: But the seventh day is the sabbath of the LORD thy God: in it thou shalt not do any work." },
          { ref:"Leviticus 23:4-5", text:"These are the feasts of the LORD, even holy convocations, which ye shall proclaim in their seasons. In the fourteenth day of the first month at even is the LORD'S passover." },
          { ref:"Deuteronomy 16:16", text:"Three times in a year shall all thy males appear before the LORD thy God in the place which he shall choose; in the feast of unleavened bread, and in the feast of weeks, and in the feast of tabernacles." },
          { ref:"Isaiah 66:23", text:"And it shall come to pass, that from one new moon to another, and from one sabbath to another, shall all flesh come to worship before me, saith the LORD." },
        ]
      },
      {
        heading:"Marriage & Moral Laws", color:"#8B3A2A",
        scriptures:[
          { ref:"Hebrews 13:4", text:"Marriage is honourable in all, and the bed undefiled: but whoremongers and adulterers God will judge." },
          { ref:"Exodus 20:14", text:"Thou shalt not commit adultery." },
          { ref:"Leviticus 20:10", text:"And the man that committeth adultery with another man's wife, even he that committeth adultery with his neighbour's wife, the adulterer and the adulteress shall surely be put to death." },
          { ref:"Genesis 2:24", text:"Therefore shall a man leave his father and his mother, and shall cleave unto his wife: and they shall be one flesh." },
          { ref:"1 Corinthians 6:18-19", text:"Flee fornication. Every sin that a man doeth is without the body; but he that committeth fornication sinneth against his own body. What? know ye not that your body is the temple of the Holy Ghost which is in you?" },
        ]
      },
    ],
    relatedScriptures:["Matthew 5:17","Deuteronomy 22:5","Leviticus 11:1-23","Leviticus 23","Hebrews 13:4","Exodus 20","Matthew 19:16-17"],
    prayer:"YAHAWAH, I come before Your law not as a burden, but as an inheritance. The same commandments given to Moses on Sinai are the ones written in my heart by Your Spirit. Let me walk in them — not to earn salvation, but because I love You, and because they protect what You have given me. In Yahawashi's name, Amein.",
    action:"Choose one Torah command you have not been observing. Research it in scripture this week. Ask: What is its purpose? What does it protect? What does it teach? Report to Shabbat class.",
    goDeeper:["weekly","women","reading"],
  },
  {
    day:"Day 5", stage:"Messiah", stageNum:5, icon:"✦", color:"#5A7A52",
    title:"The Messiah Fulfilled the Prophecy of Sacrifice",
    subtitle:"Yahawashi was not a general savior. He was sent to a specific people with a specific mission.",
    verse:"Matthew 15:24",
    text:"But he answered and said, I am not sent but unto the lost sheep of the house of Israel.",
    primaryScriptures:[
      { ref:"Matthew 5:17", text:"Think not that I am come to destroy the law, or the prophets: I am not come to destroy, but to fulfil." },
      { ref:"Matthew 15:24", text:"But he answered and said, I am not sent but unto the lost sheep of the house of Israel." },
      { ref:"Acts 3:18", text:"But those things, which God before had shewed by the mouth of all his prophets, that Christ should suffer, he hath so fulfilled." },
      { ref:"Hebrews 10:8-10", text:"Above when he said, Sacrifice and offering and burnt offerings and offering for sin thou wouldest not, neither hadst pleasure therein; which are offered by the law; Then said he, Lo, I come to do thy will, O God. He taketh away the first, that he may establish the second. By the which will we are sanctified through the offering of the body of Jesus Christ once for all." },
      { ref:"Matthew 19:16-17", text:"And, behold, one came and said unto him, Good Master, what good thing shall I do, that I may have eternal life? And he said unto him, Why callest thou me good? there is none good but one, that is, God: but if thou wilt enter into life, keep the commandments." },
      { ref:"John 1:11", text:"He came unto his own, and his own received him not." },
      { ref:"Romans 1:16", text:"For I am not ashamed of the gospel of Christ: for it is the power of God unto salvation to every one that believeth; to the Jew first, and also to the Greek." },
    ],
    explanation:"Yahawashi stated His mission explicitly: the lost sheep of the house of Israel. He came to demonstrate the covenant's fulfillment through sacrifice (Hebrews 10:8-10), to restore the prophets' words (Acts 3:18), and to point scattered Israel back to covenant relationship with YAHAWAH. Acts 3:18 confirms: all that the prophets spoke was fulfilled in His suffering.",
    whyMatters:"Understanding who Yahawashi was sent to changes how you read the entire New Testament. The Sermon on the Mount was given to Israel. The parables were about Israel. The 12 disciples represented the 12 tribes. This is not exclusion — it is covenant priority.",
    relatedScriptures:["Matthew 15:24","Acts 3:18","Hebrews 10:8-10","Matthew 19:16-17","Matthew 5:17","John 1:11","Romans 1:16","Ezekiel 34:11-16"],
    prayer:"YAHAWAH, open my understanding of Your Son — not through tradition or religion, but through covenant. Let me see Yahawashi as the fulfillment of Your promises to Abraham, Isaac, and Jacob. Let His sacrifice be the bridge that leads me back to covenant life, covenant law, and covenant identity. In His name, Amein.",
    action:"Read Matthew 15:21-28 and Matthew 10:5-7. Write in your journal what you notice about who Yahawashi prioritized and why. How does this align with Ezekiel 34:11-16?",
    resources:[
      { type:"Scripture Source", label:"BibleGateway — Matthew 15", url:"https://www.biblegateway.com/passage/?search=Matthew+15&version=KJV" },
      { type:"Scripture Source", label:"BibleGateway — Hebrews 10", url:"https://www.biblegateway.com/passage/?search=Hebrews+10&version=KJV" },
    ],
    goDeeper:["ai-study","weekly","reading"],
  },
  {
    day:"Day 6", stage:"Diaspora", stageNum:6, icon:"🌍", color:"#7B5EA7",
    title:"Scattered Among the Nations",
    subtitle:"Understanding the scattering is the key to understanding the current age.",
    verse:"Hosea 8:8",
    text:"Israel is swallowed up: now shall they be among the Gentiles as a vessel wherein is no pleasure.",
    primaryScriptures:[
      { ref:"Hosea 8:8", text:"Israel is swallowed up: now shall they be among the Gentiles as a vessel wherein is no pleasure." },
      { ref:"James 1:1", text:"James, a servant of God and of the Lord Jesus Christ, to the twelve tribes which are scattered abroad, greeting." },
      { ref:"2 Kings 17:6", text:"In the ninth year of Hoshea the king of Assyria took Samaria, and carried Israel away into Assyria, and placed them in Halah and in Habor by the river of Gozan, and in the cities of the Medes." },
      { ref:"Joel 3:2", text:"I will also gather all nations, and will bring them down into the valley of Jehoshaphat, and will plead with them there for my people and for my heritage Israel, whom they have scattered among the nations, and parted my land." },
      { ref:"Joel 3:6", text:"The children also of Judah and the children of Jerusalem have ye sold unto the Grecians, that ye might remove them far from their border." },
      { ref:"Amos 9:9", text:"For, lo, I will command, and I will sift the house of Israel among all nations, like as corn is sifted in a sieve, yet shall not the least grain fall upon the earth." },
    ],
    explanation:"The process of Israel being counted among the nations happened in stages: the Assyrian exile (722 BCE) scattered the northern tribes. The Babylonian captivity (586 BCE) scattered Judah. The Roman destruction of Jerusalem (70 CE) finalized the global dispersion. James 1:1 writes to 'the twelve tribes scattered abroad' — confirming they were still a recognizable population in the first century.",
    whyMatters:"Hosea 8:8 describes something specific: Israel would be swallowed up — not exterminated, but absorbed. Their identity would be hidden among the nations, not erased. This means the covenant people exist today — they just do not know who they are.",
    diasporaSections:[
      {
        heading:"A. The Assyrian Captivity", color:"#6D4C41",
        scriptures:[
          { ref:"2 Kings 17:6", text:"In the ninth year of Hoshea the king of Assyria took Samaria, and carried Israel away into Assyria, and placed them in Halah and in Habor by the river of Gozan, and in the cities of the Medes." },
          { ref:"2 Kings 18:11", text:"And the king of Assyria did carry away Israel unto Assyria, and put them in Halah and in Habor by the river of Gozan, and in the cities of the Medes." },
          { ref:"Amos 5:27", text:"Therefore will I cause you to go into captivity beyond Damascus, saith the LORD, whose name is The God of hosts." },
          { ref:"Isaiah 10:5-6", text:"O Assyrian, the rod of mine anger, and the staff in their hand is mine indignation. I will send him against an hypocritical nation, and against the people of my wrath will I give him a charge, to take the spoil, and to take the prey." },
        ]
      },
      {
        heading:"B. The Arzareth Tradition — 2 Esdras", color:"#7B5EA7",
        scriptures:[
          { ref:"2 Esdras 13:40-45", text:"Those are the ten tribes, which were carried away prisoners out of their own land in the time of Osea the king, whom Salmanasar the king of Assyria led away captive, and he carried them over the waters, and so came they into another land. But they took this counsel among themselves, that they would leave the multitude of the heathen, and go forth into a further country, where never mankind dwelt, That they might there keep their statutes, which they never kept in their own land. And they entered into Euphrates by the narrow passages of the river. For the most High then shewed signs for them, and held still the flood, till they were passed over. For through that country there was a great way to go, namely, of a year and a half: and the same region is called Arzareth." },
        ]
      },
      {
        heading:"C. Nations and Captive-Selling", color:"#C0392B",
        scriptures:[
          { ref:"Joel 3:2", text:"I will also gather all nations, and will bring them down into the valley of Jehoshaphat, and will plead with them there for my people and for my heritage Israel, whom they have scattered among the nations, and parted my land." },
          { ref:"Joel 3:6", text:"The children also of Judah and the children of Jerusalem have ye sold unto the Grecians, that ye might remove them far from their border." },
          { ref:"Deuteronomy 28:68", text:"And the LORD shall bring thee into Egypt again with ships, by the way whereof I spake unto thee, Thou shalt see it no more again: and there ye shall be sold unto your enemies for bondmen and bondwomen, and no man shall buy you." },
          { ref:"Amos 1:6", text:"Thus saith the LORD; For three transgressions of Gaza, and for four, I will not turn away the punishment thereof; because they carried away captive the whole captivity, to deliver them up to Edom." },
        ]
      },
      {
        heading:"D. The Scattered Tribes", color:"#1B3A5C",
        scriptures:[
          { ref:"James 1:1", text:"James, a servant of God and of the Lord Jesus Christ, to the twelve tribes which are scattered abroad, greeting." },
          { ref:"Hosea 8:8", text:"Israel is swallowed up: now shall they be among the Gentiles as a vessel wherein is no pleasure." },
          { ref:"Deuteronomy 4:27", text:"And the LORD shall scatter you among the nations, and ye shall be left few in number among the heathen, whither the LORD shall lead you." },
          { ref:"Ezekiel 36:19", text:"And I scattered them among the heathen, and they were dispersed through the countries: according to their way and according to their doings I judged them." },
          { ref:"Jeremiah 9:16", text:"I will scatter them also among the heathen, whom neither they nor their fathers have known: and I will send a sword after them, till I have consumed them." },
        ]
      },
    ],
    relatedScriptures:["Hosea 8:8","James 1:1","2 Kings 17:6","Joel 3:2","Joel 3:6","Amos 9:9","Deuteronomy 4:27"],
    prayer:"YAHAWAH, Your people have been scattered and swallowed. We have been hidden in plain sight — carrying the weight of covenant consequence without knowing its name. Today I ask for the spirit of remembrance spoken of in Deuteronomy 30:1 — the ability to call You to mind in the midst of captivity. Gather us, YAHAWAH. In Yahawashi's name, Amein.",
    action:"Read 1 Maccabees 1:41-50 and James 1:1. Compare them. What does the forced assimilation of the Maccabean period have in common with later periods of diaspora? Journal your thoughts.",
    teachingCommentary:"Some covenant study communities identify modern peoples — including various groups in the African and Caribbean diaspora — as descendants of the scattered tribes of Israel. This identification is typically made through prophetic interpretation of Deuteronomy 28, Genesis 49, and observable historical patterns. The specific identifications (e.g., which modern people corresponds to which tribe) are not found directly in the Bible and represent interpretive traditions, not universally settled history. Students are encouraged to study the primary scriptures carefully and draw their own conclusions with prayer and discernment.",
    resources:[
      { type:"Historical Source", label:"Britannica — Transatlantic Slave Trade", url:"https://www.britannica.com/topic/transatlantic-slave-trade" },
      { type:"Encyclopedia", label:"Jewish Encyclopedia — Arzareth", url:"https://www.jewishencyclopedia.com/articles/1959-arzareth" },
      { type:"Scripture Source", label:"BibleGateway — 2 Kings 17", url:"https://www.biblegateway.com/passage/?search=2+Kings+17&version=KJV" },
      { type:"Scripture Source", label:"BibleGateway — Joel 3", url:"https://www.biblegateway.com/passage/?search=Joel+3&version=KJV" },
    ],
    goDeeper:["captivities","historical","ai-tribes"],
  },
  {
    day:"Day 7", stage:"Restoration", stageNum:7, icon:"🌿", color:"#2E7D32",
    title:"Restoration, Trouble, and the Kingdom",
    subtitle:"The last chapter is not exile. It is restoration, judgment, and kingdom.",
    verse:"Jeremiah 30:7",
    text:"Alas! for that day is great, so that none is like it: it is even the time of Jacob's trouble; but he shall be saved out of it.",
    primaryScriptures:[
      { ref:"Deuteronomy 30:3", text:"That then the LORD thy God will turn thy captivity, and have compassion upon thee, and will return and gather thee from all the nations, whither the LORD thy God hath scattered thee." },
      { ref:"Jeremiah 30:7", text:"Alas! for that day is great, so that none is like it: it is even the time of Jacob's trouble; but he shall be saved out of it." },
      { ref:"Isaiah 11:12", text:"And he shall set up an ensign for the nations, and shall assemble the outcasts of Israel, and gather together the dispersed of Judah from the four corners of the earth." },
      { ref:"Ezekiel 37:21-22", text:"And say unto them, Thus saith the Lord GOD; Behold, I will take the children of Israel from among the heathen, whither they be gone, and will gather them on every side, and bring them into their own land: And I will make them one nation in the land upon the mountains of Israel; and one king shall be king to them all: and they shall be no more two nations, neither shall they be divided into two kingdoms any more at all." },
      { ref:"Revelation 21:12", text:"And had a wall great and high, and had twelve gates, and at the gates twelve angels, and names written thereon, which are the names of the twelve tribes of the children of Israel." },
      { ref:"Amos 9:14-15", text:"And I will bring again the captivity of my people of Israel, and they shall build the waste cities, and inhabit them; and they shall plant vineyards, and drink the wine thereof; they shall also make gardens, and eat the fruit of them. And I will plant them upon their land, and they shall no more be pulled up out of their land which I have given them, saith the LORD thy God." },
    ],
    explanation:"Jacob's trouble — described in Jeremiah 30:7, confirmed in Matthew 24, and detailed in Revelation — is the final period of tribulation before the Messiah's return and the regathering of Israel. But the verse does not end at trouble: 'but he shall be saved out of it.' The restoration arc: tribulation → repentance → Messiah's return → regathering of the 12 tribes → 12 gates of New Jerusalem named for the 12 tribes.",
    whyMatters:"Knowing where the story ends changes how you live today. You are not in a permanent captivity — you are in a covenant process. The dry bones will live (Ezekiel 37). The outcasts will be gathered (Isaiah 11:12). The tribes will be reunified. The twelve gates stand forever (Revelation 21:12). You are not finished — you are being prepared.",
    relatedScriptures:["Jeremiah 30:7","Ezekiel 37:21-22","Revelation 21:12","Isaiah 11:12","Deuteronomy 30:1-3","Baruch 5:5-9","Luke 1:68-71","Amos 9:14-15"],
    prayer:"YAHAWAH, I believe the story is not over. I believe the dry bones will live. I believe the outcasts will be gathered. I believe the twelve gates stand, and the names of the twelve tribes are written on them forever. Let me live with this end in view — not as speculation, but as covenant certainty. In Yahawashi's name, Amein.",
    action:"Read Revelation 21:9-14 and Ezekiel 37:1-14. Write out what the end of the covenant story looks like. Memorize one restoration verse this week. Declare it every morning.",
    teachingCommentary:"Luke 1:68-71 contains the Benedictus — the prayer of Zechariah at the birth of John the Baptist — declaring that YAHAWAH has visited and redeemed His people, raised up a horn of salvation in the house of David, and given deliverance from enemies. This language is national and covenantal, not merely spiritual. It frames Yahawashi's coming in terms of the restoration of Israel, the fulfillment of oaths to Abraham, and deliverance from national enemies. The restoration scriptures point to a literal, physical, and covenantal regathering — not only a spiritual metaphor.",
    resources:[
      { type:"Scripture Source", label:"BibleGateway — Ezekiel 37", url:"https://www.biblegateway.com/passage/?search=Ezekiel+37&version=KJV" },
      { type:"Scripture Source", label:"BibleGateway — Revelation 21", url:"https://www.biblegateway.com/passage/?search=Revelation+21&version=KJV" },
      { type:"Scripture Source", label:"BibleGateway — Jeremiah 30", url:"https://www.biblegateway.com/passage/?search=Jeremiah+30&version=KJV" },
    ],
    goDeeper:["captivities","ai-tribes","ai-timeline"],
  },
]

const READING_PLAN = [
  { day:"Day 1",  reading:"Genesis 1–2",         focus:"Creation, order, purpose, Sabbath pattern" },
  { day:"Day 2",  reading:"Exodus 19–20",        focus:"Covenant, commandments, reverence" },
  { day:"Day 3",  reading:"Leviticus 23",        focus:"Holy convocations, appointed times" },
  { day:"Day 4",  reading:"Deuteronomy 28",      focus:"Blessings, curses, covenant responsibility" },
  { day:"Day 5",  reading:"Psalm 1, 19, 119:1–32", focus:"Delight in the law, meditation" },
  { day:"Day 6",  reading:"Isaiah 58",           focus:"True fasting, justice, Sabbath delight" },
  { day:"Day 7",  reading:"Jeremiah 6:10–19 & Baruch 4", focus:"Return, the ancient paths" },
  { day:"Day 8",  reading:"Matthew 5–7",         focus:"Kingdom conduct, purity, prayer" },
  { day:"Day 9",  reading:"John 9",              focus:"Spiritual blindness, healing, boldness" },
  { day:"Day 10", reading:"Romans 6",            focus:"Grace, holiness, walking new" },
  { day:"Day 11", reading:"Ephesians 4–6",       focus:"Unity, character, spiritual warfare" },
  { day:"Day 12", reading:"James 1–2 & 1 Peter 5", focus:"Faith with works, sobriety" },
  { day:"Day 13", reading:"Sirach 2, 25, 26",    focus:"Wisdom, testing, household order" },
  { day:"Day 14", reading:"2 Esdras 6",          focus:"Signs, endurance, discernment" },
];


// ─── DIVINE NAMES CONFIGURATION ───────────────────────────────────────────────
// Hebrew Names used in teaching content (KJV quotes retain "LORD" / "God")
const DIVINE_NAMES = {
  father:    "YAHAWAH",          // The Most High — Heavenly Father
  son:       "Yahawashi",         // The Messiah — Son of the Father
  spirit:    "The Ruach Ha'Qodesh", // The Holy Spirit
  mostHigh:  "The Most High",
  note:      "Scripture quotes retain KJV text. Teaching commentary uses the Hebrew names.",
};

// ─── DAILY PRAYER & DEVOTIONAL DATA ──────────────────────────────────────────
const DAILY_PRAYERS = [
  {
    day:0, title:"Shabbat Prayer", type:"shabbat",
    opening:"Baruch Atah YAHAWAH — Blessed are You, O YAHAWAH our Power, who has sanctified us through Your commandments and commanded us to light the Shabbat candle.",
    body:"YAHAWAH, on this holy Shabbat, I come before Your presence with a grateful and humble heart. You are the Creator of heaven and earth, and You set apart this day as a sign between You and Your people forever. Let this day be a true rest — not just from labor, but from worry, from striving, from the noise of the world. Speak to me in the stillness. Teach me who I am in Your covenant. Let the Shabbat restore what the week has taken — my focus, my peace, my clarity of purpose. I bless Your name, YAHAWAH. Shabbat Shalom.",
    anchor:"Exodus 20:8 — Remember the Shabbat day to keep it holy.",
    instruction:"Light two candles at sunset. Rest from all labor. Study scripture. Fellowship with your household."
  },
  {
    day:1, title:"Morning Prayer — Identity & Covenant", type:"morning",
    opening:"YAHAWAH, I come before You at the beginning of this day.",
    body:"YAHAWAH, before I do anything else today, I declare that I belong to You — not to this world, not to my fears, and not to my past. You created me in Your image and called me by name before I was formed in the womb. Today I choose to walk in the identity You have given me, not the identity the world has assigned me. Let every word I speak, every decision I make, and every step I take today reflect the covenant people You are restoring. I am Your servant, and I trust Your plan. In the name of Yahawashi, Amein.",
    anchor:"1 Peter 2:9 — But ye are a chosen generation, a royal priesthood, a holy nation, a peculiar people.",
    instruction:"Speak your identity declaration before leaving home. Write one covenant truth you will stand on today."
  },
  {
    day:2, title:"Prayer for Wisdom & Discernment", type:"wisdom",
    opening:"YAHAWAH, I need Your wisdom today — not my own understanding.",
    body:"Heavenly Father YAHAWAH, the scriptures say that if any man lacks wisdom, let him ask You — and You give to all liberally. Today I ask for wisdom that goes beyond education, wisdom that comes from the fear of the LORD. Give me discernment to tell truth from deception, a spirit that recognizes false teaching, and the courage to act on what I know is right. Protect my mind from strongholds and my heart from compromise. As the men of Issachar had understanding of the times, give me understanding of this hour. In Yahawashi's name, Amein.",
    anchor:"James 1:5 — If any of you lack wisdom, let him ask of God, that giveth to all men liberally.",
    instruction:"Before making any major decision today, pause and pray this prayer. Write down what wisdom you receive."
  },
  {
    day:3, title:"Midweek Intercession Prayer", type:"intercession",
    opening:"YAHAWAH, I stand in the gap today for those who cannot stand for themselves.",
    body:"Father YAHAWAH, like Daniel who prayed three times a day and like Nehemiah who wept and prayed for his people, I come before You as an intercessor. Hear my prayer for my family — let covenant truth reach every member. Hear my prayer for my community — let righteousness and justice be established. Hear my prayer for our scattered people — gather the remnant from the four corners of the earth, as You promised through Isaiah. Let Your kingdom come in my household before it comes in the earth. In the name of Yahawashi HaMashiach, Amein.",
    anchor:"James 5:16 — The effectual fervent prayer of a righteous man availeth much.",
    instruction:"Name three specific people or situations to intercede for today. Return to this prayer throughout the day."
  },
  {
    day:4, title:"Prayer for Covenant Households", type:"family",
    opening:"YAHAWAH, I pray for my household — that it would be a covenant household.",
    body:"YAHAWAH, You commanded us in Deuteronomy 6 to teach Your words diligently to our children and to speak of them when we sit in our house and walk by the way. Let my home be a place where Your presence is welcomed, where Your word is taught, and where the next generation learns the ancient path. Strengthen the covenant bonds in my family. Restore what has been broken. Protect the children from the world's influence. Let the fathers in this community turn their hearts to their children, and the children to their fathers. Build covenant households that carry the truth forward. In Yahawashi's name, Amein.",
    anchor:"Deuteronomy 6:6-7 — These words shall be in thine heart: and thou shalt teach them diligently unto thy children.",
    instruction:"Gather your household before bed tonight. Read one scripture together. Pray this prayer over your home."
  },
  {
    day:5, title:"Prayer for Preparation & Purpose", type:"purpose",
    opening:"YAHAWAH, show me clearly what I am called to do.",
    body:"Father YAHAWAH, like Jeremiah who said 'before I formed thee in the belly I knew thee, and before thou camest forth I sanctified thee,' I believe that my life has a purpose that was determined before my birth. Help me not to waste the days of my assignment. Remove every distraction, every idol, and every fear that competes with my calling. Give me the courage to step into what You have prepared for me. I am not too old, too young, too broken, or too unknown. You called Gideon while he was hiding, David while he was tending sheep, and Moses while he was in the wilderness. Call me where I am and commission me forward. In Yahawashi's name, Amein.",
    anchor:"Jeremiah 1:5 — Before I formed thee in the belly I knew thee; and before thou camest forth out of the womb I sanctified thee.",
    instruction:"Write out your assignment statement this week. What specific work did YAHAWAH prepare you to do?"
  },
  {
    day:6, title:"Evening Prayer — Restoration & Rest", type:"evening",
    opening:"YAHAWAH, as this day ends, I lay down everything before You.",
    body:"Father YAHAWAH, as the sun sets on this day, I bring before You everything I carried — the victories, the failures, the questions, and the burdens. Thank You for being a God who does not sleep, who watches over Your covenant people through the night. Restore me as I sleep. Let my mind be renewed. Let the weight of the week lift. I trust Your promise in Deuteronomy 30 — that no matter how far the captivity has stretched, You will turn it. The promises are not canceled. The covenant is still in force. I rest in that truth tonight. In Yahawashi's name, Amein.",
    anchor:"Psalm 4:8 — I will both lay me down in peace, and sleep: for thou, YAHAWAH, only makest me dwell in safety.",
    instruction:"Before sleep: write one thing YAHAWAH did for you today. One gratitude. One trust. Release the rest."
  },
];

// ─── DIASPORA EXPANDED SECTIONS ──────────────────────────────────────────────
const DIASPORA_FLOW = [
  {
    id:"a1", label:"A1 — Covenant Distinction of Israel",
    summary:"Before the scattering, YAHAWAH established Israel as a distinct covenant people, separated from all nations.",
    scriptures:["Exodus 11:7","Leviticus 20:24","Deuteronomy 7:6"],
    note:`Exodus 11:7 matters because it establishes a foundational covenant principle — YAHAWAH made a distinction between Israel and Egypt while they were still in the same land. This distinction is the covenant basis that appears before the later scattering and identity loss. Teaching flow: (1) Israel separated → (2) Israel scattered → (3) Identity lost → (4) Oppressed → (5) Remembers → (6) Restored.`,
    type:"covenant",
  },
  {
    id:"a2", label:"A2 — Prophecy of Scattering",
    summary:"YAHAWAH warned that covenant disobedience would result in Israel being scattered among all peoples and countries.",
    scriptures:["Deuteronomy 28:64","Leviticus 26:33","Ezekiel 36:19"],
    note:"The scattering was not accidental or random — it was prophesied in specific detail before Israel entered the land. Moses and the prophets all warned of this covenant consequence.",
    type:"warning",
  },
  {
    id:"a3", label:"A3 — Identity Loss Among the Nations",
    summary:"The prophets describe a period where Israel would lose national identity and be counted among other nations.",
    scriptures:["Hosea 1:9-10","Hosea 8:8","Baruch 2:30-31"],
    note:"Hosea 1:9 — 'Lo-ammi: for ye are not my people.' This naming is directly reversed in Hosea 2:23 — the same God who declared 'not my people' will declare 'Thou art my people.' Identity loss is a covenant stage, not a permanent condition.",
    type:"identity",
  },
  {
    id:"a4", label:"A4 — Captivity and Oppression",
    summary:"Israel would experience reproach, oppression, and hardship among the nations as a covenant consequence.",
    scriptures:["Deuteronomy 28:37","Deuteronomy 28:48","Lamentations 5:5"],
    note:"The yoke of iron (Deuteronomy 28:48) and being a byword among nations (28:37) describe conditions that affect the whole covenant people — not one region or era, but a pattern that repeats across the diaspora.",
    type:"oppression",
  },
  {
    id:"a5", label:"A5 — Sold Among the Nations",
    summary:"Scriptures commonly studied in relation to captivity, forced displacement, and the selling of Israelites among the nations.",
    scriptures:["Joel 3:6","Deuteronomy 28:68","Baruch 4:6"],
    note:"TEACHING NOTE: Where historical interpretation is discussed, it is labeled as such. Joel 3:6 describes the selling of Israelites to the Grecians. Deuteronomy 28:68 describes a maritime captivity. Baruch 4:6 connects being delivered to enemies with covenant unfaithfulness. Members are encouraged to study these scriptures carefully and bring questions to the Shabbat discussion.",
    type:"captivity",
    resources:[
      { label:"Britannica — Transatlantic Slave Trade", url:"https://www.britannica.com/topic/transatlantic-slave-trade", type:"Historical Source" },
      { label:"SlaveVoyages Database", url:"https://www.slavevoyages.org/", type:"Database / Academic Resource" },
      { label:"NMAAHC — Transatlantic Slave Trade", url:"https://nmaahc.si.edu/explore/stories/transatlantic-slave-trade", type:"Museum / Archive" },
    ],
  },
  {
    id:"a6", label:"A6 — Remembrance in the Last Days",
    summary:"The prophets describe scattered Israel remembering covenant identity in the lands of captivity.",
    scriptures:["Deuteronomy 30:1-3","Jeremiah 16:14-15","Baruch 2:32"],
    note:"Deuteronomy 30:1 — 'When thou shalt call them to mind among all the nations whither the LORD thy God hath driven thee…' The act of remembering covenant identity — even in captivity — is the first step in the restoration sequence.",
    type:"remembrance",
  },
  {
    id:"a7", label:"A7 — Prophecy of Restoration",
    summary:"The scattering is not the end. The prophets speak of global regathering and full covenant restoration.",
    scriptures:["Ezekiel 37:21-22","Isaiah 11:12","Amos 9:14-15"],
    note:"Every captivity in Israel's history was followed by a restoration promise. The final gathering will be greater than the Exodus. Isaiah 11:11 calls it 'a second time' — the first was Egypt. The second will be global.",
    type:"restoration",
  },
  {
    id:"a8", label:"A8 — Why Exodus 11:7 Matters",
    summary:"A foundational covenant principle: YAHAWAH made a distinction between Israel and Egypt before the Exodus.",
    scriptures:["Exodus 11:7","Numbers 23:9","Deuteronomy 7:6"],
    note:"YAHAWAH told Moses: 'against any of the children of Israel shall not a dog move his tongue, against man or beast: that ye may know how that the LORD doth put a difference between the Egyptians and Israel.' This verse establishes that covenant distinction is a divine action — not a human claim. Understanding this distinction is foundational to understanding the scattering and the restoration.",
    type:"foundation",
  },
];

const MIGRATION_TRADITIONS = [
  {
    id:"b1", label:"The Northern Kingdom and Arzareth",
    summary:"Some traditions interpret apocryphal material as describing the ten tribes traveling to a distant land after the Assyrian exile.",
    scriptures:["2 Kings 17:6","2 Kings 18:11"],
    apocrypha:["2 Esdras 13:40-45"],
    note:"2 Esdras 13:40-45 records a tradition of the ten tribes journeying to Arzareth — 'another land' in Hebrew (eretz acheret). This is a historical interpretation, not a settled fact. It has been discussed in Jewish scholarship for centuries.",
    type:"interpretation",
    resources:[
      { label:"Jewish Encyclopedia — Arzareth", url:"https://www.jewishencyclopedia.com/articles/1867-arzareth", type:"Historical Interpretation / Encyclopedia" },
    ],
  },
  {
    id:"b2", label:"Jews Fleeing Roman Persecution",
    summary:"After the Roman destruction of Jerusalem (70 CE) and later upheavals, Jewish communities spread across many regions.",
    scriptures:["Luke 21:24","Matthew 24:16","James 1:1"],
    note:"Communities formed across North Africa, the Middle East, Europe, and the Mediterranean world. James 1:1 addresses 'the twelve tribes which are scattered abroad' — a New Testament confirmation of active diaspora.",
    type:"historical",
    resources:[
      { label:"Britannica — Siege of Jerusalem (70 CE)", url:"https://www.britannica.com/event/Siege-of-Jerusalem-70", type:"Encyclopedia" },
      { label:"Livius — Jerusalem", url:"https://www.livius.org/articles/place/jerusalem/", type:"Historical Source" },
      { label:"Britannica — Diaspora", url:"https://www.britannica.com/topic/diaspora-society", type:"Encyclopedia" },
    ],
  },
  {
    id:"b3", label:"Peoples of Africa in Biblical Context",
    summary:"The biblical genealogy of Ham and ancient peoples associated with African regions in biblical tradition.",
    scriptures:["Genesis 10:6-20"],
    note:"Genesis 10 records Egypt (Mitsrayim), Cush (Ethiopia), Put (Libya/North Africa), and Canaan as sons of Ham. These regions were in close geographical and covenant relationship with Israel throughout biblical history.",
    type:"geography",
    resources:[
      { label:"Britannica — Near East", url:"https://www.britannica.com/place/Near-East", type:"Encyclopedia" },
      { label:"Britannica — Levant", url:"https://www.britannica.com/place/Levant", type:"Encyclopedia" },
      { label:"World History Encyclopedia — Assyrian Empire", url:"https://www.worldhistory.org/Assyrian_Empire/", type:"Historical Source" },
    ],
  },
  {
    id:"b4", label:"Nations Trading Captives",
    summary:"Joel speaks of scattering and the selling of captives during ancient warfare.",
    scriptures:["Joel 3:2","Joel 3:6"],
    note:"Joel 3:6 — 'The children also of Judah and the children of Jerusalem have ye sold unto the Grecians, that ye might remove them far from their border.' This is an ancient prophetic text about captive-selling in a war context, not a modern political statement.",
    type:"captivity",
    resources:[
      { label:"Trans-Saharan Trade — World History Encyclopedia", url:"https://www.worldhistory.org/Trans-Saharan_Trade/", type:"Historical Source" },
      { label:"Library of Congress — Slavery Collections", url:"https://www.loc.gov/collections/", type:"Archive" },
    ],
  },
  {
    id:"b5", label:"Restoration Despite Scattering",
    summary:"Despite the breadth of the scattering, restoration remains the central covenant promise.",
    scriptures:["Ezekiel 37:21-22","Isaiah 11:12"],
    note:"The same God who scattered for covenant disobedience will regather for covenant restoration. This is the consistent pattern from Deuteronomy 30 through the final chapters of Revelation.",
    type:"restoration",
  },
];

// ─── WOMEN'S LAWS & PRACTICAL STUDY DATA ─────────────────────────────────────
// ─── WOMEN'S COVENANT PATH (7 Stages) ───────────────────────────────────────
const COVENANT_PATH_WOMEN = [
  {
    stage:1, icon:"👑", color:"#6B1A4A",
    title:"Identity of a Daughter of Israel",
    titleEs:"Identidad de una Hija de Israel",
    titleFr:"Identité d'une Fille d'Israël",
    subtitle:"Before law comes identity. You were called before you were born.",
    subtitleEs:"Antes de la ley viene la identidad. Fuiste llamada antes de nacer.",
    subtitleFr:"Avant la loi vient l'identité. Tu as été appelée avant ta naissance.",
    studyNote:"A daughter of Israel does not receive her identity from culture, tradition, or family opinion. She receives it from scripture. Covenant identity precedes every commandment — because obedience flows from knowing who you are.",
    primaryScriptures:[
      { ref:"Deuteronomy 7:6", text:"For thou art an holy people unto the LORD thy God: the LORD thy God hath chosen thee to be a special people unto himself, above all people that are upon the face of the earth." },
      { ref:"Isaiah 43:1", text:"But now thus saith the LORD that created thee, O Jacob, and he that formed thee, O Israel, Fear not: for I have redeemed thee, I have called thee by thy name; thou art mine." },
      { ref:"1 Peter 2:9", text:"But ye are a chosen generation, a royal priesthood, an holy nation, a peculiar people; that ye should shew forth the praises of him who hath called you out of darkness into his marvellous light." },
      { ref:"Hosea 1:10", text:"Yet the number of the children of Israel shall be as the sand of the sea, which cannot be measured nor numbered; and it shall come to pass, that in the place where it was said unto them, Ye are not my people, there it shall be said unto them, Ye are the sons of the living God." },
      { ref:"Baruch 4:1-3", text:"This is the book of the commandments of God, and the law that endureth for ever: all they that keep it shall come to life; but such as leave it shall die. Turn thee, O Jacob, and take hold of it: walk in the presence of the light thereof, that thou mayest be illuminated. Give not thine honour to another, nor the things that are profitable unto thee to a strange nation." },
      { ref:"Romans 9:4", text:"Who are Israelites; to whom pertaineth the adoption, and the glory, and the covenants, and the giving of the law, and the service of God, and the promises." },
    ],
    supporting:["Jeremiah 1:5","Sirach 24:8-12","Galatians 3:29","Psalm 135:4","Isaiah 44:1-2"],
    action:"Write your covenant identity declaration using Isaiah 43:1 and 1 Peter 2:9 as your foundation. Declare it aloud every morning this week.",
  },
  {
    stage:2, icon:"🌸", color:"#C97D1A",
    title:"What Is a Woman",
    titleEs:"¿Qué Es una Mujer?",
    titleFr:"Qu'est-ce qu'une Femme ?",
    subtitle:"What scripture teaches about womanhood, order, purpose, and dignity.",
    subtitleEs:"Lo que la escritura enseña sobre la feminidad, el orden, el propósito y la dignidad.",
    subtitleFr:"Ce que l'Écriture enseigne sur la féminité, l'ordre, le but et la dignité.",
    studyNote:"Womanhood in scripture is not defined by culture, modernity, or opinion. It is defined by covenant order. A woman was made from man, for man, with man — in covenant partnership. Understanding this is the beginning of honorable womanhood.",
    primaryScriptures:[
      { ref:"Genesis 2:18", text:"And the LORD God said, It is not good that the man should be alone; I will make him an help meet for him." },
      { ref:"Genesis 2:22-24", text:"And the rib, which the LORD God had taken from man, made he a woman, and brought her unto the man. And Adam said, This is now bone of my bones, and flesh of my flesh: she shall be called Woman, because she was taken out of Man." },
      { ref:"Proverbs 12:4", text:"A virtuous woman is a crown to her husband: but she that maketh ashamed is as rottenness in his bones." },
      { ref:"Proverbs 31:10", text:"Who can find a virtuous woman? for her price is far above rubies." },
      { ref:"Sirach 26:13-15", text:"The grace of a wife delighteth her husband, and her discretion will fatten his bones. A silent and loving woman is a gift of the Lord; and there is nothing so much worth as a mind well instructed." },
      { ref:"1 Corinthians 11:3", text:"But I would have you know, that the head of every man is Christ; and the head of the woman is the man; and the head of Christ is God." },
      { ref:"Titus 2:3-5", text:"The aged women likewise, that they be in behaviour as becometh holiness, not false accusers, not given to much wine, teachers of good things; That they may teach the young women to be sober, to love their husbands, to love their children, To be discreet, chaste, keepers at home, good, obedient to their own husbands, that the word of God be not blasphemed." },
    ],
    supporting:["Genesis 1:27","Proverbs 14:1","Proverbs 31:30","Sirach 26:1-4","1 Timothy 2:11-12"],
    action:"Read Proverbs 31 in full. Identify 5 qualities of the woman described. Which one do you most want to cultivate this week?",
  },
  {
    stage:3, icon:"🤝", color:"#5A7A52",
    title:"What Is a Real Friend",
    titleEs:"¿Qué Es una Verdadera Amiga?",
    titleFr:"Qu'est-ce qu'une Vraie Amie ?",
    subtitle:"A righteous friend sharpens, protects, corrects, and fears God.",
    subtitleEs:"Una amiga justa afila, protege, corrige y teme a Dios.",
    subtitleFr:"Une amie juste affine, protège, corrige et craint Dieu.",
    studyNote:"Scripture makes a sharp distinction between a flattering companion and a covenant friend. A flattering companion tells you what you want to hear. A covenant friend tells you what you need to hear — because they are walking toward the same goal: covenant obedience and restoration.",
    primaryScriptures:[
      { ref:"Proverbs 13:20", text:"He that walketh with wise men shall be wise: but a companion of fools shall be destroyed." },
      { ref:"Proverbs 17:17", text:"A friend loveth at all times, and a brother is born for adversity." },
      { ref:"Proverbs 27:17", text:"Iron sharpeneth iron; so a man sharpeneth the countenance of his friend." },
      { ref:"Sirach 6:14-15", text:"A faithful friend is a strong defence: and he that hath found such an one hath found a treasure. Nothing doth countervail a faithful friend, and his excellency is invaluable." },
      { ref:"Sirach 37:4-5", text:"There is a companion, which rejoiceth in the prosperity of a friend, but in the time of trouble will be against him. There is a companion, which helpeth his friend for the belly, and taketh up the buckler against the enemy." },
      { ref:"1 Corinthians 15:33", text:"Be not deceived: evil communications corrupt good manners." },
      { ref:"James 4:4", text:"Ye adulterers and adulteresses, know ye not that the friendship of the world is enmity with God? whosoever therefore will be a friend of the world is the enemy of God." },
    ],
    supporting:["Proverbs 27:5-6","Ecclesiastes 4:9-10","Sirach 6:5-13","Amos 3:3","Ruth 1:16-17"],
    action:"Evaluate the three people closest to you. Does their presence pull you closer to YAHAWAH or further away? What does scripture say a covenant friend looks like?",
  },
  {
    stage:4, icon:"📜", color:"#8B3A2A",
    title:"Laws Given to Women",
    titleEs:"Leyes Dadas a las Mujeres",
    titleFr:"Lois Données aux Femmes",
    subtitle:"Commands and instructions addressed directly to daughters of the covenant.",
    subtitleEs:"Mandamientos e instrucciones dirigidos directamente a las hijas del pacto.",
    subtitleFr:"Commandements et instructions adressés directement aux filles de l'alliance.",
    studyNote:"YAHAWAH gave women specific laws not as burdens, but as protections and honors. Each law reveals how He views women: as holy vessels, covenant members, and witnesses. Study these laws to understand your dignity before YAHAWAH.",
    primaryScriptures:[
      { ref:"Leviticus 15:19-20", text:"And if a woman have an issue, and her issue in her flesh be blood, she shall be put apart seven days: and whosoever toucheth her shall be unclean until the even." },
      { ref:"Leviticus 18:19", text:"Also thou shalt not approach unto a woman to uncover her nakedness, as long as she is put apart for her uncleanness." },
      { ref:"Numbers 30:3-4", text:"If a woman also vow a vow unto the LORD, and bind herself by a bond, being in her father's house in her youth; And her father hear her vow, and her bond wherewith she hath bound her soul, and her father shall hold his peace at her: then all her vows shall stand." },
      { ref:"Numbers 27:7-8", text:"The daughters of Zelophehad speak right: thou shalt surely give them a possession of an inheritance among their father's brethren; and thou shalt cause the inheritance of their father to pass unto them." },
      { ref:"Deuteronomy 22:5", text:"The woman shall not wear that which pertaineth unto a man, neither shall a man put on a woman's garment: for all that do so are abomination unto the LORD thy God." },
      { ref:"Exodus 21:10-11", text:"If he take him another wife; her food, her raiment, and her duty of marriage, shall he not diminish. And if he do not these three unto her, then shall she go out free without money." },
      { ref:"Leviticus 12:2-4", text:"Speak unto the children of Israel, saying, If a woman have conceived seed, and born a man child: then she shall be unclean seven days; according to the days of the separation for her infirmity shall she be unclean." },
    ],
    supporting:["Numbers 5:11-31","Leviticus 15:28-30","Numbers 36:1-9","Deuteronomy 24:1-4","Deuteronomy 16:11"],
    action:"Choose one law from this stage and study it in its full chapter context. Ask: What was this law protecting? What does it tell you about YAHAWAH's view of women?",
  },
  {
    stage:5, icon:"👗", color:"#7B5EA7",
    title:"How God Wants Women to Dress Daily",
    titleEs:"Cómo Dios Quiere que las Mujeres Se Vistan Diariamente",
    titleFr:"Comment Dieu Veut que les Femmes S'habillent au Quotidien",
    subtitle:"Daily modesty, distinction, humility, and holiness.",
    subtitleEs:"Modestia, distinción, humildad y santidad diarias.",
    subtitleFr:"Modestie, distinction, humilité et sainteté au quotidien.",
    studyNote:"Dress is not a superficial topic in scripture — it is a covenant marker. How a woman dresses communicates who she belongs to. Covenant dress is modest, distinguished, feminine, and holy. It does not draw attention to the body but to the character. A daughter of Israel does not dress like the world because she is not of the world.",
    primaryScriptures:[
      { ref:"Deuteronomy 22:5", text:"The woman shall not wear that which pertaineth unto a man, neither shall a man put on a woman's garment: for all that do so are abomination unto the LORD thy God." },
      { ref:"1 Timothy 2:9-10", text:"In like manner also, that women adorn themselves in modest apparel, with shamefacedness and sobriety; not with broided hair, or gold, or pearls, or costly array; But (which becometh women professing godliness) with good works." },
      { ref:"1 Peter 3:3-4", text:"Whose adorning let it not be that outward adorning of plaiting the hair, and of wearing of gold, or of putting on of apparel; But let it be the hidden man of the heart, in that which is not corruptible, even the ornament of a meek and quiet spirit, which is in the sight of God of great price." },
      { ref:"Proverbs 7:10", text:"And, behold, there met him a woman with the attire of an harlot, and subtil of heart." },
      { ref:"Isaiah 3:16-17", text:"Moreover the LORD saith, Because the daughters of Zion are haughty, and walk with stretched forth necks and wanton eyes, walking and mincing as they go, and making a tinkling with their feet: Therefore the LORD will smite with a scab the crown of the head of the daughters of Zion." },
      { ref:"Numbers 15:38-40", text:"Speak unto the children of Israel, and bid them that they make them fringes in the borders of their garments throughout their generations, and that they put upon the fringe of the borders a ribband of blue: And it shall be unto you for a fringe, that ye may look upon it, and remember all the commandments of the LORD, and do them." },
    ],
    supporting:["Proverbs 31:22","Sirach 26:16","Ezekiel 16:10-13","Revelation 19:8","1 Corinthians 6:19-20"],
    action:"Review your current wardrobe this week through scripture. Ask for each item: Does this reflect modesty, distinction, and covenant identity? Does it draw attention to my body or my character?",
  },
  {
    stage:6, icon:"🌙", color:"#1B3A5C",
    title:"My Body",
    titleEs:"Mi Cuerpo",
    titleFr:"Mon Corps",
    subtitle:"Understanding the female body, monthly cycle, purity, rest, and wisdom in scripture.",
    subtitleEs:"Entender el cuerpo femenino, el ciclo mensual, la pureza, el descanso y la sabiduría en la escritura.",
    subtitleFr:"Comprendre le corps féminin, le cycle mensuel, la pureté, le repos et la sagesse dans l'Écriture.",
    studyNote:"This section is for understanding the scriptural language around the monthly cycle, bodily changes, rest, and wisdom. The laws around the monthly cycle are not laws of shame — they are laws of holiness. YAHAWAH established rhythms in the female body that reflect covenant order, separation, and renewal. Understanding your own body through scripture is a form of covenant self-knowledge.",
    primaryScriptures:[
      { ref:"Leviticus 15:19-24", text:"And if a woman have an issue, and her issue in her flesh be blood, she shall be put apart seven days: and whosoever toucheth her shall be unclean until the even. And every thing that she lieth upon in her separation shall be unclean." },
      { ref:"Leviticus 15:28-30", text:"But if she be cleansed of her issue, then she shall number to herself seven days, and after that she shall be clean. And on the eighth day she shall take unto her two turtles, or two young pigeons, and bring them unto the priest." },
      { ref:"Leviticus 18:19", text:"Also thou shalt not approach unto a woman to uncover her nakedness, as long as she is put apart for her uncleanness." },
      { ref:"Mark 5:25-29", text:"And a certain woman, which had an issue of blood twelve years, And had suffered many things of many physicians, and had spent all that she had, and was nothing bettered, but rather grew worse, When she had heard of Jesus, came in the press behind, and touched his garment. For she said, If I may touch but his clothes, I shall be whole. And straightway the fountain of her blood was dried up; and she felt in her body that she was healed of that plague." },
      { ref:"Genesis 31:35", text:"And she said to her father, Let it not displease my lord that I cannot rise up before thee; for the custom of women is upon me." },
      { ref:"1 Corinthians 6:19-20", text:"What? know ye not that your body is the temple of the Holy Ghost which is in you, which ye have of God, and ye are not your own? For ye are bought with a price: therefore glorify God in your body, and in your spirit, which are God's." },
    ],
    supporting:["Psalm 139:13-14","Ezekiel 36:17","Leviticus 20:18","Isaiah 64:6","Leviticus 12:2-8"],
    action:"Read Leviticus 15:19-30 in full. Write in your journal: What does YAHAWAH's language around the monthly cycle reveal about how He views the female body and covenant separation?",
  },
  {
    stage:7, icon:"🍎", color:"#2E7D32",
    title:"What Should I Eat Daily",
    titleEs:"¿Qué Debo Comer Diariamente?",
    titleFr:"Que Devrais-je Manger Quotidiennement ?",
    subtitle:"What a daughter of the covenant should and should not eat.",
    subtitleEs:"Lo que una hija del pacto debe y no debe comer.",
    subtitleFr:"Ce qu'une fille de l'alliance devrait et ne devrait pas manger.",
    studyNote:"Dietary discipline is part of covenant holiness. YAHAWAH made clear what is food and what is not food. A daughter of Israel does not eat unclean animals — not because of health trends, but because scripture defines them as abominations. Daniel's resolve in Daniel 1 shows that dietary discipline is an act of covenant faith.",
    primaryScriptures:[
      { ref:"Leviticus 11:2-3", text:"Speak unto the children of Israel, saying, These are the beasts which ye shall eat among all the beasts that are on the earth. Whatsoever parteth the hoof, and is clovenfooted, and cheweth the cud, among the beasts, that shall ye eat." },
      { ref:"Leviticus 11:7-8", text:"And the swine, though he divide the hoof, and be clovenfooted, yet he cheweth not the cud; he is unclean to you. Of their flesh shall ye not eat, and their carcase shall ye not touch; they are unclean to you." },
      { ref:"Deuteronomy 14:3", text:"Thou shalt not eat any abominable thing." },
      { ref:"Genesis 1:29", text:"And God said, Behold, I have given you every herb bearing seed, which is upon the face of all the earth, and every tree, in the which is the fruit of a tree yielding seed; to you it shall be for meat." },
      { ref:"Daniel 1:8", text:"But Daniel purposed in his heart that he would not defile himself with the portion of the king's meat, nor with the wine which he drank: therefore he requested of the prince of the eunuchs that he might not defile himself." },
      { ref:"Daniel 1:15-16", text:"And at the end of ten days their countenances appeared fairer and fatter in flesh than all the children which did eat the portion of the king's meat. Thus Melzar took away the portion of their meat, and the wine that they should drink; and gave them pulse." },
      { ref:"Sirach 30:15-16", text:"Health and good estate of body are above all gold, and a strong body above infinite wealth. There is no riches above a sound body, and no joy above the joy of the heart." },
      { ref:"1 Corinthians 10:31", text:"Whether therefore ye eat, or drink, or whatsoever ye do, do all to the glory of God." },
    ],
    supporting:["Leviticus 11:9-12","Isaiah 66:17","Proverbs 23:1-3","Deuteronomy 14:9-10","Sirach 37:27-31"],
    action:"Review what you eat this week against Leviticus 11 and Deuteronomy 14. Identify one dietary change that aligns your eating with covenant law. Make that change this week.",
  },
  {
    stage:8, icon:"💞", color:"#C0392B",
    title:"Marriage and Covenant Partnership",
    titleEs:"Matrimonio y Asociación del Pacto",
    titleFr:"Mariage et Partenariat d'Alliance",
    subtitle:"What covenant partnership means before YAHAWAH.",
    subtitleEs:"Lo que significa la asociación del pacto ante YAHAWAH.",
    subtitleFr:"Ce que signifie le partenariat d'alliance devant YAHAWAH.",
    studyNote:"Marriage in scripture is a covenant — a blood oath — not a legal contract or casual arrangement. Malachi 2:14 calls the wife 'the wife of thy covenant.' YAHAWAH is a witness to the marriage. Understanding marriage as covenant changes how you enter it, how you maintain it, and how seriously you take its obligations.",
    primaryScriptures:[
      { ref:"Genesis 2:24", text:"Therefore shall a man leave his father and his mother, and shall cleave unto his wife: and they shall be one flesh." },
      { ref:"Malachi 2:14-15", text:"Yet ye say, Wherefore? Because the LORD hath been witness between thee and the wife of thy youth, against whom thou hast dealt treacherously: yet is she thy companion, and the wife of thy covenant. And did not he make one? Yet had he the residue of the spirit. And wherefore one? That he might seek a godly seed." },
      { ref:"Tobit 8:6-7", text:"Thou madest Adam, and gavest him Eve his wife for an helper and stay: of them came mankind: thou hast said, It is not good that man should be alone; let us make unto him an aid like unto himself." },
      { ref:"Ephesians 5:25-28", text:"Husbands, love your wives, even as Christ also loved the church, and gave himself for it; That he might sanctify and cleanse it with the washing of water by the word. So ought men to love their wives as their own bodies." },
      { ref:"Hebrews 13:4", text:"Marriage is honourable in all, and the bed undefiled: but whoremongers and adulterers God will judge." },
      { ref:"Sirach 26:1-4", text:"Blessed is the man that hath a virtuous wife, for the number of his days shall be double. A virtuous woman rejoiceth her husband, and he shall fulfil the years of his life in peace." },
    ],
    supporting:["Genesis 24:67","Colossians 3:18-19","1 Corinthians 7:3-5","Proverbs 5:18-19","Ruth 4:13","Malachi 2:16"],
    action:"Read Malachi 2:13-16 and Tobit 8:4-9 this week. Write: What does covenant marriage require from a woman before she enters it? What must she know?",
  },
  {
    stage:9, icon:"🏠", color:"#37474F",
    title:"How to Be a Wife",
    titleEs:"Cómo Ser una Esposa",
    titleFr:"Comment Être une Épouse",
    subtitle:"The honor, discipline, humility, and wisdom of a covenant wife.",
    subtitleEs:"El honor, la disciplina, la humildad y la sabiduría de una esposa del pacto.",
    subtitleFr:"L'honneur, la discipline, l'humilité et la sagesse d'une épouse de l'alliance.",
    studyNote:"A covenant wife is not passive — she is active. She builds the household, instructs the children, manages the home, and honors her husband not out of weakness but out of wisdom. Proverbs 31 is not a burden placed on women — it is a praise poem. She is praised, not pressured. A covenant wife understands that her household is her ministry.",
    primaryScriptures:[
      { ref:"Proverbs 31:25-27", text:"Strength and honour are her clothing; and she shall rejoice in time to come. She openeth her mouth with wisdom; and in her tongue is the law of kindness. She looketh well to the ways of her household, and eateth not the bread of idleness." },
      { ref:"Proverbs 31:11-12", text:"The heart of her husband doth safely trust in her, so that he shall have no need of spoil. She will do him good and not evil all the days of her life." },
      { ref:"1 Peter 3:1-4", text:"Likewise, ye wives, be in subjection to your own husbands; that, if any obey not the word, they also may without the word be won by the conversation of the wives; While they behold your chaste conversation coupled with fear. Whose adorning let it not be that outward adorning... but let it be the hidden man of the heart." },
      { ref:"Ephesians 5:22-24", text:"Wives, submit yourselves unto your own husbands, as unto the Lord. For the husband is the head of the wife, even as Christ is the head of the church: and he is the saviour of the body." },
      { ref:"Sirach 25:1", text:"In three things I was beautified, and stood up beautiful both before God and men: the unity of brethren, the love of neighbours, a man and a wife that agree together." },
      { ref:"Genesis 24:64-67", text:"And Rebekah lifted up her eyes, and when she saw Isaac, she lighted off the camel. For she had said unto the servant, What man is this that walketh in the field to meet us? And the servant had said, It is my master: therefore she took a vail, and covered herself." },
      { ref:"Titus 2:4-5", text:"That they may teach the young women to be sober, to love their husbands, to love their children, To be discreet, chaste, keepers at home, good, obedient to their own husbands, that the word of God be not blasphemed." },
    ],
    supporting:["Colossians 3:18","Proverbs 14:1","Proverbs 19:13-14","Sirach 26:13-16","1 Corinthians 7:34"],
    action:"Read Proverbs 31:10-31 as if it were written about you. Which qualities do you already have? Which do you need to develop? Write a 7-day plan to cultivate one of them.",
  },
  {
    stage:10, icon:"🔍", color:"#00838F",
    title:"How Do I Know He Is the One",
    titleEs:"¿Cómo Sé Que Él Es el Indicado?",
    titleFr:"Comment Savoir S'il Est le Bon ?",
    subtitle:"How to discern a godly man according to scripture.",
    subtitleEs:"Cómo discernir a un hombre piadoso según la escritura.",
    subtitleFr:"Comment discerner un homme de Dieu selon l'Écriture.",
    studyNote:"A covenant man is not identified by his looks, wealth, or charm. He is identified by his fruit — his fear of YAHAWAH, his order, his self-control, his commitment to truth, and his pattern of life. Proverbs 20:6 asks: 'Who can find a faithful man?' The question implies that faithful men are rare. Study the marks of a godly man in scripture before making a covenant decision.",
    primaryScriptures:[
      { ref:"Psalm 1:1-3", text:"Blessed is the man that walketh not in the counsel of the ungodly, nor standeth in the way of sinners, nor sitteth in the seat of the scornful. But his delight is in the law of the LORD; and in his law doth he meditate day and night." },
      { ref:"Proverbs 20:6", text:"Most men will proclaim every one his own goodness: but a faithful man who can find?" },
      { ref:"1 Timothy 3:2-4", text:"A bishop then must be blameless, the husband of one wife, vigilant, sober, of good behaviour, given to hospitality, apt to teach; Not given to wine, no striker, not greedy of filthy lucre; but patient, not a brawler, not covetous; One that ruleth well his own house, having his children in subjection with all gravity." },
      { ref:"Ephesians 5:25-28", text:"Husbands, love your wives, even as Christ also loved the church, and gave himself for it. So ought men to love their wives as their own bodies. He that loveth his wife loveth himself." },
      { ref:"1 Peter 3:7", text:"Likewise, ye husbands, dwell with them according to knowledge, giving honour unto the wife, as unto the weaker vessel, and as being heirs together of the grace of life; that your prayers be not hindered." },
      { ref:"Matthew 6:33", text:"But seek ye first the kingdom of God, and his righteousness; and all these things shall be added unto you." },
      { ref:"Genesis 24:12-14", text:"And he said, O LORD God of my master Abraham, I pray thee, send me good speed this day, and shew kindness unto my master Abraham. Behold, I stand here by the well of water; and the daughters of the men of the city come out to draw water." },
    ],
    supporting:["Malachi 2:15","Titus 1:6-9","Proverbs 31:23","1 Corinthians 11:3","John 13:15","Colossians 3:19"],
    action:"Write a list of the 10 scriptural qualities a covenant man must have. Compare this list to what you have previously sought or accepted. Where does scripture require you to raise your standard?",
  },
  {
    stage:11, icon:"🌿", color:"#6B1A4A",
    title:"Mothers, Daughters, and the Household",
    titleEs:"Madres, Hijas y el Hogar",
    titleFr:"Mères, Filles et le Foyer",
    subtitle:"Women build generations through wisdom, correction, nurture, and order.",
    subtitleEs:"Las mujeres construyen generaciones a través de la sabiduría, la corrección, la crianza y el orden.",
    subtitleFr:"Les femmes construisent des générations à travers la sagesse, la correction, la bienveillance et l'ordre.",
    studyNote:"The greatest act of a covenant woman is not just personal obedience — it is generational transmission. What she teaches, demonstrates, and embodies will be passed to her daughters and sons. 2 Timothy 1:5 shows that Timothy's faith lived first in his grandmother and mother. Your covenant walk is not just about you.",
    primaryScriptures:[
      { ref:"Deuteronomy 6:6-7", text:"And these words, which I command thee this day, shall be in thine heart: And thou shalt teach them diligently unto thy children, and shalt talk of them when thou sittest in thine house, and when thou walkest by the way, and when thou liest down, and when thou risest up." },
      { ref:"Proverbs 22:6", text:"Train up a child in the way he should go: and when he is old, he will not depart from it." },
      { ref:"2 Timothy 1:5", text:"When I call to remembrance the unfeigned faith that is in thee, which dwelt first in thy grandmother Lois, and thy mother Eunice; and I am persuaded that in thee also." },
      { ref:"Proverbs 31:28", text:"Her children arise up, and call her blessed; her husband also, and he praiseth her." },
      { ref:"Sirach 3:2-4", text:"For the LORD hath given the father honour over the children, and hath confirmed the authority of the mother over the sons. Whoso honoureth his father maketh an atonement for his sins: And he that honoureth his mother is as one that layeth up treasure." },
      { ref:"Proverbs 1:8-9", text:"My son, hear the instruction of thy father, and forsake not the law of thy mother: For they shall be an ornament of grace unto thy head, and chains about thy neck." },
      { ref:"Titus 2:4-5", text:"That they may teach the young women to be sober, to love their husbands, to love their children, To be discreet, chaste, keepers at home, good, obedient to their own husbands." },
    ],
    supporting:["Sirach 30:1-6","Isaiah 49:15","Psalm 78:1-7","Proverbs 29:15","Luke 1:46-48","Sirach 7:27-28"],
    action:"Read 2 Timothy 1:3-7. What covenant inheritance was transmitted through women in Timothy's family? What covenant truth are you carrying to pass to the next generation?",
  },
  {
    stage:12, icon:"✨", color:"#C4893A",
    title:"Women of Wisdom and Restoration",
    titleEs:"Mujeres de Sabiduría y Restauración",
    titleFr:"Femmes de Sagesse et de Restauration",
    subtitle:"From brokenness to restoration — women of faith return to covenant order.",
    subtitleEs:"De la ruptura a la restauración — las mujeres de fe regresan al orden del pacto.",
    subtitleFr:"De la rupture à la restauration — les femmes de foi reviennent à l'ordre de l'alliance.",
    studyNote:"The covenant does not end in shame. Restoration is real, available, and prophesied. Women like Ruth, Esther, and Anna chose covenant loyalty above everything — and YAHAWAH honored them with legacy, influence, and purpose. Isaiah 54 speaks directly to the woman who has suffered, been abandoned, or felt forgotten. She is not finished — she is being prepared.",
    primaryScriptures:[
      { ref:"Isaiah 54:1-4", text:"Sing, O barren, thou that didst not bear; break forth into singing, and cry aloud, thou that didst not travail with child: for more are the children of the desolate than the children of the married wife, saith the LORD. Enlarge the place of thy tent, and let them stretch forth the curtains of thine habitations: spare not, lengthen thy cords, and strengthen thy stakes. Fear not; for thou shalt not be ashamed." },
      { ref:"Ruth 1:16-17", text:"And Ruth said, Intreat me not to leave thee, or to return from following after thee: for whither thou goest, I will go; and where thou lodgest, I will lodge: thy people shall be my people, and thy God my God: Where thou diest, will I die, and there will I be buried." },
      { ref:"Esther 4:14-16", text:"For if thou altogether holdest thy peace at this time, then shall there enlargement and deliverance arise to the Jews from another place; but thou and thy father's house shall be destroyed: and who knoweth whether thou art come to the kingdom for such a time as this? Then Esther bade them return Mordecai this answer... and if I perish, I perish." },
      { ref:"Baruch 4:21-22", text:"Be of good cheer, O my children, cry unto the LORD, and he will deliver you from the power and hand of the enemies. For my hope is in the Everlasting, that he will save you; and joy is come unto me from the Holy One, because of the mercy which shall soon come unto you from the Everlasting our Saviour." },
      { ref:"Luke 8:2-3", text:"And certain women, which had been healed of evil spirits and infirmities, Mary called Magdalene, out of whom went seven devils, And Joanna the wife of Chuza Herod's steward, and Susanna, and many others, which ministered unto him of their substance." },
      { ref:"Zephaniah 3:14-15", text:"Sing, O daughter of Zion; shout, O Israel; be glad and rejoice with all the heart, O daughter of Jerusalem. The LORD hath taken away thy judgments, he hath cast out thine enemy: the king of Israel, even the LORD, is in the midst of thee: thou shalt not see evil any more." },
      { ref:"Joel 2:28-29", text:"And it shall come to pass afterward, that I will pour out my spirit upon all flesh; and your sons and your daughters shall prophesy, your old men shall dream dreams, your young men shall see visions: And also upon the servants and upon the handmaids in those days will I pour out my spirit." },
    ],
    supporting:["Isaiah 62:4-5","Isaiah 49:22","Baruch 5:5-6","Judith 13:18-19","Luke 2:36-38","Revelation 21:2"],
    action:"Read Isaiah 54 in full. Write every name or title YAHAWAH gives to the covenant woman in this chapter. Declare each one over yourself aloud this week.",
  },
];


// ─── WOMEN OF SCRIPTURE PROFILES ─────────────────────────────────────────────
const WOMEN_OF_SCRIPTURE = [
  {
    name:"Sarah", title:"Mother of Nations", tribe:"From Ur of the Chaldees", icon:"👑", color:"#C4893A",
    keyVerse:"Genesis 17:15-16",
    summary:"YAHAWAH changed her name from Sarai to Sarah — princess. He declared that kings of peoples would come from her. Her faith is honored in Hebrews 11 as the mechanism of the miracle of Isaac's birth.",
    scriptures:[
      { ref:"Genesis 17:15-16", text:"And God said unto Abraham, As for Sarai thy wife, thou shalt not call her name Sarai, but Sarah shall her name be. And I will bless her, and give thee a son also of her: yea, I will bless her, and she shall be a mother of nations; kings of people shall be of her." },
      { ref:"Genesis 18:10-12", text:"And he said, I will certainly return unto thee according to the time of life; and, lo, Sarah thy wife shall have a son. And Sarah heard it in the tent door, which was behind him." },
      { ref:"Genesis 21:1-3", text:"And the LORD visited Sarah as he had said, and the LORD did unto Sarah as he had spoken. For Sarah conceived, and bare Abraham a son in his old age, at the set time of which God had spoken to him." },
      { ref:"Hebrews 11:11", text:"Through faith also Sara herself received strength to conceive seed, and was delivered of a child when she was past age, because she judged him faithful who had promised." },
      { ref:"1 Peter 3:6", text:"Even as Sara obeyed Abraham, calling him lord: whose daughters ye are, as long as ye do well, and are not afraid with any amazement." },
      { ref:"Isaiah 51:2", text:"Look unto Abraham your father, and unto Sarah that bare you: for I called him alone, and blessed him, and increased him." },
    ],
    lessons:["Faith that outlasts logic","A name change that signified covenant destiny","Laughter becoming praise when YAHAWAH is faithful"],
  },
  {
    name:"Deborah", title:"Judge & Prophetess of Israel", tribe:"Tribe of Ephraim", icon:"🔥", color:"#8B3A2A",
    keyVerse:"Judges 4:4",
    summary:"Deborah judged all of Israel, gave military strategy to Barak, composed one of the oldest victory songs in scripture (Judges 5), and called herself 'a mother in Israel.' Her authority was spiritual, judicial, and military.",
    scriptures:[
      { ref:"Judges 4:4-5", text:"And Deborah, a prophetess, the wife of Lapidoth, she judged Israel at that time. And she dwelt under the palm tree of Deborah between Ramah and Bethel in mount Ephraim: and the children of Israel came up to her for judgment." },
      { ref:"Judges 4:6-7", text:"And she sent and called Barak the son of Abinoam out of Kedeshnaphtali, and said unto him, Hath not the LORD God of Israel commanded, saying, Go and draw toward mount Tabor, and take with thee ten thousand men of the children of Naphtali and of the children of Zebulun?" },
      { ref:"Judges 4:14", text:"And Deborah said unto Barak, Up; for this is the day in which the LORD hath delivered Sisera into thine hand: is not the LORD gone out before thee? So Barak went down from mount Tabor, and ten thousand men after him." },
      { ref:"Judges 5:7", text:"The inhabitants of the villages ceased, they ceased in Israel, until that I Deborah arose, that I arose a mother in Israel." },
      { ref:"Judges 5:31", text:"So let all thine enemies perish, O LORD: but let them that love him be as the sun when he goeth forth in his might. And the land had rest forty years." },
      { ref:"Micah 6:4", text:"For I brought thee up out of the land of Egypt, and redeemed thee out of the house of servants; and I sent before thee Moses, Aaron, and Miriam." },
    ],
    lessons:["Women can hold judicial and prophetic authority","A mother in Israel leads through wisdom, not force","Faith in YAHAWAH's command produces military victory"],
  },
  {
    name:"Ruth", title:"Covenant Woman of Moab", tribe:"Moabite by birth, Israel by covenant", icon:"🌾", color:"#5A7A52",
    keyVerse:"Ruth 1:16",
    summary:"Ruth was a Moabite woman who chose covenant loyalty above nationality, family, and comfort. Her declaration 'thy people shall be my people' is one of the most powerful covenant commitments in scripture. She became the great-grandmother of King David and is in the lineage of Yahawashi.",
    scriptures:[
      { ref:"Ruth 1:16-17", text:"And Ruth said, Intreat me not to leave thee, or to return from following after thee: for whither thou goest, I will go; and where thou lodgest, I will lodge: thy people shall be my people, and thy God my God: Where thou diest, will I die, and there will I be buried: the LORD do so to me, and more also, if ought but death part thee and me." },
      { ref:"Ruth 2:11-12", text:"And Boaz answered and said unto her, It hath fully been shewed me, all that thou hast done unto thy mother in law since the death of thine husband: and how thou hast left thy father and thy mother, and the land of thy nativity, and art come unto a people which thou knewest not heretofore. The LORD recompense thy work, and a full reward be given thee of the LORD God of Israel, under whose wings thou art come to trust." },
      { ref:"Ruth 3:11", text:"And now, my daughter, fear not; I will do to thee all that thou requirest: for all the city of my people doth know that thou art a virtuous woman." },
      { ref:"Ruth 4:13-14", text:"So Boaz took Ruth, and she was his wife: and when he came in unto her, the LORD gave her conception, and she bare a son. And the women said unto Naomi, Blessed be the LORD, which hath not left thee this day without a kinsman." },
      { ref:"Ruth 4:17", text:"And the women her neighbours gave it a name, saying, There is a son born to Naomi; and they called his name Obed: he is the father of Jesse, the father of David." },
      { ref:"Matthew 1:5", text:"And Salmon begat Booz of Rachab; and Booz begat Obed of Ruth; and Obed begat Jesse." },
    ],
    lessons:["Covenant loyalty transcends bloodline and nationality","A virtuous reputation is known throughout a community","YAHAWAH honors faithfulness across generations"],
  },
  {
    name:"Esther", title:"Queen and Deliverer of Israel", tribe:"Tribe of Benjamin", icon:"👸", color:"#7B5EA7",
    keyVerse:"Esther 4:14",
    summary:"Esther was chosen as queen of Persia during the diaspora. When a decree of extermination was issued against her people, she risked her life to appear before the king — and YAHAWAH used her courage to deliver the entire Jewish community in Persia.",
    scriptures:[
      { ref:"Esther 2:7", text:"And he brought up Hadassah, that is, Esther, his uncle's daughter: for she had neither father nor mother, and the maid was fair and beautiful; whom Mordecai, when her father and mother were dead, took for his own daughter." },
      { ref:"Esther 4:13-14", text:"Then Mordecai commanded to answer Esther, Think not with thyself that thou shalt escape in the king's house, more than all the Jews. For if thou altogether holdest thy peace at this time, then shall there enlargement and deliverance arise to the Jews from another place; but thou and thy father's house shall be destroyed: and who knoweth whether thou art come to the kingdom for such a time as this?" },
      { ref:"Esther 4:16", text:"Go, gather together all the Jews that are present in Shushan, and fast ye for me, and neither eat nor drink three days, night or day: I also and my maidens will fast likewise; and so will I go in unto the king, which is not according to the law: and if I perish, I perish." },
      { ref:"Esther 5:2", text:"And it was so, when the king saw Esther the queen standing in the court, that she obtained favour in his sight: and the king held out to Esther the golden sceptre that was in his hand. So Esther drew near, and touched the top of the sceptre." },
      { ref:"Esther 9:29-32", text:"Then Esther the queen, the daughter of Abihail, and Mordecai the Jew, wrote with all authority, to confirm this second letter of Purim." },
    ],
    lessons:["Covenant women are positioned for specific times","Fasting and prayer precede covenant action","You were placed where you are for a reason"],
  },
  {
    name:"Judith", title:"Deliverer of Bethulia", tribe:"Tribe of Simeon (Apocrypha)", icon:"⚔️", color:"#C0392B",
    keyVerse:"Judith 13:18",
    summary:"Judith was a widow who used wisdom and courage to deliver the city of Bethulia from Holofernes, the Assyrian general besieging it. Her story is in the Apocrypha and represents the covenant woman who acts in faith when no one else will.",
    scriptures:[
      { ref:"Judith 8:7-8", text:"She was also of a goodly countenance, and very beautiful to behold: her husband Manasses had left her gold, and silver, and menservants and maidservants, and cattle, and lands; and she remained upon them. And there was none that gave her an ill word; for she feared God greatly." },
      { ref:"Judith 9:11-12", text:"For thy power standeth not in multitude nor thy might in strong men: for thou art a God of the afflicted, an helper of the oppressed, an upholder of the weak, a protector of the forlorn, a saviour of them that are without hope." },
      { ref:"Judith 13:7-8", text:"And she smote twice upon his neck with all her might, and she took away his head from him, And tumbled his body down from the bed, and pulled down the canopy from the pillars; and anon after she went forth, and gave Holofernes his head to her maid." },
      { ref:"Judith 13:18-20", text:"And Uzziah said to her, O daughter, blessed art thou of the most high God above all the women upon the earth; and blessed be the Lord God, which hath created the heavens and the earth, which hath directed thee to the cutting off of the head of the chief of our enemies." },
      { ref:"Judith 16:1", text:"Then Judith began to sing this thanksgiving in all Israel, and all the people sang with her this song of praise." },
    ],
    lessons:["A widow in covenant is not weak — she is free to act","Prayer and fasting prepare for covenant action","One woman's courage can save an entire community"],
  },
  {
    name:"Mary / Miriam", title:"Mother of Yahawashi", tribe:"Tribe of Judah / Levi (disputed)", icon:"🌸", color:"#E91E8C",
    keyVerse:"Luke 1:28",
    summary:"Mary (Miriam in Hebrew) was chosen to carry Yahawashi the Messiah. Her response to the angel — 'be it unto me according to thy word' — is one of the most profound acts of covenant surrender in all of scripture. She is also the first to witness the resurrection.",
    scriptures:[
      { ref:"Luke 1:28-30", text:"And the angel came in unto her, and said, Hail, thou that art highly favoured, the Lord is with thee: blessed art thou among women. And when she saw him, she was troubled at his saying, and cast in her mind what manner of salutation this should be. And the angel said unto her, Fear not, Mary: for thou hast found favour with God." },
      { ref:"Luke 1:38", text:"And Mary said, Behold the handmaid of the Lord; be it unto me according to thy word. And the angel departed from her." },
      { ref:"Luke 1:46-48", text:"And Mary said, My soul doth magnify the Lord, And my spirit hath rejoiced in God my Saviour. For he hath regarded the low estate of his handmaiden: for, behold, from henceforth all generations shall call me blessed." },
      { ref:"John 2:5", text:"His mother saith unto the servants, Whatsoever he saith unto you, do it." },
      { ref:"John 19:25-27", text:"Now there stood by the cross of Jesus his mother, and his mother's sister, Mary the wife of Cleophas, and Mary Magdalene. When Jesus therefore saw his mother, and the disciple standing by, whom he loved, he saith unto his mother, Woman, behold thy son!" },
      { ref:"Acts 1:14", text:"These all continued with one accord in prayer and supplication, with the women, and Mary the mother of Jesus, and with his brethren." },
    ],
    lessons:["Covenant women submit to divine assignment above personal plans","A mother's suffering is part of covenant service","Faithful women are present at the beginning and the end"],
  },
  {
    name:"Anna", title:"Prophetess of the Temple", tribe:"Tribe of Asher", icon:"🙏", color:"#00838F",
    keyVerse:"Luke 2:36-38",
    summary:"Anna was an 84-year-old widow from the tribe of Asher who served in the Temple with fasting and prayer night and day. She was one of the first people to publicly declare that Yahawashi was the Messiah. She is evidence that tribe of Asher produced covenant women.",
    scriptures:[
      { ref:"Luke 2:36-38", text:"And there was one Anna, a prophetess, the daughter of Phanuel, of the tribe of Aser: she was of a great age, and had lived with an husband seven years from her virginity; And she was a widow of about fourscore and four years, which departed not from the temple, but served God with fastings and prayers night and day. And she coming in that instant gave thanks likewise unto the Lord, and spake of him to all them that looked for redemption in Jerusalem." },
      { ref:"Isaiah 62:6", text:"I have set watchmen upon thy walls, O Jerusalem, which shall never hold their peace day nor night: ye that make mention of the LORD, keep not silence." },
      { ref:"1 Timothy 5:5", text:"Now she that is a widow indeed, and desolate, trusteth in God, and continueth in supplications and prayers night and day." },
    ],
    lessons:["Widowhood is not the end of covenant service — it can be the beginning","Fasting and prayer is a weapon of covenant women","One tribe of Asher woman witnessed the most important moment in history"],
  },
];

// ─── WOMEN'S LAWS FULL SCRIPTURE DATABASE ─────────────────────────────────────
const WOMEN_LAWS_STUDY = [
  {
    id:"wlaw-given", icon:"📜", color:"#6B1A4A",
    title:"Laws Given Specifically to Women",
    subtitle:"Commands addressed directly to daughters of the covenant",
    sections:[
      {
        heading:"Purity Laws — The Niddah",
        scripture:"Leviticus 15:19-30 · Leviticus 18:19 · Leviticus 20:18",
        note:"The niddah (separation period) was not shame — it was covenant rhythm. The seven-day separation, counting of clean days, and immersion (mikveh) at the end represented a monthly death-and-resurrection pattern. The woman's body was treated as a holy vessel whose cycles were governed by the same Creator who set apart Shabbat.",
        primaryScriptures:[
          { ref:"Leviticus 15:19-20", text:"And if a woman have an issue, and her issue in her flesh be blood, she shall be put apart seven days: and whosoever toucheth her shall be unclean until the even. And every thing that she lieth upon in her separation shall be unclean." },
          { ref:"Leviticus 15:25-27", text:"And if a woman have an issue of her blood many days out of the time of her separation, or if it run beyond the time of her separation; all the days of the issue of her uncleanness shall be as the days of her separation." },
          { ref:"Leviticus 15:28-30", text:"But if she be cleansed of her issue, then she shall number to herself seven days, and after that she shall be clean. And on the eighth day she shall take unto her two turtles, or two young pigeons, and bring them unto the priest." },
          { ref:"Leviticus 18:19", text:"Also thou shalt not approach unto a woman to uncover her nakedness, as long as she is put apart for her uncleanness." },
          { ref:"Leviticus 20:18", text:"And if a man shall lie with a woman having her sickness, and shall uncover her nakedness; he hath discovered her fountain, and she hath uncovered the fountain of her blood: and both of them shall be cut off from among their people." },
          { ref:"Ezekiel 18:5-6", text:"But if a man be just, and do that which is lawful and right, And hath not eaten upon the mountains, neither hath lifted up his eyes to the idols of the house of Israel, neither hath defiled his neighbour's wife, neither hath come near to a menstruous woman." },
        ],
        supporting:["Numbers 19:9","Lamentations 1:17","Ezekiel 22:10","2 Samuel 11:4","Mark 5:25-29 (Yeshua heals a woman with issue of blood)"],
      },
      {
        heading:"The Sotah — Trial by Bitter Waters",
        scripture:"Numbers 5:11-31",
        note:"The sotah was a legal protection for women — not a weapon against them. It prevented mob justice against an accused wife. The formal process required a priest, congregation, and specific ritual. If innocent, the water had no effect. This was one of the first formal legal protections for a woman's right to be presumed innocent.",
        primaryScriptures:[
          { ref:"Numbers 5:11-14", text:"And the LORD spake unto Moses, saying, Speak unto the children of Israel, and say unto them, If any man's wife go aside, and commit a trespass against him, And a man lie with her carnally, and it be hid from the eyes of her husband, and be kept close, and she be defiled; or if the spirit of jealousy come upon him, and he be jealous of his wife, and she be not defiled." },
          { ref:"Numbers 5:19-22", text:"And the priest shall charge her by an oath, and say unto the woman, If no man have lain with thee, and if thou hast not gone aside to uncleanness with another instead of thy husband, be thou free from this bitter water that causeth the curse." },
          { ref:"Numbers 5:28", text:"And if the woman be not defiled, but be clean; then she shall be free, and shall conceive seed." },
          { ref:"Numbers 5:31", text:"Then shall the man be guiltless from iniquity, and this woman shall bear her iniquity." },
        ],
        supporting:["Deuteronomy 22:13-21","John 8:3-11 (woman caught in adultery — Yeshua applies sotah principle)","Leviticus 5:1","Numbers 5:29-30"],
      },
      {
        heading:"Vows Made by Women",
        scripture:"Numbers 30:3-16",
        note:"Numbers 30 established that a woman's spoken covenant before YAHAWAH had legal weight. The annulment window (one day of hearing) showed that silence was confirmation — not indifference. Once that window passed, the vow stood fully. This gave women genuine covenant agency.",
        primaryScriptures:[
          { ref:"Numbers 30:3-5", text:"If a woman also vow a vow unto the LORD, and bind herself by a bond, being in her father's house in her youth; And her father hear her vow, and her bond wherewith she hath bound her soul, and her father shall hold his peace at her: then all her vows shall stand, and every bond wherewith she hath bound her soul shall stand." },
          { ref:"Numbers 30:8-9", text:"But if her husband disallowed her on the day that he heard it; then he shall make her vow which she vowed of none effect: and the LORD shall forgive her. But every vow of a widow, and of her that is divorced, wherewith they have bound their souls, shall stand against her." },
          { ref:"Numbers 30:11-12", text:"And if she vowed in her husband's house, or bound herself by a bond with an oath; And her husband heard it, and held his peace at her, and disallowed her not: then all her vows shall stand, and every bond wherewith she bound her soul shall stand." },
          { ref:"Numbers 30:16", text:"These are the statutes, which the LORD commanded Moses, between a man and his wife, between the father and his daughter, being yet in her youth in her father's house." },
          { ref:"Ecclesiastes 5:4-5", text:"When thou vowest a vow unto God, defer not to pay it; for he hath no pleasure in fools: pay that which thou hast vowed. Better is it that thou shouldest not vow, than that thou shouldest vow and not pay." },
          { ref:"1 Samuel 1:11", text:"And she vowed a vow, and said, O LORD of hosts, if thou wilt indeed look on the affliction of thine handmaid, and remember me, and not forget thine handmaid, but wilt give unto thine handmaid a man child, then I will give him unto the LORD all the days of his life." },
        ],
        supporting:["Judges 11:30-39 (Jephthah's daughter)","Psalm 116:14","Acts 21:26","Leviticus 27:1-8 (vow valuations)"],
      },
      {
        heading:"Women's Inheritance Rights — Daughters of Zelophehad",
        scripture:"Numbers 27:1-11 · Numbers 36:1-12 · Joshua 17:3-6",
        note:"The daughters of Zelophehad brought their case directly to Moses, Eleazar, the princes, and the congregation — and YAHAWAH ruled in their favor. This was a landmark legal precedent: daughters can inherit when there are no male heirs. It was not an exception — it became enshrined in covenant law.",
        primaryScriptures:[
          { ref:"Numbers 27:1-4", text:"Then came the daughters of Zelophehad, the son of Hepher, the son of Gilead, the son of Machir, the son of Manasseh, of the families of Manasseh the son of Joseph: and these are the names of his daughters; Mahlah, Noah, and Hoglah, and Milcah, and Tirzah. And they stood before Moses, and before Eleazar the priest, and before the princes and all the congregation, by the door of the tabernacle of the congregation, saying... Why should the name of our father be done away from among his family, because he hath no son?" },
          { ref:"Numbers 27:6-8", text:"And the LORD spake unto Moses, saying, The daughters of Zelophehad speak right: thou shalt surely give them a possession of an inheritance among their father's brethren; and thou shalt cause the inheritance of their father to pass unto them. And thou shalt speak unto the children of Israel, saying, If a man die, and have no son, then ye shall cause his inheritance to pass unto his daughter." },
          { ref:"Numbers 27:11", text:"And if his father have no brethren, then ye shall give his inheritance unto his kinsman that is next to him of his family, and he shall possess it: and it shall be unto the children of Israel a statute of judgment, as the LORD commanded Moses." },
          { ref:"Joshua 17:3-4", text:"But Zelophehad, the son of Hepher, the son of Gilead, the son of Machir, the son of Manasseh, had no sons, but daughters: and these are the names of his daughters, Mahlah, and Noah, Hoglah, Milcah, and Tirzah. And they came near before Eleazar the priest, and before Joshua the son of Nun, and before the princes, saying, The LORD commanded Moses to give us an inheritance among our brethren." },
          { ref:"Numbers 36:6-9", text:"This is the thing which the LORD doth command concerning the daughters of Zelophehad, saying, Let them marry to whom they think best; only to the family of the tribe of their father shall they marry. So shall not the inheritance of the children of Israel remove from tribe to tribe." },
          { ref:"Proverbs 13:22", text:"A good man leaveth an inheritance to his children's children: and the wealth of the sinner is laid up for the just." },
        ],
        supporting:["Ruth 4:9-10 (land redemption and women)","Job 42:15","Tobit 3:15","Sirach 33:20-21"],
      },
      {
        heading:"Women and the Holy Feasts",
        scripture:"Deuteronomy 16:11-14 · Exodus 35:29 · 1 Samuel 1:3-7",
        note:"Women were explicitly named in the feast commands. They were not spectators — they were participants. Deuteronomy 16:11-14 includes daughters in both Shavuot and Sukkot by name. Exodus 35:29 records women as free-will givers to the Tabernacle. Hannah's annual pilgrimage to Shiloh shows women as full worshipers before YAHAWAH.",
        primaryScriptures:[
          { ref:"Deuteronomy 16:11", text:"And thou shalt rejoice before the LORD thy God, thou, and thy son, and thy daughter, and thy manservant, and thy maidservant, and the Levite that is within thy gates, and the stranger, and the fatherless, and the widow that are among you, in the place which the LORD thy God hath chosen to place his name there." },
          { ref:"Deuteronomy 16:13-14", text:"Thou shalt observe the feast of tabernacles seven days, after that thou hast gathered in thy corn and thy wine: And thou shalt rejoice in thy feast, thou, and thy son, and thy daughter, and thy manservant, and thy maidservant, and the Levite, the stranger, and the fatherless, and the widow, that are within thy gates." },
          { ref:"Exodus 35:29", text:"The children of Israel brought a willing offering unto the LORD, every man and woman, whose heart made them willing to bring for all manner of work, which the LORD had commanded to be made by the hand of Moses." },
          { ref:"1 Samuel 1:3-7", text:"And this man went up out of his city yearly to worship and to sacrifice unto the LORD of hosts in Shiloh. And the two sons of Eli, Hophni and Phinehas, the priests of the LORD, were there. And when the time was that Elkanah offered, he gave to Peninnah his wife, and to all her sons and her daughters, portions: But unto Hannah he gave a worthy portion; for he loved Hannah." },
          { ref:"Nehemiah 8:2-3", text:"And Ezra the priest brought the law before the congregation both of men and women, and all that could hear with understanding, upon the first day of the seventh month. And he read therein before the street that was before the water gate from the morning until midday, before the men and the women, and those that could understand; and the ears of all the people were attentive unto the book of the law." },
          { ref:"Leviticus 23:41-42", text:"And ye shall keep it a feast unto the LORD seven days in the year. It shall be a statute for ever in your generations: ye shall celebrate it in the seventh month. Ye shall dwell in booths seven days; all that are Israelites born shall dwell in booths." },
        ],
        supporting:["Exodus 12:3 (Passover includes households)","2 Chronicles 20:13 (women in assembly)","Joel 2:16 (women gathered for solemn assembly)","Luke 2:36-38 (Anna serves in Temple)"],
      },
      {
        heading:"The Purification Laws After Childbirth",
        scripture:"Leviticus 12:1-8",
        note:"The post-birth purification period was not punishment for childbirth — it was covenant honor. The offering brought afterward (a burnt offering and a sin offering) acknowledged YAHAWAH as the source of life. Luke 2:22-24 records that Mary kept this law after Yahawashi's birth — confirming these laws were still being observed in the first century.",
        primaryScriptures:[
          { ref:"Leviticus 12:2-4", text:"Speak unto the children of Israel, saying, If a woman have conceived seed, and born a man child: then she shall be unclean seven days; according to the days of the separation for her infirmity shall she be unclean. And in the eighth day the flesh of his foreskin shall be circumcised. And she shall then continue in the blood of her purifying three and thirty days; she shall touch no hallowed thing, nor come into the sanctuary, until the days of her purifying be fulfilled." },
          { ref:"Leviticus 12:6-8", text:"And when the days of her purifying are fulfilled, for a son, or for a daughter, she shall bring a lamb of the first year for a burnt offering, and a young pigeon, or a turtledove, for a sin offering, unto the door of the tabernacle of the congregation, unto the priest: Who shall offer it before the LORD, and make an atonement for her; and she shall be cleansed from the issue of her blood. This is the law for her that hath born a male or a female. And if she be not able to bring a lamb, then she shall bring two turtles, or two young pigeons." },
          { ref:"Luke 2:22-24", text:"And when the days of her purification according to the law of Moses were accomplished, they brought him to Jerusalem, to present him to the Lord; (As it is written in the law of the Lord, Every male that openeth the womb shall be called holy to the Lord;) And to offer a sacrifice according to that which is said in the law of the Lord, A pair of turtledoves, or two young pigeons." },
          { ref:"Psalm 139:13-14", text:"For thou hast possessed my reins: thou hast covered me in my mother's womb. I will praise thee; for I am fearfully and wonderfully made: marvellous are thy works; and that my soul knoweth right well." },
        ],
        supporting:["Genesis 1:27-28","Isaiah 44:2","Jeremiah 1:5","Psalm 22:9-10"],
      },
    ],
  },
  {
    id:"wlaw-relationships", icon:"💞", color:"#C0392B",
    title:"Relationships, Marriage & Covenant Partnership",
    subtitle:"What YAHAWAH's word says about women in covenant relationships",
    sections:[
      {
        heading:"The Wife of Noble Character — Proverbs 31",
        scripture:"Proverbs 31:10-31",
        note:"The Proverbs 31 woman is a complete portrait of covenant femininity: she is a businesswoman (v.16), an investor (v.16), a merchant (v.18,24), a provider (v.15), a teacher (v.26), and a household manager (v.27). The poem ends not with her physical beauty but with her fear of YAHAWAH (v.30) and her works being known at the city gates (v.31).",
        primaryScriptures:[
          { ref:"Proverbs 31:10-12", text:"Who can find a virtuous woman? for her price is far above rubies. The heart of her husband doth safely trust in her, so that he shall have no need of spoil. She will do him good and not evil all the days of her life." },
          { ref:"Proverbs 31:15-17", text:"She riseth also while it is yet night, and giveth meat to her household, and a portion to her maidens. She considereth a field, and buyeth it: with the fruit of her hands she planteth a vineyard. She girdeth her loins with strength, and strengtheneth her arms." },
          { ref:"Proverbs 31:20", text:"She stretcheth out her hand to the poor; yea, she reacheth forth her hands to the needy." },
          { ref:"Proverbs 31:25-27", text:"Strength and honour are her clothing; and she shall rejoice in time to come. She openeth her mouth with wisdom; and in her tongue is the law of kindness. She looketh well to the ways of her household, and eateth not the bread of idleness." },
          { ref:"Proverbs 31:28-30", text:"Her children arise up, and call her blessed; her husband also, and he praiseth her. Many daughters have done virtuously, but thou excellest them all. Favour is deceitful, and beauty is vain: but a woman that feareth the LORD, she shall be praised." },
          { ref:"Proverbs 31:31", text:"Give her of the fruit of her hands; and let her own works praise her in the gates." },
        ],
        supporting:["Proverbs 12:4","Proverbs 14:1","Proverbs 19:14","Sirach 26:1-4","Sirach 36:29","Titus 2:3-5","1 Peter 3:3-5"],
      },
      {
        heading:"Covenant Marriage — Not a Contract",
        scripture:"Genesis 2:24 · Malachi 2:14-16 · Ephesians 5:22-33 · Tobit 8:5-8",
        note:"Covenant marriage in scripture is a blood oath — not a legal transaction. Malachi 2:14 calls the wife 'the wife of thy covenant.' The Hebrew word berith (covenant) is the same word used for the Abrahamic and Sinai covenants. YAHAWAH is literally a witness to the marriage. Ephesians 5 uses the Messiah's self-sacrifice as the model — not authority, but self-giving.",
        primaryScriptures:[
          { ref:"Genesis 2:24", text:"Therefore shall a man leave his father and his mother, and shall cleave unto his wife: and they shall be one flesh." },
          { ref:"Malachi 2:14-16", text:"Yet ye say, Wherefore? Because the LORD hath been witness between thee and the wife of thy youth, against whom thou hast dealt treacherously: yet is she thy companion, and the wife of thy covenant. And did not he make one? Yet had he the residue of the spirit. And wherefore one? That he might seek a godly seed. Therefore take heed to your spirit, and let none deal treacherously against the wife of his youth. For the LORD, the God of Israel, saith that he hateth putting away." },
          { ref:"Ephesians 5:25-28", text:"Husbands, love your wives, even as Christ also loved the church, and gave himself for it; That he might sanctify and cleanse it with the washing of water by the word, That he might present it to himself a glorious church, not having spot, or wrinkle, or any such thing; but that it should be holy and without blemish. So ought men to love their wives as their own bodies." },
          { ref:"1 Corinthians 7:3-4", text:"Let the husband render unto the wife due benevolence: and likewise also the wife unto the husband. The wife hath not power of her own body, but the husband: and likewise also the husband hath not power of his own body, but the wife." },
          { ref:"Tobit 8:5-7", text:"Blessed art thou, O God of our fathers, and blessed is thy holy and glorious name for ever; let the heavens bless thee, and all thy creatures. Thou madest Adam, and gavest him Eve his wife for an helper and stay: of them came mankind: thou hast said, It is not good that man should be alone; let us make unto him an aid like unto himself." },
          { ref:"Hebrews 13:4", text:"Marriage is honourable in all, and the bed undefiled: but whoremongers and adulterers God will judge." },
        ],
        supporting:["Genesis 1:27-28","Genesis 24:67","Ruth 4:13","Song of Solomon 2:16","1 Peter 3:7","Colossians 3:18-19","Sirach 25:1","Mark 10:6-9"],
      },
      {
        heading:"The Legal Rights of a Married Woman",
        scripture:"Exodus 21:10-11 · Deuteronomy 21:10-14 · 1 Corinthians 7:3-5",
        note:"Exodus 21:10-11 is one of the earliest legal codes protecting women's rights in any civilization. A married woman was legally entitled to: food (she'er), clothing (k'sut), and conjugal rights (onah). These were not optional generosity — they were enforceable obligations. Failure to provide them gave a wife the legal right to leave freely, without payment.",
        primaryScriptures:[
          { ref:"Exodus 21:10-11", text:"If he take him another wife; her food, her raiment, and her duty of marriage, shall he not diminish. And if he do not these three unto her, then shall she go out free without money." },
          { ref:"1 Corinthians 7:3-5", text:"Let the husband render unto the wife due benevolence: and likewise also the wife unto the husband. The wife hath not power of her own body, but the husband: and likewise also the husband hath not power of his own body, but the wife. Defraud ye not one the other, except it be with consent for a time, that ye may give yourselves to fasting and prayer; and come together again, that Satan tempt you not for your incontinency." },
          { ref:"Ephesians 5:28-29", text:"So ought men to love their wives as their own bodies. He that loveth his wife loveth himself. For no man ever yet hated his own flesh; but nourisheth and cherisheth it, even as the Lord the church." },
          { ref:"1 Peter 3:7", text:"Likewise, ye husbands, dwell with them according to knowledge, giving honour unto the wife, as unto the weaker vessel, and as being heirs together of the grace of life; that your prayers be not hindered." },
          { ref:"Proverbs 5:18-19", text:"Let thy fountain be blessed: and rejoice with the wife of thy youth. Let her be as the loving hind and pleasant roe; let her breasts satisfy thee at all times; and be thou ravished always with her love." },
        ],
        supporting:["Deuteronomy 24:5","Song of Solomon 1:2-4","Song of Solomon 4:1-7","Sirach 36:29-31","Tobit 8:4-9"],
      },
      {
        heading:"Widows — Protected by Covenant Law",
        scripture:"Deuteronomy 24:17-22 · Isaiah 1:17 · James 1:27 · 1 Timothy 5:3-16",
        note:"YAHAWAH's protection of widows is not charity — it is covenant justice. The widows are mentioned alongside strangers and orphans throughout the Torah as the three classes of vulnerable people who carry divine protection. Mistreating a widow is treated as a direct offense against YAHAWAH.",
        primaryScriptures:[
          { ref:"Deuteronomy 24:17", text:"Thou shalt not pervert the judgment of the stranger, nor of the fatherless; nor take a widow's raiment to pledge." },
          { ref:"Deuteronomy 24:19-21", text:"When thou cuttest down thine harvest in thy field, and hast forgot a sheaf in the field, thou shalt not go again to fetch it: it shall be for the stranger, for the fatherless, and for the widow: that the LORD thy God may bless thee in all the work of thine hands." },
          { ref:"Isaiah 1:17", text:"Learn to do well; seek judgment, relieve the oppressed, judge the fatherless, plead for the widow." },
          { ref:"James 1:27", text:"Pure religion and undefiled before God and the Father is this, To visit the fatherless and widows in their affliction, and to keep himself unspotted from the world." },
          { ref:"1 Timothy 5:3-5", text:"Honour widows that are widows indeed. But if any widow have children or nephews, let them learn first to shew piety at home, and to requite their parents: for that is good and acceptable before God. Now she that is a widow indeed, and desolate, trusteth in God, and continueth in supplications and prayers night and day." },
          { ref:"Psalm 68:5", text:"A father of the fatherless, and a judge of the widows, is God in his holy habitation." },
          { ref:"Proverbs 15:25", text:"The LORD will destroy the house of the proud: but he will establish the border of the widow." },
        ],
        supporting:["Exodus 22:22-24","Ruth 1 (Naomi as widow)","Luke 2:36-38 (Anna as widow)","Acts 9:39-41 (widows and Dorcas)","1 Kings 17:9-24 (widow of Zarephath)","Luke 21:1-4 (widow's offering)"],
      },
      {
        heading:"Protection for the Divorced Woman",
        scripture:"Deuteronomy 24:1-4 · Matthew 19:3-9 · Malachi 2:16",
        note:"Deuteronomy 24 required a written bill of divorcement (get in Hebrew) — a legal document that protected a woman from informal abandonment. Without it, she had no legal standing to remarry. Yeshua's teaching in Matthew 19 elevated protection further: except for fornication, the writ was being misused. YAHAWAH's heart through Malachi is clear: He hates treacherous putting away.",
        primaryScriptures:[
          { ref:"Deuteronomy 24:1-2", text:"When a man hath taken a wife, and married her, and it come to pass that she find no favour in his eyes, because he hath found some uncleanness in her: then let him write her a bill of divorcement, and give it in her hand, and send her out of his house. And when she is departed out of his house, she may go and be another man's wife." },
          { ref:"Deuteronomy 24:3-4", text:"And if the latter husband hate her, and write her a bill of divorcement, and giveth it in her hand, and sendeth her out of his house; or if the latter husband die, which took her to be his wife; Her former husband, which sent her away, may not take her again to be his wife, after that she is defiled; for that is abomination before the LORD." },
          { ref:"Matthew 19:8-9", text:"He saith unto them, Moses because of the hardness of your hearts suffered you to put away your wives: but from the beginning it was not so. And I say unto you, Whosoever shall put away his wife, except it be for fornication, and shall marry another, committeth adultery: and whoso marrieth her which is put away doth commit adultery." },
          { ref:"Malachi 2:16", text:"For the LORD, the God of Israel, saith that he hateth putting away: for one covereth violence with his garment, saith the LORD of hosts: therefore take heed to your spirit, that ye deal not treacherously." },
          { ref:"Isaiah 54:6-7", text:"For the LORD hath called thee as a woman forsaken and grieved in spirit, and a wife of youth, when thou wast refused, saith thy God. For a small moment have I forsaken thee; but with great mercies will I gather thee." },
        ],
        supporting:["Ezekiel 16:1-8 (YAHAWAH as husband of Israel)","Hosea 2:19-20","Jeremiah 3:1","1 Corinthians 7:10-15","Mark 10:11-12"],
      },
    ],
  },
  {
    id:"wlaw-motherhood", icon:"🌿", color:"#5A7A52",
    title:"Motherhood, Children & the Generational Covenant",
    subtitle:"The covenant mandate given to mothers",
    sections:[
      {
        heading:"Training Children in the Covenant",
        scripture:"Deuteronomy 6:4-9 · Proverbs 22:6 · 2 Timothy 1:5",
        note:"The Shema command (Deuteronomy 6) was given to households — not just fathers. It says 'thou shalt teach them diligently unto thy children' — the Hebrew word is shanan, meaning to sharpen, to engrave on. Mothers were the primary teachers in daily household life. Paul's testimony about Timothy confirms that covenant faith was transmitted through his mother and grandmother first.",
        primaryScriptures:[
          { ref:"Deuteronomy 6:4-7", text:"Hear, O Israel: The LORD our God is one LORD: And thou shalt love the LORD thy God with all thine heart, and with all thy soul, and with all thy might. And these words, which I command thee this day, shall be in thine heart: And thou shalt teach them diligently unto thy children, and shalt talk of them when thou sittest in thine house, and when thou walkest by the way, and when thou liest down, and when thou risest up." },
          { ref:"Proverbs 22:6", text:"Train up a child in the way he should go: and when he is old, he will not depart from it." },
          { ref:"Proverbs 1:8-9", text:"My son, hear the instruction of thy father, and forsake not the law of thy mother: For they shall be an ornament of grace unto thy head, and chains about thy neck." },
          { ref:"2 Timothy 1:5", text:"When I call to remembrance the unfeigned faith that is in thee, which dwelt first in thy grandmother Lois, and thy mother Eunice; and I am persuaded that in thee also." },
          { ref:"Proverbs 31:1-2", text:"The words of king Lemuel, the prophecy that his mother taught him. What, my son? and what, the son of my womb? and what, the son of my vows?" },
          { ref:"Sirach 3:2-4", text:"For the LORD hath given the father honour over the children, and hath confirmed the authority of the mother over the sons. Whoso honoureth his father maketh an atonement for his sins: And he that honoureth his mother is as one that layeth up treasure." },
          { ref:"Proverbs 29:15", text:"The rod and reproof give wisdom: but a child left to himself bringeth his mother to shame." },
        ],
        supporting:["Psalm 78:1-7","Isaiah 38:19","Joel 1:3","Psalm 127:3-5","Proverbs 6:20","Joshua 4:21-23"],
      },
      {
        heading:"Mothers of the Covenant — Examples in Scripture",
        scripture:"Exodus 2:1-10 · 1 Samuel 1:10-28 · Judges 13:2-7",
        note:"The most decisive moments in Israel's history often involved a mother's courage: Jochebed hid Moses. Hannah dedicated Samuel. Manoah's wife received the angelic announcement about Samson. Each of these mothers operated in covenant and prophetic capacity — not as passive figures but as active covenant agents.",
        primaryScriptures:[
          { ref:"Exodus 2:2-3", text:"And the woman conceived, and bare a son: and when she saw him that he was a goodly child, she hid him three months. And when she could not longer hide him, she took for him an ark of bulrushes, and daubed it with slime and with pitch, and put the child therein; and she laid it in the flags by the river's brink." },
          { ref:"Hebrews 11:23", text:"By faith Moses, when he was born, was hid three months of his parents, because they saw he was a proper child; and they were not afraid of the king's commandment." },
          { ref:"1 Samuel 1:15-16", text:"And Hannah answered and said, No, my lord, I am a woman of a sorrowful spirit: I have drunk neither wine nor strong drink, but have poured out my soul before the LORD. Count not thine handmaid for a daughter of Belial: for out of the abundance of my complaint and grief have I spoken hitherto." },
          { ref:"1 Samuel 1:27-28", text:"For this child I prayed; and the LORD hath given me my petition which I asked of him: Therefore also I have lent him to the LORD; as long as he liveth he shall be lent to the LORD." },
          { ref:"Judges 13:3-5", text:"And the angel of the LORD appeared unto the woman, and said unto her, Behold now, thou art barren, and bearest not: but thou shalt conceive, and bear a son. Now therefore beware, I pray thee, and drink not wine nor strong drink, and eat not any unclean thing: For, lo, thou shalt conceive, and bear a son; and no razor shall come on his head: for the child shall be a Nazarite unto God from the womb." },
          { ref:"Proverbs 31:28", text:"Her children arise up, and call her blessed; her husband also, and he praiseth her." },
        ],
        supporting:["Genesis 21:1-3 (Sarah)","Genesis 25:22-23 (Rebekah hears from God directly)","Luke 1:46-55 (Magnificat of Mary)","Acts 16:1 (Timothy's mother Eunice)","2 Kings 4:14-17 (Shunammite woman)"],
      },
      {
        heading:"The Purification After Birth",
        scripture:"Leviticus 12:1-8 · Luke 2:22-24",
        note:"The post-birth purification was not about shame — it was about transition. The woman's body had performed a sacred act of covenant continuation, and there was a ritual acknowledgment of that transition back into ordinary life. Mary and Joseph kept this law after Yahawashi's birth, confirming its ongoing observance in the first century.",
        primaryScriptures:[
          { ref:"Leviticus 12:2-5", text:"Speak unto the children of Israel, saying, If a woman have conceived seed, and born a man child: then she shall be unclean seven days; according to the days of the separation for her infirmity shall she be unclean. And in the eighth day the flesh of his foreskin shall be circumcised. And she shall then continue in the blood of her purifying three and thirty days." },
          { ref:"Leviticus 12:6-8", text:"And when the days of her purifying are fulfilled, for a son, or for a daughter, she shall bring a lamb of the first year for a burnt offering, and a young pigeon, or a turtledove, for a sin offering, unto the door of the tabernacle of the congregation, unto the priest." },
          { ref:"Luke 2:22-24", text:"And when the days of her purification according to the law of Moses were accomplished, they brought him to Jerusalem, to present him to the Lord; And to offer a sacrifice according to that which is said in the law of the Lord, A pair of turtledoves, or two young pigeons." },
          { ref:"Isaiah 66:13", text:"As one whom his mother comforteth, so will I comfort you; and ye shall be comforted in Jerusalem." },
          { ref:"Psalm 139:13-14", text:"For thou hast possessed my reins: thou hast covered me in my mother's womb. I will praise thee; for I am fearfully and wonderfully made: marvellous are thy works; and that my soul knoweth right well." },
        ],
        supporting:["Genesis 1:27-28","Isaiah 44:2","Psalm 22:9-10","Jeremiah 1:5","Isaiah 46:3-4"],
      },
      {
        heading:"YAHAWAH's Heart for Mothers",
        scripture:"Isaiah 49:15 · Isaiah 66:13 · Psalm 113:9",
        note:"YAHAWAH uses the image of a nursing mother as His highest metaphor for covenant faithfulness. The Hebrew word racham (compassion) literally derives from rechem — the womb. YAHAWAH's compassion is womb-love: deep, instinctive, and unbreakable. Psalm 113:9 shows that barrenness is not a curse He ignores — it is a condition He specifically addresses.",
        primaryScriptures:[
          { ref:"Isaiah 49:15-16", text:"Can a woman forget her sucking child, that she should not have compassion on the son of her womb? yea, they may forget, yet will I not forget thee. Behold, I have graven thee upon the palms of my hands; thy walls are continually before me." },
          { ref:"Isaiah 66:13", text:"As one whom his mother comforteth, so will I comfort you; and ye shall be comforted in Jerusalem." },
          { ref:"Psalm 113:9", text:"He maketh the barren woman to keep house, and to be a joyful mother of children. Praise ye the LORD." },
          { ref:"Genesis 21:1-2", text:"And the LORD visited Sarah as he had said, and the LORD did unto Sarah as he had spoken. For Sarah conceived, and bare Abraham a son in his old age." },
          { ref:"Luke 1:36-37", text:"And, behold, thy cousin Elisabeth, she hath also conceived a son in her old age: and this is the sixth month with her, who was called barren. For with God nothing shall be impossible." },
          { ref:"Sirach 26:22", text:"A virtuous daughter is a precious treasure: as a man's heart so is a good wife." },
        ],
        supporting:["1 Samuel 1:19-20 (Hannah)","Genesis 30:22-24 (Rachel)","Luke 1:24-25 (Elisabeth)","Judges 13:3 (Samson's mother)","2 Kings 4:14-17 (Shunammite)"],
      },
    ],
  },
  {
    id:"wlaw-business", icon:"💼", color:"#C97D1A",
    title:"Women in Business, Work & Commerce",
    subtitle:"The covenant blueprint for women in economic life",
    sections:[
      {
        heading:"The Proverbs 31 Businesswoman",
        scripture:"Proverbs 31:10-31",
        note:"The Proverbs 31 woman is an entrepreneur, investor, merchant, and employer. She evaluates land, makes the purchase, plants the vineyard with the profit, manages employees (maidens), exports goods to merchants, and has her own income stream. This is not a spiritual metaphor — it is a literal description of a covenant woman operating in economic life.",
        primaryScriptures:[
          { ref:"Proverbs 31:16", text:"She considereth a field, and buyeth it: with the fruit of her hands she planteth a vineyard." },
          { ref:"Proverbs 31:13-14", text:"She seeketh wool, and flax, and worketh willingly with her hands. She is like the merchants' ships; she bringeth her food from afar." },
          { ref:"Proverbs 31:18", text:"She perceiveth that her merchandise is good: her candle goeth not out by night." },
          { ref:"Proverbs 31:24", text:"She maketh fine linen, and selleth it; and delivereth girdles unto the merchant." },
          { ref:"Proverbs 31:20", text:"She stretcheth out her hand to the poor; yea, she reacheth forth her hands to the needy." },
          { ref:"Proverbs 31:26-27", text:"She openeth her mouth with wisdom; and in her tongue is the law of kindness. She looketh well to the ways of her household, and eateth not the bread of idleness." },
          { ref:"Proverbs 31:31", text:"Give her of the fruit of her hands; and let her own works praise her in the gates." },
        ],
        supporting:["Genesis 29-31 (Rachel and Leah managing household)","2 Kings 8:1-6 (Shunammite woman's land)","Acts 18:3 (Priscilla as tentmaker)","Sirach 26:13","Proverbs 14:1"],
      },
      {
        heading:"Women Leaders in the New Testament",
        scripture:"Acts 16:14-15 · Acts 18:24-26 · Romans 16:1-4",
        note:"The New Testament documents women in roles of theological teacher (Priscilla), house church host (Lydia, Priscilla), deaconess (Phoebe), and businesswoman (Lydia of purple). These are not exceptions to a rule against women in leadership — they are documented examples of covenant women fulfilling the roles YAHAWAH prepared for them.",
        primaryScriptures:[
          { ref:"Acts 16:14-15", text:"And a certain woman named Lydia, a seller of purple, of the city of Thyatira, which worshipped God, heard us: whose heart the Lord opened, that she attended unto the things which were spoken of Paul. And when she was baptized, and her household, she besought us, saying, If ye have judged me to be faithful to the Lord, come into my house, and abide there. And she constrained us." },
          { ref:"Acts 18:24-26", text:"And a certain Jew named Apollos, born at Alexandria, an eloquent man, and mighty in the scriptures, came to Ephesus. This man was instructed in the way of the Lord; and being fervent in the spirit, he spake and taught diligently the things of the Lord, knowing only the baptism of John. And he began to speak boldly in the synagogue: whom when Aquila and Priscilla had heard, they took him unto them, and expounded unto him the way of God more perfectly." },
          { ref:"Romans 16:1-3", text:"I commend unto you Phebe our sister, which is a servant of the church which is at Cenchrea: That ye receive her in the Lord, as becometh saints, and that ye assist her in whatsoever business she hath need of you: for she hath been a succourer of many, and of myself also. Greet Priscilla and Aquila my helpers in Christ Jesus." },
          { ref:"Philippians 4:2-3", text:"I beseech Euodias, and beseech Syntyche, that they be of the same mind in the Lord. And I intreat thee also, true yokefellow, help those women which laboured with me in the gospel, with Clement also, and with other my fellowlabourers, whose names are in the book of life." },
          { ref:"Luke 8:2-3", text:"And certain women, which had been healed of evil spirits and infirmities, Mary called Magdalene, out of whom went seven devils, And Joanna the wife of Chuza Herod's steward, and Susanna, and many others, which ministered unto him of their substance." },
        ],
        supporting:["Acts 9:36-42 (Dorcas/Tabitha)","Acts 21:9 (Philip's daughters who prophesied)","Colossians 4:15 (Nympha's house church)","2 John 1:1 (The elect lady)","1 Corinthians 16:19 (Aquila and Priscilla)"],
      },
      {
        heading:"Women Who Exercised Prophetic Authority",
        scripture:"Exodus 15:20-21 · 2 Kings 22:14-20 · Judges 4:4-5 · Luke 2:36-38",
        note:"Miriam is called a prophetess and listed alongside Moses and Aaron as one of three leaders of the Exodus (Micah 6:4). Huldah certified the Book of the Law as authentic when the king's priests brought it to her — not to Jeremiah or Zephaniah who were alive at the time. Deborah judged all of Israel. Anna declared the Messiah in the Temple. Prophetic authority was never exclusively male.",
        primaryScriptures:[
          { ref:"Exodus 15:20-21", text:"And Miriam the prophetess, the sister of Aaron, took a timbrel in her hand; and all the women went out after her with timbrels and with dances. And Miriam answered them, Sing ye to the LORD, for he hath triumphed gloriously; the horse and his rider hath he thrown into the sea." },
          { ref:"2 Kings 22:14-15", text:"So Hilkiah the priest, and Ahikam, and Achbor, and Shaphan, and Asahiah, went unto Huldah the prophetess, the wife of Shallum the son of Tikvah, the son of Harhas, keeper of the wardrobe; (now she dwelt in Jerusalem in the college;) and they communed with her. And she said unto them, Thus saith the LORD God of Israel, Tell the man that sent you to me." },
          { ref:"Joel 2:28-29", text:"And it shall come to pass afterward, that I will pour out my spirit upon all flesh; and your sons and your daughters shall prophesy, your old men shall dream dreams, your young men shall see visions: And also upon the servants and upon the handmaids in those days will I pour out my spirit." },
          { ref:"Acts 2:17-18", text:"And it shall come to pass in the last days, saith God, I will pour out of my Spirit upon all flesh: and your sons and your daughters shall prophesy, and your young men shall see visions, and your old men shall dream dreams: And on my servants and on my handmaidens I will pour out in those days of my Spirit; and they shall prophesy." },
          { ref:"Acts 21:8-9", text:"And the next day we that were of Paul's company departed, and came unto Caesarea: and we entered into the house of Philip the evangelist, which was one of the seven; and abode with him. And the same man had four daughters, virgins, which did prophesy." },
          { ref:"Micah 6:4", text:"For I brought thee up out of the land of Egypt, and redeemed thee out of the house of servants; and I sent before thee Moses, Aaron, and Miriam." },
        ],
        supporting:["Numbers 12:1-8 (Miriam's authority acknowledged)","Isaiah 8:3 (Isaiah's wife called a prophetess)","Nehemiah 6:14 (female prophet Noadiah)","Revelation 2:20","1 Corinthians 11:5","Judges 5:1-31 (Deborah's song)"],
      },
    ],
  },
];

// ─── RESOURCE LINKS SYSTEM ────────────────────────────────────────────────────
const RESOURCE_LINK_BADGES = {
  "Historical Source":       { color:"#8B3A2A", bg:"rgba(139,58,42,0.1)" },
  "Encyclopedia":            { color:"#1B3A5C", bg:"rgba(27,58,92,0.1)" },
  "Museum / Archive":        { color:"#2E7D32", bg:"rgba(46,125,50,0.1)" },
  "Database / Academic":     { color:"#7B5EA7", bg:"rgba(123,94,167,0.1)" },
  "Scripture Source":        { color:"#C4893A", bg:"rgba(196,137,58,0.1)" },
  "Historical Interpretation":{ color:"#6D4C41", bg:"rgba(109,76,65,0.1)" },
  "Map Resource":            { color:"#00838F", bg:"rgba(0,131,143,0.1)" },
  "Archive":                 { color:"#37474F", bg:"rgba(55,71,79,0.1)" },
};

// Master resource links catalog used across the app
const MASTER_RESOURCES = {
  arzareth:[
    { label:"Jewish Encyclopedia — Arzareth", url:"https://www.jewishencyclopedia.com/articles/1867-arzareth", type:"Historical Interpretation / Encyclopedia", desc:"Reference article discussing Arzareth and the ten tribes tradition." },
  ],
  slavery:[
    { label:"Britannica — Transatlantic Slave Trade", url:"https://www.britannica.com/topic/transatlantic-slave-trade", type:"Historical Source", desc:"Overview of the Atlantic slave trade, 16th–19th century." },
    { label:"SlaveVoyages Database", url:"https://www.slavevoyages.org/", type:"Database / Academic", desc:"Large public database with voyage-level evidence of enslaved Africans." },
    { label:"NMAAHC — Transatlantic Slave Trade", url:"https://nmaahc.si.edu/explore/stories/transatlantic-slave-trade", type:"Museum / Archive", desc:"National Museum of African American History and Culture." },
    { label:"Library of Congress — Slavery Collections", url:"https://www.loc.gov/collections/", type:"Archive", desc:"Primary source documents and collections." },
    { label:"National Archives — African American History", url:"https://www.archives.gov/research/african-americans", type:"Archive", desc:"U.S. National Archives research resources." },
  ],
  assyria:[
    { label:"British Museum — Assyrian Collection", url:"https://www.britishmuseum.org/collection", type:"Museum / Archive", desc:"Lachish Reliefs and Assyrian campaign material." },
    { label:"World History Encyclopedia — Assyrian Empire", url:"https://www.worldhistory.org/Assyrian_Empire/", type:"Historical Source", desc:"Detailed overview of the Assyrian Empire." },
    { label:"Britannica — Sargon II", url:"https://www.britannica.com/biography/Sargon-II", type:"Encyclopedia", desc:"The king who completed the conquest of the Northern Kingdom." },
  ],
  babylon:[
    { label:"Britannica — Babylonian Captivity", url:"https://www.britannica.com/event/Babylonian-Captivity", type:"Encyclopedia", desc:"Overview of the 70-year Babylonian exile." },
    { label:"Britannica — Nebuchadnezzar II", url:"https://www.britannica.com/biography/Nebuchadnezzar-II", type:"Encyclopedia", desc:"The Babylonian king who destroyed Jerusalem." },
    { label:"World History Encyclopedia — Neo-Babylonian Empire", url:"https://www.worldhistory.org/Neo-Babylonian_Empire/", type:"Historical Source", desc:"Historical context for the Babylonian period." },
  ],
  rome:[
    { label:"Britannica — Siege of Jerusalem (70 CE)", url:"https://www.britannica.com/event/Siege-of-Jerusalem-70", type:"Encyclopedia", desc:"The Roman destruction of the Second Temple." },
    { label:"Livius — Jerusalem", url:"https://www.livius.org/articles/place/jerusalem/", type:"Historical Source", desc:"Historical source on ancient Jerusalem." },
    { label:"Britannica — Titus", url:"https://www.britannica.com/biography/Titus-Roman-emperor", type:"Encyclopedia", desc:"The Roman general who destroyed Jerusalem." },
  ],
  diaspora:[
    { label:"Britannica — Diaspora", url:"https://www.britannica.com/topic/diaspora-society", type:"Encyclopedia", desc:"Overview of diaspora as a concept and historical reality." },
    { label:"Jewish Virtual Library — Jewish Diaspora", url:"https://www.jewishvirtuallibrary.org/the-jewish-diaspora", type:"Historical Source", desc:"Overview of Jewish diaspora communities worldwide." },
    { label:"USHMM — Jewish Communities in Europe", url:"https://encyclopedia.ushmm.org/", type:"Museum / Archive", desc:"US Holocaust Memorial Museum encyclopedia." },
  ],
  geography:[
    { label:"Britannica — Levant", url:"https://www.britannica.com/place/Levant", type:"Encyclopedia", desc:"The historical region of Israel, Lebanon, Syria, and Palestine." },
    { label:"Britannica — Near East", url:"https://www.britannica.com/place/Near-East", type:"Encyclopedia", desc:"The older term for the Middle East region." },
    { label:"Britannica — Middle East", url:"https://www.britannica.com/place/Middle-East", type:"Encyclopedia" },
    { label:"Britannica — Suez Canal", url:"https://www.britannica.com/topic/Suez-Canal", type:"Encyclopedia" },
  ],
  scripture:[
    { label:"BibleGateway — Full Chapters", url:"https://www.biblegateway.com/", type:"Scripture Source" },
    { label:"Blue Letter Bible — Hebrew / Greek Study", url:"https://www.blueletterbible.org/", type:"Scripture Source" },
    { label:"KJV Bible Online — Apocrypha", url:"https://www.kingjamesbibleonline.org/Apocrypha-Books/", type:"Scripture Source" },
    { label:"Sacred Texts — Apocrypha", url:"https://www.sacred-texts.com/bib/apo/", type:"Scripture Source" },
  ],
};

const ONBOARDING_STEPS = [
  { id:"welcome",    icon:"✦",  title:"Welcome to God Did It Bible Club", desc:"You're now part of a covenant community built on truth, order, and the ancient path. Let's take a quick tour.", cta:"Begin Tour →" },
  { id:"bible",      icon:"🏛️", title:"Start with Scripture Hub", desc:"Browse Genesis through Revelation + full Apocrypha, search any passage live, and access the Codex Sinaiticus, Codex Sassoon, Blue Letter Bible, and more.", cta:"Open Scripture Hub →" },
  { id:"study",      icon:"📖", title:"Your Weekly Study is Ready", desc:"52 weeks covering the full covenant narrative — Creation through the New Jerusalem. Filter by season, search any topic.", cta:"Explore Weekly Studies →" },
  { id:"devotional", icon:"🕯️", title:"Start Your Daily Devotional", desc:"Seven devotionals — one for each day of the week. Short, focused, and designed to keep you grounded.", cta:"Read Today's Devotional →" },
  { id:"reading",    icon:"📜", title:"Your 14-Day Reading Plan", desc:"A roadmap through Torah, Psalms, prophets, gospel, and Apocrypha — aligned with our weekly study themes.", cta:"Start Reading Plan →" },
  { id:"audio",      icon:"🎙️", title:"Audio Bible — Verse by Verse", desc:"Listen to scripture read precept upon precept, line by line. Upload your own MP3 voiceovers or use our audio library.", cta:"Open Audio Bible →" },
];

// ─── LANGUAGES / i18n ─────────────────────────────────────────────────────────
const LANGUAGES = [
  { code:"en", flag:"🇺🇸", name:"English",    nativeName:"English" },
  { code:"es", flag:"🇪🇸", name:"Spanish",    nativeName:"Español" },
  { code:"fr", flag:"🇫🇷", name:"French",     nativeName:"Français" },
  { code:"pt", flag:"🇧🇷", name:"Portuguese", nativeName:"Português" },
  { code:"ht", flag:"🇭🇹", name:"Haitian Creole", nativeName:"Kreyòl Ayisyen" },
];

const T = {
  en: {
    navHome:"Home", navWeekly:"Weekly Study", navDevotional:"Devotional",
    navReading:"Reading Plan", navBible:"Scripture Hub", navAudio:"Audio Bible", navJoin:"Join Club",
    navCaptivities:"⛓️ Captivities", navWomen:"🌸 Women's Study", navLive:"📡 Live", navAncient:"Ancient Israel",
    navBrand:"GOD DID IT BIBLE CLUB", navBrandSub:"Weekly Study · Devotional · Scripture · Audio",
    heroEyebrow:"Welcome to the Community",
    heroH1a:"Weekly Study.", heroH1b:"Daily Devotion.", heroH1c:"Living Scripture.",
    heroSub:"A reverent online home built for those walking the ancient path — structured weekly teaching, daily devotionals, a scripture reading plan, and verse-by-verse audio rooted in covenant truth.",
    heroCta1:"Start This Week's Study →", heroCta2:"Today's Devotional", heroCta3:"Open Scripture Hub →",
    heroCard1t:"📖 52 Weeks of Study", heroCard1b:"Creation → Covenant → Kingdom → New Jerusalem",
    heroCard2t:"🕯️ Daily Devotional", heroCard2b:"Reflection, prayer & scripture each day",
    heroCard3t:"🏛️ Scripture Hub", heroCard3b:"Ancient manuscripts · Lexicon · Codex · Blue Letter Bible",
    featuresEyebrow:"What's Inside", featuresH2:"Everything you need to stay consistent.",
    featuresSub:"From first visit to faithful member — weekly lessons, daily devotionals, a 14-day reading plan, full scripture browser, and verse-by-verse audio.",
    joinCtaEyebrow:"Ready to Begin", joinCtaH2:"Join the weekly community.",
    joinCtaSub:"Enter your name, email, and prayer request to receive weekly studies and devotionals.",
    joinCtaBtn:"Join the Bible Club ✦",
    f1title:"Weekly Bible Study", f1body:"52 weeks of themed study — Creation through New Jerusalem. Filter by season, search any topic or scripture.", f1cta:"Open This Week's Study",
    f2title:"Daily Devotional", f2body:"7 short devotionals with scripture, reflection, and prayer to keep members grounded all week.", f2cta:"Read Today's Devotional",
    f3title:"Daily Reading Plan", f3body:"A 14-day scripture roadmap through Torah, Psalms, prophets, gospel, and Apocrypha.", f3cta:"View Reading Plan",
    f4title:"Scripture Hub", f4body:"Browse Genesis through Revelation + full Apocrypha. Live API for any passage in KJV, ASV, WEB.", f4cta:"Open Scripture Hub",
    f5title:"Audio Bible", f5body:"Listen verse by verse, precept upon precept. Upload your own MP3 voiceovers for custom audio.", f5cta:"Open Audio Bible",
    f6title:"Join the Community", f6body:"Sign up to receive weekly studies, devotionals, and become part of the covenant community.", f6cta:"Join the Club",
    joinTitle:"Come as you are. Grow where you stand.",
    joinEyebrow:"Become a Member", joinSub:"You don't need to have it all figured out. You need a community that studies truth together.",
    placeholderName:"Your full name", placeholderEmail:"Your email address", placeholderPhone:"Phone (optional)",
    placeholderPrayer:"Prayer request or what you want to grow in spiritually",
    joinSubmit:"Submit & Begin Your Journey ✦", joinNote:"Your information is private. God did it — and He will do it again.",
    journeyTitle:"YOUR JOURNEY AFTER JOINING",
    journeySteps:["1. Welcome & guided tour","2. Scripture Hub access","3. Weekly Bible study","4. Daily devotional","5. Audio Bible access","6. Community & prayer"],
    highlights:[["📖","Weekly live Bible study pages"],["🕯️","Daily devotionals for consistency"],["📜","14-day reading plan & scripture archive"],["🎙️","Audio Bible — verse by verse"],["🙏","Prayer request & personal follow-up"],["🤝","A covenant community built on truth"]],
    errorName:"Name is required", errorEmail:"A valid email is required",
    weeklyEyebrow:"Weekly Bible Study", weeklyH2:"52 Weeks · The Full Covenant Narrative.",
    weeklySub:"Search by topic, keyword or scripture. Filter by season. A full year of teaching.",
    weeklyStudies:"STUDIES", weeklyWeeksLabel:"weeks of teaching",
    hebrewEyebrow:"✦ ANCIENT HEBREW WORD OF THE WEEK",
    seasonLabel:"FILTER BY SEASON", allWeeks:"All 52 Weeks",
    topicLabel:"EXPLORE BY TOPIC", showAll:"Show all topics ↓", showLess:"Show fewer ↑",
    searchPlaceholder:"Search topics, keywords or scriptures…",
    studiesFound:"STUDIES FOUND", studyFound:"STUDY FOUND", clearAll:"Clear All",
    noStudiesText:"No studies found for", clearSearch:"Clear Search",
    devEyebrow:"Daily Devotional", devH2:"Seven Stages of Awakening.",
    devSub:"A 7-stage covenant roadmap through identity, covenant, punishment, law, Messiah, diaspora, and restoration.",
    reflection:"REFLECTION", prayer:"PRAYER",
    devJourneyTitle:"7-Stage Covenant Awakening", devJourneySub:"A scripture roadmap through identity, covenant, punishment, the law, Messiah, diaspora, and restoration.",
    devStageLabel:"STAGE", devOf:"OF 7",
    devSectionA:"A · ANCHOR SCRIPTURE", devSectionB:"B · UNDERSTANDING THE TEXT",
    devSectionC:"C · WHY THIS MATTERS TODAY", devSectionD:"D · RELATED SCRIPTURES",
    devSectionE:"E · COVENANT PRAYER", devSectionF:"F · TODAY'S ACTION STEP",
    devGoDeeper:"GO DEEPER", devCopyBtn:"Copy Prayer & Action", devCopied:"✓ Copied!",
    devStudyNote:"Study Note: This roadmap combines KJV scripture, Apocrypha, and covenant teaching tradition.",
    devCovenantArc:"THE COVENANT ARC", devReadDeut:"Read Deuteronomy 30", devGoRestoration:"→ Go to Restoration",
    readEyebrow:"Daily Reading Plan", readH2:"A 14-day scripture roadmap.",
    readSub:"This plan combines Torah, wisdom books, prophets, gospel, epistles, and Apocrypha passages.",
    readIdentityTitle:"14-Day Covenant Identity Roadmap",
    readIdentitySub:"Click any passage to open in the Bible reader. Tap 🤖 for an AI explanation.",
    readExplainLabel:"AI VERSE EXPLANATION", readExplaining:"Generating explanation…",
    hubEyebrow:"Scripture Hub", hubH2:"Read, Study and Explore the Word.",
    hubSub:"Your central Bible portal — explore every book, search any passage, access ancient manuscripts.",
    toolsEyebrow:"Reference Tools", toolsH2:"Ancient Manuscripts & Study Resources.",
    toolsSub:"Access the oldest known Biblical manuscripts, original language lexicons, concordances, and full study tools.",
    audioEyebrow:"Audio Bible", audioH2:"Precept upon precept. Line by line.",
    audioSub:"Listen to scripture verse by verse — exact, literal words. Upload your own MP3 recordings.",
    audioHowTitle:"How to Use", audioUploadTitle:"UPLOAD YOUR MP3",
    audioDrop:"Drag MP3 Files Here", audioDropSub:"Verse-by-verse voice recordings\nMP3, WAV, M4A · Any size",
    onboardSkip:"Skip Tour",
    backHub:"← Back to Scripture Hub",
    passEyebrow:"Passage Reader", passH2:"Read the Word.",
    passSub:"Search any passage — Genesis through Revelation plus Apocrypha.",
    passSearch:"🔍 SEARCH", passSearching:"⏳",
    passNotFound:"NOT FOUND", passBackFeatured:"← Back to Featured Passages",
    passFeatured:"FEATURED PASSAGES — GENESIS THROUGH REVELATION + APOCRYPHA",
    passNewSearch:"← New Search", passLoadKJV:"Load Full Chapter in KJV",
    passLiveChapter:"Full chapter loaded via bible-api.com ·",
    versEyebrow:"Bible Versions", versH2:"Choose Your Translation.",
    versSub:"Select the Bible version you'd like to read.",
    booksEyebrow:"Bible Books", booksH2:"Browse the Scriptures.",
    booksSub:"Select a book and chapter — includes full Old Testament, New Testament, and Apocrypha.",
    bookSelectChapter:"SELECT CHAPTER",
    apoNote:"✦ Apocrypha — Includes Deuterocanonical books, Ethiopian Orthodox canon, Septuagint, and Pseudepigrapha.",
    welcomeEyebrow:"You're In",
    welcomeSub:"You are now part of the God Did It Bible Club — a covenant community built on truth, the ancient path, and precept upon precept learning.",
    welcomeCta1:"Take the Guided Tour →", welcomeCta2:"Go to This Week's Study",
    welcomeNextSteps:"Your Next Steps",
    footerSub:"Weekly study · Daily devotionals · Scripture from Genesis to Revelation + Apocrypha · Verse-by-verse audio · Rooted in covenant truth.",
    footerWeekly:"Weekly Study", footerJoin:"Join Club",
    langLabel:"Language", toolOpenBtn:"Open Resource", manuscriptBanner:"These are not artifacts — they are the living foundation of scripture.",
    filterMandatory:"Mandatory", filterShabbat:"Shabbat", filterSpring:"Spring", filterFall:"Fall", filterAdditional:"Additional",
    quickScripture:"Scripture", quickAudio:"Audio", quickReading:"Reading",
    quickFeasts:"Feasts", quickWomen:"Women", quickCaptivities:"Captivities",
    tileAncient:"Ancient Israel", tileAncientSub:"Timeline, Tribes & History",
    tileCaptiv:"7 Captivities", tileCaptivSub:"Egypt → Diaspora",
    tileWomen:"Women's Study", tileWomenSub:"Covenant identity & laws",
    tileDeut:"Deut. 28 Study", tileDeutSub:"Signs & wonders module",
    tileTribes:"12 Tribes", tileTribesSub:"Prophecies & diaspora",
    tileHist:"Historical Context", tileHistSub:"Papal bulls & modern Israel",
    pillWeekly:"Weekly Study", pillReading:"Reading Plan", pillAudio:"Audio Bible",
    pillReadingSub:"14-Day Identity Roadmap",
    toggleDevotional:"🕯️ Devotional", togglePrayer:"🙏 Prayer",
    captivTitle:"The 7 Major Captivities of Israel",
    captivSub:"A scripture-first timeline of Israel's major captivities — from Egyptian bondage to the long diaspora.",
    captivAnchorLabel:"ANCHOR SCRIPTURE · DEUTERONOMY 28:46",
    captivTimelineLabel:"COVENANT TIMELINE OVERVIEW",
    captivKeyScriptures:"KEY SCRIPTURES", captivTeachingPoint:"TEACHING POINT",
    captivSignificance:"COVENANT SIGNIFICANCE", captivProphetic:"PROPHETIC CONNECTION",
    captivDiasporaFlow:"COVENANT IDENTITY FLOW — 8 TEACHING STAGES",
    captivMigration:"MIGRATION TRADITIONS OF THE LOST TRIBES",
    captivMigrationNote:"This section contains scripture, apocrypha, and historical interpretation. Migration theories are study traditions, not settled fact.",
    captivStudyDeut:"Study Deut. 28 Module", captivTribes:"12 Tribes Page",
    captivTeaser:"Egypt → Assyria → Babylon → Rome → Diaspora",
    captivTeaserSub:"A scripture-first study of Israel's seven major captivities with covenant significance and restoration promise.",
    captivTeaserBtn:"Study the Captivities →",
    womenHeroTitle:"Women of the Covenant", womenHeroSub:"A dedicated study space for women — covenant identity, prophetic women, motherhood, laws given specifically to women, relationships, business, and restoration prophecy.",
    womenTabStudy:"📖 Study Lessons", womenTabLaws:"📜 Laws for Women", womenTabPrayer:"🙏 Prayer Requests",
    womenBeginStudy:"Begin Study →", womenLawsFor:"Laws for Women", womenSubmitPrayer:"Submit Prayer",
    womenLawsNote:"Laws and commandments in scripture addressed specifically to women — purity laws, inheritance rights, marriage protections, and the mandate of motherhood.",
    womenReflection:"💬 REFLECTION QUESTION", womenAssignment:"📝 THIS WEEK'S ASSIGNMENT",
    womenPrayerTitle:"WOMEN'S PRAYER REQUEST",
    womenPrayerSub:"Submit your prayer request to be prayed over by the women's covenant community during Shabbat class.",
    womenPrayerName:"Your name (optional)", womenPrayerTextarea:"Write your prayer request here…",
    womenPrayerSubmit:"Submit Prayer Request ✦", womenPrayerReceived:"Prayer Received",
    womenPrayerConfirm:"Your request has been submitted. It will be brought before YAHAWAH in our next Shabbat prayer session.",
    womenPrayerAnother:"Submit Another →",
    womenClosing:"The LORD thy God in the midst of thee is mighty; he will joy over thee with singing. — Zephaniah 3:17",
    tribesTitle:"The 12 Tribes of Israel", tribesSub:"Each tribe carries a name, a territory, a gemstone, and a prophetic destiny.",
    tribesBreastplate:"THE BREASTPLATE OF AARON — EXODUS 28:17-20",
    tribesViewScriptures:"View Prophecies & Scriptures",
    tribesSharedCovenant:"SHARED COVENANT · ALL TWELVE TRIBES",
    tribesSharedSub:"These scriptures apply to all twelve tribes collectively.",
    tribesTabCurses:"⛓️ Covenant Curses", tribesTabRestoration:"🌿 Restoration Promises",
    tribesStudyDeut:"Study the Full Deuteronomy 28 Module →",
    tribesLocationTheme:"Prophecies of Where This Tribe Would Dwell",
    deut28Title:"The Curses of Deuteronomy 28 — Signs & Wonders",
    deut28Sub:"A structured study of the 12 major themes in Deuteronomy 28:15-68 with related scriptures, historical discussion, and the restoration promise.",
    deut28TeachingPrinciple:"TEACHING PRINCIPLE",
    deut28TeachingText:"Always study Deuteronomy 28 alongside Deuteronomy 30. The covenant arc: Disobedience → Captivity → Repentance → Restoration.",
    deut28Theme:"THEME", deut28Related:"RELATED SCRIPTURES", deut28Historical:"HISTORICAL NOTE",
    deut28Discussion:"SHABBAT DISCUSSION TOPICS", deut28Anchor:"ANCHOR",
    histTitle:"Historical Context", histSub:"Documented historical events situated alongside the prophetic framework of scripture.",
    histNote:"📋 HISTORICAL NOTE", histImportant:"⚠️ IMPORTANT — RESPONSIBLE TEACHING",
    histScriptures:"📖 REFLECTIVE SCRIPTURES", histDiscussion:"💬 SHABBAT DISCUSSION QUESTIONS",
    histTimeline:"DOCUMENTED TIMELINE",
    feastTitle:"Holy Feast Calendar", feastSub:"Mandatory appointed times with live countdowns. Click any feast to see how to observe it.",
    feastFullCalendar:"Full Calendar →", feastJoinShabbat:"Join Shabbat Class →",
    feastWeeklyShabbat:"WEEKLY SHABBAT", feastNextFeast:"NEXT FEAST APPROACHING",
    communityTitle:"Join the weekly community.", communitySub:"Enter your name, email, and prayer request to receive weekly studies and devotionals.",
    homeDailyBread:"TODAY'S DAILY BREAD", homeClassSchedule:"CLASS SCHEDULE",
    homeContinue:"CONTINUE STUDYING", homeDeepStudy:"DEEP STUDY SECTIONS",
    homeCaptivitiesTeaser:"THE 7 CAPTIVITIES OF ISRAEL",
    homeStudyCaptivities:"Study the Captivities →",
    homeSearchPlaceholder:"Search scripture, topic, or tribe…",
    joinFormTitle:"Begin Your Covenant Journey",
    womenCovenantPathH2:"A 7-Stage Scripture Journey", womenOfScripH2:"Women of Scripture",
    joinFormSub:"Fill out the form below to join the God Did It Bible Club community.",
  },
  es: {
    navHome:"Inicio", navWeekly:"Estudio Semanal", navDevotional:"Devocional",
    navReading:"Plan de Lectura", navBible:"Centro Bíblico", navAudio:"Biblia en Audio", navJoin:"Únete",
    navCaptivities:"⛓️ Cautiverios", navWomen:"🌸 Estudio Femenino", navLive:"📡 En Vivo", navAncient:"Israel Antiguo",
    navBrand:"CLUB BÍBLICO DIOS LO HIZO", navBrandSub:"Estudio · Devocional · Escrituras · Audio",
    heroEyebrow:"Bienvenido a la Comunidad",
    heroH1a:"Estudio Semanal.", heroH1b:"Devoción Diaria.", heroH1c:"Escritura Viva.",
    heroSub:"Un hogar espiritual para quienes caminan el camino antiguo — enseñanza semanal estructurada, devocionales diarios, un plan de lectura de escrituras y audio versículo por versículo.",
    heroCta1:"Comenzar el Estudio de Esta Semana →", heroCta2:"Devocional de Hoy", heroCta3:"Abrir Centro Bíblico →",
    heroCard1t:"📖 52 Semanas de Estudio", heroCard1b:"Creación → Pacto → Reino → Nueva Jerusalén",
    heroCard2t:"🕯️ Devocional Diario", heroCard2b:"Reflexión, oración y escrituras cada día",
    heroCard3t:"🏛️ Centro Bíblico", heroCard3b:"Manuscritos antiguos · Léxico · Códex · Blue Letter Bible",
    featuresEyebrow:"Lo que Contiene", featuresH2:"Todo lo que necesitas para mantenerte constante.",
    featuresSub:"Desde la primera visita hasta miembro fiel — lecciones semanales, devocionales diarios, plan de lectura de 14 días, navegador de escrituras y audio versículo por versículo.",
    joinCtaEyebrow:"Listo para Comenzar", joinCtaH2:"Únete a la comunidad semanal.",
    joinCtaSub:"Ingresa tu nombre, correo y petición de oración para recibir estudios y devocionales semanales.",
    joinCtaBtn:"Únete al Club Bíblico ✦",
    f1title:"Estudio Bíblico Semanal", f1body:"52 semanas de estudio temático — Creación hasta Nueva Jerusalén. Filtra por temporada, busca cualquier tema.", f1cta:"Abrir el Estudio de Esta Semana",
    f2title:"Devocional Diario", f2body:"7 devocionales cortos con escritura, reflexión y oración.", f2cta:"Leer el Devocional de Hoy",
    f3title:"Plan de Lectura Diario", f3body:"Una hoja de ruta de escrituras de 14 días a través de Torá, Salmos, profetas, evangelio y Apócrifos.", f3cta:"Ver Plan de Lectura",
    f4title:"Centro Bíblico", f4body:"Navega de Génesis al Apocalipsis + Apócrifos completos. API en vivo para cualquier pasaje en KJV, ASV, WEB.", f4cta:"Abrir Centro Bíblico",
    f5title:"Biblia en Audio", f5body:"Escucha versículo por versículo, precepto sobre precepto. Sube tus propias grabaciones MP3.", f5cta:"Abrir Biblia en Audio",
    f6title:"Únete a la Comunidad", f6body:"Regístrate para recibir estudios semanales, devocionales y ser parte de la comunidad del pacto.", f6cta:"Únete al Club",
    joinTitle:"Ven como eres. Crece donde estás.",
    joinEyebrow:"Hazte Miembro", joinSub:"No necesitas tenerlo todo resuelto. Necesitas una comunidad que estudie la verdad juntos.",
    placeholderName:"Tu nombre completo", placeholderEmail:"Tu correo electrónico", placeholderPhone:"Teléfono (opcional)",
    placeholderPrayer:"Petición de oración o en qué quieres crecer espiritualmente",
    joinSubmit:"Enviar e Iniciar tu Viaje ✦", joinNote:"Tu información es privada. Dios lo hizo — y lo volverá a hacer.",
    journeyTitle:"TU CAMINO DESPUÉS DE UNIRTE",
    journeySteps:["1. Bienvenida y tour guiado","2. Acceso al Centro Bíblico","3. Estudio bíblico semanal","4. Devocional diario","5. Acceso a Biblia en audio","6. Comunidad y oración"],
    highlights:[["📖","Páginas de estudio bíblico semanal"],["🕯️","Devocionales diarios"],["📜","Plan de lectura de 14 días"],["🎙️","Biblia en audio — versículo por versículo"],["🙏","Petición de oración y seguimiento personal"],["🤝","Una comunidad de pacto basada en la verdad"]],
    errorName:"El nombre es requerido", errorEmail:"Se requiere un correo válido",
    weeklyEyebrow:"Estudio Bíblico Semanal", weeklyH2:"52 Semanas · La Narrativa Completa del Pacto.",
    weeklySub:"Busca por tema, palabra clave o escritura. Filtra por temporada. Un año completo de enseñanza.",
    weeklyStudies:"ESTUDIOS", weeklyWeeksLabel:"semanas de enseñanza",
    hebrewEyebrow:"✦ PALABRA HEBREA ANTIGUA DE LA SEMANA",
    seasonLabel:"FILTRAR POR TEMPORADA", allWeeks:"Las 52 Semanas",
    topicLabel:"EXPLORAR POR TEMA", showAll:"Mostrar todos los temas ↓", showLess:"Mostrar menos ↑",
    searchPlaceholder:"Buscar temas, palabras clave o escrituras…",
    studiesFound:"ESTUDIOS ENCONTRADOS", studyFound:"ESTUDIO ENCONTRADO", clearAll:"Limpiar Todo",
    noStudiesText:"No se encontraron estudios para", clearSearch:"Limpiar Búsqueda",
    devEyebrow:"Devocional Diario", devH2:"Siete Etapas del Despertar.",
    devSub:"Una hoja de ruta del pacto de 7 etapas a través de identidad, pacto, castigo, ley, Mesías, diáspora y restauración.",
    reflection:"REFLEXIÓN", prayer:"ORACIÓN",
    devJourneyTitle:"7 Etapas del Despertar del Pacto", devJourneySub:"Una hoja de ruta escritural a través de identidad, pacto, castigo, la ley, el Mesías, diáspora y restauración.",
    devStageLabel:"ETAPA", devOf:"DE 7",
    devSectionA:"A · ESCRITURA ANCLA", devSectionB:"B · COMPRENDIENDO EL TEXTO",
    devSectionC:"C · POR QUÉ IMPORTA HOY", devSectionD:"D · ESCRITURAS RELACIONADAS",
    devSectionE:"E · ORACIÓN DEL PACTO", devSectionF:"F · PASO DE ACCIÓN DE HOY",
    devGoDeeper:"PROFUNDIZAR", devCopyBtn:"Copiar Oración y Acción", devCopied:"✓ Copiado!",
    devStudyNote:"Esta hoja de ruta combina escrituras KJV, Apócrifos y tradición de enseñanza del pacto.",
    devCovenantArc:"EL ARCO DEL PACTO", devReadDeut:"Leer Deuteronomio 30", devGoRestoration:"→ Ir a Restauración",
    readEyebrow:"Plan de Lectura", readH2:"Un mapa de escrituras de 14 días.",
    readSub:"Este plan combina Torá, libros de sabiduría, profetas, evangelio, epístolas y Apócrifos.",
    readIdentityTitle:"Hoja de Ruta de Identidad — 14 Días",
    readIdentitySub:"Toca cualquier pasaje para abrirlo. Toca 🤖 para explicación de IA.",
    readExplainLabel:"EXPLICACIÓN IA", readExplaining:"Generando explicación…",
    hubEyebrow:"Centro Bíblico", hubH2:"Lee, Estudia y Explora la Palabra.",
    hubSub:"Tu portal bíblico central — explora cada libro, busca cualquier pasaje, accede a manuscritos antiguos.",
    toolsEyebrow:"Herramientas de Referencia", toolsH2:"Manuscritos Antiguos y Recursos de Estudio.",
    toolsSub:"Accede a los manuscritos bíblicos más antiguos, léxicos en idiomas originales, concordancias y herramientas de estudio.",
    audioEyebrow:"Biblia en Audio", audioH2:"Precepto sobre precepto. Línea por línea.",
    audioSub:"Escucha las escrituras versículo por versículo. Sube tus propias grabaciones en MP3.",
    audioHowTitle:"Cómo Usar", audioUploadTitle:"SUBE TU GRABACIÓN EN MP3",
    audioDrop:"Arrastra Archivos MP3 Aquí", audioDropSub:"Grabaciones de voz versículo por versículo\nMP3, WAV, M4A",
    onboardSkip:"Saltar Tour",
    backHub:"← Volver al Centro Bíblico",
    passEyebrow:"Lector de Pasajes", passH2:"Lee la Palabra.",
    passSub:"Busca cualquier pasaje — Génesis hasta Apocalipsis más Apócrifos.",
    passSearch:"🔍 BUSCAR", passSearching:"⏳",
    passNotFound:"NO ENCONTRADO", passBackFeatured:"← Volver a los Pasajes Destacados",
    passFeatured:"PASAJES DESTACADOS — GÉNESIS HASTA APOCALIPSIS + APÓCRIFOS",
    passNewSearch:"← Nueva Búsqueda", passLoadKJV:"Cargar Capítulo Completo en KJV",
    passLiveChapter:"Capítulo completo cargado vía bible-api.com ·",
    versEyebrow:"Versiones de la Biblia", versH2:"Elige Tu Traducción.",
    versSub:"Selecciona la versión de la Biblia que deseas leer.",
    booksEyebrow:"Libros de la Biblia", booksH2:"Explora las Escrituras.",
    booksSub:"Selecciona un libro y capítulo — incluye Antiguo Testamento, Nuevo Testamento y Apócrifos.",
    bookSelectChapter:"SELECCIONAR CAPÍTULO",
    apoNote:"✦ Apócrifos — Incluye libros deuterocanónicos, canon ortodoxo etíope, Septuaginta y Pseudoepígrafos.",
    welcomeEyebrow:"Ya Estás Adentro",
    welcomeSub:"Ahora eres parte del Club Bíblico Dios Lo Hizo — una comunidad de pacto construida sobre la verdad.",
    welcomeCta1:"Tomar el Tour Guiado →", welcomeCta2:"Ir al Estudio de Esta Semana",
    welcomeNextSteps:"Tus Próximos Pasos",
    footerSub:"Estudio semanal · Devocionales diarios · Escrituras de Génesis al Apocalipsis + Apócrifos · Audio versículo por versículo.",
    footerWeekly:"Estudio Semanal", footerJoin:"Únete",
    langLabel:"Idioma", toolOpenBtn:"Abrir Recurso", manuscriptBanner:"Estos no son artefactos — son el fundamento vivo de las escrituras.",
    filterMandatory:"Obligatorio", filterShabbat:"Shabat", filterSpring:"Primavera", filterFall:"Otoño", filterAdditional:"Adicional",
    quickScripture:"Escrituras", quickAudio:"Audio", quickReading:"Lectura",
    quickFeasts:"Fiestas", quickWomen:"Mujeres", quickCaptivities:"Cautiverios",
    tileAncient:"Israel Antiguo", tileAncientSub:"Línea del tiempo, Tribus e Historia",
    tileCaptiv:"7 Cautiverios", tileCaptivSub:"Egipto → Diáspora",
    tileWomen:"Estudio Femenino", tileWomenSub:"Identidad del pacto y leyes",
    tileDeut:"Estudio Deut. 28", tileDeutSub:"Módulo de señales y maravillas",
    tileTribes:"12 Tribus", tileTribesSub:"Profecías y diáspora",
    tileHist:"Contexto Histórico", tileHistSub:"Bulas papales e Israel moderno",
    pillWeekly:"Estudio Semanal", pillReading:"Plan de Lectura", pillAudio:"Biblia en Audio",
    pillReadingSub:"Hoja de ruta de identidad de 14 días",
    toggleDevotional:"🕯️ Devocional", togglePrayer:"🙏 Oración",
    captivTitle:"Las 7 Cautividades de Israel",
    captivSub:"Una línea de tiempo de las principales cautividades de Israel — desde el cautiverio egipcio hasta la larga diáspora.",
    captivAnchorLabel:"ESCRITURA ANCLA · DEUTERONOMIO 28:46",
    captivTimelineLabel:"RESUMEN DE LA LÍNEA DE TIEMPO DEL PACTO",
    captivKeyScriptures:"ESCRITURAS CLAVE", captivTeachingPoint:"PUNTO DE ENSEÑANZA",
    captivSignificance:"SIGNIFICADO DEL PACTO", captivProphetic:"CONEXIÓN PROFÉTICA",
    captivDiasporaFlow:"FLUJO DE IDENTIDAD DEL PACTO — 8 ETAPAS",
    captivMigration:"TRADICIONES DE MIGRACIÓN DE LAS TRIBUS PERDIDAS",
    captivMigrationNote:"Esta sección mezcla escritura, apócrifos e interpretación histórica. Las teorías de migración son tradiciones de estudio.",
    captivStudyDeut:"Estudiar Módulo Deut. 28", captivTribes:"12 Tribus",
    captivTeaser:"Egipto → Asiria → Babilonia → Roma → Diáspora",
    captivTeaserSub:"Un estudio de las siete principales cautividades de Israel con significado del pacto y promesa de restauración.",
    captivTeaserBtn:"Estudiar las Cautividades →",
    womenHeroTitle:"Mujeres del Pacto", womenHeroSub:"Espacio de estudio para mujeres — identidad del pacto, mujeres proféticas, maternidad, leyes para mujeres, relaciones, negocios y profecía de restauración.",
    womenTabStudy:"📖 Lecciones", womenTabLaws:"📜 Leyes para Mujeres", womenTabPrayer:"🙏 Peticiones",
    womenBeginStudy:"Comenzar Estudio →", womenLawsFor:"Leyes para Mujeres", womenSubmitPrayer:"Enviar Oración",
    womenLawsNote:"Leyes dirigidas específicamente a las mujeres — leyes de pureza, herencia, protecciones matrimoniales y mandato de la maternidad.",
    womenReflection:"💬 REFLEXIÓN", womenAssignment:"📝 TAREA DE ESTA SEMANA",
    womenPrayerTitle:"PETICIÓN DE ORACIÓN", womenPrayerSub:"Tu petición será intercedida por la comunidad de mujeres durante Shabat.",
    womenPrayerName:"Tu nombre (opcional)", womenPrayerTextarea:"Escribe tu petición aquí…",
    womenPrayerSubmit:"Enviar Petición ✦", womenPrayerReceived:"Oración Recibida",
    womenPrayerConfirm:"Tu petición ha sido enviada. Será presentada ante YAHAWAH en nuestro próximo Shabat.",
    womenPrayerAnother:"Enviar Otra →",
    womenClosing:"El SEÑOR tu Dios está en medio de ti, poderoso para salvar. — Sofonías 3:17",
    tribesTitle:"Las 12 Tribus de Israel", tribesSub:"Cada tribu lleva un nombre, territorio, piedra preciosa y destino profético.",
    tribesBreastplate:"EL PECTORAL DE AARÓN — ÉXODO 28:17-20", tribesViewScriptures:"Ver Profecías y Escrituras",
    tribesSharedCovenant:"PACTO COMPARTIDO · LAS DOCE TRIBUS", tribesSharedSub:"Estas escrituras se aplican colectivamente a las doce tribus.",
    tribesTabCurses:"⛓️ Maldiciones del Pacto", tribesTabRestoration:"🌿 Promesas de Restauración",
    tribesStudyDeut:"Estudiar el Módulo Deuteronomio 28 →",
    tribesLocationTheme:"Profecías de Dónde Habitaría Esta Tribu",
    deut28Title:"Las Maldiciones del Deuteronomio 28 — Señales y Maravillas",
    deut28Sub:"Estudio estructurado de los 12 temas principales en Deuteronomio 28:15-68.",
    deut28TeachingPrinciple:"PRINCIPIO DE ENSEÑANZA",
    deut28TeachingText:"Siempre estudia Deuteronomio 28 junto con Deuteronomio 30. El arco del pacto: Desobediencia → Cautividad → Arrepentimiento → Restauración.",
    deut28Theme:"TEMA", deut28Related:"ESCRITURAS RELACIONADAS", deut28Historical:"NOTA HISTÓRICA",
    deut28Discussion:"DISCUSIÓN SHABAT", deut28Anchor:"ANCLA",
    histTitle:"Contexto Histórico", histSub:"Eventos históricos documentados junto al marco profético de las escrituras.",
    histNote:"📋 NOTA HISTÓRICA", histImportant:"⚠️ ENSEÑANZA RESPONSABLE",
    histScriptures:"📖 ESCRITURAS REFLEXIVAS", histDiscussion:"💬 PREGUNTAS DE DISCUSIÓN",
    histTimeline:"LÍNEA DEL TIEMPO DOCUMENTADA",
    feastTitle:"Calendario de Fiestas Sagradas", feastSub:"Tiempos designados con cuenta regresiva en vivo. Toca cualquier fiesta para ver cómo observarla.",
    feastFullCalendar:"Calendario Completo →", feastJoinShabbat:"Unirse a la Clase de Shabat →",
    feastWeeklyShabbat:"SHABAT SEMANAL", feastNextFeast:"PRÓXIMA FIESTA",
    communityTitle:"Únete a la comunidad semanal.", communitySub:"Ingresa tu nombre, correo y petición de oración para recibir estudios y devocionales.",
    homeDailyBread:"PAN DIARIO DE HOY", homeClassSchedule:"HORARIO DE CLASES",
    homeContinue:"CONTINUAR ESTUDIANDO", homeDeepStudy:"SECCIONES DE ESTUDIO PROFUNDO",
    homeCaptivitiesTeaser:"LAS 7 CAUTIVIDADES DE ISRAEL",
    homeStudyCaptivities:"Estudiar las Cautividades →",
    homeSearchPlaceholder:"Buscar escritura, tema o tribu…",
    joinFormTitle:"Comienza Tu Viaje del Pacto",
    womenCovenantPathH2:"Un Recorrido de 7 Etapas", womenOfScripH2:"Mujeres de las Escrituras",
    joinFormSub:"Completa el formulario para unirte a la comunidad del Club Bíblico Dios Lo Hizo.",
  },
  fr: {
    navHome:"Accueil", navWeekly:"Étude Hebdo.", navDevotional:"Dévotion",
    navReading:"Plan de Lecture", navBible:"Centre Biblique", navAudio:"Bible Audio", navJoin:"Rejoindre",
    navCaptivities:"⛓️ Captivités", navWomen:"🌸 Étude Femmes", navLive:"📡 En Direct", navAncient:"Israël Ancien",
    navBrand:"CLUB BIBLIQUE DIEU L'A FAIT", navBrandSub:"Étude · Dévotion · Écritures · Audio",
    heroEyebrow:"Bienvenue dans la Communauté",
    heroH1a:"Étude Hebdomadaire.", heroH1b:"Dévotion Quotidienne.", heroH1c:"Écriture Vivante.",
    heroSub:"Un foyer spirituel pour ceux qui marchent sur l'ancien chemin — enseignement hebdomadaire, dévotions quotidiennes, plan de lecture et audio verset par verset.",
    heroCta1:"Commencer l'Étude de Cette Semaine →", heroCta2:"Dévotion du Jour", heroCta3:"Ouvrir le Centre Biblique →",
    heroCard1t:"📖 52 Semaines d'Étude", heroCard1b:"Création → Alliance → Royaume → Nouvelle Jérusalem",
    heroCard2t:"🕯️ Dévotion Quotidienne", heroCard2b:"Réflexion, prière et écriture chaque jour",
    heroCard3t:"🏛️ Centre Biblique", heroCard3b:"Manuscrits anciens · Lexique · Codex · Blue Letter Bible",
    featuresEyebrow:"Ce qui est Inclus", featuresH2:"Tout ce dont vous avez besoin pour rester constant.",
    featuresSub:"De la première visite à membre fidèle — leçons hebdomadaires, dévotions quotidiennes, plan de lecture de 14 jours, navigateur d'écritures et audio verset par verset.",
    joinCtaEyebrow:"Prêt à Commencer", joinCtaH2:"Rejoins la communauté hebdomadaire.",
    joinCtaSub:"Entre ton nom, email et demande de prière pour recevoir études et dévotions hebdomadaires.",
    joinCtaBtn:"Rejoindre le Club Biblique ✦",
    f1title:"Étude Biblique Hebdomadaire", f1body:"52 semaines d'étude thématique — Création jusqu'à la Nouvelle Jérusalem.", f1cta:"Ouvrir l'Étude de Cette Semaine",
    f2title:"Dévotion Quotidienne", f2body:"7 dévotions courtes avec écriture, réflexion et prière.", f2cta:"Lire la Dévotion du Jour",
    f3title:"Plan de Lecture Quotidien", f3body:"Une feuille de route d'écritures de 14 jours à travers Torah, Psaumes, prophètes, évangile et Apocryphes.", f3cta:"Voir le Plan de Lecture",
    f4title:"Centre Biblique", f4body:"Navigue de la Genèse à l'Apocalypse + Apocryphes complets. API en direct pour tout passage.", f4cta:"Ouvrir le Centre Biblique",
    f5title:"Bible Audio", f5body:"Écoute verset par verset, précepte sur précepte. Télécharge tes propres enregistrements MP3.", f5cta:"Ouvrir la Bible Audio",
    f6title:"Rejoindre la Communauté", f6body:"Inscris-toi pour recevoir des études hebdomadaires et faire partie de la communauté de l'alliance.", f6cta:"Rejoindre le Club",
    joinTitle:"Viens comme tu es. Grandis là où tu es.",
    joinEyebrow:"Devenir Membre", joinSub:"Tu n'as pas besoin d'avoir tout résolu. Tu as besoin d'une communauté qui étudie la vérité ensemble.",
    placeholderName:"Ton nom complet", placeholderEmail:"Ton adresse email", placeholderPhone:"Téléphone (optionnel)",
    placeholderPrayer:"Demande de prière ou en quoi tu veux grandir spirituellement",
    joinSubmit:"Soumettre et Commencer ton Voyage ✦", joinNote:"Tes informations sont privées. Dieu l'a fait — et Il le refera.",
    journeyTitle:"TON CHEMIN APRÈS AVOIR REJOINT",
    journeySteps:["1. Bienvenue et visite guidée","2. Accès au Centre Biblique","3. Étude biblique hebdomadaire","4. Dévotion quotidienne","5. Accès à la Bible Audio","6. Communauté et prière"],
    highlights:[["📖","Pages d'étude biblique hebdomadaire"],["🕯️","Dévotions quotidiennes"],["📜","Plan de lecture de 14 jours"],["🎙️","Bible audio — verset par verset"],["🙏","Demande de prière et suivi personnel"],["🤝","Une communauté d'alliance basée sur la vérité"]],
    errorName:"Le nom est requis", errorEmail:"Un email valide est requis",
    weeklyEyebrow:"Étude Biblique Hebdomadaire", weeklyH2:"52 Semaines · Le Récit Complet de l'Alliance.",
    weeklySub:"Recherche par sujet, mot-clé ou écriture. Filtre par saison. Une année complète d'enseignement.",
    weeklyStudies:"ÉTUDES", weeklyWeeksLabel:"semaines d'enseignement",
    hebrewEyebrow:"✦ MOT HÉBREU ANCIEN DE LA SEMAINE",
    seasonLabel:"FILTRER PAR SAISON", allWeeks:"Les 52 Semaines",
    topicLabel:"EXPLORER PAR SUJET", showAll:"Afficher tous les sujets ↓", showLess:"Afficher moins ↑",
    searchPlaceholder:"Rechercher sujets, mots-clés ou écritures…",
    studiesFound:"ÉTUDES TROUVÉES", studyFound:"ÉTUDE TROUVÉE", clearAll:"Tout Effacer",
    noStudiesText:"Aucune étude trouvée pour", clearSearch:"Effacer la Recherche",
    devEyebrow:"Dévotion Quotidienne", devH2:"Sept Étapes de l'Éveil.",
    devSub:"Une feuille de route du pacte en 7 étapes à travers identité, alliance, punition, loi, Messie, diaspora et restauration.",
    reflection:"RÉFLEXION", prayer:"PRIÈRE",
    devJourneyTitle:"Éveil du Pacte en 7 Étapes", devJourneySub:"Une feuille de route scripturaire à travers l'identité, l'alliance, la punition, la loi, le Messie, la diaspora et la restauration.",
    devStageLabel:"ÉTAPE", devOf:"SUR 7",
    devSectionA:"A · VERSET ANCRE", devSectionB:"B · COMPRENDRE LE TEXTE",
    devSectionC:"C · POURQUOI CELA IMPORTE AUJOURD'HUI", devSectionD:"D · ÉCRITURES ASSOCIÉES",
    devSectionE:"E · PRIÈRE DE L'ALLIANCE", devSectionF:"F · ÉTAPE D'ACTION DU JOUR",
    devGoDeeper:"APPROFONDIR", devCopyBtn:"Copier Prière & Action", devCopied:"✓ Copié!",
    devStudyNote:"Cette feuille de route combine les Écritures KJV, les Apocryphes et la tradition d'enseignement de l'alliance.",
    devCovenantArc:"L'ARC DE L'ALLIANCE", devReadDeut:"Lire Deutéronome 30", devGoRestoration:"→ Aller à la Restauration",
    readEyebrow:"Plan de Lecture", readH2:"Une feuille de route scripturaire de 14 jours.",
    readSub:"Ce plan combine Torah, livres de sagesse, prophètes, évangile, épîtres et Apocryphes.",
    readIdentityTitle:"Plan de Route d'Identité — 14 Jours",
    readIdentitySub:"Appuie sur un passage pour l'ouvrir. Appuie sur 🤖 pour une explication IA.",
    readExplainLabel:"EXPLICATION IA", readExplaining:"Génération en cours…",
    hubEyebrow:"Centre Biblique", hubH2:"Lis, Étudie et Explore la Parole.",
    hubSub:"Ton portail biblique central — explore chaque livre, recherche tout passage, accède aux manuscrits anciens.",
    toolsEyebrow:"Outils de Référence", toolsH2:"Manuscrits Anciens et Ressources d'Étude.",
    toolsSub:"Accède aux plus anciens manuscrits bibliques connus, lexiques en langues originales, concordances et outils d'étude complets.",
    audioEyebrow:"Bible Audio", audioH2:"Précepte sur précepte. Ligne par ligne.",
    audioSub:"Écoute les écritures verset par verset. Télécharge tes propres enregistrements MP3.",
    audioHowTitle:"Comment Utiliser", audioUploadTitle:"TÉLÉCHARGE TON MP3",
    audioDrop:"Glisse les Fichiers MP3 Ici", audioDropSub:"Enregistrements vocaux verset par verset\nMP3, WAV, M4A",
    onboardSkip:"Passer la Visite",
    backHub:"← Retour au Centre Biblique",
    passEyebrow:"Lecteur de Passages", passH2:"Lis la Parole.",
    passSub:"Recherche tout passage — Genèse jusqu'à l'Apocalypse plus Apocryphes.",
    passSearch:"🔍 RECHERCHER", passSearching:"⏳",
    passNotFound:"NON TROUVÉ", passBackFeatured:"← Retour aux Passages en Vedette",
    passFeatured:"PASSAGES EN VEDETTE — GENÈSE JUSQU'À L'APOCALYPSE + APOCRYPHES",
    passNewSearch:"← Nouvelle Recherche", passLoadKJV:"Charger le Chapitre Complet en KJV",
    passLiveChapter:"Chapitre complet chargé via bible-api.com ·",
    versEyebrow:"Versions de la Bible", versH2:"Choisissez Votre Traduction.",
    versSub:"Sélectionnez la version de la Bible que vous souhaitez lire.",
    booksEyebrow:"Livres de la Bible", booksH2:"Parcourez les Écritures.",
    booksSub:"Sélectionnez un livre et un chapitre — inclut l'Ancien Testament, le Nouveau Testament et les Apocryphes.",
    bookSelectChapter:"SÉLECTIONNER UN CHAPITRE",
    apoNote:"✦ Apocryphes — Inclut les livres deutérocanoniques, le canon orthodoxe éthiopien, la Septante et les Pseudépigraphes.",
    welcomeEyebrow:"Vous êtes Inscrit",
    welcomeSub:"Vous faites maintenant partie du Club Biblique Dieu L'a Fait — une communauté d'alliance construite sur la vérité.",
    welcomeCta1:"Prendre la Visite Guidée →", welcomeCta2:"Aller à l'Étude de Cette Semaine",
    welcomeNextSteps:"Vos Prochaines Étapes",
    footerSub:"Étude hebdomadaire · Dévotions quotidiennes · Écritures de la Genèse à l'Apocalypse + Apocryphes · Audio verset par verset.",
    footerWeekly:"Étude Hebdomadaire", footerJoin:"Rejoindre",
    langLabel:"Langue", toolOpenBtn:"Ouvrir la Ressource", manuscriptBanner:"Ce ne sont pas des artefacts — ce sont le fondement vivant des écritures.",
    filterMandatory:"Obligatoire", filterShabbat:"Shabbat", filterSpring:"Printemps", filterFall:"Automne", filterAdditional:"Supplémentaire",
    quickScripture:"Écritures", quickAudio:"Audio", quickReading:"Lecture",
    quickFeasts:"Fêtes", quickWomen:"Femmes", quickCaptivities:"Captivités",
    tileAncient:"Israël Ancien", tileAncientSub:"Chronologie, Tribus et Histoire",
    tileCaptiv:"7 Captivités", tileCaptivSub:"Égypte → Diaspora",
    tileWomen:"Étude Femmes", tileWomenSub:"Identité de l'alliance et lois",
    tileDeut:"Étude Deut. 28", tileDeutSub:"Module signes et merveilles",
    tileTribes:"12 Tribus", tileTribesSub:"Prophéties et diaspora",
    tileHist:"Contexte Historique", tileHistSub:"Bulles papales et Israël moderne",
    pillWeekly:"Étude Hebdomadaire", pillReading:"Plan de Lecture", pillAudio:"Bible Audio",
    pillReadingSub:"Feuille de route identité 14 jours",
    toggleDevotional:"🕯️ Dévotion", togglePrayer:"🙏 Prière",
    captivTitle:"Les 7 Grandes Captivités d'Israël",
    captivSub:"Une chronologie des grandes captivités d'Israël — de l'esclavage égyptien à la longue diaspora.",
    captivAnchorLabel:"VERSET ANCRE · DEUTÉRONOME 28:46",
    captivTimelineLabel:"APERÇU DE LA CHRONOLOGIE DE L'ALLIANCE",
    captivKeyScriptures:"VERSETS CLÉS", captivTeachingPoint:"POINT D'ENSEIGNEMENT",
    captivSignificance:"SIGNIFICATION DE L'ALLIANCE", captivProphetic:"CONNEXION PROPHÉTIQUE",
    captivDiasporaFlow:"FLUX D'IDENTITÉ DE L'ALLIANCE — 8 ÉTAPES",
    captivMigration:"TRADITIONS MIGRATOIRES DES TRIBUS PERDUES",
    captivMigrationNote:"Cette section mélange écriture, apocryphes et interprétation historique. Les théories migratoires sont des traditions d'étude.",
    captivStudyDeut:"Étudier le Module Deut. 28", captivTribes:"12 Tribus",
    captivTeaser:"Égypte → Assyrie → Babylone → Rome → Diaspora",
    captivTeaserSub:"Une étude des sept grandes captivités d'Israël avec leur signification d'alliance et la promesse de restauration.",
    captivTeaserBtn:"Étudier les Captivités →",
    womenHeroTitle:"Femmes de l'Alliance", womenHeroSub:"Un espace d'étude dédié aux femmes — identité de l'alliance, femmes prophétiques, maternité, lois pour femmes, relations, affaires et prophétie de restauration.",
    womenTabStudy:"📖 Leçons d'Étude", womenTabLaws:"📜 Lois pour Femmes", womenTabPrayer:"🙏 Demandes de Prière",
    womenBeginStudy:"Commencer l'Étude →", womenLawsFor:"Lois pour Femmes", womenSubmitPrayer:"Soumettre Prière",
    womenLawsNote:"Lois et commandements adressés spécifiquement aux femmes — lois de pureté, droits d'héritage, protections matrimoniales et mandat de la maternité.",
    womenReflection:"💬 QUESTION DE RÉFLEXION", womenAssignment:"📝 DEVOIR DE CETTE SEMAINE",
    womenPrayerTitle:"DEMANDE DE PRIÈRE DES FEMMES", womenPrayerSub:"Ta demande sera intercédée par la communauté d'alliance des femmes pendant le Shabbat.",
    womenPrayerName:"Ton nom (optionnel)", womenPrayerTextarea:"Écris ta demande de prière ici…",
    womenPrayerSubmit:"Soumettre la Demande ✦", womenPrayerReceived:"Prière Reçue",
    womenPrayerConfirm:"Ta demande a été soumise. Elle sera présentée devant YAHAWAH lors de notre prochain Shabbat.",
    womenPrayerAnother:"Soumettre une Autre →",
    womenClosing:"L'Éternel ton Dieu est au milieu de toi, puissant pour sauver. — Sophonie 3:17",
    tribesTitle:"Les 12 Tribus d'Israël", tribesSub:"Chaque tribu porte un nom, un territoire, une pierre précieuse et un destin prophétique.",
    tribesBreastplate:"LE PECTORAL D'AARON — EXODE 28:17-20", tribesViewScriptures:"Voir Prophéties et Écritures",
    tribesSharedCovenant:"ALLIANCE PARTAGÉE · LES DOUZE TRIBUS", tribesSharedSub:"Ces écritures s'appliquent collectivement aux douze tribus.",
    tribesTabCurses:"⛓️ Malédictions de l'Alliance", tribesTabRestoration:"🌿 Promesses de Restauration",
    tribesStudyDeut:"Étudier le Module Deutéronome 28 →",
    tribesLocationTheme:"Prophéties sur Où Cette Tribu Habiterait",
    deut28Title:"Les Malédictions du Deutéronome 28 — Signes et Merveilles",
    deut28Sub:"Étude structurée des 12 thèmes principaux du Deutéronome 28:15-68.",
    deut28TeachingPrinciple:"PRINCIPE D'ENSEIGNEMENT",
    deut28TeachingText:"Étudie toujours Deutéronome 28 avec Deutéronome 30. L'arc de l'alliance: Désobéissance → Captivité → Repentance → Restauration.",
    deut28Theme:"THÈME", deut28Related:"ÉCRITURES ASSOCIÉES", deut28Historical:"NOTE HISTORIQUE",
    deut28Discussion:"DISCUSSION DU SHABBAT", deut28Anchor:"ANCRE",
    histTitle:"Contexte Historique", histSub:"Événements historiques documentés situés dans le cadre prophétique des écritures.",
    histNote:"📋 NOTE HISTORIQUE", histImportant:"⚠️ ENSEIGNEMENT RESPONSABLE",
    histScriptures:"📖 ÉCRITURES RÉFLEXIVES", histDiscussion:"💬 QUESTIONS DE DISCUSSION DU SHABBAT",
    histTimeline:"CHRONOLOGIE DOCUMENTÉE",
    feastTitle:"Calendrier des Fêtes Saintes", feastSub:"Moments désignés avec compte à rebours en direct. Appuie sur une fête pour voir comment l'observer.",
    feastFullCalendar:"Calendrier Complet →", feastJoinShabbat:"Rejoindre la Classe du Shabbat →",
    feastWeeklyShabbat:"SHABBAT HEBDOMADAIRE", feastNextFeast:"PROCHAINE FÊTE",
    communityTitle:"Rejoins la communauté hebdomadaire.", communitySub:"Entre ton nom, email et demande de prière pour recevoir études et dévotions hebdomadaires.",
    homeDailyBread:"PAIN QUOTIDIEN D'AUJOURD'HUI", homeClassSchedule:"HORAIRE DES CLASSES",
    homeContinue:"CONTINUER L'ÉTUDE", homeDeepStudy:"SECTIONS D'ÉTUDE APPROFONDIE",
    homeCaptivitiesTeaser:"LES 7 CAPTIVITÉS D'ISRAËL",
    homeStudyCaptivities:"Étudier les Captivités →",
    homeSearchPlaceholder:"Chercher une écriture, un thème ou une tribu…",
    joinFormTitle:"Commence Ton Voyage de l'Alliance",
    womenCovenantPathH2:"Un Voyage en 7 Étapes", womenOfScripH2:"Femmes des Écritures",
    joinFormSub:"Remplis le formulaire pour rejoindre la communauté du Club Biblique Dieu L'a Fait.",
  },
  pt: {
    navHome:"Início", navWeekly:"Estudo Semanal", navDevotional:"Devocional",
    navReading:"Plano de Leitura", navBible:"Centro Bíblico", navAudio:"Bíblia em Áudio", navJoin:"Entrar",
    navCaptivities:"⛓️ Cativeiros", navWomen:"🌸 Estudo Feminino", navLive:"📡 Ao Vivo", navAncient:"Israel Antigo",
    navBrand:"CLUBE BÍBLICO DEUS FEZ ISSO", navBrandSub:"Estudo · Devocional · Escrituras · Áudio",
    heroEyebrow:"Bem-vindo à Comunidade",
    heroH1a:"Estudo Semanal.", heroH1b:"Devoção Diária.", heroH1c:"Escritura Viva.",
    heroSub:"Um lar espiritual para quem caminha o caminho antigo — ensino semanal estruturado, devocionais diários, plano de leitura e áudio versículo por versículo.",
    heroCta1:"Começar o Estudo desta Semana →", heroCta2:"Devocional de Hoje", heroCta3:"Abrir Centro Bíblico →",
    heroCard1t:"📖 52 Semanas de Estudo", heroCard1b:"Criação → Aliança → Reino → Nova Jerusalém",
    heroCard2t:"🕯️ Devocional Diário", heroCard2b:"Reflexão, oração e escrituras cada dia",
    heroCard3t:"🏛️ Centro Bíblico", heroCard3b:"Manuscritos antigos · Léxico · Codex · Blue Letter Bible",
    featuresEyebrow:"O que Contém", featuresH2:"Tudo que você precisa para permanecer consistente.",
    featuresSub:"Da primeira visita a membro fiel — lições semanais, devocionais diários, plano de leitura de 14 dias, navegador de escrituras e áudio versículo por versículo.",
    joinCtaEyebrow:"Pronto para Começar", joinCtaH2:"Junte-se à comunidade semanal.",
    joinCtaSub:"Digite seu nome, email e pedido de oração para receber estudos e devocionais semanais.",
    joinCtaBtn:"Entrar no Clube Bíblico ✦",
    f1title:"Estudo Bíblico Semanal", f1body:"52 semanas de estudo temático — Criação até Nova Jerusalém.", f1cta:"Abrir o Estudo desta Semana",
    f2title:"Devocional Diário", f2body:"7 devocionais curtos com escritura, reflexão e oração.", f2cta:"Ler o Devocional de Hoje",
    f3title:"Plano de Leitura Diário", f3body:"Um roteiro de escrituras de 14 dias por Torá, Salmos, profetas, evangelho e Apócrifos.", f3cta:"Ver Plano de Leitura",
    f4title:"Centro Bíblico", f4body:"Navegue do Gênesis ao Apocalipse + Apócrifos completos. API ao vivo para qualquer passagem.", f4cta:"Abrir Centro Bíblico",
    f5title:"Bíblia em Áudio", f5body:"Ouça versículo por versículo, preceito sobre preceito. Envie suas próprias gravações MP3.", f5cta:"Abrir Bíblia em Áudio",
    f6title:"Junte-se à Comunidade", f6body:"Cadastre-se para receber estudos semanais e fazer parte da comunidade da aliança.", f6cta:"Entrar no Clube",
    joinTitle:"Venha como você é. Cresça onde você está.",
    joinEyebrow:"Torne-se Membro", joinSub:"Você não precisa ter tudo resolvido. Você precisa de uma comunidade que estude a verdade juntos.",
    placeholderName:"Seu nome completo", placeholderEmail:"Seu endereço de email", placeholderPhone:"Telefone (opcional)",
    placeholderPrayer:"Pedido de oração ou em que você quer crescer espiritualmente",
    joinSubmit:"Enviar e Iniciar sua Jornada ✦", joinNote:"Suas informações são privadas. Deus fez isso — e Ele fará novamente.",
    journeyTitle:"SUA JORNADA APÓS ENTRAR",
    journeySteps:["1. Boas-vindas e tour guiado","2. Acesso ao Centro Bíblico","3. Estudo bíblico semanal","4. Devocional diário","5. Acesso à Bíblia em Áudio","6. Comunidade e oração"],
    highlights:[["📖","Páginas de estudo bíblico semanal"],["🕯️","Devocionais diários para consistência"],["📜","Plano de leitura de 14 dias"],["🎙️","Bíblia em áudio — versículo por versículo"],["🙏","Pedido de oração e acompanhamento pessoal"],["🤝","Uma comunidade de aliança baseada na verdade"]],
    errorName:"O nome é obrigatório", errorEmail:"Um email válido é obrigatório",
    weeklyEyebrow:"Estudo Bíblico Semanal", weeklyH2:"52 Semanas · A Narrativa Completa da Aliança.",
    weeklySub:"Pesquise por tema, palavra-chave ou escritura. Filtre por temporada. Um ano completo de ensino.",
    weeklyStudies:"ESTUDOS", weeklyWeeksLabel:"semanas de ensino",
    hebrewEyebrow:"✦ PALAVRA HEBRAICA ANTIGA DA SEMANA",
    seasonLabel:"FILTRAR POR TEMPORADA", allWeeks:"As 52 Semanas",
    topicLabel:"EXPLORAR POR TEMA", showAll:"Mostrar todos os temas ↓", showLess:"Mostrar menos ↑",
    searchPlaceholder:"Pesquisar temas, palavras-chave ou escrituras…",
    studiesFound:"ESTUDOS ENCONTRADOS", studyFound:"ESTUDO ENCONTRADO", clearAll:"Limpar Tudo",
    noStudiesText:"Nenhum estudo encontrado para", clearSearch:"Limpar Pesquisa",
    devEyebrow:"Devocional Diário", devH2:"Sete Etapas do Despertar.",
    devSub:"Um roteiro da aliança em 7 etapas através de identidade, aliança, punição, lei, Messias, diáspora e restauração.",
    reflection:"REFLEXÃO", prayer:"ORAÇÃO",
    devJourneyTitle:"Despertar da Aliança em 7 Etapas", devJourneySub:"Um roteiro escritural através de identidade, aliança, punição, a lei, o Messias, diáspora e restauração.",
    devStageLabel:"ETAPA", devOf:"DE 7",
    devSectionA:"A · ESCRITURA ÂNCORA", devSectionB:"B · ENTENDENDO O TEXTO",
    devSectionC:"C · POR QUE ISSO IMPORTA HOJE", devSectionD:"D · ESCRITURAS RELACIONADAS",
    devSectionE:"E · ORAÇÃO DA ALIANÇA", devSectionF:"F · PASSO DE AÇÃO DE HOJE",
    devGoDeeper:"IR MAIS FUNDO", devCopyBtn:"Copiar Oração e Ação", devCopied:"✓ Copiado!",
    devStudyNote:"Este roteiro combina as Escrituras KJV, os Apócrifos e a tradição de ensino da aliança.",
    devCovenantArc:"O ARCO DA ALIANÇA", devReadDeut:"Ler Deuteronômio 30", devGoRestoration:"→ Ir à Restauração",
    readEyebrow:"Plano de Leitura", readH2:"Um roteiro de escrituras de 14 dias.",
    readSub:"Este plano combina Torá, livros de sabedoria, profetas, evangelho, epístolas e Apócrifos.",
    readIdentityTitle:"Roteiro de Identidade da Aliança — 14 Dias",
    readIdentitySub:"Toque em qualquer passagem para abrir no leitor. Toque 🤖 para explicação por IA.",
    readExplainLabel:"EXPLICAÇÃO IA", readExplaining:"Gerando explicação…",
    hubEyebrow:"Centro Bíblico", hubH2:"Leia, Estude e Explore a Palavra.",
    hubSub:"Seu portal bíblico central — explore cada livro, pesquise qualquer passagem, acesse manuscritos antigos.",
    toolsEyebrow:"Ferramentas de Referência", toolsH2:"Manuscritos Antigos e Recursos de Estudo.",
    toolsSub:"Acesse os mais antigos manuscritos bíblicos conhecidos, léxicos em idiomas originais e concordâncias.",
    audioEyebrow:"Bíblia em Áudio", audioH2:"Preceito sobre preceito. Linha por linha.",
    audioSub:"Ouça as escrituras versículo por versículo. Faça upload de suas próprias gravações MP3.",
    audioHowTitle:"Como Usar", audioUploadTitle:"FAÇA UPLOAD DO SEU MP3",
    audioDrop:"Arraste Arquivos MP3 Aqui", audioDropSub:"Gravações de voz versículo por versículo\nMP3, WAV, M4A",
    onboardSkip:"Pular Tour",
    backHub:"← Voltar ao Centro Bíblico",
    passEyebrow:"Leitor de Passagens", passH2:"Leia a Palavra.",
    passSub:"Pesquise qualquer passagem — Gênesis até Apocalipse mais Apócrifos.",
    passSearch:"🔍 PESQUISAR", passSearching:"⏳",
    passNotFound:"NÃO ENCONTRADO", passBackFeatured:"← Voltar às Passagens em Destaque",
    passFeatured:"PASSAGENS EM DESTAQUE — GÊNESIS ATÉ APOCALIPSE + APÓCRIFOS",
    passNewSearch:"← Nova Pesquisa", passLoadKJV:"Carregar Capítulo Completo em KJV",
    passLiveChapter:"Capítulo completo carregado via bible-api.com ·",
    versEyebrow:"Versões da Bíblia", versH2:"Escolha Sua Tradução.",
    versSub:"Selecione a versão da Bíblia que deseja ler.",
    booksEyebrow:"Livros da Bíblia", booksH2:"Explore as Escrituras.",
    booksSub:"Selecione um livro e capítulo — inclui AT, NT e Apócrifos.",
    bookSelectChapter:"SELECIONAR CAPÍTULO",
    apoNote:"✦ Apócrifos — Inclui livros deuterocanônicos, cânon ortodoxo etíope, Septuaginta e Pseudepígrafes.",
    welcomeEyebrow:"Você Entrou",
    welcomeSub:"Agora você faz parte do Clube Bíblico Deus Fez Isso — uma comunidade de aliança construída sobre a verdade.",
    welcomeCta1:"Fazer o Tour Guiado →", welcomeCta2:"Ir ao Estudo desta Semana",
    welcomeNextSteps:"Seus Próximos Passos",
    footerSub:"Estudo semanal · Devocionais diários · Escrituras de Gênesis ao Apocalipse + Apócrifos · Áudio versículo por versículo.",
    footerWeekly:"Estudo Semanal", footerJoin:"Entrar",
    langLabel:"Idioma", toolOpenBtn:"Abrir Recurso", manuscriptBanner:"Estes não são artefatos — são o fundamento vivo das escrituras.",
    filterMandatory:"Obrigatório", filterShabbat:"Shabat", filterSpring:"Primavera", filterFall:"Outono", filterAdditional:"Adicional",
    quickScripture:"Escrituras", quickAudio:"Áudio", quickReading:"Leitura",
    quickFeasts:"Festas", quickWomen:"Mulheres", quickCaptivities:"Cativeiros",
    tileAncient:"Israel Antigo", tileAncientSub:"Linha do tempo, Tribos e História",
    tileCaptiv:"7 Cativeiros", tileCaptivSub:"Egito → Diáspora",
    tileWomen:"Estudo Feminino", tileWomenSub:"Identidade da aliança e leis",
    tileDeut:"Estudo Deut. 28", tileDeutSub:"Módulo de sinais e maravilhas",
    tileTribes:"12 Tribos", tileTribesSub:"Profecias e diáspora",
    tileHist:"Contexto Histórico", tileHistSub:"Bulas papais e Israel moderno",
    pillWeekly:"Estudo Semanal", pillReading:"Plano de Leitura", pillAudio:"Bíblia em Áudio",
    pillReadingSub:"Roteiro de identidade de 14 dias",
    toggleDevotional:"🕯️ Devocional", togglePrayer:"🙏 Oração",
    captivTitle:"Os 7 Principais Cativeiros de Israel",
    captivSub:"Uma linha do tempo do cativeiro egípcio à longa diáspora.",
    captivAnchorLabel:"ESCRITURA ÂNCORA · DEUTERONÔMIO 28:46",
    captivTimelineLabel:"RESUMO DA LINHA DO TEMPO DA ALIANÇA",
    captivKeyScriptures:"ESCRITURAS CHAVE", captivTeachingPoint:"PONTO DE ENSINO",
    captivSignificance:"SIGNIFICADO DA ALIANÇA", captivProphetic:"CONEXÃO PROFÉTICA",
    captivDiasporaFlow:"FLUXO DE IDENTIDADE DA ALIANÇA — 8 ETAPAS",
    captivMigration:"TRADIÇÕES DE MIGRAÇÃO DAS TRIBOS PERDIDAS",
    captivMigrationNote:"Esta seção mistura escritura, apócrifos e interpretação histórica. As teorias de migração são tradições de estudo.",
    captivStudyDeut:"Estudar Módulo Deut. 28", captivTribes:"12 Tribos",
    captivTeaser:"Egito → Assíria → Babilônia → Roma → Diáspora",
    captivTeaserSub:"Um estudo das sete principais catividades de Israel com significado da aliança e promessa de restauração.",
    captivTeaserBtn:"Estudar os Cativeiros →",
    womenHeroTitle:"Mulheres da Aliança", womenHeroSub:"Um espaço de estudo dedicado às mulheres — identidade da aliança, mulheres proféticas, maternidade, leis para mulheres, relacionamentos, negócios e profecia de restauração.",
    womenTabStudy:"📖 Lições", womenTabLaws:"📜 Leis para Mulheres", womenTabPrayer:"🙏 Pedidos de Oração",
    womenBeginStudy:"Começar Estudo →", womenLawsFor:"Leis para Mulheres", womenSubmitPrayer:"Enviar Oração",
    womenLawsNote:"Leis e mandamentos nas escrituras dirigidos especificamente às mulheres — leis de pureza, direitos de herança, proteções matrimoniais e o mandato da maternidade.",
    womenReflection:"💬 PERGUNTA DE REFLEXÃO", womenAssignment:"📝 TAREFA DESTA SEMANA",
    womenPrayerTitle:"PEDIDO DE ORAÇÃO DAS MULHERES", womenPrayerSub:"Seu pedido será intercedido pela comunidade de aliança das mulheres durante o Shabat.",
    womenPrayerName:"Seu nome (opcional)", womenPrayerTextarea:"Escreva seu pedido de oração aqui…",
    womenPrayerSubmit:"Enviar Pedido ✦", womenPrayerReceived:"Oração Recebida",
    womenPrayerConfirm:"Seu pedido foi enviado. Será apresentado diante de YAHAWAH em nosso próximo Shabat.",
    womenPrayerAnother:"Enviar Outro →",
    womenClosing:"O SENHOR teu Deus está no meio de ti, poderoso para salvar. — Sofonias 3:17",
    tribesTitle:"As 12 Tribos de Israel", tribesSub:"Cada tribo carrega um nome, território, pedra preciosa e destino profético.",
    tribesBreastplate:"O PEITORAL DE ARÃO — ÊXODO 28:17-20", tribesViewScriptures:"Ver Profecias e Escrituras",
    tribesSharedCovenant:"ALIANÇA COMPARTILHADA · AS DOZE TRIBOS", tribesSharedSub:"Essas escrituras se aplicam coletivamente às doze tribos.",
    tribesTabCurses:"⛓️ Maldições da Aliança", tribesTabRestoration:"🌿 Promessas de Restauração",
    tribesStudyDeut:"Estudar o Módulo Deuteronômio 28 →",
    tribesLocationTheme:"Profecias sobre Onde Esta Tribo Habitaria",
    deut28Title:"As Maldições do Deuteronômio 28 — Sinais e Maravilhas",
    deut28Sub:"Estudo estruturado dos 12 temas principais em Deuteronômio 28:15-68.",
    deut28TeachingPrinciple:"PRINCÍPIO DE ENSINO",
    deut28TeachingText:"Sempre estude Deuteronômio 28 junto com Deuteronômio 30. O arco da aliança: Desobediência → Cativeiro → Arrependimento → Restauração.",
    deut28Theme:"TEMA", deut28Related:"ESCRITURAS RELACIONADAS", deut28Historical:"NOTA HISTÓRICA",
    deut28Discussion:"DISCUSSÃO DO SHABAT", deut28Anchor:"ÂNCORA",
    histTitle:"Contexto Histórico", histSub:"Eventos históricos documentados no quadro profético das escrituras.",
    histNote:"📋 NOTA HISTÓRICA", histImportant:"⚠️ ENSINO RESPONSÁVEL",
    histScriptures:"📖 ESCRITURAS REFLEXIVAS", histDiscussion:"💬 PERGUNTAS DE DISCUSSÃO DO SHABAT",
    histTimeline:"LINHA DO TEMPO DOCUMENTADA",
    feastTitle:"Calendário de Festas Sagradas", feastSub:"Tempos designados com contagem regressiva ao vivo. Toque em qualquer festa para ver como observá-la.",
    feastFullCalendar:"Calendário Completo →", feastJoinShabbat:"Participar da Aula de Shabat →",
    feastWeeklyShabbat:"SHABAT SEMANAL", feastNextFeast:"PRÓXIMA FESTA",
    communityTitle:"Junte-se à comunidade semanal.", communitySub:"Digite seu nome, email e pedido de oração para receber estudos e devocionais semanais.",
    homeDailyBread:"PÃO DIÁRIO DE HOJE", homeClassSchedule:"HORÁRIO DAS AULAS",
    homeContinue:"CONTINUAR ESTUDANDO", homeDeepStudy:"SEÇÕES DE ESTUDO APROFUNDADO",
    homeCaptivitiesTeaser:"OS 7 CATIVEIROS DE ISRAEL",
    homeStudyCaptivities:"Estudar os Cativeiros →",
    homeSearchPlaceholder:"Buscar escritura, tema ou tribo…",
    joinFormTitle:"Comece Sua Jornada da Aliança",
    womenCovenantPathH2:"Uma Jornada de 7 Etapas", womenOfScripH2:"Mulheres das Escrituras",
    joinFormSub:"Preencha o formulário para se juntar à comunidade do Clube Bíblico Deus Fez Isso.",
  },
  ht: {
    navHome:"Lakay", navWeekly:"Etid Semèn nan", navDevotional:"Devosyonèl",
    navReading:"Plan Lekti", navBible:"Sant Bib la", navAudio:"Bib Odyo", navJoin:"Rantre",
    navCaptivities:"⛓️ Kaptivite yo", navWomen:"🌸 Etid Fanm", navLive:"📡 Dirèk", navAncient:"Izrayèl Ansyen",
    navBrand:"KLIB BIB BONDYE FÈ L", navBrandSub:"Etid · Devosyonèl · Ekriti · Odyo",
    heroEyebrow:"Byenveni nan Kominote a",
    heroH1a:"Etid Semèn nan.", heroH1b:"Devosyon Chak Jou.", heroH1c:"Ekriti Vivan.",
    heroSub:"Yon kay espirityèl pou moun k ap mache sou ansyen wout la — ansèyman chak semèn, devosyonèl chak jou, plan lekti ak odyo vèsè pa vèsè.",
    heroCta1:"Kòmanse Etid Semèn sa a →", heroCta2:"Devosyonèl Jou a", heroCta3:"Ouvri Sant Bib la →",
    heroCard1t:"📖 52 Semèn Etid", heroCard1b:"Kreyasyon → Alyans → Wayòm → Nouvo Jerizalèm",
    heroCard2t:"🕯️ Devosyonèl Chak Jou", heroCard2b:"Refleksyon, lapriyè ak ekriti chak jou",
    heroCard3t:"🏛️ Sant Bib la", heroCard3b:"Maniskri ansyen · Lèksik · Kodèks · Blue Letter Bible",
    featuresEyebrow:"Sa ki Anndan", featuresH2:"Tout sa ou bezwen pou rete konsistan.",
    featuresSub:"Depi premye vizit rive manm fidèl — leson semèn, devosyonèl chak jou, plan lekti 14 jou, navigatè ekriti ak odyo vèsè pa vèsè.",
    joinCtaEyebrow:"Prè pou Kòmanse", joinCtaH2:"Jwenn kominote semèn nan.",
    joinCtaSub:"Antre non ou, imel ak demand lapriyè pou resevwa etid ak devosyonèl chak semèn.",
    joinCtaBtn:"Rantre nan Klib Bib la ✦",
    f1title:"Etid Bib Chak Semèn", f1body:"52 semèn etid tematik — Kreyasyon rive Nouvo Jerizalèm.", f1cta:"Ouvri Etid Semèn sa a",
    f2title:"Devosyonèl Chak Jou", f2body:"7 devosyonèl kout ak ekriti, refleksyon ak lapriyè.", f2cta:"Li Devosyonèl Jou a",
    f3title:"Plan Lekti Chak Jou", f3body:"Yon kat wout ekriti 14 jou atravè Torah, Sòm, pwofèt, levanjil ak Apokrèf.", f3cta:"Wè Plan Lekti a",
    f4title:"Sant Bib la", f4body:"Navige depi Jenèz rive Revelasyon + Apokrèf konplè. API an dirèk pou nenpòt pasaj.", f4cta:"Ouvri Sant Bib la",
    f5title:"Bib Odyo", f5body:"Koute vèsè pa vèsè, preyansèp sou preyansèp. Telechaje pwòp anrejistreman MP3 ou.", f5cta:"Ouvri Bib Odyo a",
    f6title:"Jwenn Kominote a", f6body:"Enskri pou resevwa etid chak semèn ak devosyonèl.", f6cta:"Rantre nan Klib la",
    joinTitle:"Vini jan ou ye a. Grandi kote ou ye a.",
    joinEyebrow:"Tounen Manm", joinSub:"Ou pa bezwen gen tout bagay regle. Ou bezwen yon kominote ki etidye verite ansanm.",
    placeholderName:"Non konplè ou", placeholderEmail:"Adrès imel ou", placeholderPhone:"Telefòn (opsyonèl)",
    placeholderPrayer:"Demand lapriyè oswa nan ki domèn ou vle grandi espirityèlman",
    joinSubmit:"Voye e Kòmanse Vwayaj ou ✦", joinNote:"Enfòmasyon ou yo prive. Bondye fè sa — epi L ap fè l ankò.",
    journeyTitle:"VWAYAJ OU APRE W RANTRE",
    journeySteps:["1. Byenveni ak tour guidé","2. Aksè nan Sant Bib la","3. Etid bib chak semèn","4. Devosyonèl chak jou","5. Aksè nan Bib Odyo","6. Kominote ak lapriyè"],
    highlights:[["📖","Paj etid bib chak semèn"],["🕯️","Devosyonèl chak jou"],["📜","Plan lekti 14 jou"],["🎙️","Bib odyo — vèsè pa vèsè"],["🙏","Demand lapriyè ak swivi pèsonèl"],["🤝","Yon kominote alyans ki baze sou verite"]],
    errorName:"Non obligatwa", errorEmail:"Yon imel valid obligatwa",
    weeklyEyebrow:"Etid Bib Chak Semèn", weeklyH2:"52 Semèn · Istwa Konplè Alyans la.",
    weeklySub:"Chèche pa sijè, mo-kle oswa ekriti. Filtre pa sezon. Yon ane konplè ansèyman.",
    weeklyStudies:"ETID", weeklyWeeksLabel:"semèn ansèyman",
    hebrewEyebrow:"✦ MÒ EBRE ANSYEN SEMÈN NAN",
    seasonLabel:"FILTRE PA SEZON", allWeeks:"52 Semèn yo",
    topicLabel:"EKSPLORE PA SIJÈ", showAll:"Montre tout sijè yo ↓", showLess:"Montre mwens ↑",
    searchPlaceholder:"Chèche sijè, mo-kle oswa ekriti…",
    studiesFound:"ETID JWENN", studyFound:"ETID JWENN", clearAll:"Efase Tout",
    noStudiesText:"Pa gen etid jwenn pou", clearSearch:"Efase Rechèch",
    devEyebrow:"Devosyonèl Chak Jou", devH2:"Sèt Etap Reveye.",
    devSub:"Yon kat wout alyans 7 etap atravè idantite, alyans, pinisyon, lalwa, Mesi a, dyaspora ak restawrasyon.",
    reflection:"REFLEKSYON", prayer:"LAPRIYÈ",
    devJourneyTitle:"7 Etap Reveye Pèp la nan Alyans", devJourneySub:"Yon plan skriti atravè idantite, alyans, pinisyon, lalwa, Mesi a, dyaspora ak restawrasyon.",
    devStageLabel:"ETAP", devOf:"NAN 7",
    devSectionA:"A · SKRITI ANKÒ", devSectionB:"B · KONPRANN TÈKS LA",
    devSectionC:"C · POUKISA SA ENPÒTAN JOU A", devSectionD:"D · SKRITI KONEKTE",
    devSectionE:"E · LAPRIYÈ ALYANS", devSectionF:"F · PAS AKSYON JOU A",
    devGoDeeper:"ALE PI FONS", devCopyBtn:"Kopye Lapriyè ak Aksyon", devCopied:"✓ Kopye!",
    devStudyNote:"Plan sa a konbine skriti KJV, Apokrèf yo, ak tradisyon ansèyman alyans kominote sa a.",
    devCovenantArc:"AK ALYANS LA", devReadDeut:"Li Detewonòm 30", devGoRestoration:"→ Ale nan Restawrasyon",
    readEyebrow:"Plan Lekti", readH2:"Yon kat wout ekriti 14 jou.",
    readSub:"Plan sa a konbine Torah, liv sajès, pwofèt, levanjil, epist ak Apokrèf.",
    readIdentityTitle:"Plan 14 Jou pou Idantite Alyans",
    readIdentitySub:"Touche nenpòt pasaj pou ouvri li. Touche 🤖 pou eksplikasyon IA.",
    readExplainLabel:"EKSPLIKASYON IA", readExplaining:"Ap jenere eksplikasyon…",
    hubEyebrow:"Sant Bib la", hubH2:"Li, Etidye epi Eksplore Pawòl la.",
    hubSub:"Pòtal bib santral ou — eksplore chak liv, chèche nenpòt pasaj, jwenn maniskri ansyen yo.",
    toolsEyebrow:"Zouti Referans", toolsH2:"Maniskri Ansyen ak Resous Etid.",
    toolsSub:"Jwenn pi ansyen maniskri bib yo, lèksik nan lang orijinal, konkòdans ak zouti etid konplè.",
    audioEyebrow:"Bib Odyo", audioH2:"Preyansèp sou preyansèp. Liy pa liy.",
    audioSub:"Koute ekriti yo vèsè pa vèsè. Telechaje pwòp anrejistreman MP3 ou.",
    audioHowTitle:"Kijan pou Itilize", audioUploadTitle:"TELECHAJE MP3 OU",
    audioDrop:"Glise Fichye MP3 Isit la", audioDropSub:"Anrejistreman vwa vèsè pa vèsè\nMP3, WAV, M4A",
    onboardSkip:"Sote Tour",
    backHub:"← Retounen nan Sant Bib la",
    passEyebrow:"Lektè Pasaj", passH2:"Li Pawòl la.",
    passSub:"Chèche nenpòt pasaj — Jenèz rive Revelasyon plis Apokrèf.",
    passSearch:"🔍 CHÈCHE", passSearching:"⏳",
    passNotFound:"PA JWENN", passBackFeatured:"← Retounen nan Pasaj Espesyal yo",
    passFeatured:"PASAJ ESPESYAL — JENÈZ RIVE REVELASYON + APOKRÈF",
    passNewSearch:"← Nouvo Rechèch", passLoadKJV:"Chaje Chapit Konplè nan KJV",
    passLiveChapter:"Chapit konplè chaje via bible-api.com ·",
    versEyebrow:"Vèsyon Bib la", versH2:"Chwazi Tradiksyon Ou.",
    versSub:"Chwazi vèsyon bib ou vle li a.",
    booksEyebrow:"Liv Bib la", booksH2:"Eksplore Ekriti yo.",
    booksSub:"Chwazi yon liv ak chapit — enkli Ansyen Testaman, Nouvo Testaman ak Apokrèf.",
    bookSelectChapter:"CHWAZI CHAPIT",
    apoNote:"✦ Apokrèf — Enkli liv deuterokanonik, kanon òtodòks etyopyen, Septant ak Psedepigraf.",
    welcomeEyebrow:"Ou Antre",
    welcomeSub:"Ou fè pati Klib Bib Bondye Fè L la kounye a — yon kominote alyans ki baze sou verite.",
    welcomeCta1:"Pran Tour Guidé a →", welcomeCta2:"Ale nan Etid Semèn sa a",
    welcomeNextSteps:"Pwochen Etap Ou yo",
    footerSub:"Etid chak semèn · Devosyonèl chak jou · Ekriti depi Jenèz rive Revelasyon + Apokrèf · Odyo vèsè pa vèsè.",
    footerWeekly:"Etid Chak Semèn", footerJoin:"Rantre",
    langLabel:"Lang", toolOpenBtn:"Louvri Resous la", manuscriptBanner:"Sa yo pa artefak — se fondasyon vivan ekriti yo.",
    filterMandatory:"Obligatwa", filterShabbat:"Shabat", filterSpring:"Prentan", filterFall:"Otòn", filterAdditional:"Siplemantè",
    quickScripture:"Skriti", quickAudio:"Odyo", quickReading:"Lekti",
    quickFeasts:"Fèt yo", quickWomen:"Fanm", quickCaptivities:"Kaptivite yo",
    tileAncient:"Izrayèl Ansyen", tileAncientSub:"Chwonolijik, Tribi ak Istwa",
    tileCaptiv:"7 Kaptivite", tileCaptivSub:"Ejip → Dyaspora",
    tileWomen:"Etid Fanm", tileWomenSub:"Idantite alyans ak lwa yo",
    tileDeut:"Etid Det. 28", tileDeutSub:"Modil siy ak mèvèy",
    tileTribes:"12 Tribi", tileTribesSub:"Pwofesi ak dyaspora",
    tileHist:"Kontèks Istorik", tileHistSub:"Bil papal ak Izrayèl modèn",
    pillWeekly:"Etid Semèn nan", pillReading:"Plan Lekti", pillAudio:"Bib Odyo",
    pillReadingSub:"Kat Wout Idantite 14 Jou",
    toggleDevotional:"🕯️ Devosyonèl", togglePrayer:"🙏 Lapriyè",
    captivTitle:"7 Pi Gran Kaptivite Izrayèl yo",
    captivSub:"Chak kaptivite ak siyifikasyon alyans li ak pwomès restawrasyon.",
    captivAnchorLabel:"SKRITI ANKÒ · DETEWONÒM 28:46",
    captivTimelineLabel:"APÈSI CHWONOLIJIK ALYANS",
    captivKeyScriptures:"SKRITI KLE", captivTeachingPoint:"PWEN ANSÈYMAN",
    captivSignificance:"SIYIFIKASYON ALYANS", captivProphetic:"KONEKSYON PWOFETIK",
    captivDiasporaFlow:"KOURAN IDANTITE ALYANS — 8 ETAP",
    captivMigration:"TRADISYON MIGRASYON TRIBI PÈDI YO",
    captivMigrationNote:"Seksyon sa a konbine skriti, apokrèf ak entèpretasyon istorik. Teorik migrasyon yo se tradisyon etid.",
    captivStudyDeut:"Etidye Modil Det. 28", captivTribes:"12 Tribi yo",
    captivTeaser:"Ejip → Asiri → Babilòn → Wòm → Dyaspora",
    captivTeaserSub:"Yon etid sèt pi gran kaptivite Izrayèl yo ak siyifikasyon alyans ak pwomès restawrasyon.",
    captivTeaserBtn:"Etidye Kaptivite yo →",
    womenHeroTitle:"Fanm Alyans la", womenHeroSub:"Yon espas etid pou fanm — idantite alyans, fanm pwofetik, matènite, lwa pou fanm, relasyon, biznis ak pwofesi restawrasyon.",
    womenTabStudy:"📖 Leson Etid", womenTabLaws:"📜 Lwa pou Fanm", womenTabPrayer:"🙏 Demand Lapriyè",
    womenBeginStudy:"Kòmanse Etid →", womenLawsFor:"Lwa pou Fanm", womenSubmitPrayer:"Voye Lapriyè",
    womenLawsNote:"Lwa ak kòmandman nan skriti yo ki adrese espesyalman pou fanm — lwa pite, dwa eritaj, pwoteksyon maryaj ak manda matènite.",
    womenReflection:"💬 KESYON REFLEKSYON", womenAssignment:"📝 DEVWA SEMÈN SA A",
    womenPrayerTitle:"DEMAND LAPRIYÈ FANM YO", womenPrayerSub:"Demand ou a ap mande entèsesyon pa kominote alyans fanm yo pandan klas Shabat la.",
    womenPrayerName:"Non ou (opsyonèl)", womenPrayerTextarea:"Ekri demand lapriyè ou la isit…",
    womenPrayerSubmit:"Voye Demand ✦", womenPrayerReceived:"Lapriyè Resevwa",
    womenPrayerConfirm:"Demand ou a voye. Li pral prezante devan YAHAWAH nan pwochen Shabat nou an.",
    womenPrayerAnother:"Voye Yon Lòt →",
    womenClosing:"SENYÈ Bondye ou a nan mitan ou, puisan pou delivre. — Sofoni 3:17",
    tribesTitle:"12 Tribi Izrayèl yo", tribesSub:"Chak tribi pote yon non, yon teritwa, yon wòch presye ak yon destin pwofetik.",
    tribesBreastplate:"PLAK PWATRIN AARON — EGZÒD 28:17-20", tribesViewScriptures:"Wè Pwofesi ak Skriti yo",
    tribesSharedCovenant:"ALYANS PATAJE · DWA ZÈB TRIBI YO", tribesSharedSub:"Skriti sa yo aplike pou douz tribi yo kolektivman.",
    tribesTabCurses:"⛓️ Madichon", tribesTabRestoration:"🌿 Pwomès Restawrasyon",
    tribesStudyDeut:"Etidye Modil Detewonòm 28 →",
    tribesLocationTheme:"Pwofesi sou Kote Tribi Sa a Ta Rete",
    deut28Title:"Madichon Detewonòm 28 — Siy ak Mèvèy",
    deut28Sub:"Etid estriktire 12 tèm prensipal nan Detewonòm 28:15-68.",
    deut28TeachingPrinciple:"PRENSIP ANSÈYMAN",
    deut28TeachingText:"Toujou etidye Detewonòm 28 ansanm ak Detewonòm 30. Ak alyans la: Dezobeyisans → Kaptivite → Repantans → Restawrasyon.",
    deut28Theme:"TÈM", deut28Related:"SKRITI KONEKTE", deut28Historical:"NÒT ISTORIK",
    deut28Discussion:"DISKISYON SHABAT", deut28Anchor:"ANKÒ",
    histTitle:"Kontèks Istorik", histSub:"Evènman istorik dokimante ki sitiye nan kad pwofetik skriti yo.",
    histNote:"📋 NÒT ISTORIK", histImportant:"⚠️ ANSÈYMAN RESPONSAB",
    histScriptures:"📖 SKRITI REFLEKSYON", histDiscussion:"💬 KESYON DISKISYON SHABAT",
    histTimeline:"CHWONOLIJIK DOKIMANTE",
    feastTitle:"Kalandriye Fèt Sakre yo", feastSub:"Moman obligatwa ak kont anba an dirèk. Touche nenpòt fèt pou wè kijan pou obsève li.",
    feastFullCalendar:"Kalandriye Konplè →", feastJoinShabbat:"Jwenn Klas Shabat la →",
    feastWeeklyShabbat:"SHABAT CHAK SEMÈN", feastNextFeast:"PWOCHEN FÈT",
    communityTitle:"Jwenn kominote semèn nan.", communitySub:"Antre non ou, imel ak demand lapriyè pou resevwa etid ak devosyonèl chak semèn.",
    homeDailyBread:"PEN CHAK JOU JOU A", homeClassSchedule:"ORÈ KLAS",
    homeContinue:"KONTINYE ETIDYE", homeDeepStudy:"SEKSYON ETID AN FONS",
    homeCaptivitiesTeaser:"7 KAPTIVITE IZRAYÈL YO",
    homeStudyCaptivities:"Etidye Kaptivite yo →",
    homeSearchPlaceholder:"Chèche skriti, tèm oswa tribi…",
    joinFormTitle:"Kòmanse Vwayaj Alyans Ou",
    womenCovenantPathH2:"Yon Vwayaj 7 Etap", womenOfScripH2:"Fanm nan Ekriti yo",
    joinFormSub:"Ranpli fòm nan pou rantre nan kominote Klib Bib Bondye Fè L la.",
  },
};


// ─── SCRIPTURE REFERENCE TOOLS ────────────────────────────────────────────────
const SCRIPTURE_TOOLS = [
  {
    id:"blb",
    icon:"🔵",
    name:"Blue Letter Bible",
    category:"Study Tool",
    desc:"Verse-by-verse Bible study with Strong's lexicon, commentaries, interlinear Hebrew/Greek, and audio.",
    url:"https://www.blueletterbible.org",
    features:["Strong's Concordance","Hebrew & Greek Lexicon","Audio Bible","Commentaries","Interlinear Text"],
    color:"#1a5fa8",
  },
  {
    id:"zondervan",
    icon:"📚",
    name:"Zondervan Bible Dictionary",
    category:"Dictionary",
    desc:"Comprehensive dictionary of Bible people, places, customs, doctrines, and theological terms with historical context.",
    url:"https://www.biblegateway.com/resources/dictionaries",
    features:["People & Places","Theological Terms","Cultural Context","Historical Background","Cross-references"],
    color:"#8B3A2A",
  },
  {
    id:"lexicon",
    icon:"🔤",
    name:"Original Language Lexicon",
    category:"Lexicon",
    desc:"Hebrew (Old Testament) and Greek (New Testament) lexicons. Search root words, meanings, and every occurrence in scripture.",
    url:"https://www.blueletterbible.org/lexicon",
    features:["Hebrew Root Words","Greek New Testament","Strong's Numbers","Word Origins","All Occurrences"],
    color:"#5A7A52",
  },
  {
    id:"concordance",
    icon:"📇",
    name:"Strong's Concordance",
    category:"Concordance",
    desc:"The definitive biblical concordance — every English word mapped to its original Hebrew or Greek root with definition and context.",
    url:"https://www.blueletterbible.org/search/search.cfm?Criteria=concordance",
    features:["Every Bible Word","Hebrew Numbers (H1–H8674)","Greek Numbers (G1–G5624)","Word Frequency","KJV Indexed"],
    color:"#C4893A",
  },
  {
    id:"sinaiticus",
    icon:"📜",
    name:"Codex Sinaiticus",
    category:"Ancient Manuscript",
    desc:"The oldest known complete New Testament (c. 330–360 CE). Written in Greek on vellum, now held at the British Library. Contains NT + portions of OT Septuagint.",
    url:"https://codexsinaiticus.org",
    features:["c. 330–360 CE","Complete Greek NT","Portions of LXX","British Library","Fully digitized online"],
    color:"#7B5EA7",
    badge:"OLDEST NT",
  },
  {
    id:"sassoon",
    icon:"📖",
    name:"Codex Sassoon",
    category:"Ancient Manuscript",
    desc:"The oldest nearly complete Hebrew Bible (c. 9th century CE). Contains virtually the entire Old Testament in Hebrew. Purchased at Sotheby's in 2023 for $38.1 million — the most expensive book ever sold.",
    url:"https://en.wikipedia.org/wiki/Codex_Sassoon",
    features:["c. 900 CE","Nearly Complete Hebrew OT","Oldest Hebrew Bible","Sotheby's 2023","$38.1M — Priceless Heritage"],
    color:"#8B3A2A",
    badge:"OLDEST OT",
  },
  {
    id:"vaticanus",
    icon:"🏛️",
    name:"Codex Vaticanus",
    category:"Ancient Manuscript",
    desc:"One of the oldest and most complete Greek manuscripts of the Bible (c. 300–325 CE). Held in the Vatican Apostolic Library. Contains OT (LXX) and NT.",
    url:"https://digi.vatlib.it/view/MSS_Vat.gr.1209",
    features:["c. 300–325 CE","Greek OT (LXX) + NT","Vatican Library","Oldest complete OT in Greek","Digitized online"],
    color:"#2A4A7A",
    badge:"GREEK OT+NT",
  },
  {
    id:"dead-sea",
    icon:"🪨",
    name:"Dead Sea Scrolls",
    category:"Ancient Manuscript",
    desc:"Discovered 1947–1956 in Qumran caves. Include the oldest known manuscripts of almost all Old Testament books, 1 Enoch, Jubilees, and other non-canonical texts. Dated 3rd century BCE – 1st century CE.",
    url:"https://www.deadseascrolls.org.il",
    features:["200 BCE – 68 CE","Oldest OT Manuscripts","1 Enoch & Jubilees","Qumran Caves","Israel Antiquities Authority"],
    color:"#6B5A3A",
    badge:"3RD CENT BCE",
  },
];

// ─── CSS ──────────────────────────────────────────────────────────────────────
const css = `
  @import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Cinzel:wght@400;600;700&display=swap');

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --ink: #1A1208; --parchment: #FAF6EE; --cream: #F5EFE2; --gold: #C4893A;
    --gold-light: #E8B96A; --gold-pale: #F7E9CE; --rust: #8B3A2A; --sage: #5A7A52;
    --deep: #2A1F0E; --muted: #7A6A52; --purple: #7B5EA7;
    --border: rgba(196,137,58,0.22); --shadow: 0 4px 24px rgba(26,18,8,0.09);
    --shadow-lg: 0 12px 48px rgba(26,18,8,0.16);
  }
  html { scroll-behavior: smooth; }
  body { font-family:'Libre Baskerville',Georgia,serif; background:var(--parchment); color:var(--ink); line-height:1.7; -webkit-font-smoothing:antialiased; }
  h1,h2,h3,h4 { font-family:'Cinzel',serif; letter-spacing:0.02em; line-height:1.2; }

  /* NAV */
  .nav { position:sticky; top:0; z-index:100; background:rgba(250,246,238,0.96); backdrop-filter:blur(14px); border-bottom:1px solid var(--border); }
  .nav-inner { max-width:1280px; margin:0 auto; padding:0 1.5rem; height:62px; display:flex; align-items:center; justify-content:space-between; gap:1rem; }
  .nav-brand { display:flex; align-items:center; gap:0.7rem; background:none; border:none; cursor:pointer; }
  .nav-icon { width:38px; height:38px; background:var(--gold); border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:1.1rem; color:white; flex-shrink:0; }
  .brand-text { font-family:'Cinzel',serif; font-size:0.82rem; font-weight:700; letter-spacing:0.1em; line-height:1.2; }
  .brand-sub { font-family:'Libre Baskerville',serif; font-size:0.6rem; color:var(--muted); letter-spacing:0.04em; }
  .nav-links { display:flex; align-items:center; gap:0.15rem; }
  .nav-btn { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.1em; padding:0.45rem 0.75rem; border-radius:7px; border:none; background:transparent; color:var(--muted); cursor:pointer; transition:all 0.18s; white-space:nowrap; }
  .nav-btn:hover { color:var(--ink); background:var(--gold-pale); }
  .nav-btn.active { background:var(--gold); color:white; }
  .nav-hamburger { display:none; background:none; border:1px solid var(--border); border-radius:8px; padding:0.45rem 0.6rem; cursor:pointer; color:var(--ink); font-size:1.1rem; line-height:1; }
  .mobile-menu { border-bottom:1px solid var(--border); background:var(--parchment); padding:0.75rem 1.5rem 1rem; display:flex; flex-direction:column; gap:0.3rem; }
  .mobile-menu .nav-btn { text-align:left; padding:0.65rem 1rem; }
  @media(max-width:900px) { .nav-links{display:none} .nav-hamburger{display:block} }

  /* LAYOUT */
  .main { max-width:1280px; margin:0 auto; padding:2.5rem 1.5rem 5rem; }

  /* HERO */
  .hero { position:relative; overflow:hidden; background:var(--deep); border-radius:22px; padding:3.5rem 3rem; color:var(--parchment); margin-bottom:3.5rem; }
  .hero::before { content:'✦'; position:absolute; top:-3rem; right:-2rem; font-size:20rem; color:rgba(196,137,58,0.05); line-height:1; pointer-events:none; font-family:'Cinzel',serif; }
  .hero-eyebrow { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.28em; color:var(--gold-light); margin-bottom:1.1rem; display:flex; align-items:center; gap:0.7rem; }
  .hero-eyebrow::before,.hero-eyebrow::after { content:''; height:1px; background:var(--gold); }
  .hero-eyebrow::before { width:20px; } .hero-eyebrow::after { width:40px; }
  .hero-h1 { font-size:clamp(2rem,5vw,3.6rem); font-weight:700; margin-bottom:1.1rem; }
  .hero-h1 em { font-family:'Cormorant Garamond',serif; font-style:italic; color:var(--gold-light); font-size:1.15em; }
  .hero-sub { font-size:0.95rem; color:rgba(250,246,238,0.7); max-width:520px; line-height:1.85; margin-bottom:2rem; }
  .hero-actions { display:flex; flex-wrap:wrap; gap:0.7rem; margin-bottom:2.25rem; }
  .hero-cards { display:grid; grid-template-columns:repeat(3,1fr); gap:0.9rem; }
  .hero-card { background:rgba(250,246,238,0.06); border:1px solid rgba(196,137,58,0.22); border-radius:13px; padding:1.1rem; }
  .hero-card-title { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.1em; color:var(--gold-light); margin-bottom:0.3rem; }
  .hero-card-body { font-size:0.78rem; color:rgba(250,246,238,0.55); line-height:1.6; }
  @media(max-width:700px) { .hero{padding:2rem 1.5rem; border-radius:16px;} .hero-cards{grid-template-columns:1fr;} }

  /* BUTTONS */
  .btn-gold { font-family:'Cinzel',serif; font-size:0.73rem; letter-spacing:0.12em; padding:0.82rem 1.6rem; border-radius:9px; background:var(--gold); color:white; border:none; cursor:pointer; transition:all 0.2s; font-weight:600; }
  .btn-gold:hover { background:var(--gold-light); transform:translateY(-1px); }
  .btn-gold:active { transform:translateY(0); }
  .btn-outline-light { font-family:'Cinzel',serif; font-size:0.73rem; letter-spacing:0.12em; padding:0.82rem 1.6rem; border-radius:9px; background:transparent; color:var(--parchment); border:1px solid rgba(250,246,238,0.3); cursor:pointer; transition:all 0.2s; }
  .btn-outline-light:hover { background:rgba(250,246,238,0.08); border-color:rgba(250,246,238,0.55); }
  .btn-outline { font-family:'Cinzel',serif; font-size:0.7rem; letter-spacing:0.1em; padding:0.6rem 1.1rem; border-radius:8px; background:transparent; color:var(--ink); border:1px solid var(--border); cursor:pointer; transition:all 0.2s; }
  .btn-outline:hover { background:var(--gold-pale); border-color:var(--gold); color:var(--gold); }
  .btn-text { font-family:'Cinzel',serif; font-size:0.7rem; letter-spacing:0.1em; background:none; border:none; color:var(--gold); cursor:pointer; display:flex; align-items:center; gap:0.4rem; padding:0; transition:gap 0.2s; }
  .btn-text:hover { gap:0.65rem; }

  /* SECTION */
  .section-eyebrow { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.24em; color:var(--gold); margin-bottom:0.6rem; text-transform:uppercase; display:flex; align-items:center; gap:0.55rem; }
  .section-eyebrow::after { content:''; height:1px; width:36px; background:var(--gold); display:inline-block; }
  .section-h2 { font-size:clamp(1.5rem,3vw,2.4rem); color:var(--ink); margin-bottom:0.65rem; }
  .section-body { font-size:0.9rem; color:var(--muted); max-width:580px; line-height:1.85; margin-bottom:2.25rem; }

  /* CARDS */
  .card { background:white; border:1px solid var(--border); border-radius:16px; overflow:hidden; box-shadow:var(--shadow); transition:box-shadow 0.22s,transform 0.22s; }
  .card:hover { box-shadow:var(--shadow-lg); transform:translateY(-2px); }
  .card-body { padding:1.6rem; }

  /* FEATURE GRID */
  .feature-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:1.1rem; margin-bottom:3.5rem; }
  .feature-icon { font-size:1.85rem; margin-bottom:0.9rem; }
  .feature-title { font-family:'Cinzel',serif; font-size:0.85rem; letter-spacing:0.05em; margin-bottom:0.45rem; }
  .feature-body { font-size:0.82rem; color:var(--muted); line-height:1.7; margin-bottom:1.1rem; }

  /* SEARCH BAR */
  .search-wrap { position:relative; margin-bottom:1.75rem; }
  .search-input { width:100%; padding:0.9rem 1rem 0.9rem 2.9rem; border:1.5px solid var(--border); border-radius:12px; font-family:'Libre Baskerville',serif; font-size:0.88rem; background:white; color:var(--ink); outline:none; transition:border-color 0.2s; }
  .search-input:focus { border-color:var(--gold); }
  .search-icon { position:absolute; left:0.9rem; top:50%; transform:translateY(-50%); color:var(--muted); font-size:0.9rem; pointer-events:none; }
  .search-clear { position:absolute; right:0.75rem; top:50%; transform:translateY(-50%); background:none; border:none; cursor:pointer; color:var(--muted); font-size:0.85rem; padding:0.2rem 0.4rem; border-radius:4px; }
  .search-clear:hover { color:var(--ink); }

  /* WEEKLY STUDY */
  .study-card { margin-bottom:1.1rem; border-radius:16px; overflow:hidden; border:1px solid var(--border); box-shadow:var(--shadow); }
  .study-header { padding:1.4rem 1.6rem; display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; flex-wrap:wrap; background:white; }
  .study-week { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.2em; margin-bottom:0.35rem; }
  .study-title { font-family:'Cormorant Garamond',serif; font-size:1.6rem; font-weight:600; color:var(--ink); line-height:1.2; }
  .study-anchor { font-size:0.77rem; color:var(--muted); padding:0.45rem 0.85rem; border-radius:20px; border:1px solid var(--border); white-space:nowrap; background:var(--cream); flex-shrink:0; font-style:italic; }
  .study-summary { padding:0 1.6rem 1.1rem; font-size:0.88rem; color:var(--muted); line-height:1.82; background:white; border-bottom:1px solid var(--border); }
  .study-takeaways { padding:1.1rem 1.6rem; display:grid; grid-template-columns:repeat(3,1fr); gap:0.9rem; background:white; }
  .takeaway { padding:0.9rem 1rem; border-radius:11px; background:var(--cream); border-left:3px solid; font-size:0.82rem; line-height:1.6; }
  @media(max-width:700px) { .study-takeaways{grid-template-columns:1fr;} .study-anchor{width:100%;} }

  /* DEVOTIONAL */
  .dev-layout { display:grid; grid-template-columns:280px 1fr; gap:1.25rem; align-items:start; }
  .dev-list { background:white; border:1px solid var(--border); border-radius:16px; overflow:hidden; box-shadow:var(--shadow); position:sticky; top:1rem; }
  .dev-item { padding:0.85rem 1.1rem; border-bottom:1px solid var(--border); cursor:pointer; transition:background 0.18s; background:transparent; border-left:3px solid transparent; border-right:none; border-top:none; width:100%; text-align:left; display:flex; align-items:center; gap:0.75rem; }
  .dev-item:last-child { border-bottom:none; }
  .dev-item:hover { background:var(--gold-pale); }
  .dev-item.active { background:linear-gradient(135deg,var(--deep),#3A2A18); color:var(--parchment); border-left-color:var(--gold); }
  .dev-item.active .dev-item-day,.dev-item.active .dev-item-verse { opacity:0.6; color:var(--parchment); }
  .dev-item.active .dev-item-title { color:var(--gold-light); }
  .dev-item-icon { font-size:1.1rem; flex-shrink:0; width:28px; text-align:center; }
  .dev-item-day { font-family:'Cinzel',serif; font-size:0.55rem; letter-spacing:0.18em; opacity:0.6; margin-bottom:0.12rem; }
  .dev-item-title { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.04em; line-height:1.3; }
  .dev-item-verse { font-size:0.65rem; opacity:0.6; margin-top:0.12rem; font-style:italic; }
  .dev-main { background:white; border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow); overflow:visible; }
  .dev-main-header { padding:1.75rem 2rem 1.25rem; border-bottom:1px solid var(--border); }
  .dev-stage-badge { display:inline-flex; align-items:center; gap:0.4rem; font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.16em; padding:0.3rem 0.75rem; border-radius:20px; margin-bottom:0.75rem; }
  .dev-title { font-family:'Cinzel',serif; font-size:1.2rem; letter-spacing:0.04em; color:var(--ink); margin-bottom:0.25rem; line-height:1.3; }
  .dev-subtitle { font-size:0.84rem; color:var(--muted); font-style:italic; line-height:1.65; }
  .dev-body { padding:1.5rem 2rem; }
  .dev-day-label { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.2em; color:var(--gold); margin-bottom:0.45rem; }
  .dev-verse-ref { font-family:'Cinzel',serif; font-size:0.7rem; letter-spacing:0.12em; color:var(--gold); margin-bottom:0.5rem; }
  .dev-scripture { background:var(--deep); color:var(--parchment); border-radius:14px; padding:1.25rem 1.6rem; font-family:'Cormorant Garamond',serif; font-size:1.1rem; font-style:italic; line-height:1.78; margin-bottom:1.25rem; border-left:4px solid var(--gold); }
  .dev-section-label { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.2em; color:var(--gold); margin-bottom:0.5rem; margin-top:1.25rem; display:flex; align-items:center; gap:0.5rem; }
  .dev-section-label::after { content:''; flex:1; height:1px; background:var(--border); }
  .dev-text { font-size:0.88rem; color:var(--ink); line-height:1.85; }
  .dev-prayer { background:var(--cream); border:1px solid var(--border); border-radius:11px; padding:1.1rem 1.4rem; font-size:0.88rem; color:var(--ink); line-height:1.82; font-style:italic; }
  .dev-action { background:rgba(196,137,58,0.07); border:1px solid rgba(196,137,58,0.22); border-radius:11px; padding:1rem 1.25rem; font-size:0.87rem; color:var(--ink); line-height:1.78; border-left:3px solid var(--gold); }
  .dev-footer { padding:1.25rem 2rem; border-top:1px solid var(--border); background:var(--cream); border-radius:0 0 16px 16px; display:flex; gap:0.65rem; align-items:center; flex-wrap:wrap; }
  .dev-progress { display:flex; gap:0; overflow-x:auto; margin-bottom:1.5rem; background:white; border:1px solid var(--border); border-radius:12px; scrollbar-width:none; }
  .dev-progress::-webkit-scrollbar { display:none; }
  .dev-progress-step { flex:1; min-width:72px; padding:0.6rem 0.4rem; text-align:center; border-right:1px solid var(--border); cursor:pointer; transition:all 0.18s; display:flex; flex-direction:column; align-items:center; gap:0.18rem; background:transparent; border-top:none; border-bottom:none; border-left:none; }
  .dev-progress-step:last-child { border-right:none; }
  .dev-progress-step:hover { background:var(--gold-pale); }
  .dev-progress-step.active { background:var(--deep); }
  .dev-progress-icon { font-size:1rem; }
  .dev-progress-num { font-family:'Cinzel',serif; font-size:0.52rem; letter-spacing:0.12em; color:var(--muted); }
  .dev-progress-label { font-family:'Cinzel',serif; font-size:0.5rem; letter-spacing:0.08em; color:var(--muted); }
  .dev-progress-step.active .dev-progress-label,.dev-progress-step.active .dev-progress-num { color:var(--gold-light); }
  @media(max-width:820px) { .dev-layout{grid-template-columns:1fr;} .dev-list{position:static;} .dev-body{padding:1.1rem 1.25rem;} .dev-main-header{padding:1.1rem 1.25rem 0.9rem;} .dev-footer{padding:1rem 1.25rem;} }


  /* READING PLAN */
  .reading-grid { display:grid; gap:0.65rem; }
  .reading-item { background:white; border:1px solid var(--border); border-radius:12px; padding:0.9rem 1.35rem; display:grid; grid-template-columns:76px 1fr 1fr; gap:0.9rem; align-items:center; transition:box-shadow 0.18s,transform 0.18s; cursor:default; }
  .reading-item:hover { box-shadow:var(--shadow); transform:translateX(3px); }
  .reading-day { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.16em; color:var(--gold); }
  .reading-passage { font-weight:700; font-size:0.88rem; }
  .reading-focus { font-size:0.8rem; color:var(--muted); }
  @media(max-width:650px) { .reading-item{grid-template-columns:60px 1fr;} .reading-focus{display:none;} }

  /* BIBLE HUB */
  .bible-hub-grid { display:grid; gap:0.9rem; max-width:540px; }
  .bible-hub-item { background:white; border:1px solid var(--border); border-radius:15px; padding:1.25rem 1.6rem; display:flex; align-items:center; gap:1.1rem; cursor:pointer; transition:all 0.2s; width:100%; text-align:left; }
  .bible-hub-item:hover { background:var(--deep); color:var(--parchment); border-color:var(--deep); transform:translateX(4px); }
  .bible-hub-item:hover .hub-sub { color:rgba(250,246,238,0.55); }
  .hub-icon { width:48px; height:48px; border-radius:13px; background:var(--deep); display:flex; align-items:center; justify-content:center; font-size:1.4rem; flex-shrink:0; color:var(--gold-light); transition:background 0.2s; }
  .bible-hub-item:hover .hub-icon { background:rgba(250,246,238,0.1); }
  .hub-title { font-family:'Cinzel',serif; font-size:0.88rem; letter-spacing:0.06em; margin-bottom:0.18rem; }
  .hub-sub { font-size:0.76rem; color:var(--muted); transition:color 0.2s; }

  /* VERSIONS */
  .version-tabs { display:flex; gap:0.45rem; margin-bottom:1.35rem; }
  .vtab { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.12em; padding:0.5rem 1.1rem; border-radius:7px; border:1px solid var(--border); background:white; color:var(--muted); cursor:pointer; transition:all 0.18s; }
  .vtab.active { background:var(--rust); color:white; border-color:var(--rust); }
  .version-list { background:white; border:1px solid var(--border); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); }
  .version-item { padding:0.82rem 1.4rem; border-bottom:1px solid var(--border); cursor:pointer; font-size:0.86rem; transition:background 0.14s; display:flex; justify-content:space-between; align-items:center; background:transparent; border-left:none; border-right:none; border-top:none; width:100%; text-align:left; color:var(--ink); }
  .version-item:last-child { border-bottom:none; }
  .version-item:hover { background:var(--gold-pale); }
  .version-item.selected { background:var(--rust); color:white; }
  .version-item.selected .version-code { color:rgba(255,255,255,0.65); }
  .version-code { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.12em; color:var(--muted); }

  /* BOOKS */
  .testament-tabs { display:flex; gap:0; margin-bottom:1.35rem; border:1px solid var(--border); border-radius:9px; overflow:hidden; width:fit-content; flex-wrap:wrap; }
  .ttab { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.1em; padding:0.5rem 1.1rem; border:none; border-right:1px solid var(--border); background:white; color:var(--muted); cursor:pointer; transition:all 0.18s; }
  .ttab:last-child { border-right:none; }
  .ttab.active { background:var(--ink); color:white; }
  .book-list { background:white; border:1px solid var(--border); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); }
  .book-item { padding:0.8rem 1.4rem; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; cursor:pointer; transition:background 0.14s; background:transparent; border-left:none; border-right:none; border-top:none; width:100%; text-align:left; color:var(--ink); }
  .book-item:last-child { border-bottom:none; }
  .book-item:hover { background:var(--gold-pale); }
  .book-name { font-size:0.88rem; display:flex; align-items:center; gap:0.45rem; }
  .book-chevron { font-size:0.68rem; color:var(--muted); }
  .book-chapters { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.1em; color:var(--muted); }
  .chapter-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(46px,1fr)); gap:0.5rem; }
  .ch-btn { aspect-ratio:1; border-radius:9px; border:1px solid var(--border); background:white; font-family:'Cinzel',serif; font-size:0.75rem; cursor:pointer; transition:all 0.18s; color:var(--ink); }
  .ch-btn:hover { background:var(--gold); color:white; border-color:var(--gold); }

  /* PASSAGE READER */
  .passage-search { display:flex; gap:0.7rem; margin-bottom:0.7rem; }
  .passage-input { flex:1; padding:0.82rem 1rem; border:1.5px solid var(--border); border-radius:9px; font-family:'Libre Baskerville',serif; font-size:0.88rem; background:white; color:var(--ink); outline:none; transition:border-color 0.2s; }
  .passage-input:focus { border-color:var(--rust); }
  .btn-search { padding:0.82rem 1.4rem; border-radius:9px; background:var(--rust); color:white; border:none; font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.1em; cursor:pointer; transition:background 0.2s; white-space:nowrap; }
  .btn-search:hover { background:#7A2A1E; }
  .version-select-bar { padding:0.72rem 1rem; border:1px solid var(--border); border-radius:9px; font-family:'Libre Baskerville',serif; font-size:0.84rem; background:white; color:var(--ink); outline:none; width:100%; margin-bottom:1.1rem; cursor:pointer; }
  .passage-ref { font-family:'Cormorant Garamond',serif; font-size:1.7rem; font-weight:600; }
  .passage-version-badge { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.12em; color:var(--muted); border:1px solid var(--border); padding:0.28rem 0.7rem; border-radius:20px; }
  .verse-block { margin-bottom:0.8rem; display:flex; gap:0.7rem; align-items:flex-start; }
  .verse-num { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.1em; color:var(--gold); margin-top:0.28rem; min-width:20px; flex-shrink:0; }
  .verse-text { font-size:0.98rem; line-height:1.88; color:var(--ink); }
  .passage-card { background:white; border:1px solid var(--border); border-radius:16px; padding:1.85rem; box-shadow:var(--shadow); }
  .passage-tip { font-size:0.78rem; color:var(--muted); text-align:center; margin-top:1.35rem; font-style:italic; }
  .back-btn { display:flex; align-items:center; gap:0.45rem; font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.1em; background:none; border:none; color:var(--gold); cursor:pointer; margin-bottom:1.4rem; padding:0; transition:gap 0.2s; }
  .back-btn:hover { gap:0.65rem; }

  /* AUDIO BIBLE */
  .audio-grid { display:grid; grid-template-columns:1fr 1fr; gap:1.1rem; margin-bottom:1.5rem; }
  .audio-player-card { background:var(--deep); color:var(--parchment); border-radius:18px; padding:2rem; box-shadow:var(--shadow-lg); }
  .audio-title { font-family:'Cormorant Garamond',serif; font-size:1.9rem; font-weight:600; margin-bottom:0.25rem; }
  .audio-ref { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.15em; color:var(--gold-light); margin-bottom:1.5rem; }
  .verse-ticker { min-height:90px; margin-bottom:1.5rem; }
  .verse-ticker-num { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.15em; color:var(--gold-light); margin-bottom:0.35rem; }
  .verse-ticker-text { font-family:'Cormorant Garamond',serif; font-size:1.25rem; font-style:italic; line-height:1.65; color:var(--parchment); }
  .audio-controls { display:flex; align-items:center; gap:0.75rem; margin-bottom:1.25rem; }
  .audio-ctrl-btn { width:42px; height:42px; border-radius:50%; border:1.5px solid rgba(250,246,238,0.25); background:rgba(250,246,238,0.08); color:var(--parchment); font-size:1rem; cursor:pointer; transition:all 0.18s; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
  .audio-ctrl-btn:hover { background:rgba(250,246,238,0.18); border-color:var(--gold-light); }
  .audio-ctrl-btn.play { width:52px; height:52px; background:var(--gold); border-color:var(--gold); font-size:1.2rem; }
  .audio-ctrl-btn.play:hover { background:var(--gold-light); }
  .audio-progress { flex:1; }
  .audio-bar-wrap { position:relative; height:4px; background:rgba(250,246,238,0.15); border-radius:2px; cursor:pointer; margin-bottom:0.3rem; }
  .audio-bar-fill { height:100%; background:var(--gold); border-radius:2px; transition:width 0.3s; }
  .audio-times { display:flex; justify-content:space-between; font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.08em; color:rgba(250,246,238,0.45); }
  .audio-upload-zone { border:2px dashed rgba(196,137,58,0.35); border-radius:14px; padding:2rem; text-align:center; cursor:pointer; transition:all 0.2s; background:rgba(250,246,238,0.03); }
  .audio-upload-zone:hover,.audio-upload-zone.drag { border-color:var(--gold); background:rgba(196,137,58,0.08); }
  .audio-upload-icon { font-size:2.25rem; margin-bottom:0.75rem; }
  .audio-upload-title { font-family:'Cinzel',serif; font-size:0.8rem; letter-spacing:0.1em; color:var(--gold-light); margin-bottom:0.4rem; }
  .audio-upload-sub { font-size:0.78rem; color:rgba(250,246,238,0.5); line-height:1.6; }
  .audio-track-list { background:rgba(250,246,238,0.04); border:1px solid rgba(250,246,238,0.1); border-radius:12px; overflow:hidden; margin-top:1.1rem; }
  .audio-track { padding:0.75rem 1rem; border-bottom:1px solid rgba(250,246,238,0.08); display:flex; align-items:center; gap:0.75rem; cursor:pointer; transition:background 0.16s; }
  .audio-track:last-child { border-bottom:none; }
  .audio-track:hover { background:rgba(250,246,238,0.06); }
  .audio-track.playing { background:rgba(196,137,58,0.15); }
  .audio-track-icon { font-size:0.85rem; color:var(--gold-light); width:20px; text-align:center; flex-shrink:0; }
  .audio-track-info { flex:1; }
  .audio-track-name { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.08em; color:var(--parchment); margin-bottom:0.12rem; }
  .audio-track-meta { font-size:0.68rem; color:rgba(250,246,238,0.45); }
  .audio-track-dur { font-family:'Cinzel',serif; font-size:0.65rem; color:rgba(250,246,238,0.45); flex-shrink:0; }
  @media(max-width:800px) { .audio-grid{grid-template-columns:1fr;} }

  /* JOIN */
  .join-grid { display:grid; grid-template-columns:1fr 390px; gap:2rem; align-items:start; }
  .join-form-card { background:white; border:1px solid var(--border); border-radius:18px; padding:2rem; box-shadow:var(--shadow); position:sticky; top:82px; }
  .form-title { font-family:'Cinzel',serif; font-size:0.95rem; letter-spacing:0.06em; margin-bottom:0.28rem; }
  .form-sub { font-size:0.8rem; color:var(--muted); margin-bottom:1.4rem; line-height:1.65; }
  .form-input { width:100%; padding:0.78rem 1rem; border:1.5px solid var(--border); border-radius:9px; background:var(--cream); font-family:'Libre Baskerville',serif; font-size:0.84rem; color:var(--ink); outline:none; transition:border-color 0.2s; margin-bottom:0.7rem; }
  .form-input:focus { border-color:var(--gold); }
  .form-input::placeholder { color:var(--muted); opacity:0.75; }
  textarea.form-input { min-height:105px; resize:vertical; }
  .btn-submit { width:100%; padding:0.88rem; border-radius:9px; background:var(--gold); color:white; border:none; font-family:'Cinzel',serif; font-size:0.78rem; letter-spacing:0.1em; font-weight:600; cursor:pointer; transition:background 0.2s; margin-top:0.2rem; }
  .btn-submit:hover { background:#B87830; }
  .form-note { font-size:0.7rem; color:var(--muted); text-align:center; margin-top:0.7rem; line-height:1.6; }
  .highlight-list { display:grid; grid-template-columns:1fr 1fr; gap:0.9rem; margin-bottom:1.75rem; }
  .highlight-item { background:white; border:1px solid var(--border); border-radius:13px; padding:1rem 1.1rem; display:flex; gap:0.7rem; align-items:flex-start; }
  .highlight-icon { font-size:1.1rem; flex-shrink:0; margin-top:0.08rem; }
  .highlight-text { font-size:0.82rem; color:var(--ink); line-height:1.6; }
  .funnel-block { background:var(--deep); border-radius:16px; padding:1.6rem; color:var(--parchment); }
  .funnel-title { font-family:'Cinzel',serif; font-size:0.82rem; letter-spacing:0.08em; color:var(--gold-light); margin-bottom:0.9rem; }
  .funnel-steps { display:grid; grid-template-columns:1fr 1fr; gap:0.55rem; }
  .funnel-step { background:rgba(250,246,238,0.05); border:1px solid rgba(196,137,58,0.18); border-radius:9px; padding:0.7rem 0.9rem; font-size:0.8rem; color:rgba(250,246,238,0.75); }
  @media(max-width:900px) { .join-grid{grid-template-columns:1fr;} .join-form-card{position:static;} .highlight-list{grid-template-columns:1fr;} .funnel-steps{grid-template-columns:1fr;} }

  /* ONBOARDING */
  .onboard-overlay { position:fixed; inset:0; background:rgba(26,18,8,0.72); backdrop-filter:blur(6px); z-index:200; display:flex; align-items:center; justify-content:center; padding:1.5rem; }
  .onboard-card { background:var(--parchment); border-radius:22px; padding:2.5rem; max-width:520px; width:100%; box-shadow:0 24px 80px rgba(26,18,8,0.35); position:relative; }
  .onboard-progress { display:flex; gap:0.45rem; margin-bottom:2rem; }
  .onboard-dot { flex:1; height:3px; border-radius:2px; background:var(--border); transition:background 0.3s; }
  .onboard-dot.done { background:var(--gold); }
  .onboard-icon { font-size:2.8rem; margin-bottom:1rem; }
  .onboard-title { font-family:'Cinzel',serif; font-size:1.2rem; letter-spacing:0.04em; margin-bottom:0.65rem; color:var(--ink); }
  .onboard-desc { font-size:0.9rem; color:var(--muted); line-height:1.82; margin-bottom:1.75rem; }
  .onboard-actions { display:flex; justify-content:space-between; align-items:center; gap:1rem; }
  .onboard-skip { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.1em; background:none; border:none; color:var(--muted); cursor:pointer; }
  .onboard-skip:hover { color:var(--ink); }

  /* DIVIDER */
  .divider { display:flex; align-items:center; gap:0.9rem; margin:3rem 0; }
  .divider::before,.divider::after { content:''; flex:1; height:1px; background:var(--border); }
  .divider-icon { color:var(--gold); font-size:0.9rem; flex-shrink:0; }

  /* FOOTER */
  .footer { border-top:1px solid var(--border); margin-top:4rem; padding:2.25rem 1.5rem; }
  .footer-inner { max-width:1280px; margin:0 auto; display:flex; justify-content:space-between; align-items:center; gap:1.5rem; flex-wrap:wrap; }
  .footer-title { font-family:'Cinzel',serif; font-size:0.88rem; letter-spacing:0.08em; margin-bottom:0.3rem; }
  .footer-body { font-size:0.78rem; color:var(--muted); max-width:400px; line-height:1.7; }
  .footer-actions { display:flex; gap:0.7rem; }

  /* LANGUAGE SELECTOR */
  .lang-selector { display:flex; align-items:center; gap:0.45rem; }
  .lang-btn { display:flex; align-items:center; gap:0.3rem; font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.08em; padding:0.38rem 0.65rem; border-radius:7px; border:1px solid var(--border); background:white; color:var(--muted); cursor:pointer; transition:all 0.18s; white-space:nowrap; }
  .lang-btn:hover { background:var(--gold-pale); border-color:var(--gold); color:var(--ink); }
  .lang-btn.active { background:var(--deep); color:var(--gold-light); border-color:var(--deep); }
  .lang-dropdown { position:relative; }
  .lang-toggle { display:flex; align-items:center; gap:0.35rem; font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.08em; padding:0.38rem 0.8rem; border-radius:7px; border:1px solid var(--border); background:white; color:var(--ink); cursor:pointer; transition:all 0.18s; }
  .lang-toggle:hover { border-color:var(--gold); background:var(--gold-pale); }
  .lang-menu { position:absolute; top:calc(100% + 6px); right:0; background:white; border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-lg); overflow:hidden; z-index:120; min-width:180px; }
  .lang-menu-item { padding:0.72rem 1rem; display:flex; align-items:center; gap:0.6rem; cursor:pointer; font-size:0.82rem; transition:background 0.14s; border-bottom:1px solid var(--border); }
  .lang-menu-item:last-child { border-bottom:none; }
  .lang-menu-item:hover { background:var(--gold-pale); }
  .lang-menu-item.active { background:var(--deep); color:var(--parchment); }
  .lang-flag { font-size:1.1rem; }
  .lang-native { font-family:'Libre Baskerville',serif; font-size:0.8rem; }
  .lang-en-name { font-size:0.7rem; color:var(--muted); }
  .lang-menu-item.active .lang-en-name { color:rgba(250,246,238,0.5); }

  /* SCRIPTURE TOOLS */
  .tools-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:1rem; margin-bottom:2rem; }
  .tool-card { background:white; border:1px solid var(--border); border-radius:16px; overflow:hidden; box-shadow:var(--shadow); transition:all 0.22s; cursor:pointer; text-decoration:none; display:block; }
  .tool-card:hover { box-shadow:var(--shadow-lg); transform:translateY(-3px); }
  .tool-card-header { padding:1.1rem 1.4rem 0.8rem; display:flex; align-items:flex-start; gap:0.75rem; }
  .tool-icon { width:44px; height:44px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:1.3rem; flex-shrink:0; }
  .tool-name { font-family:'Cinzel',serif; font-size:0.8rem; letter-spacing:0.05em; margin-bottom:0.2rem; }
  .tool-category { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.15em; opacity:0.6; }
  .tool-badge { font-family:'Cinzel',serif; font-size:0.55rem; letter-spacing:0.12em; padding:0.2rem 0.55rem; border-radius:20px; color:white; margin-left:auto; flex-shrink:0; align-self:flex-start; margin-top:0.1rem; }
  .tool-desc { padding:0 1.4rem 0.85rem; font-size:0.8rem; color:var(--muted); line-height:1.72; }
  .tool-features { padding:0.75rem 1.4rem; border-top:1px solid var(--border); background:var(--cream); display:flex; flex-wrap:wrap; gap:0.35rem; }
  .tool-feat-tag { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.08em; padding:0.2rem 0.55rem; border-radius:20px; border:1px solid var(--border); background:white; color:var(--muted); }
  .tool-open-btn { padding:0.75rem 1.4rem; display:flex; align-items:center; justify-content:space-between; border-top:1px solid var(--border); font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.1em; color:var(--gold); }

  /* MANUSCRIPT BANNER */
  .ms-banner { background:var(--deep); border-radius:14px; padding:1.1rem 1.5rem; margin-bottom:1.5rem; display:flex; align-items:center; gap:1rem; flex-wrap:wrap; }
  .ms-banner-text { font-size:0.8rem; color:rgba(250,246,238,0.7); line-height:1.72; flex:1; min-width:200px; }
  .ms-banner-title { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.12em; color:var(--gold-light); margin-bottom:0.3rem; }

  /* ── LIVE STREAM ── */
  .live-hero { background:linear-gradient(135deg,#0D0D0D 0%,#1A0A0A 50%,#2A0A0A 100%); border-radius:22px; padding:3rem 2.5rem; margin-bottom:2rem; color:white; position:relative; overflow:hidden; }
  .live-hero::before { content:''; position:absolute; inset:0; background:radial-gradient(ellipse at 70% 50%,rgba(255,40,40,0.12) 0%,transparent 60%); pointer-events:none; }
  .live-badge { display:inline-flex; align-items:center; gap:0.5rem; font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.2em; padding:0.38rem 0.9rem; border-radius:20px; background:rgba(255,40,40,0.15); border:1px solid rgba(255,80,80,0.35); color:#FF6B6B; margin-bottom:1rem; }
  .live-dot { width:8px; height:8px; border-radius:50%; background:#FF4444; animation:livePulse 1.5s infinite; flex-shrink:0; }
  @keyframes livePulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.5;transform:scale(1.4)} }
  .live-hero-h1 { font-family:'Cinzel',serif; font-size:clamp(1.6rem,4vw,2.8rem); font-weight:700; color:white; margin-bottom:0.75rem; line-height:1.15; }
  .live-hero-h1 em { font-family:'Cormorant Garamond',serif; color:#FF8C8C; font-style:italic; }
  .live-hero-sub { font-size:0.9rem; color:rgba(255,255,255,0.6); line-height:1.82; max-width:500px; }
  /* Platform cards */
  .platform-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:1rem; margin-bottom:2.5rem; }
  .platform-card { background:white; border-radius:16px; overflow:hidden; box-shadow:var(--shadow); transition:all 0.22s; cursor:pointer; text-decoration:none; display:block; }
  .platform-card:hover { box-shadow:var(--shadow-lg); transform:translateY(-3px); }
  .platform-card-header { padding:1.25rem 1.4rem; display:flex; align-items:center; gap:0.9rem; }
  .platform-icon-wrap { width:48px; height:48px; border-radius:13px; display:flex; align-items:center; justify-content:center; font-size:1.4rem; flex-shrink:0; }
  .platform-name { font-family:'Cinzel',serif; font-size:0.85rem; letter-spacing:0.06em; color:var(--ink); margin-bottom:0.15rem; }
  .platform-handle { font-size:0.72rem; color:var(--muted); }
  .platform-desc { padding:0 1.4rem 0.8rem; font-size:0.8rem; color:var(--muted); line-height:1.7; }
  .platform-features { padding:0.75rem 1.4rem; border-top:1px solid var(--border); background:var(--cream); display:flex; flex-wrap:wrap; gap:0.35rem; }
  .platform-feat { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.08em; padding:0.2rem 0.55rem; border-radius:20px; border:1px solid var(--border); background:white; color:var(--muted); }
  .platform-cta { padding:0.8rem 1.4rem; display:flex; align-items:center; justify-content:space-between; border-top:1px solid var(--border); font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.1em; color:white; }
  /* Schedule */
  .schedule-list { display:grid; gap:0.75rem; margin-bottom:2.5rem; }
  .schedule-item { background:white; border-radius:14px; padding:1.1rem 1.5rem; display:grid; grid-template-columns:auto 1fr auto; gap:1rem; align-items:center; border:1px solid var(--border); box-shadow:var(--shadow); transition:all 0.18s; }
  .schedule-item:hover { transform:translateX(4px); box-shadow:var(--shadow-lg); }
  .schedule-type-dot { width:12px; height:12px; border-radius:50%; flex-shrink:0; }
  .schedule-day { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.12em; color:var(--gold); margin-bottom:0.18rem; }
  .schedule-time { font-family:'Cinzel',serif; font-size:1rem; color:var(--ink); margin-bottom:0.25rem; font-weight:600; }
  .schedule-title { font-size:0.84rem; color:var(--muted); }
  .schedule-platforms { display:flex; gap:0.35rem; flex-wrap:wrap; }
  .schedule-platform-tag { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.08em; padding:0.2rem 0.55rem; border-radius:20px; border:1px solid var(--border); background:var(--cream); color:var(--muted); }
  /* Embed player */
  .live-embed { border-radius:18px; overflow:hidden; background:#000; aspect-ratio:16/9; width:100%; display:flex; align-items:center; justify-content:center; margin-bottom:2rem; }
  .live-embed iframe { width:100%; height:100%; border:0; }
  /* Mega chat */
  .mega-chat-wrap { background:var(--deep); border-radius:18px; overflow:hidden; box-shadow:var(--shadow-lg); display:flex; flex-direction:column; height:480px; }
  .mega-chat-header { padding:1rem 1.25rem; border-bottom:1px solid rgba(196,137,58,0.25); display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
  .mega-chat-title { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.16em; color:var(--gold-light); display:flex; align-items:center; gap:0.55rem; }
  .mega-chat-messages { flex:1; overflow-y:auto; padding:1rem; display:flex; flex-direction:column; gap:0.6rem; scrollbar-width:thin; scrollbar-color:rgba(196,137,58,0.3) transparent; }
  .chat-msg { display:flex; gap:0.65rem; align-items:flex-start; }
  .chat-avatar { width:28px; height:28px; border-radius:50%; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:0.8rem; font-weight:700; color:white; font-family:'Cinzel',serif; }
  .chat-bubble { background:rgba(250,246,238,0.07); border-radius:10px; padding:0.55rem 0.8rem; flex:1; }
  .chat-name { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.1em; margin-bottom:0.2rem; }
  .chat-text { font-size:0.82rem; color:rgba(250,246,238,0.75); line-height:1.55; }
  .chat-time { font-size:0.6rem; color:rgba(250,246,238,0.3); margin-top:0.18rem; }
  .chat-input-row { padding:0.85rem 1rem; border-top:1px solid rgba(196,137,58,0.2); display:flex; gap:0.6rem; flex-shrink:0; }
  .chat-input { flex:1; background:rgba(250,246,238,0.08); border:1px solid rgba(196,137,58,0.25); border-radius:9px; padding:0.6rem 0.9rem; color:var(--parchment); font-family:'Libre Baskerville',serif; font-size:0.84rem; outline:none; }
  .chat-input::placeholder { color:rgba(250,246,238,0.3); }
  .chat-input:focus { border-color:var(--gold); }
  .chat-send { padding:0.6rem 1rem; border-radius:9px; background:var(--gold); border:none; cursor:pointer; font-family:'Cinzel',serif; font-size:0.7rem; letter-spacing:0.1em; color:white; transition:background 0.18s; flex-shrink:0; }
  .chat-send:hover { background:var(--gold-light); }
  @media(max-width:800px) { .schedule-item{grid-template-columns:1fr;} }

  /* ── HOMEPAGE LIVE BANNER ── */
  .live-banner { background:linear-gradient(90deg,#1A0A0A 0%,#2A0D0D 50%,#1A0A0A 100%); border-radius:16px; padding:1.1rem 1.6rem; margin-bottom:2rem; display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; border:1px solid rgba(255,80,80,0.2); }
  .live-banner-left { display:flex; align-items:center; gap:0.9rem; }
  .live-banner-dot { width:10px; height:10px; border-radius:50%; background:#FF4444; animation:livePulse 1.5s infinite; flex-shrink:0; }
  .live-banner-label { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.2em; color:#FF8C8C; margin-bottom:0.18rem; }
  .live-banner-title { font-family:'Cinzel',serif; font-size:0.88rem; color:white; }
  .live-banner-time { font-size:0.78rem; color:rgba(255,255,255,0.5); margin-top:0.12rem; }
  .live-banner-btn { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.12em; padding:0.62rem 1.2rem; border-radius:9px; background:#FF4444; color:white; border:none; cursor:pointer; transition:background 0.18s; white-space:nowrap; flex-shrink:0; }
  .live-banner-btn:hover { background:#FF6666; }
  .live-banner-platforms { display:flex; gap:0.4rem; flex-wrap:wrap; }
  .live-banner-platform { font-size:0.7rem; color:rgba(255,255,255,0.45); font-family:'Cinzel',serif; font-size:0.6rem; }

  /* ── ENHANCED STUDY CARD ── */
  .study-expanded { background:var(--cream); border-top:1px solid var(--border); padding:1.4rem 1.6rem; }
  .study-section-label { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.18em; color:var(--gold); margin-bottom:0.5rem; margin-top:1.1rem; display:flex; align-items:center; gap:0.5rem; }
  .study-section-label:first-child { margin-top:0; }
  .study-section-label::after { content:''; flex:1; height:1px; background:var(--border); }
  .study-teaching { background:var(--deep); color:var(--parchment); border-radius:11px; padding:1rem 1.25rem; font-family:'Cormorant Garamond',serif; font-size:1.1rem; font-style:italic; line-height:1.72; border-left:4px solid var(--gold); margin-bottom:0; }
  .study-reflection { background:white; border-radius:11px; padding:0.9rem 1.1rem; font-size:0.88rem; color:var(--ink); line-height:1.78; border-left:3px solid var(--rust); }
  .study-assignment { background:white; border-radius:11px; padding:0.9rem 1.1rem; font-size:0.88rem; color:var(--ink); line-height:1.78; border-left:3px solid var(--sage); }
  .study-action { background:var(--gold); border-radius:11px; padding:0.9rem 1.1rem; font-size:0.88rem; color:white; line-height:1.78; font-weight:600; }
  /* Shabbat class flow */
  .shabbat-flow { display:grid; grid-template-columns:repeat(3,1fr); gap:0.5rem; margin-top:0; }
  .shabbat-step { background:white; border-radius:10px; padding:0.7rem 0.85rem; display:flex; align-items:center; gap:0.6rem; border:1px solid var(--border); }
  .shabbat-step-icon { font-size:1.1rem; flex-shrink:0; }
  .shabbat-step-num { font-family:'Cinzel',serif; font-size:0.55rem; letter-spacing:0.1em; color:var(--muted); margin-bottom:0.1rem; }
  .shabbat-step-label { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.04em; color:var(--ink); line-height:1.3; }
  .shabbat-step-time { font-size:0.62rem; color:var(--muted); }
  .study-expand-btn { display:flex; align-items:center; gap:0.5rem; font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.1em; background:none; border:none; cursor:pointer; color:var(--gold); padding:0.75rem 1.6rem; width:100%; background:white; border-top:1px solid var(--border); transition:background 0.15s; }
  .study-expand-btn:hover { background:var(--gold-pale); }
  @media(max-width:650px) { .shabbat-flow{grid-template-columns:1fr 1fr;} }

  /* ── LIVE STREAM LAYOUT ── */
  .live-stream-layout { display:grid; grid-template-columns:1fr 360px; gap:1.25rem; align-items:start; margin-bottom:2rem; }
  @media(max-width:900px) { .live-stream-layout{grid-template-columns:1fr;} }

  /* ── FEAST CALENDAR ── */
  .feast-section { margin:2.5rem 0; }
  .feast-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:1rem; }
  .feast-card { background:white; border-radius:18px; overflow:hidden; box-shadow:var(--shadow); transition:all 0.22s; cursor:pointer; border:1px solid var(--border); }
  .feast-card:hover { box-shadow:var(--shadow-lg); transform:translateY(-3px); }
  .feast-card-top { padding:1.1rem 1.35rem 0.9rem; display:flex; align-items:flex-start; gap:0.9rem; }
  .feast-icon-wrap { width:48px; height:48px; border-radius:14px; display:flex; align-items:center; justify-content:center; font-size:1.5rem; flex-shrink:0; }
  .feast-name { font-family:'Cinzel',serif; font-size:0.85rem; letter-spacing:0.05em; color:var(--ink); margin-bottom:0.15rem; }
  .feast-hebrew { font-size:1rem; color:var(--muted); font-family:'Cormorant Garamond',serif; font-style:italic; }
  .feast-scripture { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.1em; color:var(--muted); margin-top:0.2rem; }
  .feast-countdown { margin:0 1.35rem 0.85rem; padding:0.75rem 1rem; border-radius:11px; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:0.5rem; }
  .feast-countdown-units { display:flex; gap:0.6rem; align-items:baseline; }
  .feast-count-num { font-family:'Cinzel',serif; font-size:1.4rem; font-weight:700; line-height:1; color:white; }
  .feast-count-label { font-family:'Cinzel',serif; font-size:0.52rem; letter-spacing:0.1em; color:rgba(255,255,255,0.6); display:block; margin-top:0.15rem; text-align:center; }
  .feast-count-unit { display:flex; flex-direction:column; align-items:center; }
  .feast-count-sep { font-size:1rem; opacity:0.4; color:white; align-self:flex-end; margin-bottom:4px; }
  .feast-date-text { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.1em; color:rgba(255,255,255,0.7); }
  .feast-mandatory-badge { font-family:'Cinzel',serif; font-size:0.52rem; letter-spacing:0.12em; padding:0.15rem 0.5rem; border-radius:20px; color:white; border:1px solid rgba(255,255,255,0.3); background:rgba(255,255,255,0.12); }
  .feast-desc { padding:0 1.35rem 0.85rem; font-size:0.8rem; color:var(--muted); line-height:1.72; }
  .feast-card-footer { padding:0.75rem 1.35rem; border-top:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; background:var(--cream); }
  .feast-type-tag { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.12em; padding:0.2rem 0.6rem; border-radius:20px; border:1px solid var(--border); background:white; color:var(--muted); }
  .feast-expanded { border-top:1px solid var(--border); padding:1.25rem 1.35rem; background:var(--cream); }
  .feast-prep-list { list-style:none; padding:0; margin:0; display:grid; gap:0.4rem; }
  .feast-prep-item { font-size:0.82rem; color:var(--ink); padding:0.45rem 0.75rem; background:white; border-radius:8px; border-left:3px solid var(--gold); display:flex; align-items:flex-start; gap:0.5rem; line-height:1.55; }
  .feast-how { background:var(--deep); color:var(--parchment); border-radius:11px; padding:1rem 1.2rem; margin-bottom:0.85rem; font-size:0.84rem; line-height:1.78; border-left:4px solid var(--gold); }
  .sukkot-prep-banner { background:linear-gradient(135deg,#2E5A28,#3D7A35); border-radius:14px; padding:1.1rem 1.5rem; margin-bottom:1rem; display:flex; align-items:center; gap:1rem; flex-wrap:wrap; }
  .sukkot-banner-text { font-size:0.84rem; color:rgba(255,255,255,0.85); line-height:1.65; flex:1; min-width:200px; }
  .sukkot-banner-title { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.14em; color:#A8D5A2; margin-bottom:0.3rem; }
  .shabbat-strip { background:linear-gradient(90deg,#2A1F0E,#3A2A18); border-radius:14px; padding:1rem 1.5rem; display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin-bottom:1rem; border:1px solid rgba(196,137,58,0.25); }
  .feast-filter-bar { display:flex; gap:0.4rem; flex-wrap:wrap; margin-bottom:1.25rem; }
  .feast-filter-btn { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.1em; padding:0.4rem 0.85rem; border-radius:20px; border:1px solid var(--border); background:white; color:var(--muted); cursor:pointer; transition:all 0.18s; }
  .feast-filter-btn.active { background:var(--deep); color:var(--parchment); border-color:var(--deep); }
  /* In-person events */
  .events-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:1rem; margin-bottom:2rem; }
  .event-card { background:white; border-radius:18px; overflow:hidden; box-shadow:var(--shadow); border:1px solid var(--border); transition:all 0.22s; }
  .event-card:hover { box-shadow:var(--shadow-lg); transform:translateY(-2px); }
  .event-card-banner { height:90px; display:flex; align-items:center; justify-content:center; }
  .event-title { font-family:'Cinzel',serif; font-size:0.9rem; letter-spacing:0.04em; color:var(--ink); margin-bottom:0.55rem; line-height:1.35; }
  .event-meta-row { display:flex; align-items:center; gap:0.5rem; font-size:0.78rem; color:var(--muted); margin-bottom:0.35rem; }
  .event-register-btn { width:100%; padding:0.78rem; border-radius:10px; background:var(--gold); color:white; border:none; font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.1em; cursor:pointer; transition:background 0.18s; }
  .event-register-btn:hover { background:var(--gold-light); }
  /* Registration modal */
  .reg-modal-overlay { position:fixed; inset:0; background:rgba(26,18,8,0.75); backdrop-filter:blur(6px); z-index:300; display:flex; align-items:center; justify-content:center; padding:1.5rem; }
  .reg-modal { background:var(--parchment); border-radius:22px; padding:2rem; max-width:480px; width:100%; box-shadow:0 24px 80px rgba(26,18,8,0.35); max-height:90vh; overflow-y:auto; }
  .reg-label { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.12em; color:var(--muted); display:block; margin-bottom:0.4rem; }
  .reg-input { width:100%; padding:0.72rem 0.9rem; border:1.5px solid var(--border); border-radius:9px; font-family:'Libre Baskerville',serif; font-size:0.88rem; background:white; color:var(--ink); outline:none; transition:border-color 0.18s; margin-bottom:0.85rem; }
  .reg-input:focus { border-color:var(--gold); }
  .reg-select { width:100%; padding:0.72rem 0.9rem; border:1.5px solid var(--border); border-radius:9px; font-family:'Libre Baskerville',serif; font-size:0.88rem; background:white; color:var(--ink); outline:none; cursor:pointer; margin-bottom:0.85rem; }
  .form-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:0.9rem; }
  .form-textarea { width:100%; padding:0.72rem 0.9rem; border:1.5px solid var(--border); border-radius:9px; font-family:'Libre Baskerville',serif; font-size:0.86rem; background:white; color:var(--ink); outline:none; resize:vertical; min-height:90px; transition:border-color 0.18s; }
  .form-textarea:focus { border-color:var(--gold); }
  @media(max-width:600px) { .form-grid-2{grid-template-columns:1fr;} .feast-grid{grid-template-columns:1fr;} .events-grid{grid-template-columns:1fr;} }

  /* ── TRIBE SCRIPTURE ACCORDION ── */
  .tribe-accordion-btn { width:100%; padding:0.75rem 1.4rem; background:var(--deep); border:none; cursor:pointer; display:flex; align-items:center; justify-content:space-between; font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.12em; color:var(--gold-light); transition:background 0.18s; }
  .tribe-accordion-btn:hover { background:#3A2A18; }
  .tribe-accordion-content { border-top:1px solid rgba(196,137,58,0.2); }
  .tribe-scripture-section { padding:1rem 1.4rem; border-bottom:1px solid var(--border); }
  .tribe-scripture-section:last-child { border-bottom:none; }
  .tribe-section-label { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.18em; margin-bottom:0.6rem; display:flex; align-items:center; gap:0.45rem; }
  .tribe-section-label::after { content:''; flex:1; height:1px; background:var(--border); }
  .tribe-scripture-item { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.05em; padding:0.38rem 0.7rem; border-radius:7px; margin-bottom:0.3rem; cursor:pointer; transition:all 0.15s; display:inline-block; margin-right:0.35rem; }
  .tribe-scripture-item:hover { transform:translateY(-1px); }
  /* Shared covenant section */
  .covenant-curse-card { background:white; border-radius:14px; padding:1.1rem 1.35rem; border-left:4px solid; margin-bottom:0.75rem; box-shadow:var(--shadow); }
  .covenant-curse-theme { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.14em; margin-bottom:0.4rem; }
  .covenant-curse-ref { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.1em; color:var(--gold); margin-bottom:0.35rem; }
  .covenant-curse-text { font-family:'Cormorant Garamond',serif; font-size:1rem; font-style:italic; color:var(--ink); line-height:1.72; }
  /* Deut28 module */
  .deut28-card { background:white; border-radius:18px; overflow:hidden; box-shadow:var(--shadow); border:1px solid var(--border); transition:all 0.22s; margin-bottom:1rem; }
  .deut28-header { padding:1.25rem 1.6rem; display:flex; align-items:flex-start; gap:1rem; cursor:pointer; transition:background 0.15s; }
  .deut28-header:hover { background:var(--cream); }
  .deut28-icon-wrap { width:48px; height:48px; border-radius:14px; display:flex; align-items:center; justify-content:center; font-size:1.4rem; flex-shrink:0; }
  .deut28-num { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.14em; margin-bottom:0.18rem; }
  .deut28-title { font-family:'Cinzel',serif; font-size:0.9rem; letter-spacing:0.04em; color:var(--ink); margin-bottom:0.18rem; line-height:1.3; }
  .deut28-ref { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.1em; }
  .deut28-body { padding:0 1.6rem 1.6rem; border-top:1px solid var(--border); }
  .deut28-verse-block { background:var(--deep); color:var(--parchment); border-radius:12px; padding:1.1rem 1.35rem; margin:1rem 0; border-left:4px solid var(--gold); font-family:'Cormorant Garamond',serif; font-size:1.1rem; font-style:italic; line-height:1.72; }
  .deut28-related { display:flex; flex-wrap:wrap; gap:0.35rem; margin-bottom:1rem; }
  .deut28-related-tag { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.08em; padding:0.25rem 0.65rem; border-radius:20px; border:1px solid var(--border); background:var(--cream); color:var(--muted); cursor:pointer; transition:all 0.15s; }
  .deut28-related-tag:hover { background:var(--gold); color:white; border-color:var(--gold); }
  .deut28-discussion-item { font-size:0.84rem; color:var(--ink); padding:0.45rem 0.75rem 0.45rem 1rem; border-left:3px solid var(--gold); background:var(--cream); border-radius:0 8px 8px 0; margin-bottom:0.4rem; line-height:1.6; }
  .deut28-hist { background:rgba(27,58,92,0.05); border-radius:12px; padding:1rem 1.25rem; border-left:3px solid #1B3A5C; font-size:0.83rem; color:var(--ink); line-height:1.8; margin-bottom:0.85rem; }
  .deut28-anchor { background:var(--gold); color:white; border-radius:9px; padding:0.6rem 1rem; font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.1em; display:inline-flex; align-items:center; gap:0.45rem; }
  /* Historical context */
  .hist-entry { background:white; border-radius:18px; overflow:hidden; box-shadow:var(--shadow); border:1px solid var(--border); margin-bottom:1.5rem; }
  .hist-entry-header { padding:1.5rem 1.75rem; border-bottom:1px solid var(--border); }
  .hist-era { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.18em; margin-bottom:0.4rem; }
  .hist-title { font-family:'Cinzel',serif; font-size:1.1rem; letter-spacing:0.04em; color:var(--ink); margin-bottom:0.25rem; line-height:1.3; }
  .hist-sub { font-size:0.82rem; color:var(--muted); }
  .hist-timeline { padding:1.25rem 1.75rem; border-bottom:1px solid var(--border); }
  .hist-event-row { display:flex; gap:1rem; align-items:flex-start; margin-bottom:0.85rem; }
  .hist-event-row:last-child { margin-bottom:0; }
  .hist-year-badge { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.1em; padding:0.25rem 0.7rem; border-radius:20px; color:white; flex-shrink:0; margin-top:2px; }
  .hist-event-label { font-family:'Cinzel',serif; font-size:0.75rem; letter-spacing:0.04em; color:var(--ink); margin-bottom:0.25rem; }
  .hist-event-desc { font-size:0.82rem; color:var(--muted); line-height:1.72; }
  .hist-note { padding:1.1rem 1.75rem; background:rgba(27,58,92,0.04); border-bottom:1px solid var(--border); border-left:4px solid #1B3A5C; font-size:0.83rem; color:var(--ink); line-height:1.8; }
  .hist-important { padding:0.85rem 1.75rem; background:rgba(201,125,26,0.06); border-bottom:1px solid var(--border); border-left:4px solid var(--gold); font-size:0.8rem; color:var(--ink); line-height:1.75; }
  .hist-scriptures { padding:1rem 1.75rem; display:flex; flex-wrap:wrap; gap:0.4rem; border-bottom:1px solid var(--border); }
  .hist-discussion { padding:1rem 1.75rem; }
  .hist-discussion-item { font-size:0.82rem; color:var(--muted); padding:0.4rem 0; border-bottom:1px solid var(--border); line-height:1.65; display:flex; align-items:flex-start; gap:0.55rem; }
  .hist-discussion-item:last-child { border-bottom:none; }

  /* ── RESOURCE LINKS ── */
  .resource-links-section { padding:0.9rem 1.1rem; border-top:1px solid var(--border); background:rgba(27,58,92,0.03); }
  .resource-links-title { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.18em; color:#1B3A5C; margin-bottom:0.6rem; display:flex; align-items:center; gap:0.45rem; }
  .resource-link-item { display:flex; align-items:flex-start; gap:0.6rem; padding:0.45rem 0; border-bottom:1px solid var(--border); }
  .resource-link-item:last-child { border-bottom:none; }
  .resource-link-badge { font-family:'Cinzel',serif; font-size:0.52rem; letter-spacing:0.1em; padding:0.15rem 0.45rem; border-radius:20px; flex-shrink:0; white-space:nowrap; }
  .resource-link-label { font-size:0.78rem; color:var(--gold); text-decoration:none; font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.04em; transition:color 0.15s; }
  .resource-link-label:hover { color:var(--rust); text-decoration:underline; }
  .resource-link-desc { font-size:0.72rem; color:var(--muted); margin-top:0.12rem; }

  /* ── DAILY PRAYER / DEVOTIONAL ── */
  .daily-card { background:var(--deep); border-radius:18px; padding:1.5rem 1.75rem; margin-bottom:1.25rem; color:var(--parchment); position:relative; overflow:hidden; }
  .daily-card::before { content:''; position:absolute; top:0; right:0; width:200px; height:200px; background:radial-gradient(circle,rgba(196,137,58,0.15) 0%,transparent 70%); pointer-events:none; }
  .daily-card-eyebrow { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.2em; color:var(--gold-light); margin-bottom:0.45rem; }
  .daily-card-title { font-family:'Cinzel',serif; font-size:1rem; letter-spacing:0.04em; color:var(--parchment); margin-bottom:0.25rem; }
  .daily-card-anchor { font-family:'Cormorant Garamond',serif; font-size:0.88rem; font-style:italic; color:rgba(250,246,238,0.55); margin-bottom:0.85rem; }
  .daily-card-text { font-size:0.86rem; color:rgba(250,246,238,0.75); line-height:1.82; margin-bottom:1rem; }
  .daily-card-actions { display:flex; gap:0.6rem; flex-wrap:wrap; }
  .copy-btn { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.1em; padding:0.45rem 0.85rem; border-radius:8px; background:rgba(196,137,58,0.2); border:1px solid rgba(196,137,58,0.35); color:var(--gold-light); cursor:pointer; transition:all 0.18s; display:flex; align-items:center; gap:0.35rem; }
  .copy-btn:hover { background:rgba(196,137,58,0.35); }
  .copy-btn.copied { background:rgba(90,122,82,0.25); border-color:rgba(90,122,82,0.4); color:#A8D5A2; }

  /* ── VERSE EXPLAINER ── */
  .verse-explain-btn { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.1em; padding:0.28rem 0.65rem; border-radius:20px; background:rgba(123,94,167,0.1); border:1px solid rgba(123,94,167,0.3); color:#7B5EA7; cursor:pointer; transition:all 0.18s; margin-left:0.5rem; }
  .verse-explain-btn:hover { background:rgba(123,94,167,0.2); }
  .verse-explain-panel { background:rgba(123,94,167,0.08); border:1px solid rgba(123,94,167,0.25); border-radius:10px; padding:0.85rem 1rem; margin-top:0.5rem; font-size:0.84rem; color:var(--ink); line-height:1.78; }
  .verse-explain-label { font-family:'Cinzel',serif; font-size:0.55rem; letter-spacing:0.16em; color:#7B5EA7; margin-bottom:0.35rem; }

  /* ── DIASPORA FLOW ── */
  .diaspora-flow-item { background:white; border-radius:14px; border-left:4px solid; padding:1rem 1.25rem; margin-bottom:0.65rem; box-shadow:var(--shadow); }
  .diaspora-flow-label { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.14em; margin-bottom:0.35rem; }
  .diaspora-flow-summary { font-size:0.85rem; color:var(--ink); line-height:1.72; margin-bottom:0.55rem; }
  .diaspora-flow-note { font-size:0.8rem; color:var(--muted); line-height:1.75; background:var(--cream); border-radius:8px; padding:0.6rem 0.8rem; margin-top:0.5rem; }

  /* ── WOMEN LAWS ── */
  .women-law-card { background:white; border-radius:16px; overflow:hidden; box-shadow:var(--shadow); border:1px solid var(--border); margin-bottom:1rem; }
  .women-law-header { padding:1.1rem 1.4rem; display:flex; align-items:center; justify-content:space-between; cursor:pointer; transition:background 0.15s; }
  .women-law-header:hover { background:var(--cream); }
  .women-law-section { padding:0.85rem 1.1rem; border-bottom:1px solid var(--border); background:rgba(107,26,74,0.03); cursor:pointer; }
  .women-law-section:last-child { border-bottom:none; }
  .women-law-section:hover { background:rgba(107,26,74,0.06); }
  .women-law-section-title { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.06em; margin-bottom:0.2rem; }
  .women-law-scripture { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.1em; color:var(--muted); }
  .women-law-note { font-size:0.84rem; color:var(--ink); line-height:1.8; padding:0.85rem 1.1rem; background:white; border-top:1px solid var(--border); }

  /* ── PRAYER REQUEST ── */
  .prayer-req-form { background:var(--deep); border-radius:16px; padding:1.5rem 1.75rem; margin-top:1.5rem; }
  .prayer-req-title { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.16em; color:var(--gold-light); margin-bottom:0.35rem; }
  .prayer-req-sub { font-size:0.8rem; color:rgba(250,246,238,0.55); margin-bottom:1rem; line-height:1.65; }
  .prayer-req-textarea { width:100%; background:rgba(250,246,238,0.07); border:1px solid rgba(196,137,58,0.25); border-radius:10px; padding:0.75rem 0.9rem; color:var(--parchment); font-family:'Libre Baskerville',serif; font-size:0.84rem; resize:vertical; min-height:80px; outline:none; }
  .prayer-req-textarea::placeholder { color:rgba(250,246,238,0.3); }
  .prayer-req-textarea:focus { border-color:var(--gold); }

  /* ── STICKY BOTTOM NAV ── */
  .sticky-bottom-nav { position:fixed; bottom:0; left:0; right:0; z-index:150; background:rgba(250,246,238,0.97); backdrop-filter:blur(14px); border-top:1px solid var(--border); display:flex; align-items:stretch; box-shadow:0 -4px 20px rgba(26,18,8,0.1); }
  .sticky-nav-item { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:0.6rem 0.3rem 0.5rem; border:none; background:transparent; cursor:pointer; transition:all 0.18s; text-decoration:none; gap:0.2rem; min-width:0; }
  .sticky-nav-item:hover { background:var(--gold-pale); }
  .sticky-nav-item.active { background:var(--gold-pale); }
  .sticky-nav-icon { font-size:1.2rem; line-height:1; }
  .sticky-nav-label { font-family:'Cinzel',serif; font-size:0.52rem; letter-spacing:0.08em; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; text-align:center; }
  .sticky-nav-item.active .sticky-nav-label { color:var(--gold); }
  .sticky-nav-dot { width:4px; height:4px; border-radius:50%; background:var(--gold); margin:0 auto; }
  /* push main content up when sticky nav present */
  .main-with-sticky { padding-bottom:72px !important; }
  @media(min-width:900px) { .sticky-bottom-nav{display:none;} .main-with-sticky{padding-bottom:5rem !important;} }

  /* ── HOMEPAGE DASHBOARD ── */
  .home-search-bar { display:flex; gap:0.6rem; margin-bottom:1.5rem; }
  .home-search-input { flex:1; padding:0.82rem 1rem 0.82rem 2.8rem; border:1.5px solid var(--border); border-radius:12px; font-family:'Libre Baskerville',serif; font-size:0.88rem; background:white; color:var(--ink); outline:none; transition:border-color 0.2s; }
  .home-search-input:focus { border-color:var(--gold); }
  .home-search-icon { position:absolute; left:0.9rem; top:50%; transform:translateY(-50%); color:var(--muted); font-size:0.9rem; pointer-events:none; }
  .quick-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:0.6rem; margin-bottom:1.5rem; }
  .quick-tile { background:white; border:1px solid var(--border); border-radius:14px; padding:0.85rem 0.5rem; display:flex; flex-direction:column; align-items:center; gap:0.35rem; cursor:pointer; transition:all 0.18s; box-shadow:var(--shadow); }
  .quick-tile:hover { background:var(--deep); transform:translateY(-2px); box-shadow:var(--shadow-lg); }
  .quick-tile:hover .quick-tile-label { color:var(--gold-light); }
  .quick-tile-icon { font-size:1.5rem; line-height:1; }
  .quick-tile-label { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.1em; color:var(--muted); text-align:center; line-height:1.3; }
  .home-section-divider { display:flex; align-items:center; gap:0.75rem; margin:1.5rem 0 1.1rem; }
  .home-section-divider::before,.home-section-divider::after { content:''; flex:1; height:1px; background:var(--border); }
  .home-section-title { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.2em; color:var(--muted); white-space:nowrap; }
  .progress-row { display:flex; gap:0.65rem; margin-bottom:1.25rem; }
  .progress-pill { flex:1; background:white; border:1px solid var(--border); border-radius:12px; padding:0.75rem 0.85rem; display:flex; align-items:center; gap:0.6rem; cursor:pointer; transition:all 0.18s; box-shadow:var(--shadow); }
  .progress-pill:hover { border-color:var(--gold); transform:translateY(-1px); }
  .progress-pill-icon { font-size:1.1rem; flex-shrink:0; }
  .progress-pill-label { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.1em; color:var(--muted); line-height:1.3; }
  .progress-pill-title { font-family:'Cinzel',serif; font-size:0.72rem; color:var(--ink); line-height:1.2; }
  .feature-tile-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:0.75rem; margin-bottom:1.5rem; }
  .feature-tile { background:white; border:1px solid var(--border); border-radius:16px; padding:1.1rem; cursor:pointer; transition:all 0.22s; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:0.45rem; }
  .feature-tile:hover { box-shadow:var(--shadow-lg); transform:translateY(-3px); border-color:var(--gold); }
  .feature-tile-icon { font-size:1.6rem; }
  .feature-tile-title { font-family:'Cinzel',serif; font-size:0.78rem; letter-spacing:0.04em; color:var(--ink); line-height:1.3; }
  .feature-tile-sub { font-size:0.72rem; color:var(--muted); line-height:1.5; }
  @media(max-width:500px) { .quick-grid{grid-template-columns:repeat(3,1fr);} .feature-tile-grid{grid-template-columns:1fr 1fr;} }

  /* ── SCRIPTURE BUTTON ── */
  .scripture-btn { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.08em; padding:0.28rem 0.72rem; border-radius:20px; background:rgba(196,137,58,0.1); border:1px solid rgba(196,137,58,0.35); color:var(--gold); cursor:pointer; transition:all 0.15s; display:inline-flex; align-items:center; gap:0.28rem; }
  .scripture-btn:hover { background:var(--gold); color:white; border-color:var(--gold); }

  .fade-up { animation:fadeUp 0.48s ease both; }
  .delay-1 { animation-delay:0.08s; } .delay-2 { animation-delay:0.16s; } .delay-3 { animation-delay:0.24s; }
  .tag { display:inline-flex; align-items:center; font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.1em; padding:0.22rem 0.6rem; border-radius:20px; border:1px solid var(--border); background:var(--cream); color:var(--muted); margin-right:0.3rem; margin-bottom:0.3rem; cursor:pointer; transition:all 0.16s; }
  .tag:hover,.tag.active { background:var(--gold); color:white; border-color:var(--gold); }
  .no-results { text-align:center; padding:2.5rem 1rem; }
  .no-results-icon { font-size:2.5rem; margin-bottom:0.75rem; }
  .no-results-text { font-family:'Cinzel',serif; font-size:0.82rem; letter-spacing:0.1em; color:var(--muted); }

  /* MISC */
  .misc-placeholder { text-align:center; padding:4rem 1rem; color:var(--muted); font-style:italic; }

  /* ── ANCIENT ISRAEL: SHARED ── */
  .ai-section-hero { background:linear-gradient(135deg,#0D2035 0%,#1B3A5C 60%,#2A4A6C 100%); border-radius:22px; padding:3rem 2.5rem; margin-bottom:2.5rem; color:#F5EED8; position:relative; overflow:hidden; }
  .ai-section-hero::before { content:''; position:absolute; top:0; right:0; width:300px; height:300px; background:radial-gradient(circle,rgba(201,125,26,0.18) 0%,transparent 70%); pointer-events:none; }
  .ai-eyebrow { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.28em; color:#C97D1A; margin-bottom:0.8rem; }
  .ai-hero-h1 { font-family:'Cinzel',serif; font-size:clamp(1.6rem,4vw,2.8rem); font-weight:700; color:#F5EED8; margin-bottom:0.75rem; line-height:1.15; }
  .ai-hero-sub { font-size:0.9rem; color:rgba(245,238,216,0.7); line-height:1.82; max-width:500px; }

  /* ── BIBLE READER ── */
  .br-layout { display:grid; grid-template-columns:220px 1fr 260px; gap:1.1rem; align-items:start; }
  .br-sidebar { background:white; border:1px solid var(--border); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); }
  .br-sidebar-title { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.18em; padding:0.85rem 1.1rem; border-bottom:1px solid var(--border); color:var(--gold); background:var(--cream); }
  .br-book-btn { padding:0.6rem 1.1rem; width:100%; text-align:left; border:none; border-bottom:1px solid var(--border); background:transparent; cursor:pointer; font-size:0.82rem; color:var(--ink); transition:background 0.15s; }
  .br-book-btn:last-child { border-bottom:none; }
  .br-book-btn:hover { background:var(--gold-pale); }
  .br-book-btn.active { background:#1B3A5C; color:#F5EED8; }
  .br-chapter-bar { display:flex; flex-wrap:wrap; gap:0.35rem; padding:0.85rem 1.1rem; border-bottom:1px solid var(--border); background:var(--cream); }
  .br-ch-btn { width:34px; height:34px; border-radius:7px; border:1px solid var(--border); background:white; font-family:'Cinzel',serif; font-size:0.72rem; cursor:pointer; transition:all 0.15s; color:var(--ink); }
  .br-ch-btn:hover { background:#C97D1A; color:white; border-color:#C97D1A; }
  .br-ch-btn.active { background:#1B3A5C; color:white; border-color:#1B3A5C; }
  .br-main { background:white; border:1px solid var(--border); border-radius:14px; padding:2rem; box-shadow:var(--shadow); min-height:500px; }
  .br-ref-header { display:flex; align-items:baseline; gap:0.9rem; margin-bottom:1.4rem; padding-bottom:1rem; border-bottom:2px solid #1B3A5C22; }
  .br-book-title { font-family:'Cinzel',serif; font-size:1.4rem; color:#1B3A5C; }
  .br-chapter-num { font-family:'Cormorant Garamond',serif; font-size:1rem; color:var(--muted); font-style:italic; }
  .br-verse { display:flex; gap:0.7rem; margin-bottom:0.9rem; padding:0.55rem 0.75rem; border-radius:9px; cursor:pointer; transition:background 0.15s; }
  .br-verse:hover { background:rgba(201,125,26,0.07); }
  .br-verse.highlighted { background:rgba(201,125,26,0.14); border-left:3px solid #C97D1A; padding-left:calc(0.75rem - 3px); }
  .br-verse.bookmarked { background:rgba(27,58,92,0.08); border-left:3px solid #1B3A5C; padding-left:calc(0.75rem - 3px); }
  .br-vnum { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.08em; color:#C97D1A; min-width:22px; flex-shrink:0; margin-top:0.28rem; }
  .br-vtext { font-family:'Libre Baskerville',serif; font-size:0.94rem; line-height:1.9; color:var(--ink); }
  .br-xref-panel { background:white; border:1px solid var(--border); border-radius:14px; padding:1.25rem; box-shadow:var(--shadow); }
  .br-xref-title { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.18em; color:#B5451B; margin-bottom:1rem; }
  .br-xref-item { padding:0.75rem; border-radius:9px; border:1px solid var(--border); background:var(--cream); margin-bottom:0.55rem; cursor:pointer; transition:all 0.15s; }
  .br-xref-item:hover { border-color:#1B3A5C; background:rgba(27,58,92,0.05); }
  .br-xref-ref { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.1em; color:#1B3A5C; margin-bottom:0.2rem; }
  .br-xref-text { font-size:0.76rem; color:var(--muted); line-height:1.65; font-style:italic; }
  .br-search-bar { display:flex; gap:0.6rem; margin-bottom:1.1rem; }
  .br-search-input { flex:1; padding:0.72rem 1rem; border:1.5px solid var(--border); border-radius:9px; font-family:'Libre Baskerville',serif; font-size:0.86rem; background:white; color:var(--ink); outline:none; }
  .br-search-input:focus { border-color:#1B3A5C; }
  .br-bookmark-bar { display:flex; gap:0.45rem; margin-bottom:1.25rem; flex-wrap:wrap; }
  @media(max-width:960px) { .br-layout{grid-template-columns:1fr;} .br-xref-panel{display:none;} }

  /* ── ARTICLES ── */
  .articles-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:1.1rem; margin-bottom:2rem; }
  .article-card { background:white; border:1px solid var(--border); border-radius:16px; overflow:hidden; box-shadow:var(--shadow); cursor:pointer; transition:all 0.22s; }
  .article-card:hover { box-shadow:var(--shadow-lg); transform:translateY(-3px); }
  .article-thumb { height:148px; position:relative; overflow:hidden; }
  .article-thumb-inner { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:3.5rem; }
  .article-body { padding:1.2rem 1.4rem 1.4rem; }
  .article-tags { display:flex; flex-wrap:wrap; gap:0.3rem; margin-bottom:0.65rem; }
  .article-tag { font-family:'Cinzel',serif; font-size:0.56rem; letter-spacing:0.12em; padding:0.18rem 0.55rem; border-radius:20px; color:white; }
  .article-title { font-family:'Cinzel',serif; font-size:0.88rem; letter-spacing:0.03em; color:var(--ink); line-height:1.4; margin-bottom:0.45rem; }
  .article-meta { font-size:0.75rem; color:var(--muted); }
  .article-excerpt { font-size:0.8rem; color:var(--muted); line-height:1.72; margin-top:0.55rem; }
  .article-filter-bar { display:flex; gap:0.4rem; flex-wrap:wrap; margin-bottom:1.5rem; }
  .art-filter-btn { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.1em; padding:0.42rem 0.9rem; border-radius:20px; border:1px solid var(--border); background:white; color:var(--muted); cursor:pointer; transition:all 0.18s; }
  .art-filter-btn.active { background:#1B3A5C; color:#F5EED8; border-color:#1B3A5C; }
  /* Article Full Read */
  .article-full { display:grid; grid-template-columns:1fr 280px; gap:1.5rem; align-items:start; }
  .article-full-main { background:white; border:1px solid var(--border); border-radius:16px; padding:2.25rem; box-shadow:var(--shadow); }
  .article-full-sidebar { background:white; border:1px solid var(--border); border-radius:14px; padding:1.4rem; box-shadow:var(--shadow); }
  .article-full-h1 { font-family:'Cinzel',serif; font-size:clamp(1.2rem,3vw,1.9rem); color:#1B3A5C; line-height:1.3; margin-bottom:0.7rem; }
  .article-full-meta { font-size:0.8rem; color:var(--muted); margin-bottom:1.5rem; padding-bottom:1rem; border-bottom:1px solid var(--border); }
  .article-full-body { font-size:0.92rem; line-height:1.95; color:var(--ink); }
  .article-full-body p { margin-bottom:1.1rem; }
  .article-scripture { background:#0D2035; color:#F5EED8; border-radius:11px; padding:1.1rem 1.4rem; margin:1.25rem 0; border-left:4px solid #C97D1A; font-family:'Cormorant Garamond',serif; font-size:1.1rem; font-style:italic; line-height:1.72; }
  .article-scripture-ref { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.1em; color:#C97D1A; margin-top:0.45rem; font-style:normal; }
  .sidebar-section-title { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.18em; color:#B5451B; margin-bottom:0.75rem; }
  .sidebar-ref-item { font-size:0.8rem; padding:0.55rem 0; border-bottom:1px solid var(--border); color:var(--ink); cursor:pointer; }
  .sidebar-ref-item:hover { color:#1B3A5C; }
  .sidebar-ref-item:last-child { border-bottom:none; }
  @media(max-width:780px) { .article-full{grid-template-columns:1fr;} .article-full-sidebar{display:none;} }

  /* ── STUDY GUIDE ── */
  .study-guide-grid { display:grid; grid-template-columns:260px 1fr; gap:1.25rem; align-items:start; }
  .lesson-list { background:white; border:1px solid var(--border); border-radius:14px; overflow:hidden; box-shadow:var(--shadow); }
  .lesson-item { padding:0.85rem 1.1rem; border-bottom:1px solid var(--border); cursor:pointer; transition:all 0.18s; display:flex; align-items:center; gap:0.75rem; background:transparent; border-left:none; border-right:none; border-top:none; width:100%; text-align:left; }
  .lesson-item:last-child { border-bottom:none; }
  .lesson-item:hover { background:var(--gold-pale); }
  .lesson-item.active { background:#1B3A5C; color:#F5EED8; }
  .lesson-num { width:28px; height:28px; border-radius:50%; background:rgba(201,125,26,0.15); font-family:'Cinzel',serif; font-size:0.68rem; display:flex; align-items:center; justify-content:center; color:#C97D1A; flex-shrink:0; }
  .lesson-item.active .lesson-num { background:rgba(245,238,216,0.2); color:#F5EED8; }
  .lesson-item.completed .lesson-num { background:#2A9D8F; color:white; }
  .lesson-meta { flex:1; min-width:0; }
  .lesson-meta-title { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.04em; line-height:1.3; }
  .lesson-meta-period { font-size:0.68rem; color:var(--muted); margin-top:0.1rem; }
  .lesson-item.active .lesson-meta-period { color:rgba(245,238,216,0.6); }
  .lesson-check { font-size:0.85rem; color:#2A9D8F; flex-shrink:0; }
  .lesson-main { background:white; border:1px solid var(--border); border-radius:14px; padding:2rem; box-shadow:var(--shadow); }
  .lesson-overview { font-size:0.9rem; color:var(--muted); line-height:1.9; margin-bottom:1.75rem; padding-bottom:1.5rem; border-bottom:1px solid var(--border); }
  .lesson-scripture-block { background:var(--cream); border-radius:12px; padding:1rem 1.25rem; margin-bottom:0.75rem; border-left:3px solid #C97D1A; }
  .lesson-scr-ref { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.1em; color:#C97D1A; margin-bottom:0.4rem; }
  .lesson-scr-text { font-family:'Cormorant Garamond',serif; font-size:1.05rem; font-style:italic; color:var(--ink); line-height:1.72; }
  .lesson-timeline { margin:1.75rem 0; }
  .timeline-row { display:flex; gap:0.9rem; align-items:flex-start; margin-bottom:0.65rem; }
  .timeline-dot { width:12px; height:12px; border-radius:50%; background:#C97D1A; flex-shrink:0; margin-top:4px; }
  .timeline-date { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.08em; color:#B5451B; min-width:80px; flex-shrink:0; }
  .timeline-event { font-size:0.85rem; color:var(--ink); line-height:1.65; }
  .lesson-arch { background:#0D2035; border-radius:12px; padding:1.25rem 1.5rem; margin:1.5rem 0; }
  .lesson-arch-title { font-family:'Cinzel',serif; font-size:0.65rem; letter-spacing:0.18em; color:#C97D1A; margin-bottom:0.65rem; }
  .lesson-arch-text { font-size:0.84rem; color:rgba(245,238,216,0.75); line-height:1.8; }
  /* Quiz */
  .quiz-section { background:var(--cream); border:1px solid var(--border); border-radius:14px; padding:1.5rem; margin-top:2rem; }
  .quiz-title { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.16em; color:#1B3A5C; margin-bottom:1.25rem; }
  .quiz-question { margin-bottom:1.25rem; }
  .quiz-q-text { font-size:0.88rem; font-weight:700; margin-bottom:0.65rem; color:var(--ink); }
  .quiz-option { display:block; padding:0.6rem 0.85rem; border-radius:8px; border:1px solid var(--border); background:white; margin-bottom:0.38rem; cursor:pointer; font-size:0.84rem; color:var(--ink); transition:all 0.15s; width:100%; text-align:left; }
  .quiz-option:hover { border-color:#1B3A5C; background:rgba(27,58,92,0.05); }
  .quiz-option.correct { background:#2A9D8F22; border-color:#2A9D8F; color:#1A6B62; }
  .quiz-option.wrong { background:#B5451B18; border-color:#B5451B; color:#7A2A10; }
  .quiz-submit { margin-top:0.5rem; }
  .lesson-complete-btn { margin-top:1.75rem; display:flex; align-items:center; gap:0.65rem; font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.1em; padding:0.8rem 1.5rem; border-radius:9px; background:#1B3A5C; color:#F5EED8; border:none; cursor:pointer; transition:all 0.2s; }
  .lesson-complete-btn:hover { background:#2A4A6C; }
  .lesson-complete-btn.done { background:#2A9D8F; }
  @media(max-width:800px) { .study-guide-grid{grid-template-columns:1fr;} }

  /* ── HISTORICAL TIMELINE ── */
  .htl-wrap { overflow-x:auto; padding-bottom:1.5rem; cursor:grab; }
  .htl-wrap:active { cursor:grabbing; }
  .htl-track { display:flex; align-items:center; gap:0; min-width:max-content; padding:2rem 1.5rem; position:relative; }
  .htl-track::before { content:''; position:absolute; top:50%; left:0; right:0; height:2px; background:linear-gradient(90deg,#1B3A5C,#C97D1A,#B5451B); transform:translateY(-50%); }
  .htl-event { position:relative; display:flex; flex-direction:column; align-items:center; cursor:pointer; padding:0 1rem; flex-shrink:0; }
  .htl-dot-wrap { position:relative; z-index:2; margin-bottom:0.6rem; }
  .htl-dot { width:16px; height:16px; border-radius:50%; background:#C97D1A; border:3px solid white; box-shadow:0 0 0 2px #C97D1A; transition:all 0.2s; }
  .htl-event:hover .htl-dot,.htl-event.active .htl-dot { transform:scale(1.5); background:#1B3A5C; box-shadow:0 0 0 2px #1B3A5C; }
  .htl-event.major .htl-dot { width:22px; height:22px; background:#B5451B; box-shadow:0 0 0 3px #B5451B; border:4px solid white; }
  .htl-date { font-family:'Cinzel',serif; font-size:0.62rem; letter-spacing:0.08em; color:#1B3A5C; white-space:nowrap; font-weight:700; }
  .htl-label { font-size:0.7rem; color:var(--muted); white-space:nowrap; max-width:100px; text-align:center; line-height:1.3; margin-top:0.2rem; }
  .htl-card { background:white; border:1px solid var(--border); border-radius:16px; padding:1.5rem; box-shadow:var(--shadow-lg); margin-top:1.25rem; }
  .htl-card-date { font-family:'Cinzel',serif; font-size:0.68rem; letter-spacing:0.12em; color:#C97D1A; margin-bottom:0.35rem; }
  .htl-card-title { font-family:'Cinzel',serif; font-size:1.1rem; color:#1B3A5C; margin-bottom:0.6rem; }
  .htl-card-desc { font-size:0.88rem; color:var(--muted); line-height:1.82; margin-bottom:0.9rem; }
  .htl-card-row { display:flex; gap:0.7rem; flex-wrap:wrap; }
  .htl-badge { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.1em; padding:0.25rem 0.65rem; border-radius:20px; }
  .htl-badge.scripture { background:rgba(27,58,92,0.1); color:#1B3A5C; border:1px solid rgba(27,58,92,0.2); }
  .htl-badge.source { background:rgba(181,69,27,0.1); color:#B5451B; border:1px solid rgba(181,69,27,0.2); }

  /* ── 12 TRIBES ── */
  .tribes-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:1rem; margin-bottom:2rem; }
  .tribe-card { border-radius:18px; overflow:hidden; box-shadow:var(--shadow); transition:all 0.25s; cursor:pointer; }
  .tribe-card:hover { box-shadow:var(--shadow-lg); transform:translateY(-4px); }
  .tribe-card-header { padding:1.3rem 1.4rem; display:flex; align-items:center; gap:0.85rem; }
  .tribe-icon { width:46px; height:46px; border-radius:13px; background:rgba(255,255,255,0.18); display:flex; align-items:center; justify-content:center; font-size:1.5rem; flex-shrink:0; }
  .tribe-name { font-family:'Cinzel',serif; font-size:0.95rem; font-weight:700; color:white; letter-spacing:0.06em; }
  .tribe-gem { font-size:0.7rem; color:rgba(255,255,255,0.75); margin-top:0.15rem; font-style:italic; }
  .tribe-card-body { background:white; padding:1rem 1.4rem 1.3rem; }
  .tribe-row { display:flex; gap:0.6rem; align-items:baseline; margin-bottom:0.38rem; }
  .tribe-label { font-family:'Cinzel',serif; font-size:0.58rem; letter-spacing:0.12em; color:var(--muted); min-width:68px; flex-shrink:0; }
  .tribe-value { font-size:0.8rem; color:var(--ink); line-height:1.45; }
  .tribe-scripture { margin-top:0.75rem; padding-top:0.75rem; border-top:1px solid var(--border); font-size:0.78rem; color:var(--muted); font-style:italic; line-height:1.55; }
  /* Breastplate */
  .breastplate-wrap { background:linear-gradient(135deg,#0D2035,#1B3A5C); border-radius:22px; padding:2rem; margin-bottom:2rem; }
  .breastplate-title { font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.2em; color:#C97D1A; text-align:center; margin-bottom:0.4rem; }
  .breastplate-sub { font-size:0.78rem; color:rgba(245,238,216,0.55); text-align:center; margin-bottom:1.5rem; font-style:italic; }
  .breastplate-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:0.65rem; max-width:420px; margin:0 auto; }
  .bp-stone { border-radius:12px; padding:0.75rem 0.5rem; text-align:center; cursor:pointer; transition:all 0.2s; }
  .bp-stone:hover { transform:scale(1.06); }
  .bp-stone-name { font-family:'Cinzel',serif; font-size:0.6rem; letter-spacing:0.08em; color:white; margin-bottom:0.18rem; }
  .bp-stone-gem { font-size:0.68rem; color:rgba(255,255,255,0.65); font-style:italic; }
  .bp-stone-emoji { font-size:1.6rem; display:block; margin-bottom:0.28rem; }
`;

// ─── NAV ──────────────────────────────────────────────────────────────────────
const BIBLE_SUB_PAGES = ["bible-read","bible-versions","bible-passage","bible-plus","bible-news","bible-explore","bible-tools"];
const AI_SUB_PAGES = ["ai-reader","ai-articles","ai-study","ai-timeline","ai-tribes"];

function Nav({ page, setPage, lang, setLang, t }) {
  const [open, setOpen] = useState(false);
  const [langOpen, setLangOpen] = useState(false);
  const navPage = BIBLE_SUB_PAGES.includes(page) ? "bible-hub" : AI_SUB_PAGES.includes(page) ? "ancient-israel" : page;
  const NAV_LINKS = [
    { key:"home",          label:t.navHome || "Home" },
    { key:"bible-hub",     label:t.navBible || "Scripture Hub" },
    { key:"ancient-israel",label:t.navAncient || "Ancient Israel" },
    { key:"weekly",        label:t.navWeekly || "Weekly Study" },
    { key:"captivities",   label:t.navCaptivities || "⛓️ Captivities" },
    { key:"women",         label:t.navWomen || "🌸 Women's Study" },
    { key:"livestream",    label:t.navLive || "📡 Live" },
    { key:"devotional",    label:t.navDevotional || "Devotional" },
    { key:"reading",       label:t.navReading || "Reading Plan" },
    { key:"audio",         label:t.navAudio || "Audio Bible" },
    { key:"join",         label:t.navJoin },
  ];
  const curLang = LANGUAGES.find(l => l.code === lang);

  return (
    <header>
      <nav className="nav">
        <div className="nav-inner">
          <button className="nav-brand" onClick={() => { setPage("home"); setOpen(false); }}>
            <div className="nav-icon">✦</div>
            <div>
              <div className="brand-text">{t.navBrand}</div>
              <div className="brand-sub">{t.navBrandSub}</div>
            </div>
          </button>
          <div className="nav-links">
            {NAV_LINKS.map(l => (
              <button key={l.key} className={`nav-btn${navPage===l.key?" active":""}`} onClick={() => setPage(l.key)}>{l.label}</button>
            ))}
          </div>
          <div style={{display:"flex",alignItems:"center",gap:"0.5rem"}}>
            {/* Language dropdown */}
            <div className="lang-dropdown" style={{position:"relative"}}>
              <button className="lang-toggle" onClick={() => setLangOpen(!langOpen)}>
                <span>{curLang?.flag}</span>
                <span>{curLang?.code.toUpperCase()}</span>
                <span style={{fontSize:"0.55rem",opacity:0.6}}>▼</span>
              </button>
              {langOpen && (
                <div className="lang-menu">
                  {LANGUAGES.map(l => (
                    <div key={l.code} className={`lang-menu-item${lang===l.code?" active":""}`} onClick={() => { setLang(l.code); setLangOpen(false); }}>
                      <span className="lang-flag">{l.flag}</span>
                      <div>
                        <div className="lang-native">{l.nativeName}</div>
                        <div className="lang-en-name">{l.name}</div>
                      </div>
                    </div>
                  ))}
                </div>
              )}
            </div>
            <button className="nav-hamburger" onClick={() => setOpen(!open)}>{open?"✕":"☰"}</button>
          </div>
        </div>
        {open && (
          <div className="mobile-menu">
            {NAV_LINKS.map(l => (
              <button key={l.key} className={`nav-btn${navPage===l.key?" active":""}`} onClick={() => { setPage(l.key); setOpen(false); }}>{l.label}</button>
            ))}
            <div style={{borderTop:"1px solid var(--border)",paddingTop:"0.6rem",marginTop:"0.3rem",display:"flex",gap:"0.35rem",flexWrap:"wrap"}}>
              {LANGUAGES.map(l => (
                <button key={l.code} className={`lang-btn${lang===l.code?" active":""}`} onClick={() => { setLang(l.code); setOpen(false); }}>
                  {l.flag} {l.nativeName}
                </button>
              ))}
            </div>
          </div>
        )}
      </nav>
    </header>
  );
}

// ─── ONBOARDING TOUR ─────────────────────────────────────────────────────────
function OnboardingTour({ onComplete, setPage, t }) {
  const [step, setStep] = useState(0);
  const current = ONBOARDING_STEPS[step];
  const isLast = step === ONBOARDING_STEPS.length - 1;

  const pageMap = { bible:"bible-hub", study:"weekly", devotional:"devotional", reading:"reading", audio:"audio" };

  const handleCta = () => {
    if (isLast) {
      if (pageMap[current.id]) setPage(pageMap[current.id]);
      onComplete();
    } else {
      setStep(s => s + 1);
    }
  };

  return (
    <div className="onboard-overlay" onClick={(e) => { if(e.target.className==="onboard-overlay") onComplete(); }}>
      <motion.div className="onboard-card" initial={{opacity:0,scale:0.93,y:24}} animate={{opacity:1,scale:1,y:0}} transition={{duration:0.32}}>
        <div className="onboard-progress">
          {ONBOARDING_STEPS.map((_,i) => <div key={i} className={`onboard-dot${i<=step?" done":""}`} />)}
        </div>
        <AnimatePresence mode="wait">
          <motion.div key={step} initial={{opacity:0,x:20}} animate={{opacity:1,x:0}} exit={{opacity:0,x:-20}} transition={{duration:0.22}}>
            <div className="onboard-icon">{current.icon}</div>
            <div className="onboard-title">{current.title}</div>
            <div className="onboard-desc">{current.desc}</div>
          </motion.div>
        </AnimatePresence>
        <div className="onboard-actions">
          <button className="onboard-skip" onClick={onComplete}>{t?.onboardSkip || "Skip Tour"}</button>
          <button className="btn-gold" onClick={handleCta}>{isLast ? current.cta : current.cta}</button>
        </div>
      </motion.div>
    </div>
  );
}

// ─── HOLY FEAST CALENDAR DATA ─────────────────────────────────────────────────
// Leviticus 23 · The LORD's Appointed Times (2025–2026 dates)
// All dates are approximate biblical calendar alignments
const HOLY_FEASTS = [
  // ── WEEKLY ──────────────────────────────────────────────────────────────────
  {
    id:"shabbat", name:"Shabbat", hebrew:"שַׁבָּת",
    type:"weekly", icon:"🕯️", color:"#C4893A",
    scripture:"Exodus 20:8–11 · Leviticus 23:3",
    description:"The weekly Sabbath — sunset Friday to sunset Saturday. A holy convocation, a day of rest from all labor. The sign of the covenant between the Most High and His people.",
    howToObserve:"Rest from all work. Light candles at sunset Friday. Study scripture. Fellowship with family and covenant community. Attend or watch Shabbat class.",
    mandatory:true, recurring:"weekly",
    nextDate: null, // computed dynamically — next Friday sunset
    preparations:["Prepare meals before sunset Friday","Clean and tidy the home","Set apart time for scripture and prayer","Avoid commerce and labor"],
  },
  // ── SPRING FEASTS ────────────────────────────────────────────────────────────
  // ── ABIB — BIBLICAL NEW YEAR ────────────────────────────────────────────────
  {
    id:"abib", name:"Abib — Biblical New Year", hebrew:"אָבִיב",
    type:"calendar-start", icon:"🌱", color:"#2E7D32",
    scripture:"Exodus 12:2 · Exodus 13:4 · Deuteronomy 16:1",
    dates:"First month of the biblical year · Beginning of spring",
    date2025:"2025-03-30", date2026:"2026-03-20",
    description:"Abib is the first month of the biblical year — the beginning of months as commanded in Exodus 12:2. It marks the agricultural and spiritual reset of the year, when spring begins and the covenant seasons are renewed. Passover follows in the same month.",
    howToObserve:"Acknowledge the beginning of the new year before YAHAWAH. Study Exodus 12. Prepare for Passover which follows in the same month. Dedicate the new year to covenant obedience.",
    scriptureObservance:[
      "Exodus 12:2 — This month shall be unto you the beginning of months: it shall be the first month of the year to you.",
      "Exodus 13:4 — This day came ye out in the month Abib.",
      "Deuteronomy 16:1 — Observe the month of Abib, and keep the passover unto the LORD thy God: for in the month of Abib the LORD thy God brought thee forth out of Egypt by night.",
      "Exodus 23:15 — Thou shalt keep the feast of unleavened bread: (thou shalt eat unleavened bread seven days, as I commanded thee, in the time appointed of the month Abib.)",
    ],
    covenantNote:"Abib establishes the biblical calendar. Every covenant season flows from this starting point. To follow YAHAWAH's calendar is to begin here — not in January.",
    mandatory:false, recurring:"annual",
    prepChecklist:["Acknowledge the new year before YAHAWAH","Study Exodus 12 in full","Prepare for Passover in the same month","Review the full feast calendar for the coming year","Dedicate the first month to covenant renewal"],
    observance:["Acknowledge the beginning of the new biblical year","Study the Passover commandments (Exodus 12)","Review the full calendar of YAHAWAH's appointed times","Begin spring covenant preparations","Renew dedication to commandment-keeping"],
    summary:"The first month of the biblical year. Passover is commanded in this month. Abib marks the spiritual and agricultural reset for all of Israel's covenant seasons.",
  },
    {
    id:"passover", name:"Passover", hebrew:"פֶּסַח",
    type:"spring", icon:"🩸", color:"#8B3A2A",
    scripture:"Leviticus 23:5 · Exodus 12:1–14",
    description:"14th of Nisan. The LORD's Passover — commemorating Israel's deliverance from Egypt and the blood of the lamb on the doorposts. The shadow of the Messiah's sacrifice.",
    howToObserve:"Seder meal at sunset. Remove leaven from the home. Retell the Exodus story. Remember the blood covenant.",
    mandatory:true, recurring:"annual",
    date2025:"2025-04-12", date2026:"2026-04-01",
    preparations:["Remove all leaven (chametz) from home","Prepare Seder plate: lamb, bitter herbs, charoset, parsley, egg, salt water","Purchase unleavened bread (matzah)","Study Exodus 12"],
    sukkotPrep:false,

    scriptureObservance:[
      "Exodus 12:2 — This month shall be unto you the beginning of months.",
      "Exodus 12:6 — And ye shall keep it up until the fourteenth day of the same month: and the whole assembly of the congregation of Israel shall kill it in the evening.",
      "Exodus 12:7 — And they shall take of the blood, and strike it on the two side posts and on the upper door post of the houses.",
      "Exodus 12:11 — And thus shall ye eat it; with your loins girded, your shoes on your feet, and your staff in your hand; and ye shall eat it in haste: it is the LORD's passover.",
      "Exodus 12:12-14 — For I will pass through the land of Egypt this night, and will smite all the firstborn...and when I see the blood, I will pass over you.",
      "Leviticus 23:5 — In the fourteenth day of the first month at even is the LORD's passover.",
      "Numbers 9:3 — In the fourteenth day of this month, at even, ye shall keep it in his appointed season.",
      "Deuteronomy 16:1-2 — Observe the month of Abib, and keep the passover unto the LORD thy God.",
    ],
  },
  {
    id:"unleavened", name:"Unleavened Bread", hebrew:"חַג הַמַּצּוֹת",
    type:"spring", icon:"🫓", color:"#8B3A2A",
    scripture:"Leviticus 23:6–8 · Exodus 12:15–20",
    description:"15th–21st of Nisan — 7 days. The Feast of Unleavened Bread immediately follows Passover. Leaven represents sin and corruption. Eating unleavened bread represents a life separated from sin.",
    howToObserve:"Eat unleavened bread for 7 days. First and last days are holy convocations — no regular work. Continue removing leaven from home and heart.",
    mandatory:true, recurring:"annual",
    date2025:"2025-04-13", date2026:"2026-04-02",
    preparations:["Remove all leavened products from home","Stock up on matzah for 7 days","Plan meals without leaven","Study 1 Corinthians 5:6–8"],
    sukkotPrep:false,

    scriptureObservance:[
      "Exodus 12:15 — Seven days shall ye eat unleavened bread; even the first day ye shall put away leaven out of your houses.",
      "Exodus 12:17 — And ye shall observe the feast of unleavened bread; for in this selfsame day have I brought your armies out of the land of Egypt.",
      "Exodus 12:19-20 — Seven days shall there be no leaven found in your houses: for whosoever eateth that which is leavened, even that soul shall be cut off.",
      "Leviticus 23:6-7 — And on the fifteenth day of the same month is the feast of unleavened bread...an holy convocation: ye shall do no servile work therein.",
      "Leviticus 23:8 — But ye shall offer an offering made by fire unto the LORD seven days: in the seventh day is an holy convocation: ye shall do no servile work therein.",
      "1 Corinthians 5:7-8 — For even Christ our passover is sacrificed for us. Therefore let us keep the feast, not with old leaven, neither with the leaven of malice and wickedness.",
    ],
  },
  {
    id:"firstfruits", name:"Firstfruits", hebrew:"בִּכּוּרִים",
    type:"spring", icon:"🌾", color:"#6B8F5E",
    scripture:"Leviticus 23:9–14 · 1 Corinthians 15:20",
    description:"The day after the Sabbath during Unleavened Bread. Firstfruits — the first sheaf of the harvest wave offering. The Messiah rose from the dead on Firstfruits, becoming the firstfruits of those who sleep.",
    howToObserve:"Bring a firstfruits offering — the first and best of your income, time, or harvest. Celebrate resurrection. Declare God's provision.",
    mandatory:true, recurring:"annual",
    date2025:"2025-04-20", date2026:"2026-04-05",
    preparations:["Prepare a firstfruits offering (financial or agricultural)","Study 1 Corinthians 15","Reflect on areas of life where God is bringing resurrection"],
    sukkotPrep:false,

    scriptureObservance:[
      "Leviticus 23:10 — Speak unto the children of Israel, and say unto them, When ye be come into the land which I give unto you, and shall reap the harvest thereof, then ye shall bring a sheaf of the firstfruits of your harvest unto the priest.",
      "Leviticus 23:11 — And he shall wave the sheaf before the LORD, to be accepted for you: on the morrow after the sabbath the priest shall wave it.",
      "Leviticus 23:14 — And ye shall eat neither bread, nor parched corn, nor green ears, until the selfsame day that ye have brought an offering unto your God.",
      "1 Corinthians 15:20 — But now is Christ risen from the dead, and become the firstfruits of them that slept.",
      "James 1:18 — Of his own will begat he us with the word of truth, that we should be a kind of firstfruits of his creatures.",
    ],
  },
  {
    id:"shavuot", name:"Shavuot / Pentecost", hebrew:"שָׁבוּעוֹת",
    type:"spring", icon:"🔥", color:"#C97D1A",
    scripture:"Leviticus 23:15–22 · Acts 2:1–4",
    description:"50 days after Firstfruits — the Feast of Weeks. The giving of the Torah at Sinai and the outpouring of the Spirit in Acts 2 both occurred on Shavuot. A holy convocation — no regular work.",
    howToObserve:"Count 50 days from Firstfruits (Counting of the Omer). Study the Torah and the Spirit. All-night study is a traditional practice. Bring wave loaves offering.",
    mandatory:true, recurring:"annual",
    date2025:"2025-06-01", date2026:"2026-05-24",
    preparations:["Complete the Counting of the Omer (49 days)","Study Acts 2 and Exodus 19–20","Prepare for an all-night study session","Community gathering — holy convocation"],
    sukkotPrep:false,

    scriptureObservance:[
      "Leviticus 23:15-16 — And ye shall count unto you from the morrow after the sabbath, from the day that ye brought the sheaf of the wave offering; seven sabbaths shall be complete. Even unto the morrow after the seventh sabbath shall ye number fifty days.",
      "Leviticus 23:17 — Ye shall bring out of your habitations two wave loaves of two tenth deals; they shall be of fine flour; they shall be baken with leaven; they are the firstfruits unto the LORD.",
      "Leviticus 23:21 — And ye shall proclaim on the selfsame day, that it may be an holy convocation unto you.",
      "Exodus 23:16 — And the feast of harvest, the firstfruits of thy labours.",
      "Deuteronomy 16:10 — And thou shalt keep the feast of weeks unto the LORD thy God with a tribute of a freewill offering of thine hand.",
      "Acts 2:1-4 — And when the day of Pentecost was fully come, they were all with one accord in one place.",
    ],
  },
  // ── FALL FEASTS ───────────────────────────────────────────────────────────────
  {
    id:"trumpets", name:"Yom Teruah / Trumpets", hebrew:"יוֹם תְּרוּעָה",
    type:"fall", icon:"🎺", color:"#7B5EA7",
    scripture:"Leviticus 23:23–25 · Numbers 29:1 · Revelation 11:15",
    description:"1st of Tishrei — the Feast of Trumpets. A day of blowing the shofar, a holy convocation, no regular work. The prophetic shadow of the return of the Messiah and the gathering of Israel.",
    howToObserve:"Blow or hear the shofar 100 times. Rest from regular work. Gather for corporate prayer and scripture. Begin the 10 Days of Awe (reflection and repentance before Yom Kippur).",
    mandatory:true, recurring:"annual",
    date2025:"2025-09-22", date2026:"2026-09-11",
    preparations:["Obtain or arrange access to a shofar","Begin personal reflection and repentance","Study Revelation 11 and 1 Thessalonians 4","Plan community gathering"],
    sukkotPrep:false,

    scriptureObservance:[
      "Leviticus 23:24 — Speak unto the children of Israel, saying, In the seventh month, in the first day of the month, shall ye have a sabbath, a memorial of blowing of trumpets, an holy convocation.",
      "Leviticus 23:25 — Ye shall do no servile work therein: but ye shall offer an offering made by fire unto the LORD.",
      "Numbers 29:1 — And in the seventh month, on the first day of the month, ye shall have an holy convocation; ye shall do no servile work: it is a day of blowing the trumpets unto you.",
      "Numbers 10:9 — And if ye go to war in your land against the enemy that oppresseth you, then ye shall blow an alarm with the trumpets.",
      "Psalm 81:3 — Blow up the trumpet in the new moon, in the time appointed, on our solemn feast day.",
      "Revelation 8:2 — And I saw the seven angels which stood before God; and to them were given seven trumpets.",
    ],
  },
  {
    id:"atonement", name:"Yom Kippur / Atonement", hebrew:"יוֹם כִּפּוּר",
    type:"fall", icon:"⚖️", color:"#1B3A5C",
    scripture:"Leviticus 23:26–32 · Hebrews 9:7",
    description:"10th of Tishrei — the holiest day of the biblical year. A complete Sabbath of Sabbaths. Fasting, afflicting the soul, and seeking full atonement. The High Priest entered the Holy of Holies once a year — this is its shadow.",
    howToObserve:"Fast completely from sunset to sunset (25 hours). No food, no water, no bathing, no work. Gather for corporate prayer, confession, and worship. Seek reconciliation with others.",
    mandatory:true, recurring:"annual",
    date2025:"2025-10-01", date2026:"2026-09-20",
    preparations:["Plan your fast — 25-hour complete fast","Seek reconciliation with anyone you have wronged","Study Leviticus 16 and Hebrews 9","Prepare spiritually in the 10 Days of Awe"],
    sukkotPrep:false,

    scriptureObservance:[
      "Leviticus 23:27 — Also on the tenth day of this seventh month there shall be a day of atonement: it shall be an holy convocation unto you; and ye shall afflict your souls, and offer an offering made by fire unto the LORD.",
      "Leviticus 23:28 — And ye shall do no work in that same day: for it is a day of atonement, to make an atonement for you before the LORD your God.",
      "Leviticus 23:29 — For whatsoever soul it be that shall not be afflicted in that same day, he shall be cut off from among his people.",
      "Leviticus 16:29-30 — And this shall be a statute for ever unto you: that in the seventh month...ye shall afflict your souls, and do no work at all.",
      "Leviticus 16:34 — And this shall be an everlasting statute unto you, to make an atonement for the children of Israel for all their sins once a year.",
      "Hebrews 9:7 — But into the second went the high priest alone once every year, not without blood.",
      "Hebrews 10:10 — By the which will we are sanctified through the offering of the body of Jesus Christ once for all.",
    ],
  },
  {
    id:"sukkot", name:"Sukkot / Tabernacles", hebrew:"סֻכּוֹת",
    type:"fall", icon:"🍃", color:"#5A7A52",
    scripture:"Leviticus 23:33–43 · Zechariah 14:16–19 · John 7:2",
    description:"15th–21st of Tishrei — 7 days of rejoicing and dwelling in booths. The greatest of all the feasts — nations will come up to Jerusalem yearly to keep Sukkot in the Kingdom age. A time of joy, community, and dwelling with God.",
    howToObserve:"Build or visit a sukkah (a temporary dwelling/booth). Dwell in or eat meals in the sukkah for 7 days. Wave the four species (lulav, etrog, myrtle, willow). Rejoice before the LORD.",
    mandatory:true, recurring:"annual",
    date2025:"2025-10-06", date2026:"2026-09-25",
    preparations:["Build or plan a sukkah — start 4 weeks before","Gather four species (or plan a communal gathering)","Plan community feast meals in the sukkah","Register for any in-person Sukkot events"],
    sukkotPrep:true, // triggers special prep reminder
    prepWeeksBefore:4,

    scriptureObservance:[
      "Leviticus 23:34 — Speak unto the children of Israel, saying, The fifteenth day of this seventh month shall be the feast of tabernacles for seven days unto the LORD.",
      "Leviticus 23:36 — Seven days ye shall offer an offering made by fire unto the LORD: on the eighth day shall be an holy convocation unto you.",
      "Leviticus 23:40 — And ye shall take you on the first day the boughs of goodly trees, branches of palm trees, and the boughs of thick trees, and willows of the brook; and ye shall rejoice before the LORD your God seven days.",
      "Leviticus 23:42-43 — Ye shall dwell in booths seven days; all that are Israelites born shall dwell in booths. That your generations may know that I made the children of Israel to dwell in booths.",
      "Deuteronomy 16:13-14 — Thou shalt observe the feast of tabernacles seven days. And thou shalt rejoice in thy feast.",
      "Nehemiah 8:14-15 — That the children of Israel should dwell in booths in the feast of the seventh month.",
      "John 7:2 — Now the Jews' feast of tabernacles was at hand.",
      "Zechariah 14:16 — And it shall come to pass, that every one that is left of all the nations which came against Jerusalem shall even go up from year to year to worship the King, the LORD of hosts, and to keep the feast of tabernacles.",
    ],
  },
  {
    id:"shemini", name:"Shemini Atzeret / Last Great Day", hebrew:"שְׁמִינִי עֲצֶרֶת",
    type:"fall", icon:"✨", color:"#5A7A52",
    scripture:"Leviticus 23:36 · John 7:37–39",
    description:"22nd of Tishrei — the 8th Day Assembly. Immediately follows Sukkot. On this day Yeshua stood up and cried out 'If any man thirst, let him come unto me and drink.' A holy convocation and day of rest.",
    howToObserve:"Holy convocation — no regular work. Rest and rejoice. Study John 7. Celebrate the completion of the Torah reading cycle (Simchat Torah). Give an offering.",
    mandatory:true, recurring:"annual",
    date2025:"2025-10-13", date2026:"2026-10-02",
    preparations:["Study John 7:37–39","Complete Torah reading cycle celebration","Prepare a closing feast offering","Rest and reflect on the Sukkot season"],
    sukkotPrep:false,
  },
  // ── ADDITIONAL APPOINTED TIMES ────────────────────────────────────────────────
  {
    id:"hanukkah", name:"Hanukkah / Dedication", hebrew:"חֲנֻכָּה",
    type:"additional", icon:"🕎", color:"#2D8CFF",
    scripture:"John 10:22 · 1 Maccabees 4:52–59",
    description:"25th of Kislev — 8 days. The Feast of Dedication. Yeshua walked in the Temple during Hanukkah. Celebrates the rededication of the Temple after Antiochus IV desecrated it. Light the menorah, declare dedication of self to God.",
    howToObserve:"Light the Hanukkiah (9-branch menorah) — one additional candle each night for 8 nights. Study Daniel 8 and 1 Maccabees. Rededicate yourself and your household to the Most High.",
    mandatory:false, recurring:"annual",
    date2025:"2025-12-14", date2026:"2026-12-04",
    preparations:["Obtain a Hanukkiah (9-branch menorah) and candles","Study Daniel 8 and 1 Maccabees 4","Plan 8 nights of family study and candle lighting","Pray about what needs to be rededicated in your life"],
    sukkotPrep:false,
  },
  {
    id:"purim", name:"Purim", hebrew:"פּוּרִים",
    type:"additional", icon:"👑", color:"#E1306C",
    scripture:"Esther 9:20–28",
    description:"14th of Adar. The Feast of Lots — celebrating how Esther and Mordecai delivered the Jewish people from Haman's plot. A time of joy, feasting, giving gifts, and remembering divine protection.",
    howToObserve:"Read the Book of Esther in full (Megillah reading). Give gifts to the poor. Send food gifts (mishloach manot). Feast and rejoice. Dress festively.",
    mandatory:false, recurring:"annual",
    date2025:"2025-03-13", date2026:"2026-03-03",
    preparations:["Read Esther 1–10","Prepare gift baskets for those in need","Plan a community feast","Study how God works behind the scenes in history"],
    sukkotPrep:false,
  },
];

// ─── IN-PERSON EVENTS DATA ────────────────────────────────────────────────────
// Starts empty — populated by admin through the event upload form
const DEFAULT_EVENTS = [
  {
    id:"evt-001",
    title:"Sukkot 2025 — Community Gathering",
    feast:"sukkot",
    type:"in-person",
    date:"2025-10-06",
    endDate:"2025-10-13",
    time:"6:00 PM CST",
    location:"TBD — Dallas, Texas Area",
    address:"",
    description:"Join us for our first in-person Sukkot gathering! We will build a community sukkah, share meals together, study scripture, and celebrate the feast of tabernacles as a covenant family. More details coming soon.",
    capacity:150,
    registrationRequired:true,
    registrationFields:["name","email","phone","attendance"], // minimal fields
    mapUrl:"",
    contactEmail:"info@goddiditbibleclub.com",
    tags:["sukkot","in-person","family","feast"],
    status:"upcoming",
    postedBy:"God Did It Bible Club",
    postedDate:"2025-03-01",
  },
];

// ─── GLOBAL SCRIPTURE BUTTON ─────────────────────────────────────────────────
// Drop anywhere in the app — clicking navigates to the Bible passage reader
function ScriptureBtn({ ref: passRef, children, goToScripture, style, compact }) {
  const label = children || passRef;
  if (!goToScripture) {
    return <span style={{fontFamily:"'Cinzel',serif",fontSize:compact?"0.6rem":"0.68rem",letterSpacing:"0.08em",color:"var(--gold)",...style}}>{label}</span>;
  }
  return (
    <button
      onClick={() => goToScripture(passRef || String(children))}
      title={`Open ${passRef || children} in Bible Reader`}
      style={{
        fontFamily:"'Cinzel',serif",
        fontSize: compact ? "0.6rem" : "0.68rem",
        letterSpacing:"0.08em",
        padding: compact ? "0.18rem 0.5rem" : "0.28rem 0.72rem",
        borderRadius:"20px",
        background:"rgba(196,137,58,0.1)",
        border:"1px solid rgba(196,137,58,0.35)",
        color:"var(--gold)",
        cursor:"pointer",
        transition:"all 0.18s",
        display:"inline-flex",
        alignItems:"center",
        gap:"0.28rem",
        ...style
      }}
      onMouseEnter={e => { e.currentTarget.style.background="var(--gold)"; e.currentTarget.style.color="white"; }}
      onMouseLeave={e => { e.currentTarget.style.background="rgba(196,137,58,0.1)"; e.currentTarget.style.color="var(--gold)"; }}
    >
      📖 {label}
    </button>
  );
}

// ScripturePill variant — small inline chip used in scripture lists
function ScripturePill({ refText, goToScripture, color }) {
  const c = color || "var(--gold)";
  if (!goToScripture) return (
    <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.06em",padding:"0.28rem 0.7rem",borderRadius:"20px",background:`rgba(196,137,58,0.1)`,border:`1px solid rgba(196,137,58,0.3)`,color:c,display:"inline-block",margin:"0.2rem"}}>{refText}</span>
  );
  return (
    <button
      onClick={() => goToScripture(refText)}
      title={`Read ${refText}`}
      style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.06em",padding:"0.28rem 0.7rem",borderRadius:"20px",background:`rgba(196,137,58,0.08)`,border:`1px solid rgba(196,137,58,0.3)`,color:c,cursor:"pointer",transition:"all 0.15s",display:"inline-block",margin:"0.2rem"}}
      onMouseEnter={e=>{e.currentTarget.style.background=c;e.currentTarget.style.color="white";e.currentTarget.style.borderColor=c;}}
      onMouseLeave={e=>{e.currentTarget.style.background="rgba(196,137,58,0.08)";e.currentTarget.style.color=c;e.currentTarget.style.borderColor="rgba(196,137,58,0.3)";}}
    >
      📖 {refText}
    </button>
  );
}

// ─── SHARED UTILITY COMPONENTS ────────────────────────────────────────────────

// Resource links panel — reusable across all pages
function ResourceLinks({ links, title }) {
  if (!links || links.length === 0) return null;
  return (
    <div className="resource-links-section">
      <div className="resource-links-title">🔗 {title || "RESOURCES / EVIDENCE"}</div>
      {links.map((link, i) => {
        const badge = RESOURCE_LINK_BADGES[link.type] || { color:"var(--muted)", bg:"var(--cream)" };
        return (
          <div key={i} className="resource-link-item">
            <span className="resource-link-badge" style={{background:badge.bg,color:badge.color,border:`1px solid ${badge.color}44`}}>{link.type}</span>
            <div>
              <a href={link.url} target="_blank" rel="noreferrer" className="resource-link-label">{link.label} ↗</a>
              {link.desc && <div className="resource-link-desc">{link.desc}</div>}
            </div>
          </div>
        );
      })}
    </div>
  );
}

// Daily Prayer Widget — shows today's prayer with copy button
function DailyPrayerWidget({ compact }) {
  const [copied, setCopied] = useState(false);
  const [expanded, setExpanded] = useState(false);
  const dayOfWeek = new Date().getDay(); // 0=Sun…6=Sat
  const prayer = DAILY_PRAYERS[dayOfWeek] || DAILY_PRAYERS[1];

  const copyPrayer = () => {
    const text = `${prayer.title}\n\n${prayer.opening}\n\n${prayer.body}\n\n${prayer.anchor}`;
    if (navigator.clipboard) {
      navigator.clipboard.writeText(text).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2500); });
    } else {
      const el = document.createElement("textarea");
      el.value = text; document.body.appendChild(el); el.select();
      document.execCommand("copy"); document.body.removeChild(el);
      setCopied(true); setTimeout(() => setCopied(false), 2500);
    }
  };

  if (compact) {
    return (
      <div className="daily-card">
        <div className="daily-card-eyebrow">🙏 PRAYER OF THE DAY</div>
        <div className="daily-card-title">{prayer.title}</div>
        <div className="daily-card-anchor">{prayer.anchor}</div>
        <div className="daily-card-text" style={{maxHeight: expanded?"none":"80px",overflow:expanded?"visible":"hidden",position:"relative"}}>
          {prayer.opening} {prayer.body}
        </div>
        <div className="daily-card-actions">
          <button className="btn-text" style={{color:"var(--gold-light)",fontSize:"0.65rem"}} onClick={() => setExpanded(!expanded)}>
            {expanded ? "Show less ▲" : "Read full prayer ▼"}
          </button>
          <button className={`copy-btn${copied?" copied":""}`} onClick={copyPrayer}>
            {copied ? "✓ Copied!" : "📋 Copy Prayer"}
          </button>
        </div>
        {prayer.instruction && (
          <div style={{marginTop:"0.75rem",fontSize:"0.75rem",color:"rgba(250,246,238,0.45)",borderTop:"1px solid rgba(196,137,58,0.2)",paddingTop:"0.65rem",lineHeight:1.65}}>
            💡 {prayer.instruction}
          </div>
        )}
      </div>
    );
  }

  return (
    <div className="daily-card">
      <div className="daily-card-eyebrow">🙏 PRAYER OF THE DAY · {["SUN","MON","TUE","WED","THU","FRI","SHABBAT"][dayOfWeek]}</div>
      <div className="daily-card-title">{prayer.title}</div>
      <div className="daily-card-anchor">{prayer.anchor}</div>
      <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",color:"rgba(250,246,238,0.7)",lineHeight:1.72,marginBottom:"0.75rem",borderLeft:"3px solid rgba(196,137,58,0.4)",paddingLeft:"0.9rem"}}>
        {prayer.opening}
      </div>
      <div className="daily-card-text">{prayer.body}</div>
      {prayer.instruction && (
        <div style={{fontSize:"0.76rem",color:"rgba(250,246,238,0.45)",borderTop:"1px solid rgba(196,137,58,0.2)",paddingTop:"0.65rem",marginTop:"0.25rem",lineHeight:1.65}}>
          💡 {prayer.instruction}
        </div>
      )}
      <div className="daily-card-actions" style={{marginTop:"1rem"}}>
        <button className={`copy-btn${copied?" copied":""}`} onClick={copyPrayer}>
          {copied ? "✓ Copied to clipboard!" : "📋 Copy Full Prayer"}
        </button>
      </div>
    </div>
  );
}

// DailyDevotionalWidget — today's devotional on homepage
function DailyDevotionalWidget({ setPage }) {
  const dayOfWeek = new Date().getDay();
  const dev = DEVOTIONALS[dayOfWeek % 7] || DEVOTIONALS[0];
  const [copied, setCopied] = useState(false);

  const copyDev = () => {
    const text = `${dev.title} — ${dev.verse}\n\n"${dev.text}"\n\nUnderstanding:\n${dev.explanation}\n\nPrayer:\n${dev.prayer}\n\nAction:\n${dev.action}`;
    if (navigator.clipboard) {
      navigator.clipboard.writeText(text).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2500); });
    } else {
      const el = document.createElement("textarea"); el.value = text;
      document.body.appendChild(el); el.select(); document.execCommand("copy"); document.body.removeChild(el);
      setCopied(true); setTimeout(() => setCopied(false), 2500);
    }
  };

  return (
    <div style={{background:"white",border:"1px solid var(--border)",borderRadius:"18px",overflow:"hidden",boxShadow:"var(--shadow)",marginBottom:"1.25rem",borderTop:"3px solid var(--sage)"}}>
      <div style={{padding:"1.25rem 1.6rem"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.2em",color:"var(--sage)",marginBottom:"0.35rem"}}>🕯️ DEVOTIONAL OF THE DAY</div>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.95rem",color:"var(--ink)",marginBottom:"0.2rem"}}>{dev.title}</div>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:"var(--gold)",marginBottom:"0.85rem"}}>{dev.verse}</div>
        <div style={{background:"var(--deep)",borderRadius:"10px",padding:"0.9rem 1.1rem",marginBottom:"0.85rem",fontFamily:"'Cormorant Garamond',serif",fontSize:"1.05rem",fontStyle:"italic",color:"var(--parchment)",lineHeight:1.72,borderLeft:"3px solid var(--gold)"}}>{dev.text}</div>
        <div style={{fontSize:"0.84rem",color:"var(--muted)",lineHeight:1.75,marginBottom:"0.65rem"}}>{dev.whyMatters || dev.explanation}</div>
        <div style={{fontSize:"0.82rem",color:"var(--ink)",fontStyle:"italic",lineHeight:1.7,padding:"0.65rem 0.85rem",background:"var(--cream)",borderRadius:"9px",marginBottom:"0.9rem"}}>{dev.prayer}</div>
        <div style={{display:"flex",gap:"0.65rem",flexWrap:"wrap"}}>
          <button className={`copy-btn${copied?" copied":""}`} onClick={copyDev}>{copied?"✓ Copied!":"📋 Copy Devotional"}</button>
          <button className="btn-text" style={{fontSize:"0.65rem"}} onClick={() => setPage("devotional")}>All Devotionals →</button>
        </div>
      </div>
    </div>
  );
}

// ─── FEAST CALENDAR HELPERS ───────────────────────────────────────────────────
function getNextFeastDate(feast) {
  const now = new Date();
  const year = now.getFullYear();
  // For weekly Shabbat — next Friday
  if (feast.recurring === "weekly") {
    const d = new Date();
    const day = d.getDay(); // 0=Sun,5=Fri
    const daysUntilFri = (5 - day + 7) % 7 || 7;
    d.setDate(d.getDate() + daysUntilFri);
    d.setHours(19, 0, 0, 0); // ~sunset
    return d;
  }
  // For annual feasts — try current year first, then next
  const d2025 = feast.date2025 ? new Date(feast.date2025 + "T18:00:00") : null;
  const d2026 = feast.date2026 ? new Date(feast.date2026 + "T18:00:00") : null;
  if (d2025 && d2025 > now) return d2025;
  if (d2026 && d2026 > now) return d2026;
  return null;
}

function getCountdown(targetDate) {
  if (!targetDate) return null;
  const now = new Date();
  const diff = targetDate - now;
  if (diff <= 0) return { days:0, hours:0, minutes:0, seconds:0, past:true };
  const days = Math.floor(diff / (1000 * 60 * 60 * 24));
  const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
  const seconds = Math.floor((diff % (1000 * 60)) / 1000);
  return { days, hours, minutes, seconds, past:false };
}

function getSukkotWeeksBefore(feast) {
  if (!feast.sukkotPrep) return null;
  const next = getNextFeastDate(feast);
  if (!next) return null;
  const now = new Date();
  const daysUntil = Math.floor((next - now) / (1000 * 60 * 60 * 24));
  const weeksUntil = Math.floor(daysUntil / 7);
  if (weeksUntil <= (feast.prepWeeksBefore || 4) && weeksUntil > 0) return weeksUntil;
  return null;
}

// ─── FEAST CARD COMPONENT ─────────────────────────────────────────────────────
function FeastCard({ feast, expanded, onToggle }) {
  const [tick, setTick] = useState(0);
  useEffect(() => {
    const id = setInterval(() => setTick(t => t + 1), 60000); // update every minute
    return () => clearInterval(id);
  }, []);

  const nextDate = getNextFeastDate(feast);
  const countdown = getCountdown(nextDate);
  const sukkotWeeks = getSukkotWeeksBefore(feast);

  const formattedDate = nextDate ? nextDate.toLocaleDateString("en-US", { weekday:"long", month:"long", day:"numeric", year:"numeric" }) : "Date TBD";

  return (
    <motion.div className="feast-card" whileHover={{y:-3}} style={{borderTop:`3px solid ${feast.color}`}}>
      {/* Sukkot prep banner */}
      {sukkotWeeks && (
        <div className="sukkot-prep-banner" style={{margin:"0",borderRadius:"0"}}>
          <span style={{fontSize:"1.4rem"}}>🍃</span>
          <div className="sukkot-banner-text">
            <div className="sukkot-banner-title">🏕️ SUKKOT IS {sukkotWeeks} WEEK{sukkotWeeks > 1 ? "S" : ""} AWAY — START BUILDING!</div>
            Time to begin preparing your sukkah, planning community meals, and organizing your gathering. Don't wait — the feast is coming!
          </div>
        </div>
      )}

      <div className="feast-card-top">
        <div className="feast-icon-wrap" style={{background:`${feast.color}18`, border:`1px solid ${feast.color}33`}}>
          {feast.icon}
        </div>
        <div style={{flex:1, minWidth:0}}>
          <div className="feast-name">{feast.name}</div>
          <div className="feast-hebrew">{feast.hebrew}</div>
          <div className="feast-scripture">{feast.scripture.split(" · ")[0]}</div>
        </div>
        {feast.mandatory && (
          <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",padding:"0.2rem 0.55rem",borderRadius:"20px",background:feast.color,color:"white",flexShrink:0,alignSelf:"flex-start"}}>
            MANDATORY
          </span>
        )}
      </div>

      {/* Countdown */}
      {countdown && !countdown.past && (
        <div className="feast-countdown" style={{background:feast.color}}>
          <div className="feast-countdown-units">
            {countdown.days > 0 && (
              <div className="feast-count-unit">
                <span className="feast-count-num">{countdown.days}</span>
                <span className="feast-count-label">DAYS</span>
              </div>
            )}
            {countdown.days > 0 && <span className="feast-count-sep">:</span>}
            <div className="feast-count-unit">
              <span className="feast-count-num">{String(countdown.hours).padStart(2,"0")}</span>
              <span className="feast-count-label">HRS</span>
            </div>
            <span className="feast-count-sep">:</span>
            <div className="feast-count-unit">
              <span className="feast-count-num">{String(countdown.minutes).padStart(2,"0")}</span>
              <span className="feast-count-label">MIN</span>
            </div>
          </div>
          <div style={{textAlign:"right"}}>
            <div className="feast-date-text">{formattedDate}</div>
            {feast.recurring === "weekly" && <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",color:"rgba(255,255,255,0.5)",marginTop:"0.2rem"}}>EVERY WEEK</div>}
          </div>
        </div>
      )}
      {countdown && countdown.past && (
        <div style={{margin:"0 1.35rem 0.85rem",padding:"0.65rem 1rem",borderRadius:"11px",background:"var(--cream)",fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.1em",color:"var(--muted)",textAlign:"center",border:"1px solid var(--border)"}}>
          ✓ This feast has passed — next date coming soon
        </div>
      )}

      <div className="feast-desc">{feast.description.substring(0, 130)}…</div>

      <div className="feast-card-footer">
        <span className="feast-type-tag">{feast.type === "weekly" ? "Weekly" : feast.type === "spring" ? "Spring Feast" : feast.type === "fall" ? "Fall Feast" : "Additional"}</span>
        <button className="btn-text" style={{fontSize:"0.65rem"}} onClick={onToggle}>
          {expanded ? "Hide details ▲" : "How to observe →"}
        </button>
      </div>

      <AnimatePresence>
        {expanded && (
          <motion.div className="feast-expanded" initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.25}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:feast.color,marginBottom:"0.55rem"}}>HOW TO OBSERVE</div>
            <div className="feast-how">{feast.howToObserve}</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:feast.color,marginBottom:"0.55rem"}}>PREPARATION CHECKLIST</div>
            <ul className="feast-prep-list">
              {feast.preparations.map((p,i) => (
                <li key={i} className="feast-prep-item">
                  <span className="feast-prep-icon">✦</span>{p}
                </li>
              ))}
            </ul>
            <div style={{marginTop:"0.9rem",padding:"0.75rem 1rem",background:"white",borderRadius:"10px",border:`1px solid ${feast.color}33`}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.12em",color:feast.color,marginBottom:"0.25rem"}}>KEY SCRIPTURE</div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",color:"var(--ink)"}}>{feast.scripture}</div>
            </div>
          </motion.div>
        )}
      </AnimatePresence>
    </motion.div>
  );
}

// ─── FEAST CALENDAR SECTION ───────────────────────────────────────────────────
function FeastCalendarSection({ setPage, t }) {
  const [filter, setFilter] = useState("all");
  const [expandedId, setExpandedId] = useState(null);

  const filtered = HOLY_FEASTS.filter(f => {
    if (filter === "all") return true;
    if (filter === "mandatory") return f.mandatory;
    return f.type === filter;
  });

  // Sort by next date ascending
  const sorted = [...filtered].sort((a, b) => {
    const da = getNextFeastDate(a);
    const db = getNextFeastDate(b);
    if (!da && !db) return 0;
    if (!da) return 1;
    if (!db) return -1;
    return da - db;
  });

  // Next upcoming (non-Shabbat) for the top highlight
  const nextMajor = sorted.find(f => f.id !== "shabbat");
  const shabbat = HOLY_FEASTS.find(f => f.id === "shabbat");
  const nextShabbat = getNextFeastDate(shabbat);
  const shabbatCD = getCountdown(nextShabbat);

  return (
    <div className="feast-section">
      {/* Shabbat weekly strip */}
      <div className="shabbat-strip">
        <div style={{display:"flex",alignItems:"center",gap:"0.9rem"}}>
          <span style={{fontSize:"1.6rem"}}>🕯️</span>
          <div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.18em",color:"var(--gold-light)",marginBottom:"0.18rem"}}>{t&&t.feastWeeklyShabbat||"WEEKLY SHABBAT"}</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.88rem",color:"var(--parchment)"}}>
              {shabbatCD && !shabbatCD.past ? `${shabbatCD.days}d ${shabbatCD.hours}h ${shabbatCD.minutes}m until Shabbat` : "Shabbat Shalom! 🕯️"}
            </div>
            <div style={{fontSize:"0.72rem",color:"rgba(250,246,238,0.5)"}}>Friday sunset → Saturday sunset · Exodus 20:8</div>
          </div>
        </div>
        <button className="btn-gold" style={{flexShrink:0}} onClick={() => setPage("livestream")}>{t&&t.feastJoinShabbat||"Join Shabbat Class →"}</button>
      </div>

      {/* Next major feast highlight */}
      {nextMajor && (() => {
        const nd = getNextFeastDate(nextMajor);
        const cd = getCountdown(nd);
        return cd && !cd.past ? (
          <div style={{background:`linear-gradient(135deg,${nextMajor.color},${nextMajor.color}CC)`,borderRadius:"16px",padding:"1.25rem 1.75rem",marginBottom:"1.25rem",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",flexWrap:"wrap",color:"white"}}>
            <div style={{display:"flex",alignItems:"center",gap:"1rem"}}>
              <span style={{fontSize:"2.2rem"}}>{nextMajor.icon}</span>
              <div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.18em",color:"rgba(255,255,255,0.65)",marginBottom:"0.2rem"}}>{t&&t.feastNextFeast||"NEXT FEAST APPROACHING"}</div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.1rem",fontWeight:700}}>{nextMajor.name}</div>
                <div style={{fontSize:"0.78rem",color:"rgba(255,255,255,0.7)",marginTop:"0.15rem"}}>{nextMajor.hebrew} · {nextMajor.scripture.split(" · ")[0]}</div>
              </div>
            </div>
            <div style={{display:"flex",gap:"1.2rem",alignItems:"baseline"}}>
              {cd.days > 0 && <div style={{textAlign:"center"}}><div style={{fontFamily:"'Cinzel',serif",fontSize:"2rem",fontWeight:700,lineHeight:1}}>{cd.days}</div><div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",opacity:0.7}}>DAYS</div></div>}
              <div style={{textAlign:"center"}}><div style={{fontFamily:"'Cinzel',serif",fontSize:"2rem",fontWeight:700,lineHeight:1}}>{String(cd.hours).padStart(2,"0")}</div><div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",opacity:0.7}}>HRS</div></div>
              <div style={{textAlign:"center"}}><div style={{fontFamily:"'Cinzel',serif",fontSize:"2rem",fontWeight:700,lineHeight:1}}>{String(cd.minutes).padStart(2,"0")}</div><div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",opacity:0.7}}>MIN</div></div>
            </div>
          </div>
        ) : null;
      })()}

      {/* Section header */}
      <div style={{display:"flex",alignItems:"flex-end",justifyContent:"space-between",marginBottom:"1rem",flexWrap:"wrap",gap:"0.75rem"}}>
        <div>
          <div className="section-eyebrow">✦ LEVITICUS 23 · THE LORD'S APPOINTED TIMES</div>
          <h2 className="section-h2" style={{marginBottom:"0.3rem"}}>{t&&t.feastTitle||"Holy Feast Calendar"}</h2>
          <p style={{fontSize:"0.82rem",color:"var(--muted)"}}>{t&&t.feastSub||"Mandatory appointed times with live countdowns. Click any feast to see how to observe it."}</p>
        </div>
        <button className="btn-outline" onClick={() => setPage && setPage("feasts")}>{t&&t.feastFullCalendar||"Full Calendar →"}</button>
      </div>

      {/* Filter bar */}
      <div className="feast-filter-bar">
        {[
          ["all", t&&t.filterAll||"All Feasts"],
          ["mandatory", t&&t.filterMandatory||"Mandatory"],
          ["weekly", t&&t.filterShabbat||"Shabbat"],
          ["spring", t&&t.filterSpring||"Spring"],
          ["fall", t&&t.filterFall||"Fall"],
          ["additional", t&&t.filterAdditional||"Additional"]
        ].map(([k,l]) => (
          <button key={k} className={`feast-filter-btn${filter===k?" active":""}`} onClick={() => setFilter(k)}>{l}</button>
        ))}
      </div>

      {/* Feast cards */}
      <div className="feast-grid">
        {sorted.map(f => (
          <FeastCard key={f.id} feast={f} expanded={expandedId === f.id} onToggle={() => setExpandedId(expandedId === f.id ? null : f.id)} />
        ))}
      </div>
    </div>
  );
}

// ─── IN-PERSON EVENTS SECTION ─────────────────────────────────────────────────
function InPersonEventsSection({ setPage }) {
  const [events, setEvents] = useState(DEFAULT_EVENTS);
  const [regModal, setRegModal] = useState(null); // event being registered for
  const [regForm, setRegForm] = useState({ name:"", email:"", phone:"", attendance:"in-person", notes:"" });
  const [regSubmitted, setRegSubmitted] = useState(false);
  const [showUpload, setShowUpload] = useState(false);
  const [uploadForm, setUploadForm] = useState({
    title:"", feast:"sukkot", type:"in-person", date:"", endDate:"", time:"",
    location:"", address:"", description:"", capacity:"", contactEmail:"", mapUrl:"",
  });
  const [uploadDone, setUploadDone] = useState(false);

  const feastLookup = id => HOLY_FEASTS.find(f => f.id === id);

  const handleRegSubmit = () => {
    if (!regForm.name.trim() || !regForm.email.trim()) return;
    setRegSubmitted(true);
  };

  const handleUploadSubmit = () => {
    if (!uploadForm.title || !uploadForm.date) return;
    const newEvent = {
      id: `evt-${Date.now()}`,
      ...uploadForm,
      registrationRequired: true,
      registrationFields: ["name","email","phone","attendance"],
      tags: [uploadForm.feast, uploadForm.type],
      status: "upcoming",
      postedBy: "Bible Club Admin",
      postedDate: new Date().toISOString().split("T")[0],
    };
    setEvents(prev => [newEvent, ...prev]);
    setUploadDone(true);
    setShowUpload(false);
    setUploadForm({ title:"", feast:"sukkot", type:"in-person", date:"", endDate:"", time:"", location:"", address:"", description:"", capacity:"", contactEmail:"", mapUrl:"" });
    setTimeout(() => setUploadDone(false), 4000);
  };

  return (
    <div style={{marginTop:"2.5rem"}}>
      <div style={{display:"flex",alignItems:"flex-end",justifyContent:"space-between",marginBottom:"1.25rem",flexWrap:"wrap",gap:"0.75rem"}}>
        <div>
          <div className="section-eyebrow">📍 IN-PERSON GATHERINGS</div>
          <h2 className="section-h2" style={{marginBottom:"0.3rem"}}>Feast Events & Gatherings</h2>
          <p style={{fontSize:"0.82rem",color:"var(--muted)"}}>Register for upcoming in-person events with minimal info required. Admins can post new events using the form below.</p>
        </div>
        <div style={{display:"flex",gap:"0.6rem"}}>
          {uploadDone && <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:"var(--sage)",padding:"0.5rem 0.9rem",background:"rgba(90,122,82,0.1)",borderRadius:"8px",border:"1px solid rgba(90,122,82,0.3)"}}>✓ Event Posted!</span>}
          <button className="btn-outline" onClick={() => setShowUpload(!showUpload)}>{showUpload ? "Cancel" : "➕ Post an Event"}</button>
        </div>
      </div>

      {/* Event upload form */}
      <AnimatePresence>
        {showUpload && (
          <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.28}}
            style={{background:"white",border:"1px solid var(--border)",borderRadius:"18px",padding:"1.75rem",marginBottom:"1.5rem",boxShadow:"var(--shadow)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.88rem",letterSpacing:"0.08em",color:"var(--ink)",marginBottom:"0.4rem"}}>📋 Post a New Event</div>
            <div style={{fontSize:"0.8rem",color:"var(--muted)",marginBottom:"1.5rem"}}>Fill in the event details. Location and date are required. Registration will open immediately.</div>

            <div className="form-grid-2" style={{marginBottom:"0.9rem"}}>
              <div>
                <label className="reg-label">EVENT TITLE *</label>
                <input className="reg-input" placeholder="e.g. Sukkot 2025 — Dallas Gathering" value={uploadForm.title} onChange={e => setUploadForm(f => ({...f, title:e.target.value}))} />
              </div>
              <div>
                <label className="reg-label">ASSOCIATED FEAST</label>
                <select className="reg-select" value={uploadForm.feast} onChange={e => setUploadForm(f => ({...f, feast:e.target.value}))}>
                  {HOLY_FEASTS.map(f => <option key={f.id} value={f.id}>{f.name}</option>)}
                </select>
              </div>
            </div>
            <div className="form-grid-2" style={{marginBottom:"0.9rem"}}>
              <div>
                <label className="reg-label">START DATE *</label>
                <input className="reg-input" type="date" value={uploadForm.date} onChange={e => setUploadForm(f => ({...f, date:e.target.value}))} />
              </div>
              <div>
                <label className="reg-label">END DATE</label>
                <input className="reg-input" type="date" value={uploadForm.endDate} onChange={e => setUploadForm(f => ({...f, endDate:e.target.value}))} />
              </div>
            </div>
            <div className="form-grid-2" style={{marginBottom:"0.9rem"}}>
              <div>
                <label className="reg-label">TIME</label>
                <input className="reg-input" placeholder="e.g. 6:00 PM CST" value={uploadForm.time} onChange={e => setUploadForm(f => ({...f, time:e.target.value}))} />
              </div>
              <div>
                <label className="reg-label">CAPACITY</label>
                <input className="reg-input" type="number" placeholder="e.g. 150" value={uploadForm.capacity} onChange={e => setUploadForm(f => ({...f, capacity:e.target.value}))} />
              </div>
            </div>
            <div style={{marginBottom:"0.9rem"}}>
              <label className="reg-label">LOCATION NAME *</label>
              <input className="reg-input" placeholder="e.g. Dallas Convention Center / TBD" value={uploadForm.location} onChange={e => setUploadForm(f => ({...f, location:e.target.value}))} />
            </div>
            <div style={{marginBottom:"0.9rem"}}>
              <label className="reg-label">FULL ADDRESS</label>
              <input className="reg-input" placeholder="Street address, city, state, zip" value={uploadForm.address} onChange={e => setUploadForm(f => ({...f, address:e.target.value}))} />
            </div>
            <div style={{marginBottom:"0.9rem"}}>
              <label className="reg-label">EVENT DESCRIPTION</label>
              <textarea className="form-textarea" placeholder="Describe the event — what to expect, what to bring, schedule, etc." value={uploadForm.description} onChange={e => setUploadForm(f => ({...f, description:e.target.value}))} />
            </div>
            <div className="form-grid-2" style={{marginBottom:"1.25rem"}}>
              <div>
                <label className="reg-label">GOOGLE MAPS LINK</label>
                <input className="reg-input" placeholder="https://maps.google.com/..." value={uploadForm.mapUrl} onChange={e => setUploadForm(f => ({...f, mapUrl:e.target.value}))} />
              </div>
              <div>
                <label className="reg-label">CONTACT EMAIL</label>
                <input className="reg-input" placeholder="events@goddiditbibleclub.com" value={uploadForm.contactEmail} onChange={e => setUploadForm(f => ({...f, contactEmail:e.target.value}))} />
              </div>
            </div>
            <button className="event-register-btn" onClick={handleUploadSubmit} disabled={!uploadForm.title || !uploadForm.date || !uploadForm.location}>
              📋 Post Event Now
            </button>
          </motion.div>
        )}
      </AnimatePresence>

      {/* Events grid */}
      {events.length === 0 ? (
        <div style={{textAlign:"center",padding:"3rem 1rem",color:"var(--muted)"}}>
          <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>📍</div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.8rem",letterSpacing:"0.1em"}}>No events posted yet</div>
          <div style={{fontSize:"0.8rem",marginTop:"0.5rem"}}>Use the "Post an Event" button above to add your first gathering.</div>
        </div>
      ) : (
        <div className="events-grid">
          {events.map(ev => {
            const feast = feastLookup(ev.feast);
            const evDate = new Date(ev.date + "T12:00:00");
            const isUpcoming = evDate >= new Date();
            return (
              <div key={ev.id} className="event-card">
                <div className="event-card-banner" style={{background:feast ? `linear-gradient(135deg,${feast.color},${feast.color}BB)` : "var(--deep)"}}>
                  <div style={{textAlign:"center"}}>
                    <span style={{fontSize:"2.2rem",display:"block",marginBottom:"0.2rem"}}>{feast?.icon || "📍"}</span>
                    <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"rgba(255,255,255,0.75)"}}>{feast?.name?.toUpperCase() || "EVENT"}</span>
                  </div>
                </div>
                <div style={{padding:"1.2rem 1.4rem"}}>
                  <div style={{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"0.5rem",marginBottom:"0.65rem"}}>
                    <div className="event-title">{ev.title}</div>
                    <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.1em",padding:"0.18rem 0.5rem",borderRadius:"20px",background:isUpcoming?"rgba(90,122,82,0.12)":"var(--cream)",color:isUpcoming?"var(--sage)":"var(--muted)",border:`1px solid ${isUpcoming?"rgba(90,122,82,0.3)":"var(--border)"}`,flexShrink:0}}>
                      {isUpcoming ? "UPCOMING" : "PAST"}
                    </span>
                  </div>
                  <div className="event-meta-row"><span>📅</span>{evDate.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}{ev.endDate && ev.endDate !== ev.date ? ` – ${new Date(ev.endDate+"T12:00:00").toLocaleDateString("en-US",{month:"long",day:"numeric"})}` : ""}</div>
                  {ev.time && <div className="event-meta-row"><span>🕕</span>{ev.time}</div>}
                  <div className="event-meta-row"><span>📍</span>{ev.location}</div>
                  {ev.address && <div className="event-meta-row" style={{fontSize:"0.72rem"}}><span>🗺️</span>{ev.address}</div>}
                  {ev.capacity && <div className="event-meta-row"><span>👥</span>Capacity: {ev.capacity} people</div>}
                  {ev.description && <div style={{fontSize:"0.8rem",color:"var(--muted)",lineHeight:1.72,margin:"0.75rem 0"}}>{ev.description.substring(0,160)}{ev.description.length > 160 ? "…" : ""}</div>}
                  <div style={{display:"flex",gap:"0.35rem",flexWrap:"wrap",marginBottom:"0.85rem"}}>
                    {ev.tags.map(tg => <span key={tg} style={{fontFamily:"'Cinzel',serif",fontSize:"0.56rem",letterSpacing:"0.1em",padding:"0.18rem 0.55rem",borderRadius:"20px",border:"1px solid var(--border)",background:"var(--cream)",color:"var(--muted)"}}>{tg}</span>)}
                  </div>
                  {ev.mapUrl && <a href={ev.mapUrl} target="_blank" rel="noreferrer" style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:"var(--gold)",display:"block",marginBottom:"0.75rem",textDecoration:"none"}}>🗺️ View on Google Maps →</a>}
                  {ev.contactEmail && <div style={{fontSize:"0.72rem",color:"var(--muted)",marginBottom:"0.85rem"}}>Questions: <a href={`mailto:${ev.contactEmail}`} style={{color:"var(--gold)"}}>{ev.contactEmail}</a></div>}
                  {isUpcoming && (
                    <button className="event-register-btn" onClick={() => { setRegModal(ev); setRegSubmitted(false); setRegForm({name:"",email:"",phone:"",attendance:"in-person",notes:""}); }}>
                      {ev.registrationRequired ? "✦ Register to Attend" : "✦ I'll Be There"}
                    </button>
                  )}
                </div>
              </div>
            );
          })}
        </div>
      )}

      {/* Registration modal */}
      <AnimatePresence>
        {regModal && (
          <motion.div className="reg-modal-overlay" initial={{opacity:0}} animate={{opacity:1}} exit={{opacity:0}} onClick={e => { if(e.target === e.currentTarget) setRegModal(null); }}>
            <motion.div className="reg-modal" initial={{scale:0.9,opacity:0}} animate={{scale:1,opacity:1}} exit={{scale:0.9,opacity:0}}>
              {!regSubmitted ? (
                <>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.5rem"}}>REGISTER TO ATTEND</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.05rem",color:"var(--ink)",marginBottom:"0.4rem"}}>{regModal.title}</div>
                  <div style={{fontSize:"0.8rem",color:"var(--muted)",marginBottom:"1.5rem",lineHeight:1.65}}>Just a few quick details — we'll send you the confirmation and any updates.</div>
                  <label className="reg-label">YOUR NAME *</label>
                  <input className="reg-input" placeholder="First and last name" value={regForm.name} onChange={e => setRegForm(f => ({...f,name:e.target.value}))} />
                  <label className="reg-label">EMAIL *</label>
                  <input className="reg-input" type="email" placeholder="your@email.com" value={regForm.email} onChange={e => setRegForm(f => ({...f,email:e.target.value}))} />
                  <label className="reg-label">PHONE (OPTIONAL)</label>
                  <input className="reg-input" type="tel" placeholder="+1 (000) 000-0000" value={regForm.phone} onChange={e => setRegForm(f => ({...f,phone:e.target.value}))} />
                  <label className="reg-label">ATTENDANCE TYPE</label>
                  <select className="reg-select" value={regForm.attendance} onChange={e => setRegForm(f => ({...f,attendance:e.target.value}))}>
                    <option value="in-person">In Person</option>
                    <option value="online">Online / Watch Remotely</option>
                    <option value="both">Both (in-person + online)</option>
                  </select>
                  <label className="reg-label">ANYTHING ELSE? (OPTIONAL)</label>
                  <textarea className="form-textarea" style={{marginBottom:"1rem"}} placeholder="Dietary needs, accessibility, number of family members, questions…" value={regForm.notes} onChange={e => setRegForm(f => ({...f,notes:e.target.value}))} />
                  <button className="event-register-btn" onClick={handleRegSubmit} disabled={!regForm.name.trim() || !regForm.email.trim()}>
                    Confirm Registration ✦
                  </button>
                  <button onClick={() => setRegModal(null)} style={{width:"100%",marginTop:"0.6rem",background:"none",border:"none",fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.1em",color:"var(--muted)",cursor:"pointer",padding:"0.5rem"}}>Cancel</button>
                </>
              ) : (
                <div style={{textAlign:"center",padding:"1rem 0"}}>
                  <div style={{fontSize:"3rem",marginBottom:"1rem"}}>✦</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.2rem",color:"var(--ink)",marginBottom:"0.6rem"}}>You're Registered!</div>
                  <div style={{fontSize:"0.88rem",color:"var(--muted)",lineHeight:1.75,marginBottom:"1.5rem"}}>
                    Thank you, {regForm.name}! We've received your registration for <strong>{regModal.title}</strong>. A confirmation will be sent to <strong>{regForm.email}</strong>.
                  </div>
                  <div style={{background:"var(--cream)",borderRadius:"12px",padding:"1rem",marginBottom:"1.5rem",border:"1px solid var(--border)"}}>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.14em",color:"var(--gold)",marginBottom:"0.4rem"}}>WHAT'S NEXT</div>
                    <div style={{fontSize:"0.82rem",color:"var(--muted)",lineHeight:1.7}}>Watch your inbox for event updates, location details, and the Shabbat class schedule leading up to the event.</div>
                  </div>
                  <button className="btn-gold" onClick={() => setRegModal(null)}>Close</button>
                </div>
              )}
            </motion.div>
          </motion.div>
        )}
      </AnimatePresence>
    </div>
  );
}

// ─── HOME PAGE ────────────────────────────────────────────────────────────────
function HomePage({ setPage, t, goToScripture }) {
  const [searchQ, setSearchQ] = useState("");
  const [dailySlide, setDailySlide] = useState(0); // 0=devotional 1=prayer
  const nextClass = SHABBAT_SCHEDULE.find(s => s.type === "main");
  const upcomingAll = SHABBAT_SCHEDULE.slice(0, 3);

  const handleSearch = () => {
    if (searchQ.trim()) {
      if (goToScripture) goToScripture(searchQ.trim());
      else setPage("bible-hub");
    } else {
      setPage("bible-hub");
    }
  };

  // Quick access tiles
  const QUICK_TILES = [
    { icon:"📖", label:t.quickScripture||"Scripture", page:"bible-hub" },
    { icon:"🎧", label:t.quickAudio||"Audio", page:"audio" },
    { icon:"📅", label:t.quickReading||"Reading", page:"reading" },
    { icon:"🕎", label:t.quickFeasts||"Feasts", page:"bible-hub" },
    { icon:"🌸", label:t.quickWomen||"Women", page:"women" },
    { icon:"⛓️", label:t.quickCaptivities||"Captivities", page:"captivities" },
  ];

  // Feature tiles (2x grid)
  const FEATURE_TILES = [
    { icon:"🏛️", title:t.tileAncient||"Ancient Israel", sub:t.tileAncientSub||"Timeline, Tribes & History", page:"ancient-israel" },
    { icon:"⛓️", title:t.tileCaptiv||"7 Captivities", sub:t.tileCaptivSub||"Egypt → Diaspora", page:"captivities" },
    { icon:"🌸", title:t.tileWomen||"Women's Study", sub:t.tileWomenSub||"Covenant identity & laws", page:"women" },
    { icon:"📖", title:t.tileDeut||"Deut. 28 Study", sub:t.tileDeutSub||"Signs & wonders module", page:"deut28" },
    { icon:"🗺️", title:t.tileTribes||"12 Tribes", sub:t.tileTribesSub||"Prophecies & diaspora", page:"ai-tribes" },
    { icon:"🏛️", title:t.tileHist||"Historical Context", sub:t.tileHistSub||"Papal bulls & modern Israel", page:"historical" },
  ];

  return (
    <div>
      {/* ── COMPACT HERO ── */}
      <section className="hero fade-up" style={{paddingBottom:"1.5rem"}}>
        <div className="hero-eyebrow">{t.heroEyebrow}</div>
        <h1 className="hero-h1" style={{fontSize:"clamp(1.6rem,5vw,2.8rem)"}}>
          {t.heroH1a}<br /><em>{t.heroH1b}</em>
        </h1>
        <p className="hero-sub" style={{maxWidth:"460px",marginBottom:"1.25rem"}}>{t.heroSub}</p>
        <div className="hero-actions" style={{gap:"0.6rem",flexWrap:"wrap"}}>
          <button className="btn-gold" style={{flex:"none"}} onClick={() => setPage("weekly")}>{t.heroCta1}</button>
          <button className="btn-outline-light" style={{flex:"none"}} onClick={() => setPage("bible-hub")}>{t.heroCta3}</button>
          <button className="btn-outline-light" style={{flex:"none"}} onClick={() => setPage("devotional")}>{t.heroCard2t || "Devotional"}</button>
        </div>
      </section>

      {/* ── HOMEPAGE SEARCH BAR ── */}
      <div style={{position:"relative",marginBottom:"1.25rem"}}>
        <span className="home-search-icon">🔍</span>
        <input
          className="home-search-input"
          placeholder={t.homeSearchPlaceholder||"Search scripture, topic, or tribe…"}
          value={searchQ}
          onChange={e => setSearchQ(e.target.value)}
          onKeyDown={e => e.key === "Enter" && handleSearch()}
        />
        {searchQ && (
          <button onClick={handleSearch}
            style={{position:"absolute",right:"0.6rem",top:"50%",transform:"translateY(-50%)",background:"var(--gold)",color:"white",border:"none",borderRadius:"8px",padding:"0.38rem 0.85rem",fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",cursor:"pointer"}}>
            Go →
          </button>
        )}
      </div>

      {/* ── QUICK ACCESS GRID ── */}
      <div className="quick-grid" style={{marginBottom:"1.5rem"}}>
        {QUICK_TILES.map(tile => (
          <button key={tile.label} className="quick-tile" onClick={() => setPage(tile.page)}>
            <span className="quick-tile-icon">{tile.icon}</span>
            <span className="quick-tile-label">{tile.label}</span>
          </button>
        ))}
      </div>

      {/* ── LIVE SHABBAT BANNER ── */}
      {nextClass && (
        <div className="live-banner fade-up delay-1" style={{marginBottom:"1.25rem"}}>
          <div className="live-banner-left">
            <div className="live-banner-dot" />
            <div>
              <div className="live-banner-label">UPCOMING SHABBAT CLASS</div>
              <div className="live-banner-title">{nextClass.title}</div>
              <div className="live-banner-time">{nextClass.day} · {nextClass.time}</div>
            </div>
          </div>
          <div style={{display:"flex",flexDirection:"column",gap:"0.45rem",alignItems:"flex-end",flexShrink:0}}>
            <button className="live-banner-btn" onClick={() => setPage("livestream")}>📡 Watch Live</button>
            <div className="live-banner-platforms">
              {(nextClass.platforms||[]).map(p => {
                const pl = LIVE_STREAMS.find(ls => ls.id === p);
                return pl ? <span key={p} className="live-banner-platform">{pl.icon} {pl.name}</span> : null;
              })}
            </div>
          </div>
        </div>
      )}

      {/* ── DAILY DASHBOARD — swipeable devotional/prayer ── */}
      <div className="home-section-divider"><span className="home-section-title">✦ {t.homeDailyBread||"TODAY'S DAILY BREAD"}</span></div>

      {/* Slide toggle */}
      <div style={{display:"flex",gap:0,marginBottom:"0.85rem",border:"1px solid var(--border)",borderRadius:"10px",overflow:"hidden",width:"fit-content"}}>
        {[[t.toggleDevotional||"🕯️ Devotional", 0], [t.togglePrayer||"🙏 Prayer", 1]].map(([label, idx]) => (
          <button key={idx} onClick={() => setDailySlide(idx)}
            style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.1em",padding:"0.55rem 1.1rem",border:"none",borderRight: idx===0?"1px solid var(--border)":"none",background:dailySlide===idx?"var(--deep)":"white",color:dailySlide===idx?"var(--parchment)":"var(--muted)",cursor:"pointer",transition:"all 0.18s"}}>
            {label}
          </button>
        ))}
      </div>

      {dailySlide === 0 && <DailyDevotionalWidget setPage={setPage} />}
      {dailySlide === 1 && <DailyPrayerWidget compact={false} />}

      {/* ── SCHEDULE STRIP ── */}
      <div className="home-section-divider" style={{marginTop:"1.5rem"}}><span className="home-section-title">📅 {t.homeClassSchedule||"CLASS SCHEDULE"}</span></div>
      <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(180px,1fr))",gap:"0.6rem",marginBottom:"1.5rem"}}>
        {upcomingAll.map(item => (
          <div key={item.id} onClick={() => setPage("livestream")}
            style={{background:"white",border:"1px solid var(--border)",borderRadius:"12px",padding:"0.85rem 1.1rem",cursor:"pointer",transition:"all 0.18s",display:"flex",gap:"0.65rem",alignItems:"flex-start",boxShadow:"var(--shadow)"}} className="card">
            <div style={{width:"8px",height:"8px",borderRadius:"50%",background:SCHEDULE_TYPE_COLORS[item.type]||"var(--gold)",flexShrink:0,marginTop:"5px"}} />
            <div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.1em",color:"var(--gold)",marginBottom:"0.18rem"}}>{item.day}</div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",color:"var(--ink)",lineHeight:1.3,marginBottom:"0.15rem"}}>{item.time}</div>
              <div style={{fontSize:"0.74rem",color:"var(--muted)",lineHeight:1.4}}>{item.title}</div>
            </div>
          </div>
        ))}
      </div>

      {/* ── PROGRESS PILLS ── */}
      <div className="home-section-divider"><span className="home-section-title">📚 {t.homeContinue||"CONTINUE STUDYING"}</span></div>
      <div className="progress-row" style={{marginBottom:"1.5rem",flexWrap:"wrap"}}>
        {[
          { icon:"📖", label:t.pillWeekly||"Weekly Study", title:t.f1title||"52-Week Curriculum", page:"weekly" },
          { icon:"📅", label:t.pillReading||"Reading Plan", title:t.pillReadingSub||"14-Day Identity Roadmap", page:"reading" },
          { icon:"🎧", label:t.pillAudio||"Audio Bible", title:t.f5title||"Verse by Verse", page:"audio" },
        ].map(p => (
          <div key={p.page} className="progress-pill" onClick={() => setPage(p.page)}>
            <span className="progress-pill-icon">{p.icon}</span>
            <div>
              <div className="progress-pill-label">{p.label}</div>
              <div className="progress-pill-title">{p.title}</div>
            </div>
            <span style={{marginLeft:"auto",color:"var(--gold)",fontSize:"0.75rem"}}>→</span>
          </div>
        ))}
      </div>

      {/* ── FEATURE TILES GRID ── */}
      <div className="home-section-divider"><span className="home-section-title">🏛️ {t.homeDeepStudy||"DEEP STUDY SECTIONS"}</span></div>
      <div className="feature-tile-grid" style={{marginBottom:"1.5rem"}}>
        {FEATURE_TILES.map(f => (
          <div key={f.title} className="feature-tile" onClick={() => setPage(f.page)}>
            <span className="feature-tile-icon">{f.icon}</span>
            <div className="feature-tile-title">{f.title}</div>
            <div className="feature-tile-sub">{f.sub}</div>
          </div>
        ))}
      </div>

      {/* ── FEAST CALENDAR ── */}
      <div className="divider"><span className="divider-icon">✦</span></div>
      <FeastCalendarSection setPage={setPage} t={t} />

      {/* ── CAPTIVITIES TEASER ── */}
      <div className="divider"><span className="divider-icon">✦</span></div>
      <div style={{background:"var(--deep)",borderRadius:"18px",padding:"1.75rem 2rem",color:"var(--parchment)",marginBottom:"1.5rem"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.2em",color:"var(--gold-light)",marginBottom:"0.6rem"}}>⛓️ THE 7 CAPTIVITIES OF ISRAEL</div>
        <h3 style={{fontFamily:"'Cinzel',serif",fontSize:"1.25rem",color:"white",marginBottom:"0.55rem",lineHeight:1.3}}>{t.captivTeaser||"Egypt → Assyria → Babylon → Rome → Diaspora"}</h3>
        <p style={{fontSize:"0.84rem",color:"rgba(250,246,238,0.65)",lineHeight:1.75,marginBottom:"1.1rem",maxWidth:"480px"}}>{t.captivTeaserSub||"A scripture-first study of Israel's seven major captivities."}</p>
        <button className="btn-gold" onClick={() => setPage("captivities")}>{t.captivTeaserBtn||"Study the Captivities →"}</button>
      </div>

      {/* ── COMMUNITY SECTION ── */}
      <div className="divider"><span className="divider-icon">✦</span></div>
      <InPersonEventsSection setPage={setPage} />
      <div className="divider"><span className="divider-icon">✦</span></div>
      <div style={{textAlign:"center",padding:"0.5rem 0 2rem"}}>
        <div className="section-eyebrow" style={{justifyContent:"center"}}>{t.joinCtaEyebrow}</div>
        <h2 className="section-h2" style={{textAlign:"center"}}>{t.communityTitle||t.joinCtaH2}</h2>
        <p className="section-body" style={{textAlign:"center",margin:"0 auto 2rem"}}>{t.joinCtaSub}</p>
        <button className="btn-gold" onClick={() => setPage("join")}>{t.joinCtaBtn}</button>
      </div>
    </div>
  );
}

// ─── WEEKLY STUDY PAGE ────────────────────────────────────────────────────────
function WeeklyPage({ t, setPage }) {
  const [query, setQuery] = useState("");
  const [activeTag, setActiveTag] = useState(null);
  const [activeSeason, setActiveSeason] = useState("ALL");
  const [showHebrew, setShowHebrew] = useState(false);
  const [hebrewWeek, setHebrewWeek] = useState(1);
  const [expandedWeek, setExpandedWeek] = useState(null);
  const inputRef = useRef(null);

  const allSeasons = ["ALL", ...Object.keys(SEASON_COLORS)];
  const allTopics = [...new Set(WEEKLY_STUDIES.flatMap(s => s.topics))].sort();

  const filtered = WEEKLY_STUDIES.filter(s => {
    const q = query.toLowerCase();
    const matchText = !q || s.title.toLowerCase().includes(q) || s.summary.toLowerCase().includes(q) || s.anchor.toLowerCase().includes(q) || s.topics.some(t => t.toLowerCase().includes(q));
    const matchTag = !activeTag || s.topics.includes(activeTag);
    const matchSeason = activeSeason === "ALL" || s.season === activeSeason;
    return matchText && matchTag && matchSeason;
  });

  const hebrewEntry = HEBREW_WORDS.find(h => h.week === hebrewWeek) || HEBREW_WORDS[0];
  const nextClass = SHABBAT_SCHEDULE.find(s => s.type === "main");

  return (
    <div>
      {/* Header */}
      <div style={{display:"flex",alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",gap:"1rem",marginBottom:"0.5rem"}}>
        <div>
          <div className="section-eyebrow">{t.weeklyEyebrow}</div>
          <h2 className="section-h2">{t.weeklyH2}</h2>
          <p className="section-body" style={{marginBottom:"0"}}>{t.weeklySub}</p>
        </div>
        <div style={{background:"var(--deep)",borderRadius:"14px",padding:"0.9rem 1.3rem",color:"var(--parchment)",textAlign:"center",flexShrink:0}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--gold-light)",marginBottom:"0.2rem"}}>{t.weeklyStudies}</div>
          <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"2.2rem",fontWeight:700,lineHeight:1,color:"var(--gold-light)"}}>{WEEKLY_STUDIES.length}</div>
          <div style={{fontSize:"0.65rem",color:"rgba(250,246,238,0.5)",marginTop:"0.2rem"}}>{t.weeklyWeeksLabel}</div>
        </div>
      </div>

      {/* Live class nudge */}
      {nextClass && (
        <div className="live-banner" style={{marginBottom:"1.5rem"}}>
          <div className="live-banner-left">
            <div className="live-dot" />
            <div>
              <div className="live-banner-label">NEXT SHABBAT CLASS</div>
              <div className="live-banner-title">{nextClass.title}</div>
              <div className="live-banner-time">{nextClass.day} · {nextClass.time}</div>
            </div>
          </div>
          <button className="live-banner-btn" onClick={() => setPage && setPage("livestream")}>Join Live →</button>
        </div>
      )}

      {/* Hebrew Word of the Week Panel */}
      <div style={{background:"var(--deep)",borderRadius:"16px",padding:"1.4rem 1.6rem",marginBottom:"1.75rem",display:"flex",gap:"1.5rem",alignItems:"center",flexWrap:"wrap"}}>
        <div style={{flex:1,minWidth:"200px"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.2em",color:"var(--gold-light)",marginBottom:"0.5rem"}}>{t.hebrewEyebrow}</div>
          <div style={{display:"flex",alignItems:"baseline",gap:"0.7rem",flexWrap:"wrap",marginBottom:"0.4rem"}}>
            <span style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"2rem",fontWeight:700,color:"var(--gold-light)"}}>{hebrewEntry.word}</span>
            <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.1em",color:"rgba(250,246,238,0.55)"}}>{hebrewEntry.meaning}</span>
          </div>
          <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.88rem",fontStyle:"italic",color:"var(--gold-light)",marginBottom:"0.5rem"}}>{hebrewEntry.verse}</div>
          <div style={{fontSize:"0.8rem",color:"rgba(250,246,238,0.6)",lineHeight:1.7}}>{hebrewEntry.desc}</div>
        </div>
        <div style={{display:"flex",flexDirection:"column",gap:"0.5rem",alignItems:"center"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.14em",color:"rgba(250,246,238,0.4)",marginBottom:"0.2rem"}}>WEEK</div>
          <div style={{display:"flex",alignItems:"center",gap:"0.5rem"}}>
            <button onClick={() => setHebrewWeek(w => Math.max(1,w-1))} style={{width:32,height:32,borderRadius:"50%",border:"1px solid rgba(250,246,238,0.2)",background:"rgba(250,246,238,0.06)",color:"var(--parchment)",cursor:"pointer",fontSize:"0.9rem"}}>‹</button>
            <span style={{fontFamily:"'Cinzel',serif",fontSize:"1.1rem",color:"var(--gold-light)",minWidth:"28px",textAlign:"center"}}>{hebrewWeek}</span>
            <button onClick={() => setHebrewWeek(w => Math.min(52,w+1))} style={{width:32,height:32,borderRadius:"50%",border:"1px solid rgba(250,246,238,0.2)",background:"rgba(250,246,238,0.06)",color:"var(--parchment)",cursor:"pointer",fontSize:"0.9rem"}}>›</button>
          </div>
          <button onClick={() => setHebrewWeek(Math.floor(Math.random()*52)+1)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",background:"rgba(196,137,58,0.2)",border:"1px solid rgba(196,137,58,0.35)",borderRadius:"6px",color:"var(--gold-light)",padding:"0.3rem 0.65rem",cursor:"pointer",marginTop:"0.2rem"}}>RANDOM</button>
        </div>
      </div>

      {/* Season Filters */}
      <div style={{marginBottom:"1.25rem"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--muted)",marginBottom:"0.55rem"}}>{t.seasonLabel}</div>
        <div style={{display:"flex",gap:"0.45rem",flexWrap:"wrap"}}>
          {allSeasons.map(s => {
            const isActive = activeSeason === s;
            const col = SEASON_COLORS[s];
            return (
              <button key={s} onClick={() => { setActiveSeason(s); setQuery(""); setActiveTag(null); }}
                style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",padding:"0.45rem 0.9rem",borderRadius:"8px",border:`1px solid ${isActive?(col||"var(--gold)"):"var(--border)"}`,background:isActive?(col||"var(--gold)"):"white",color:isActive?"white":"var(--muted)",cursor:"pointer",transition:"all 0.18s"}}>
                {s === "ALL" ? t.allWeeks : s.replace("Phase ","P").split(" — ")[0] + " — " + s.split(" — ")[1]}
              </button>
            );
          })}
        </div>
      </div>

      {/* Search */}
      <div className="search-wrap">
        <span className="search-icon">🔍</span>
        <input ref={inputRef} className="search-input" placeholder={t.searchPlaceholder} value={query} onChange={e => { setQuery(e.target.value); setActiveTag(null); setActiveSeason("ALL"); }} />
        {query && <button className="search-clear" onClick={() => { setQuery(""); setActiveTag(null); inputRef.current?.focus(); }}>✕</button>}
      </div>

      {/* Topic Tags */}
      <div style={{marginBottom:"1.5rem"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--muted)",marginBottom:"0.6rem"}}>{t.topicLabel} — {allTopics.length}</div>
        <div style={{display:"flex",flexWrap:"wrap",gap:"0.28rem",maxHeight:showHebrew?"none":"92px",overflow:showHebrew?"visible":"hidden",position:"relative"}}>
          {allTopics.map(topic => (
            <span key={topic} className={`tag${activeTag===topic?" active":""}`} onClick={() => { setActiveTag(activeTag===topic?null:topic); setQuery(""); setActiveSeason("ALL"); }}>{topic}</span>
          ))}
        </div>
        <button className="btn-text" style={{marginTop:"0.5rem",fontSize:"0.65rem"}} onClick={() => setShowHebrew(!showHebrew)}>{showHebrew ? t.showLess : t.showAll}</button>
      </div>

      {/* Results count */}
      {(query || activeTag || activeSeason !== "ALL") && (
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:"var(--muted)",marginBottom:"1rem",display:"flex",alignItems:"center",gap:"0.6rem"}}>
          <span>{filtered.length} {filtered.length === 1 ? t.studyFound : t.studiesFound}</span>
          <button className="btn-outline" style={{padding:"0.25rem 0.65rem",fontSize:"0.6rem"}} onClick={() => { setQuery(""); setActiveTag(null); setActiveSeason("ALL"); }}>{t.clearAll}</button>
        </div>
      )}

      {/* Results */}
      {filtered.length === 0 ? (
        <div className="no-results">
          <div className="no-results-icon">📜</div>
          <div className="no-results-text">{t.noStudiesText} "{query || activeTag}"</div>
          <button className="btn-outline" style={{marginTop:"1rem"}} onClick={() => { setQuery(""); setActiveTag(null); setActiveSeason("ALL"); }}>{t.clearSearch}</button>
        </div>
      ) : (
        filtered.map((s,i) => {
          const isOpen = expandedWeek === s.week;
          return (
            <motion.div key={s.week} className="study-card" initial={{opacity:0,y:14}} animate={{opacity:1,y:0}} transition={{delay:Math.min(i*0.05,0.4)}}>
              <div className="study-header" style={{borderBottom:`3px solid ${s.color}`}}>
                <div style={{flex:1}}>
                  <div style={{display:"flex",gap:"0.5rem",alignItems:"center",flexWrap:"wrap",marginBottom:"0.2rem"}}>
                    <div className="study-week" style={{color:s.color,marginBottom:0}}>{s.week}</div>
                    <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.1em",padding:"0.18rem 0.55rem",borderRadius:"20px",border:`1px solid ${s.color}44`,background:`${s.color}12`,color:s.color}}>{s.phase || s.season}</span>
                    {s.months && <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.56rem",letterSpacing:"0.1em",color:"var(--muted)",padding:"0.18rem 0.55rem",borderRadius:"20px",border:"1px solid var(--border)",background:"var(--cream)"}}>{s.months}</span>}
                  </div>
                  <div className="study-title">{s.title}</div>
                </div>
                <div className="study-anchor" style={{alignSelf:"flex-start"}}>{s.anchor}</div>
              </div>
              <div className="study-summary">{s.summary}</div>
              <div style={{padding:"0 1.6rem 1rem",background:"white"}}>
                {s.topics.map(topic => (
                  <span key={topic} className={`tag${activeTag===topic?" active":""}`} onClick={() => { setActiveTag(activeTag===topic?null:topic); setQuery(""); }}>{topic}</span>
                ))}
              </div>
              <div className="study-takeaways">
                {s.takeaways.map(tk => <div key={tk} className="takeaway" style={{borderLeftColor:s.color}}>{tk}</div>)}
              </div>

              {/* Expand/collapse button */}
              <button className="study-expand-btn" onClick={() => setExpandedWeek(isOpen ? null : s.week)}>
                <span style={{fontSize:"0.9rem"}}>{isOpen ? "▲" : "▼"}</span>
                {isOpen ? "Hide Shabbat Class Lesson" : "▸ Open Shabbat Class Lesson"}
                <span style={{marginLeft:"auto",fontFamily:"'Cinzel',serif",fontSize:"0.58rem",color:"var(--muted)",letterSpacing:"0.1em"}}>TEACHING · REFLECTION · ASSIGNMENT</span>
              </button>

              {/* Expanded lesson content */}
              <AnimatePresence>
                {isOpen && (
                  <motion.div className="study-expanded" initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.28}}>

                    {/* Teaching */}
                    {s.teaching && <>
                      <div className="study-section-label">🎙️ TEACHING</div>
                      <div className="study-teaching">"{s.teaching}"</div>
                    </>}

                    {/* Shabbat class flow */}
                    <div className="study-section-label">🕯️ SHABBAT CLASS FLOW — 60 MIN</div>
                    <div className="shabbat-flow">
                      {SHABBAT_FLOW.map(step => (
                        <div key={step.step} className="shabbat-step">
                          <span className="shabbat-step-icon">{step.icon}</span>
                          <div>
                            <div className="shabbat-step-num">STEP {step.step}</div>
                            <div className="shabbat-step-label">{step.label}</div>
                            <div className="shabbat-step-time">{step.time}</div>
                          </div>
                        </div>
                      ))}
                    </div>

                    {/* Reflection */}
                    {s.reflection && <>
                      <div className="study-section-label">💬 REFLECTION QUESTION</div>
                      <div className="study-reflection">{s.reflection}</div>
                    </>}

                    {/* Assignment */}
                    {s.assignment && <>
                      <div className="study-section-label">📝 WEEKLY ASSIGNMENT</div>
                      <div className="study-assignment">{s.assignment}</div>
                    </>}

                    {/* Action */}
                    {s.action && <>
                      <div className="study-section-label">⚡ THIS WEEK'S ACTION</div>
                      <div className="study-action">{s.action}</div>
                    </>}

                    {/* Rock Did It phase badge */}
                    <div style={{marginTop:"1.1rem",padding:"0.75rem 1rem",background:`${s.color}15`,borderRadius:"10px",display:"flex",alignItems:"center",gap:"0.6rem",border:`1px solid ${s.color}30`}}>
                      <span style={{fontSize:"0.9rem"}}>🏔️</span>
                      <div>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.12em",color:s.color,marginBottom:"0.1rem"}}>ROCK DID IT 15-MONTH ALIGNMENT</div>
                        <div style={{fontSize:"0.78rem",color:"var(--muted)"}}>{s.phase} · {s.months}</div>
                      </div>
                      {setPage && <button className="btn-text" style={{marginLeft:"auto",fontSize:"0.62rem"}} onClick={() => setPage("livestream")}>Watch Live →</button>}
                    </div>
                  </motion.div>
                )}
              </AnimatePresence>
            </motion.div>
          );
        })
      )}
    </div>
  );
}

// ─── DEVOTIONAL PAGE ──────────────────────────────────────────────────────────
function DevotionalPage({ t, goToScripture, setPage }) {
  const [activeDay, setActiveDay] = useState("Day 1");
  const [copied, setCopied] = useState(false);
  const [openCommentary, setOpenCommentary] = useState(false);
  const [openLawSec, setOpenLawSec] = useState(null);
  const [openDiasSec, setOpenDiasSec] = useState(null);
  const [aiExplain, setAiExplain] = useState({});
  const [aiLoading, setAiLoading] = useState({});
  const d = DEVOTIONALS.find(x => x.day === activeDay) || DEVOTIONALS[0];

  const copyPrayer = () => {
    const text = `${d.day} — ${d.title}\n\nStage: ${d.stage}\n\n${d.verse}\n"${d.text}"\n\nPrayer:\n${d.prayer}\n\nAction Step:\n${d.action}`;
    if (navigator.clipboard) navigator.clipboard.writeText(text).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2500); });
    else { const el=document.createElement("textarea"); el.value=text; document.body.appendChild(el); el.select(); document.execCommand("copy"); document.body.removeChild(el); setCopied(true); setTimeout(()=>setCopied(false),2500); }
  };

  const explainVerse = async (ref) => {
    if (aiExplain[ref]) return;
    setAiLoading(s => ({...s,[ref]:true}));
    try {
      const res = await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:"claude-sonnet-4-20250514",max_tokens:400,messages:[{role:"user",content:`Explain this Bible verse plainly for a covenant study student. Include historical context, Hebrew/Greek meaning if relevant, and practical application. Use "YAHAWAH" and "Yahawashi". Under 100 words.\n\nVerse: ${ref}`}]})});
      const data = await res.json();
      setAiExplain(s => ({...s,[ref]:data.content?.map(c=>c.text||"").join("")||"Unable to load."}));
    } catch { setAiExplain(s => ({...s,[ref]:"Unable to load at this time."})); }
    setAiLoading(s => ({...s,[ref]:false}));
  };

  const idx = DEVOTIONALS.findIndex(x => x.day === activeDay);
  const nextDay = DEVOTIONALS[idx + 1];
  const prevDay = DEVOTIONALS[idx - 1];

  const RESOURCE_BADGE_COLORS = {
    "Scripture Source":"var(--gold)","Historical Source":"#8B3A2A",
    "Encyclopedia":"#1B3A5C","Historical Interpretation":"#6D4C41","Teaching Commentary":"#7B5EA7",
  };

  const ScripturePill = ({verse, color}) => {
    const [showAI, setShowAI] = useState(false);
    return (
      <div style={{background:"var(--cream)",borderRadius:"11px",padding:"0.85rem 1.05rem",marginBottom:"0.55rem",border:"1px solid var(--border)",borderLeft:`3px solid ${color||"var(--gold)"}`}}>
        <div style={{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.4rem",marginBottom:"0.35rem"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",color:color||"var(--gold)",fontWeight:600}}>{verse.ref}</div>
          <div style={{display:"flex",gap:"0.35rem",flexShrink:0}}>
            {goToScripture && <button onClick={()=>goToScripture(verse.ref)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.2rem 0.5rem",borderRadius:"5px",background:"transparent",border:`1px solid ${color||"var(--gold)"}44`,color:color||"var(--gold)",cursor:"pointer"}}>📖</button>}
            <button onClick={()=>{setShowAI(!showAI);if(!showAI&&!aiExplain[verse.ref])explainVerse(verse.ref);}} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.2rem 0.5rem",borderRadius:"5px",background:showAI?`${color||"#C4893A"}20`:"transparent",border:`1px solid ${color||"var(--gold)"}44`,color:color||"var(--gold)",cursor:"pointer"}}>🤖</button>
            <button onClick={()=>navigator.clipboard&&navigator.clipboard.writeText(`${verse.ref}\n"${verse.text}"`)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.2rem 0.5rem",borderRadius:"5px",background:"transparent",border:"1px solid var(--border)",color:"var(--muted)",cursor:"pointer"}}>📋</button>
          </div>
        </div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.98rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.75}}>"{verse.text}"</div>
        {showAI && (
          <div style={{marginTop:"0.65rem",background:`${color||"#C4893A"}0d`,borderRadius:"8px",padding:"0.65rem 0.85rem",borderTop:"1px solid var(--border)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.12em",color:color||"var(--gold)",marginBottom:"0.3rem"}}>🤖 EXPLANATION</div>
            {aiLoading[verse.ref] ? <div style={{fontSize:"0.78rem",color:"var(--muted)",fontStyle:"italic"}}>Generating…</div> : <div style={{fontSize:"0.8rem",color:"var(--ink)",lineHeight:1.78}}>{aiExplain[verse.ref]}</div>}
          </div>
        )}
      </div>
    );
  };

  return (
    <div>
      {/* Page header */}
      <div style={{marginBottom:"1.5rem"}}>
        <div className="section-eyebrow">✦ 7-STAGE COVENANT AWAKENING</div>
        <h2 className="section-h2">{t.devJourneyTitle||"A Guided Transformation Roadmap"}</h2>
        <p className="section-body" style={{marginBottom:"0.75rem"}}>Identity → Covenant → Signs → Law → Messiah → Diaspora → Restoration</p>
        <div style={{background:"rgba(196,137,58,0.08)",border:"1px solid rgba(196,137,58,0.2)",borderRadius:"10px",padding:"0.65rem 1rem",fontSize:"0.78rem",color:"var(--muted)",lineHeight:1.65}}>
          📌 <strong style={{color:"var(--ink)"}}>Study Note:</strong> {t.devStudyNote||"This roadmap combines KJV scripture, Apocrypha, and covenant teaching tradition. Teaching commentary sections are labeled clearly and represent community interpretation, not universally settled historical fact."}
        </div>
      </div>

      {/* Stage progress tracker */}
      <div className="dev-progress">
        {DEVOTIONALS.map(item => (
          <button key={item.day} className={`dev-progress-step${activeDay===item.day?" active":""}`} onClick={()=>setActiveDay(item.day)}>
            <span className="dev-progress-icon">{item.icon}</span>
            <span className="dev-progress-num">{item.day.replace("Day ","D")}</span>
            <span className="dev-progress-label">{item.stage}</span>
          </button>
        ))}
      </div>

      {/* Main layout */}
      <div className="dev-layout">
        {/* Sidebar */}
        <div className="dev-list">
          {DEVOTIONALS.map(item => (
            <button key={item.day} className={`dev-item${activeDay===item.day?" active":""}`} onClick={()=>{setActiveDay(item.day);setOpenCommentary(false);setOpenLawSec(null);setOpenDiasSec(null);}}>
              <span className="dev-item-icon">{item.icon}</span>
              <div style={{flex:1,minWidth:0}}>
                <div className="dev-item-day">{item.day} · {item.stage}</div>
                <div className="dev-item-title">{item.title}</div>
                <div className="dev-item-verse">{item.verse}</div>
              </div>
            </button>
          ))}
        </div>

        {/* Main study panel */}
        <AnimatePresence mode="wait">
          <motion.div key={d.day} className="dev-main" initial={{opacity:0,x:14}} animate={{opacity:1,x:0}} exit={{opacity:0,x:-14}} transition={{duration:0.22}}>

            {/* Header */}
            <div className="dev-main-header">
              <div className="dev-stage-badge" style={{background:`${d.color}15`,color:d.color,border:`1px solid ${d.color}33`}}>
                {d.icon} STAGE {d.stageNum} OF 7 · {d.stage.toUpperCase()}
              </div>
              <div className="dev-title">{d.title}</div>
              <div className="dev-subtitle">{d.subtitle}</div>
            </div>

            <div className="dev-body">
              {/* ── A: Anchor Scripture ── */}
              <div className="dev-section-label">{t.devSectionA||"A · ANCHOR SCRIPTURE"}</div>
              <div className="dev-verse-ref">{d.verse}</div>
              <div className="dev-scripture">"{d.text}"</div>

              {/* ── ALL Primary Scriptures ── */}
              {d.primaryScriptures && d.primaryScriptures.length > 0 && (
                <>
                  <div className="dev-section-label" style={{marginTop:"1.25rem"}}>📖 ALL PRIMARY SCRIPTURES ({d.primaryScriptures.length})</div>
                  {d.primaryScriptures.map((verse,i) => <ScripturePill key={i} verse={verse} color={d.color} />)}
                </>
              )}

              {/* ── Day 4 Law Subsections ── */}
              {d.lawSections && (
                <>
                  <div className="dev-section-label" style={{marginTop:"1.25rem"}}>⚖️ LAW CATEGORIES — TAP TO EXPAND</div>
                  {d.lawSections.map((sec,i) => {
                    const isOpen = openLawSec === i;
                    return (
                      <div key={i} style={{background:"var(--cream)",borderRadius:"12px",marginBottom:"0.55rem",border:"1px solid var(--border)",overflow:"hidden"}}>
                        <div style={{padding:"0.85rem 1.1rem",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"}} onClick={()=>setOpenLawSec(isOpen?null:i)}>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.06em",color:sec.color}}>{sec.heading}</div>
                          <span style={{fontSize:"0.62rem",color:"var(--muted)",transform:isOpen?"rotate(180deg)":"none",transition:"transform 0.2s"}}>▼</span>
                        </div>
                        <AnimatePresence>
                          {isOpen && (
                            <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.2}} style={{borderTop:"1px solid var(--border)",padding:"0.9rem 1.1rem",background:"white"}}>
                              {sec.scriptures.map((verse,vi) => <ScripturePill key={vi} verse={verse} color={sec.color} />)}
                            </motion.div>
                          )}
                        </AnimatePresence>
                      </div>
                    );
                  })}
                </>
              )}

              {/* ── Day 6 Diaspora Subsections ── */}
              {d.diasporaSections && (
                <>
                  <div className="dev-section-label" style={{marginTop:"1.25rem"}}>🌍 DIASPORA STAGES — TAP TO EXPAND</div>
                  {d.diasporaSections.map((sec,i) => {
                    const isOpen = openDiasSec === i;
                    return (
                      <div key={i} style={{background:"var(--cream)",borderRadius:"12px",marginBottom:"0.55rem",border:"1px solid var(--border)",overflow:"hidden"}}>
                        <div style={{padding:"0.85rem 1.1rem",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"}} onClick={()=>setOpenDiasSec(isOpen?null:i)}>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.06em",color:sec.color}}>{sec.heading}</div>
                          <span style={{fontSize:"0.62rem",color:"var(--muted)",transform:isOpen?"rotate(180deg)":"none",transition:"transform 0.2s"}}>▼</span>
                        </div>
                        <AnimatePresence>
                          {isOpen && (
                            <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.2}} style={{borderTop:"1px solid var(--border)",padding:"0.9rem 1.1rem",background:"white"}}>
                              {sec.scriptures.map((verse,vi) => <ScripturePill key={vi} verse={verse} color={sec.color} />)}
                            </motion.div>
                          )}
                        </AnimatePresence>
                      </div>
                    );
                  })}
                </>
              )}

              {/* ── B: Understanding the Text ── */}
              <div className="dev-section-label">{t.devSectionB||"B · UNDERSTANDING THE TEXT"}</div>
              <div className="dev-text">{d.explanation}</div>

              {/* ── C: Why This Matters ── */}
              <div className="dev-section-label">{t.devSectionC||"C · WHY THIS MATTERS TODAY"}</div>
              <div style={{background:`${d.color}08`,borderRadius:"12px",padding:"1rem 1.25rem",borderLeft:`3px solid ${d.color}`,marginBottom:"0.5rem"}}>
                <div className="dev-text" style={{color:"var(--ink)"}}>{d.whyMatters}</div>
              </div>

              {/* ── D: Related Scriptures ── */}
              <div className="dev-section-label">{t.devSectionD||"D · RELATED SCRIPTURES"}</div>
              <div style={{display:"flex",flexWrap:"wrap",gap:"0.4rem",marginBottom:"0.5rem"}}>
                {d.relatedScriptures.map((ref,i) => (
                  <button key={i} className="scripture-btn" onClick={()=>goToScripture&&goToScripture(ref)}>📖 {ref}</button>
                ))}
              </div>

              {/* ── E: Covenant Prayer ── */}
              <div className="dev-section-label">{t.devSectionE||"E · COVENANT PRAYER"}</div>
              <div className="dev-prayer">{d.prayer}</div>

              {/* ── F: Action Step ── */}
              <div className="dev-section-label">{t.devSectionF||"F · TODAY'S ACTION STEP"}</div>
              <div className="dev-action">📝 {d.action}</div>

              {/* ── Teaching Commentary (optional, collapsible) ── */}
              {d.teachingCommentary && (
                <div style={{marginTop:"1.25rem"}}>
                  <button onClick={()=>setOpenCommentary(!openCommentary)}
                    style={{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 1rem",background:`${d.color}08`,border:`1px solid ${d.color}22`,borderRadius:"11px",cursor:"pointer",fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",color:d.color}}>
                    📚 TEACHING COMMENTARY
                    <span style={{transform:openCommentary?"rotate(180deg)":"none",transition:"transform 0.2s"}}>▼</span>
                  </button>
                  <AnimatePresence>
                    {openCommentary && (
                      <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.22}}>
                        <div style={{background:`${d.color}06`,border:`1px solid ${d.color}18`,borderRadius:"0 0 11px 11px",padding:"1rem 1.1rem",borderTop:"none"}}>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.56rem",letterSpacing:"0.14em",color:"#7B5EA7",marginBottom:"0.35rem"}}>⚠️ LABELED AS: COMMUNITY STUDY VIEW / HISTORICAL INTERPRETATION</div>
                          <div style={{fontSize:"0.85rem",color:"var(--ink)",lineHeight:1.85}}>{d.teachingCommentary}</div>
                        </div>
                      </motion.div>
                    )}
                  </AnimatePresence>
                </div>
              )}

              {/* ── Resources / Evidence (optional) ── */}
              {d.resources && d.resources.length > 0 && (
                <div style={{marginTop:"1.25rem"}}>
                  <div className="dev-section-label">🔗 RESOURCES / EVIDENCE</div>
                  <div style={{display:"flex",flexDirection:"column",gap:"0.45rem"}}>
                    {d.resources.map((res,i) => (
                      <a key={i} href={res.url} target="_blank" rel="noopener noreferrer"
                        style={{display:"flex",alignItems:"center",gap:"0.65rem",padding:"0.65rem 0.9rem",background:"white",border:"1px solid var(--border)",borderRadius:"9px",textDecoration:"none",transition:"all 0.18s"}}>
                        <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",padding:"0.2rem 0.5rem",borderRadius:"5px",background:`${RESOURCE_BADGE_COLORS[res.type]||"var(--gold)"}18`,color:RESOURCE_BADGE_COLORS[res.type]||"var(--gold)",flexShrink:0,border:`1px solid ${RESOURCE_BADGE_COLORS[res.type]||"var(--gold)"}33`}}>{res.type}</span>
                        <span style={{fontSize:"0.82rem",color:"var(--ink)"}}>{res.label}</span>
                        <span style={{marginLeft:"auto",color:"var(--muted)",fontSize:"0.75rem",flexShrink:0}}>↗</span>
                      </a>
                    ))}
                  </div>
                </div>
              )}
            </div>

            {/* Footer — nav + copy */}
            <div className="dev-footer">
              <button className={`copy-btn${copied?" copied":""}`} onClick={copyPrayer}>
                {copied ? (t.devCopied||"✓ Copied!") : (t.devCopyBtn||"📋 Copy Prayer & Action")}
              </button>
              <div style={{flex:1}} />
              {prevDay && (
                <button className="btn-outline" style={{fontSize:"0.68rem",padding:"0.45rem 0.85rem"}} onClick={()=>{setActiveDay(prevDay.day);setOpenCommentary(false);setOpenLawSec(null);setOpenDiasSec(null);}}>← {prevDay.stage}</button>
              )}
              {nextDay && (
                <button className="btn-gold" style={{fontSize:"0.68rem",padding:"0.45rem 0.85rem"}} onClick={()=>{setActiveDay(nextDay.day);setOpenCommentary(false);setOpenLawSec(null);setOpenDiasSec(null);}}>{nextDay.stage} →</button>
              )}
            </div>

            {/* Go Deeper */}
            {d.goDeeper && d.goDeeper.length > 0 && (
              <div style={{padding:"1rem 2rem",borderTop:"1px solid var(--border)",background:"rgba(27,58,92,0.03)",borderRadius:"0 0 16px 16px"}}>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"#1B3A5C",marginBottom:"0.6rem"}}>🔍 {t.devGoDeeper||"GO DEEPER"}</div>
                <div style={{display:"flex",gap:"0.5rem",flexWrap:"wrap"}}>
                  {d.goDeeper.map(pg => {
                    const labels={captivities:"⛓️ 7 Captivities","ai-tribes":"🗺️ 12 Tribes",deut28:"📖 Deut. 28 Module",reading:"📅 Reading Plan","ai-study":"📚 Study Guide",weekly:"📖 Weekly Study",women:"🌸 Women's Study",historical:"🏛️ Historical Context","ai-timeline":"⏳ Timeline"};
                    return <button key={pg} className="btn-outline" style={{fontSize:"0.68rem",padding:"0.4rem 0.85rem"}} onClick={()=>setPage&&setPage(pg)}>{labels[pg]||pg}</button>;
                  })}
                </div>
              </div>
            )}
          </motion.div>
        </AnimatePresence>
      </div>

      {/* Bottom banner */}
      <div style={{background:"linear-gradient(135deg,var(--deep),#3A2A18)",borderRadius:"18px",padding:"1.75rem 2rem",marginTop:"2rem",color:"var(--parchment)",textAlign:"center"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.2em",color:"var(--gold-light)",marginBottom:"0.45rem"}}>{t.devCovenantArc||"THE COVENANT ARC"}</div>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.78rem",letterSpacing:"0.06em",color:"rgba(250,246,238,0.75)",lineHeight:2,marginBottom:"1rem"}}>
          Identity → Covenant → Signs → Law → Messiah → Diaspora → <span style={{color:"var(--gold-light)",fontWeight:600}}>Restoration</span>
        </div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.05rem",fontStyle:"italic",color:"rgba(250,246,238,0.65)",maxWidth:"440px",margin:"0 auto 1.1rem",lineHeight:1.75}}>"That then the LORD thy God will turn thy captivity, and have compassion upon thee." — Deuteronomy 30:3</div>
        <div style={{display:"flex",gap:"0.65rem",justifyContent:"center",flexWrap:"wrap"}}>
          <button className="btn-gold" onClick={()=>goToScripture&&goToScripture("Deuteronomy 30:1-3")}>📖 Read Deuteronomy 30</button>
          <button className="btn-outline-light" onClick={()=>setActiveDay("Day 7")}>→ Go to Restoration</button>
        </div>
      </div>
    </div>
  );
}
// ─── READING PLAN PAGE ────────────────────────────────────────────────────────
function ReadingPage({ t, setPage, setPassageQuery }) {
  const [explainVerse, setExplainVerse] = useState(null);
  const [explainText, setExplainText] = useState("");
  const [explaining, setExplaining] = useState(false);

  // Extended 14-day plan with covenant identity focus
  const IDENTITY_PLAN = [
    { day:"Day 1",  reading:"Genesis 1:26-27 · Genesis 2:7",   focus:"You are made in the image of YAHAWAH — tselem. Your identity begins at creation.", identity:"Who I Am" },
    { day:"Day 2",  reading:"Deuteronomy 7:6 · 1 Peter 2:9",   focus:"A chosen generation. A royal priesthood. A peculiar people.", identity:"Chosen" },
    { day:"Day 3",  reading:"Deuteronomy 28:1-14",             focus:"The covenant blessings — what obedience produces.", identity:"Covenant Promise" },
    { day:"Day 4",  reading:"Deuteronomy 28:15-68",            focus:"The covenant warnings — what disobedience produces. Signs and wonders.", identity:"Covenant Warning" },
    { day:"Day 5",  reading:"Hosea 1:9-10 · Hosea 2:23",       focus:"Lo-ammi (not my people) → Ammi (my people). Identity lost and restored.", identity:"Identity Restored" },
    { day:"Day 6",  reading:"Isaiah 11:11-12 · Jeremiah 16:14-15", focus:"The second gathering — greater than the Exodus.", identity:"Restoration" },
    { day:"Day 7",  reading:"Baruch 2:29-35 · Baruch 4:5-7",   focus:"Baruch applies the covenant curses directly to the scattered diaspora.", identity:"Apocrypha" },
    { day:"Day 8",  reading:"Matthew 15:24 · James 1:1",        focus:"The lost sheep of the house of Israel. Twelve tribes scattered abroad.", identity:"New Testament" },
    { day:"Day 9",  reading:"Romans 9:4-5 · Romans 11:1-5",     focus:"God has not cast away His people. The remnant according to grace.", identity:"Remnant" },
    { day:"Day 10", reading:"Ezekiel 37:1-14",                  focus:"The dry bones — national resurrection prophecy.", identity:"Resurrection" },
    { day:"Day 11", reading:"Amos 3:1-2 · Amos 9:9-15",        focus:"Covenant accountability and the promise of national restoration.", identity:"Accountability" },
    { day:"Day 12", reading:"Exodus 11:7 · Leviticus 20:24",    focus:"YAHAWAH makes a distinction between Israel and other nations.", identity:"Distinction" },
    { day:"Day 13", reading:"Revelation 7:4-8 · Revelation 21:12", focus:"The 144,000 and the twelve gates of New Jerusalem.", identity:"End Times" },
    { day:"Day 14", reading:"Deuteronomy 30:1-10",              focus:"The restoration promise — repentance activates return.", identity:"Return" },
  ];

  const handleExplain = async (passage) => {
    setExplainVerse(passage);
    setExplaining(true);
    setExplainText("");
    try {
      const res = await fetch("https://api.anthropic.com/v1/messages", {
        method:"POST",
        headers:{"Content-Type":"application/json"},
        body: JSON.stringify({
          model:"claude-sonnet-4-20250514",
          max_tokens:1000,
          messages:[{
            role:"user",
            content:`Explain this Bible passage in plain language for a covenant Bible study student. Be clear, reverent, and grounded in scripture context. Use "YAHAWAH" for the divine name and "Yahawashi" for the Messiah. Keep it under 150 words.\n\nPassage: ${passage}`
          }]
        })
      });
      const data = await res.json();
      const text = data.content?.map(c => c.text||"").join("") || "Unable to load explanation.";
      setExplainText(text);
    } catch {
      setExplainText("AI explanation temporarily unavailable. Please check your connection and try again.");
    }
    setExplaining(false);
  };

  return (
    <div>
      <div className="section-eyebrow">{t.readEyebrow}</div>
      <h2 className="section-h2">{t.readIdentityTitle||"14-Day Covenant Identity Roadmap"}</h2>
      <p className="section-body">{t.readIdentitySub||"Click any passage to open in the Bible reader. Tap the 🤖 button to get an AI explanation of any verse."}</p>

      {/* Verse explainer active panel */}
      {explainVerse && (
        <div style={{background:"rgba(123,94,167,0.06)",border:"1px solid rgba(123,94,167,0.25)",borderRadius:"14px",padding:"1.1rem 1.35rem",marginBottom:"1.25rem"}}>
          <div style={{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.5rem"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"#7B5EA7"}}>🤖 AI VERSE EXPLANATION</div>
            <button onClick={()=>setExplainVerse(null)} style={{background:"none",border:"1px solid rgba(123,94,167,0.3)",borderRadius:"6px",padding:"0.2rem 0.5rem",cursor:"pointer",color:"#7B5EA7",fontSize:"0.75rem"}}>✕</button>
          </div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",color:"#7B5EA7",marginBottom:"0.5rem"}}>{explainVerse}</div>
          {explaining
            ? <div style={{fontSize:"0.84rem",color:"var(--muted)",fontStyle:"italic"}}>Generating explanation…</div>
            : <div style={{fontSize:"0.88rem",color:"var(--ink)",lineHeight:1.82}}>{explainText}</div>
          }
        </div>
      )}

      <div className="reading-grid">
        {IDENTITY_PLAN.map((r,i) => (
          <motion.div key={r.day} className="reading-item" initial={{opacity:0,x:-12}} animate={{opacity:1,x:0}} transition={{delay:i*0.04}}
            style={{cursor:"pointer",gridTemplateColumns:"60px 1fr auto"}} onClick={() => setPage && setPage("bible-passage")}>
            <div className="reading-day">{r.day}</div>
            <div>
              <div className="reading-passage">{r.reading}</div>
              <div className="reading-focus">{r.focus}</div>
              <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.56rem",letterSpacing:"0.1em",padding:"0.15rem 0.45rem",borderRadius:"20px",background:"rgba(90,122,82,0.1)",color:"var(--sage)",border:"1px solid rgba(90,122,82,0.25)",marginTop:"0.3rem",display:"inline-block"}}>{r.identity}</span>
            </div>
            <button className="verse-explain-btn" onClick={e => { e.stopPropagation(); handleExplain(r.reading); }}>🤖 Explain</button>
          </motion.div>
        ))}
      </div>

      <div style={{textAlign:"center",marginTop:"1.5rem",padding:"1.25rem",background:"var(--cream)",borderRadius:"14px",border:"1px solid var(--border)"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.16em",color:"var(--gold)",marginBottom:"0.5rem"}}>DEUTERONOMY 30:1</div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.05rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.75}}>"And it shall come to pass, when all these things are come upon thee… that thou shalt call them to mind among all the nations."</div>
      </div>
    </div>
  );
}

// ─── AUDIO BIBLE PAGE ─────────────────────────────────────────────────────────
function AudioBiblePage({ t }) {
  const audioRef = useRef(null);
  const fileInputRef = useRef(null);
  const [tracks, setTracks] = useState([
    { id:1, name:"Psalm 23 — KJV Voiceover", ref:"Psalm 23", src:null, duration:"1:24", isDemo:true },
    { id:2, name:"Jeremiah 6:16 — Ancient Path", ref:"Jeremiah 6:16", src:null, duration:"0:38", isDemo:true },
    { id:3, name:"James 2 — Faith & Works", ref:"James 2", src:null, duration:"2:15", isDemo:true },
  ]);
  const [currentTrack, setCurrentTrack] = useState(null);
  const [playing, setPlaying] = useState(false);
  const [progress, setProgress] = useState(0);
  const [currentTime, setCurrentTime] = useState(0);
  const [duration, setDuration] = useState(0);
  const [currentVerseIdx, setCurrentVerseIdx] = useState(0);
  const [drag, setDrag] = useState(false);

  // Demo verses for visual display
  const demoVerses = FEATURED_PASSAGES["psalm 23"]?.verses || [];

  const formatTime = (s) => { const m=Math.floor(s/60); return `${m}:${String(Math.floor(s%60)).padStart(2,'0')}`; };

  const handleFileUpload = (files) => {
    Array.from(files).forEach(file => {
      if (!file.type.startsWith("audio/")) return;
      const url = URL.createObjectURL(file);
      const name = file.name.replace(/\.[^.]+$/,"");
      setTracks(prev => [...prev, { id:Date.now()+Math.random(), name, ref:"Custom Upload", src:url, duration:"--:--", isDemo:false }]);
    });
  };

  const playTrack = (track) => {
    if (!track.src && track.isDemo) {
      setCurrentTrack(track);
      setPlaying(false);
      setProgress(0); setCurrentTime(0);
      setCurrentVerseIdx(0);
      return;
    }
    setCurrentTrack(track);
    if (audioRef.current) { audioRef.current.src=track.src; audioRef.current.play(); setPlaying(true); }
  };

  const togglePlay = () => {
    if (!currentTrack) return;
    if (currentTrack.isDemo && !currentTrack.src) {
      // Simulate playback for demo tracks
      setPlaying(p => !p);
      return;
    }
    if (audioRef.current) { playing ? audioRef.current.pause() : audioRef.current.play(); setPlaying(p => !p); }
  };

  // Simulate verse advancement for demo
  useEffect(() => {
    if (!playing || !currentTrack?.isDemo || currentTrack.src) return;
    const interval = setInterval(() => {
      setCurrentVerseIdx(i => (i+1) % demoVerses.length);
      setProgress(p => Math.min(p+5, 100));
      setCurrentTime(t => t+3);
    }, 3000);
    return () => clearInterval(interval);
  }, [playing, currentTrack, demoVerses.length]);

  const handleAudioUpdate = () => {
    if (!audioRef.current) return;
    const p = (audioRef.current.currentTime / audioRef.current.duration) * 100;
    setProgress(p||0); setCurrentTime(audioRef.current.currentTime); setDuration(audioRef.current.duration||0);
    const vIdx = Math.floor((audioRef.current.currentTime / (audioRef.current.duration||1)) * demoVerses.length);
    setCurrentVerseIdx(Math.min(vIdx, demoVerses.length-1));
  };

  const currentVerse = demoVerses[currentVerseIdx];
  const displayTrack = currentTrack || tracks[0];

  return (
    <div>
      <div className="section-eyebrow">{t.audioEyebrow}</div>
      <h2 className="section-h2">{t.audioH2}</h2>
      <p className="section-body">{t.audioSub}</p>

      <div className="audio-grid">
        {/* Player */}
        <div className="audio-player-card">
          <div className="audio-title">{displayTrack?.name || "Select a Track"}</div>
          <div className="audio-ref">{displayTrack?.ref || "——"}</div>

          {/* Live verse ticker */}
          <div className="verse-ticker">
            {currentVerse ? (
              <AnimatePresence mode="wait">
                <motion.div key={currentVerseIdx} initial={{opacity:0,y:10}} animate={{opacity:1,y:0}} exit={{opacity:0,y:-10}} transition={{duration:0.3}}>
                  <div className="verse-ticker-num">VERSE {currentVerse.v}</div>
                  <div className="verse-ticker-text">"{currentVerse.t}"</div>
                </motion.div>
              </AnimatePresence>
            ) : (
              <div style={{color:"rgba(250,246,238,0.35)",fontStyle:"italic",fontSize:"0.88rem"}}>Select a track to begin verse-by-verse playback…</div>
            )}
          </div>

          {/* Controls */}
          <div className="audio-controls">
            <button className="audio-ctrl-btn" onClick={() => { setCurrentVerseIdx(i => Math.max(0,i-1)); setProgress(p => Math.max(0,p-5)); }}>⏮</button>
            <button className="audio-ctrl-btn play" onClick={togglePlay}>{playing?"⏸":"▶"}</button>
            <button className="audio-ctrl-btn" onClick={() => { setCurrentVerseIdx(i => Math.min(demoVerses.length-1,i+1)); setProgress(p => Math.min(100,p+5)); }}>⏭</button>
            <div className="audio-progress">
              <div className="audio-bar-wrap" onClick={e => { const pct=(e.nativeEvent.offsetX/e.currentTarget.offsetWidth)*100; setProgress(pct); if(audioRef.current&&duration){audioRef.current.currentTime=(pct/100)*duration;} }}>
                <div className="audio-bar-fill" style={{width:`${progress}%`}} />
              </div>
              <div className="audio-times"><span>{formatTime(currentTime)}</span><span>{duration?formatTime(duration):displayTrack?.duration||"--:--"}</span></div>
            </div>
          </div>

          {/* Track list */}
          <div className="audio-track-list">
            {tracks.map(t => (
              <div key={t.id} className={`audio-track${currentTrack?.id===t.id?" playing":""}`} onClick={() => playTrack(t)}>
                <span className="audio-track-icon">{currentTrack?.id===t.id&&playing?"🔊":"🎵"}</span>
                <div className="audio-track-info">
                  <div className="audio-track-name">{t.name}</div>
                  <div className="audio-track-meta">{t.ref} {t.isDemo?"· Demo Library":"· Uploaded"}</div>
                </div>
                <span className="audio-track-dur">{t.duration}</span>
              </div>
            ))}
          </div>

          <audio ref={audioRef} onTimeUpdate={handleAudioUpdate} onEnded={() => { setPlaying(false); setProgress(0); }} style={{display:"none"}} />
        </div>

        {/* Upload panel */}
        <div>
          <div style={{background:"var(--deep)",borderRadius:"18px",padding:"1.75rem",marginBottom:"1.1rem"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.78rem",letterSpacing:"0.1em",color:"var(--gold-light)",marginBottom:"1rem"}}>{t.audioUploadTitle}</div>
            <div
              className={`audio-upload-zone${drag?" drag":""}`}
              onDragOver={e => { e.preventDefault(); setDrag(true); }}
              onDragLeave={() => setDrag(false)}
              onDrop={e => { e.preventDefault(); setDrag(false); handleFileUpload(e.dataTransfer.files); }}
              onClick={() => fileInputRef.current?.click()}
            >
              <div className="audio-upload-icon">🎙️</div>
              <div className="audio-upload-title">{t.audioDrop}</div>
              <div className="audio-upload-sub">{t.audioDropSub}</div>
            </div>
            <input ref={fileInputRef} type="file" accept="audio/*" multiple style={{display:"none"}} onChange={e => handleFileUpload(e.target.files)} />
          </div>

          {/* Instructions */}
          <div style={{background:"white",border:"1px solid var(--border)",borderRadius:"16px",padding:"1.6rem"}}>
            <div className="section-eyebrow">{t.audioHowTitle}</div>
            <div style={{display:"grid",gap:"0.85rem"}}>
              {[
                ["🎙️","Record verse by verse","Record each verse separately, or full chapters line by line, exact KJV words verbatim."],
                ["📁","Upload your MP3 files","Drag and drop or tap to upload. MP3, WAV, and M4A are all supported."],
                ["📜","Verses sync automatically","As your audio plays, the verse text displays in real time — precept upon precept."],
                ["▶️","Press play and follow along","The verse ticker shows each verse as it is spoken. Follow along in the word."],
              ].map(([icon,title,body]) => (
                <div key={title} style={{display:"flex",gap:"0.75rem",alignItems:"flex-start"}}>
                  <span style={{fontSize:"1.1rem",flexShrink:0,marginTop:"0.05rem"}}>{icon}</span>
                  <div>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.08em",marginBottom:"0.2rem"}}>{title}</div>
                    <div style={{fontSize:"0.8rem",color:"var(--muted)",lineHeight:1.65}}>{body}</div>
                  </div>
                </div>
              ))}
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}

// ─── BIBLE HUB PAGE ───────────────────────────────────────────────────────────
function BibleHubPage({ setPage, t }) {
  const items = [
    {icon:"📖",title:"READ THE BIBLE",sub:"Browse all 66 books + full Apocrypha",page:"bible-read"},
    {icon:"🔍",title:"SEARCH A PASSAGE",sub:"Live KJV · ASV · WEB · YLT · DARBY",page:"bible-passage"},
    {icon:"📋",title:"BIBLE VERSIONS",sub:"30+ translations — EN, ES & more",page:"bible-versions"},
    {icon:"🏛️",title:"REFERENCE TOOLS",sub:"Lexicon · Concordance · Codex · Blue Letter Bible",page:"bible-tools"},
    {icon:"📰",title:"BIBLE NEWS",sub:"Current events through a scriptural lens",page:"bible-news"},
    {icon:"🧭",title:"EXPLORE MORE",sub:"Plans, podcasts & devotional archives",page:"bible-explore"},
  ];
  return (
    <div>
      <div className="section-eyebrow">{t.hubEyebrow}</div>
      <h2 className="section-h2">{t.hubH2}</h2>
      <p className="section-body">{t.hubSub}</p>

      {/* Quick passage search right on hub page */}
      <div style={{background:"var(--deep)",borderRadius:"18px",padding:"1.6rem",marginBottom:"1.75rem"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.2em",color:"var(--gold-light)",marginBottom:"0.7rem"}}>⚡ QUICK PASSAGE SEARCH</div>
        <div style={{display:"flex",gap:"0.65rem",flexWrap:"wrap"}}>
          <input id="hub-search" style={{flex:1,minWidth:"200px",padding:"0.78rem 1rem",borderRadius:"9px",border:"1px solid rgba(250,246,238,0.15)",background:"rgba(250,246,238,0.06)",color:"var(--parchment)",fontFamily:"'Libre Baskerville',serif",fontSize:"0.86rem",outline:"none"}} placeholder="e.g. John 3:16, Psalm 23, Sirach 2…" onKeyDown={e => { if(e.key==="Enter"){ setPage("bible-passage"); }}} />
          <button className="btn-gold" style={{whiteSpace:"nowrap"}} onClick={() => setPage("bible-passage")}>🔍 Search →</button>
        </div>
        <div style={{display:"flex",gap:"0.45rem",marginTop:"0.75rem",flexWrap:"wrap"}}>
          {["Psalm 23","John 3","Romans 6","Isaiah 53","Jeremiah 29","Revelation 21","Sirach 2"].map(ref => (
            <button key={ref} onClick={() => setPage("bible-passage")} style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",padding:"0.25rem 0.6rem",borderRadius:"20px",border:"1px solid rgba(196,137,58,0.3)",background:"rgba(196,137,58,0.1)",color:"var(--gold-light)",cursor:"pointer"}}>{ref}</button>
          ))}
        </div>
      </div>

      <div className="bible-hub-grid" style={{maxWidth:"100%",display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(260px,1fr))"}}>
        {items.map((item,i) => (
          <motion.button key={item.title} className="bible-hub-item" initial={{opacity:0,x:-16}} animate={{opacity:1,x:0}} transition={{delay:i*0.07}} onClick={() => setPage(item.page)}>
            <div className="hub-icon">{item.icon}</div>
            <div><div className="hub-title">{item.title}</div><div className="hub-sub">{item.sub}</div></div>
            <span style={{marginLeft:"auto",color:"var(--gold)",fontSize:"1.1rem"}}>›</span>
          </motion.button>
        ))}
      </div>
    </div>
  );
}

// ─── SCRIPTURE TOOLS PAGE ─────────────────────────────────────────────────────
function ScriptureToolsPage({ setPage, t }) {
  return (
    <div>
      <button className="back-btn" onClick={() => setPage("bible-hub")}>{t.backHub}</button>
      <div className="section-eyebrow">{t.toolsEyebrow}</div>
      <h2 className="section-h2">{t.toolsH2}</h2>
      <p className="section-body">{t.toolsSub}</p>

      <div className="ms-banner">
        <div style={{fontSize:"1.8rem",flexShrink:0}}>📜</div>
        <div className="ms-banner-text">
          <div className="ms-banner-title">ANCIENT MANUSCRIPTS — THE OLDEST BIBLES EVER FOUND</div>
          The Codex Sassoon (c. 900 CE) is the oldest nearly complete Hebrew Bible. The Codex Sinaiticus (c. 330–360 CE) is the oldest complete Greek New Testament. The Dead Sea Scrolls (200 BCE – 68 CE) contain the oldest Old Testament manuscripts ever discovered. These are not artifacts — they are the living foundation of scripture.
        </div>
      </div>

      <div className="tools-grid">
        {SCRIPTURE_TOOLS.map((tool, i) => (
          <motion.a
            key={tool.id}
            href={tool.url}
            target="_blank"
            rel="noopener noreferrer"
            className="tool-card"
            initial={{opacity:0,y:14}}
            animate={{opacity:1,y:0}}
            transition={{delay:i*0.07}}
            style={{textDecoration:"none",color:"inherit"}}
          >
            <div className="tool-card-header">
              <div className="tool-icon" style={{background:`${tool.color}18`,border:`1px solid ${tool.color}33`}}>
                <span>{tool.icon}</span>
              </div>
              <div style={{flex:1}}>
                <div className="tool-name" style={{color:tool.color}}>{tool.name}</div>
                <div className="tool-category" style={{color:tool.color}}>{tool.category}</div>
              </div>
              {tool.badge && (
                <div className="tool-badge" style={{background:tool.color}}>{tool.badge}</div>
              )}
            </div>
            <div className="tool-desc">{tool.desc}</div>
            <div className="tool-features">
              {tool.features.map(f => <span key={f} className="tool-feat-tag">{f}</span>)}
            </div>
            <div className="tool-open-btn">
              <span>{t.toolOpenBtn || "Open Resource"}</span>
              <span>→</span>
            </div>
          </motion.a>
        ))}
      </div>

      {/* Scripture Chain Study feature */}
      <div style={{background:"var(--deep)",borderRadius:"18px",padding:"1.75rem",marginTop:"1rem"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.12em",color:"var(--gold-light)",marginBottom:"1.1rem"}}>✦ SCRIPTURE CHAIN STUDIES — FOLLOW THE COVENANT NARRATIVE</div>
        <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(220px,1fr))",gap:"0.85rem"}}>
          {[
            {chain:"Identity Chain",refs:"Genesis 12 → Deuteronomy 28 → Baruch 2 → Romans 11",color:"#C4893A"},
            {chain:"Prayer Chain",refs:"Daniel 9 → Matthew 6 → James 5 → Psalm 91",color:"#5A7A52"},
            {chain:"Restoration Chain",refs:"Ezekiel 37 → Jeremiah 31 → Isaiah 11 → Revelation 21",color:"#7B5EA7"},
            {chain:"Wisdom Chain",refs:"Proverbs 8 → Sirach 1 → Wisdom of Solomon 6 → James 1",color:"#8B3A2A"},
            {chain:"Warfare Chain",refs:"Ephesians 6 → Daniel 10 → Psalm 91 → Revelation 12",color:"#2A4A7A"},
            {chain:"Covenant Chain",refs:"Genesis 15 → Deuteronomy 28 → Jeremiah 31 → Hebrews 8",color:"#6B5A3A"},
          ].map(c => (
            <div key={c.chain} style={{background:"rgba(250,246,238,0.05)",border:`1px solid ${c.color}33`,borderRadius:"11px",padding:"0.9rem 1.1rem"}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.1em",color:c.color,marginBottom:"0.4rem"}}>{c.chain}</div>
              <div style={{fontSize:"0.75rem",color:"rgba(250,246,238,0.55)",lineHeight:1.7}}>{c.refs}</div>
            </div>
          ))}
        </div>
      </div>
    </div>
  );
}

// ─── BIBLE VERSIONS PAGE ──────────────────────────────────────────────────────
function BibleVersionsPage({ selectedVersion, setSelectedVersion, setPage, t }) {
  const [lang, setLang] = useState("EN");
  const filtered = BIBLE_VERSIONS.filter(v => lang==="ALL" || v.lang===lang);
  return (
    <div>
      <button className="back-btn" onClick={() => setPage("bible-hub")}>{t.backHub}</button>
      <div className="section-eyebrow">{t.versEyebrow}</div>
      <h2 className="section-h2">{t.versH2}</h2>
      <p className="section-body">{t.versSub}</p>
      <div className="version-tabs">
        {["EN","ES","ALL"].map(l => (
          <button key={l} className={`vtab${lang===l?" active":""}`} onClick={() => setLang(l)}>{l==="EN"?"ENGLISH":l==="ES"?"ESPAÑOL":"ALL"}</button>
        ))}
      </div>
      <div className="version-list">
        {filtered.map(v => (
          <button key={v.code} className={`version-item${selectedVersion===v.code?" selected":""}`} onClick={() => { setSelectedVersion(v.code); setPage("bible-passage"); }}>
            <span>{v.name} {v.api && <span style={{fontSize:"0.65rem",color:selectedVersion===v.code?"rgba(255,255,255,0.7)":"var(--sage)"}}>✓ Live</span>}</span>
            <span className="version-code">({v.code.toUpperCase()})</span>
          </button>
        ))}
      </div>
    </div>
  );
}

// ─── BIBLE BOOKS PAGE ─────────────────────────────────────────────────────────
function BibleBooksPage({ setPage, setPassageQuery, t }) {
  const [testament, setTestament] = useState("ALL");
  const [expandedBook, setExpandedBook] = useState(null);

  const books = testament==="OT"?OT_BOOKS:testament==="NT"?NT_BOOKS:testament==="APO"?APOCRYPHA_BOOKS:[...OT_BOOKS,...NT_BOOKS];
  const tabColors = { APO:"#7B5EA7" };

  return (
    <div>
      <button className="back-btn" onClick={() => setPage("bible-hub")}>{t.backHub}</button>
      <div className="section-eyebrow">{t.booksEyebrow}</div>
      <h2 className="section-h2">{t.booksH2}</h2>
      <p className="section-body">{t.booksSub}</p>

      <div className="testament-tabs">
        {[["ALL","All (OT+NT)"],["OT","Old Testament"],["NT","New Testament"],["APO","Apocrypha ✦"]].map(([tb,label]) => (
          <button key={tb} className={`ttab${testament===tb?" active":""}`} style={testament===tb&&tabColors[tb]?{background:tabColors[tb],color:"white"}:{}} onClick={() => { setTestament(tb); setExpandedBook(null); }}>{label}</button>
        ))}
      </div>

      {testament==="APO" && (
        <div style={{background:"rgba(123,94,167,0.07)",border:"1px solid rgba(123,94,167,0.2)",borderRadius:"11px",padding:"0.85rem 1.1rem",marginBottom:"1.1rem",fontSize:"0.8rem",color:"var(--muted)",lineHeight:1.72}}>
          {t.apoNote}
        </div>
      )}

      <div className="book-list">
        {books.map(book => (
          <div key={book.name}>
            <button className="book-item" onClick={() => setExpandedBook(expandedBook===book.name?null:book.name)}>
              <span className="book-name">
                <span className="book-chevron">{expandedBook===book.name?"▼":"›"}</span>
                {book.name}
                {book.note && <span style={{fontSize:"0.65rem",color:"#7B5EA7",marginLeft:"0.4rem",fontStyle:"italic"}}>{book.note}</span>}
              </span>
              <span className="book-chapters">{book.ch}</span>
            </button>
            <AnimatePresence>
              {expandedBook===book.name && (
                <motion.div initial={{height:0,opacity:0}} animate={{height:"auto",opacity:1}} exit={{height:0,opacity:0}} style={{overflow:"hidden",padding:"0.7rem 1.4rem 0.9rem",borderBottom:"1px solid var(--border)",background:"var(--cream)"}}>
                  <div style={{fontSize:"0.62rem",fontFamily:"'Cinzel',serif",letterSpacing:"0.12em",color:"var(--muted)",marginBottom:"0.55rem"}}>{t.bookSelectChapter}</div>
                  <div className="chapter-grid">
                    {Array.from({length:book.ch},(_,i)=>i+1).map(n => (
                      <button key={n} className="ch-btn" onClick={() => { setPassageQuery(`${book.name} ${n}`); setPage("bible-passage"); }}>{n}</button>
                    ))}
                  </div>
                </motion.div>
              )}
            </AnimatePresence>
          </div>
        ))}
      </div>
    </div>
  );
}

// ─── PASSAGE READER PAGE ─────────────────────────────────────────────────────
function PassageReaderPage({ selectedVersion, setSelectedVersion, passageQuery, setPassageQuery, setPage, t }) {
  const [search, setSearch] = useState(passageQuery || "");
  const [result, setResult] = useState(null);
  const [loading, setLoading] = useState(false);
  const [error, setError] = useState(null);
  const [activeGroup, setActiveGroup] = useState(0);
  const isApiVersion = API_VERSIONS.includes(selectedVersion.toLowerCase());
  const catColor = { OT:"#C4893A", NT:"#5A7A52", APO:"#7B5EA7" };

  // Word study / tool state
  const [selectedWord, setSelectedWord] = useState(null);     // { word, verse, verseNum }
  const [toolbarPos, setToolbarPos] = useState({ x:0, y:0 });
  const [showToolbar, setShowToolbar] = useState(false);
  const [activeTool, setActiveTool] = useState(null);         // 'hebrew'|'greek'|'crossref'|'ai'|'commentary'
  const [toolResult, setToolResult] = useState({});
  const [toolLoading, setToolLoading] = useState({});
  const [activeVerseRef, setActiveVerseRef] = useState(null); // for verse-level tools
  const [showVerseTools, setShowVerseTools] = useState(null);
  const [copiedVerse, setCopiedVerse] = useState(null);

  const lookupPassage = useCallback(async (q) => {
    if (!q.trim()) return;
    setLoading(true); setError(null); setResult(null);
    setSelectedWord(null); setShowToolbar(false); setActiveTool(null); setToolResult({});
    const key = q.trim().toLowerCase();
    if (FEATURED_PASSAGES[key]) {
      setResult({ ...FEATURED_PASSAGES[key], version:selectedVersion.toUpperCase(), fromAPI:false });
      setLoading(false); return;
    }
    try {
      const data = await fetchPassageFromAPI(q, selectedVersion);
      setResult(data);
    } catch {
      setError(`"${q}" was not found. ${isApiVersion?"Try adjusting the reference (e.g. 'Psalm 23', 'John 3:16').":"Switch to KJV, ASV, WEB, YLT, or DARBY for live API access to any passage."}`);
    }
    setLoading(false);
  }, [selectedVersion, isApiVersion]);

  useEffect(() => { if (passageQuery) { setSearch(passageQuery); lookupPassage(passageQuery); } }, [passageQuery]);

  // Handle word selection from verse text
  const handleWordSelect = (e, verseText, verseNum) => {
    const selection = window.getSelection();
    const word = selection?.toString().trim();
    if (!word || word.length < 2 || word.length > 40) { setShowToolbar(false); return; }
    const rect = e.currentTarget.getBoundingClientRect();
    const selRect = selection.getRangeAt(0).getBoundingClientRect();
    setSelectedWord({ word, verseText, verseNum });
    setToolbarPos({ x: selRect.left, y: selRect.top - 10 });
    setShowToolbar(true);
    setActiveTool(null);
    setToolResult({});
  };

  // Run AI tool for selected word or verse
  const runTool = async (toolKey, word, verseText, ref) => {
    const cacheKey = `${toolKey}:${word||ref}`;
    if (toolResult[cacheKey]) { setActiveTool(toolKey); return; }
    setActiveTool(toolKey);
    setToolLoading(s => ({...s, [cacheKey]:true}));

    const prompts = {
      hebrew: `You are a biblical Hebrew lexicon. The word or phrase "${word}" appears in the Bible verse: "${verseText}" (${ref}). Provide:
1. HEBREW/ARAMAIC ORIGINAL: the original word transliterated and in Hebrew script if applicable
2. STRONG'S NUMBER: the Strong's Concordance number (e.g. H1234 for Hebrew, G1234 for Greek)
3. ROOT MEANING: the literal root meaning
4. DEFINITION: full lexical definition in plain English
5. USAGE: how this word is used across scripture (2-3 other verses)
Keep under 150 words. Format with labels.`,
      greek: `You are a biblical Greek lexicon. The word or phrase "${word}" appears in: "${verseText}" (${ref}). Provide:
1. GREEK ORIGINAL: the Greek word transliterated
2. STRONG'S NUMBER: G number
3. ROOT MEANING: etymological root
4. DEFINITION: full lexical definition
5. OTHER USES: 2 other NT uses of this same Greek word
Keep under 150 words. Format with labels.`,
      crossref: `List 5-7 cross-reference scriptures for this Bible verse: ${ref} — "${verseText}".
For each: give reference + 1 sentence explaining the connection.
Focus on thematic, doctrinal, or direct quote connections.
Use "YAHAWAH" for the divine name. Format as a numbered list. Under 200 words.`,
      ai: `Explain this Bible verse for a covenant scripture student. Use "YAHAWAH" for divine name and "Yahawashi" for the Messiah.
Include: (1) historical context, (2) covenant significance, (3) application today. 
Verse: ${ref} — "${verseText}"
Under 120 words.`,
      commentary: `Write a short teaching commentary on this Bible verse for a covenant community Bible study class.
Include: what the verse teaches, what it corrects, and how it applies to daily covenant life.
Use "YAHAWAH" for divine name. Be practical and scripture-grounded.
Verse: ${ref} — "${verseText}"
Under 150 words.`,
    };

    const wordPrompts = {
      hebrew: prompts.hebrew,
      greek: prompts.greek,
    };

    try {
      const prompt = (toolKey === 'hebrew' || toolKey === 'greek') && word
        ? wordPrompts[toolKey]
        : prompts[toolKey];

      const res = await fetch("https://api.anthropic.com/v1/messages", {
        method:"POST", headers:{"Content-Type":"application/json"},
        body:JSON.stringify({ model:"claude-sonnet-4-20250514", max_tokens:500,
          messages:[{ role:"user", content:prompt }]
        })
      });
      const data = await res.json();
      const text = data.content?.map(c=>c.text||"").join("")||"Unable to load.";
      setToolResult(s => ({...s, [cacheKey]:text}));
    } catch {
      setToolResult(s => ({...s, [cacheKey]:"Unable to load at this time. Check connection."}));
    }
    setToolLoading(s => ({...s, [cacheKey]:false}));
  };

  const getToolResult = (toolKey, word) => toolResult[`${toolKey}:${word}`];
  const getToolLoading = (toolKey, word) => toolLoading[`${toolKey}:${word}`];

  const copyVerse = (verseText, verseNum, ref) => {
    const txt = `${ref}:${verseNum} — "${verseText}"`;
    navigator.clipboard?.writeText(txt);
    setCopiedVerse(verseNum);
    setTimeout(() => setCopiedVerse(null), 2000);
  };

  // Tool button config
  const WORD_TOOLS = [
    { key:"hebrew",    label:"🔤 Hebrew / Aramaic", color:"#8B3A2A" },
    { key:"greek",     label:"🏛️ Greek Lexicon",    color:"#1B3A5C" },
    { key:"strongs",   label:"🔢 Strong's Number",  color:"#6D4C41" },
    { key:"ai",        label:"🤖 AI Explain",       color:"#5A7A52" },
  ];
  const VERSE_TOOLS = [
    { key:"crossref",    label:"🔗 Cross-References",   color:"#C4893A" },
    { key:"ai",          label:"🤖 AI Explain Verse",    color:"#5A7A52" },
    { key:"commentary",  label:"📚 Commentary",          color:"#7B5EA7" },
    { key:"dictionary",  label:"📖 Bible Dictionary",    color:"#1B3A5C" },
  ];

  // In-app embedded reference tools (open within the reader panel)
  const EMBEDDED_TOOLS = [
    { key:"blb",        icon:"📖", label:"Blue Letter Bible",         desc:"Strong's · Lexicon · Interlinear · Audio", color:"#8B3A2A",
      urlFn:(ref,word)=>`https://www.blueletterbible.org/kjv/${ref.toLowerCase().replace(/\s/g,"/").replace(/:/g,"/")}/` },
    { key:"strongs_db", icon:"🔢", label:"Strong's Concordance",      desc:"Hebrew H-numbers · Greek G-numbers · Root words", color:"#C4893A",
      urlFn:(ref,word)=>`https://www.blueletterbible.org/search/search.cfm?Criteria=${encodeURIComponent(word||ref)}&t=KJV` },
    { key:"interlinear",icon:"🔤", label:"Interlinear Bible",         desc:"Word-for-word Hebrew/Greek beneath English", color:"#1B3A5C",
      urlFn:(ref,word)=>`https://biblehub.com/interlinear/${ref.toLowerCase().replace(/\s/g,"/").replace(/:/g,"-")}.htm` },
    { key:"lexicon_heb",icon:"✡️",  label:"Hebrew Lexicon",           desc:"OT original words · Aramaic · Root meanings", color:"#8B3A2A",
      urlFn:(ref,word)=>`https://biblehub.com/hebrew/` },
    { key:"lexicon_grk",icon:"🏛️", label:"Greek Lexicon",            desc:"NT original words · Koine Greek · Etymology", color:"#1B3A5C",
      urlFn:(ref,word)=>`https://biblehub.com/greek/` },
    { key:"gateway",    icon:"📜", label:"BibleGateway",              desc:"Multiple translations side by side", color:"#5A7A52",
      urlFn:(ref,word)=>`https://www.biblegateway.com/passage/?search=${encodeURIComponent(ref)}&version=KJV` },
    { key:"parallel",   icon:"📑", label:"Parallel Bible",            desc:"KJV · ASV · WEB · YLT in columns", color:"#2E7D32",
      urlFn:(ref,word)=>`https://www.biblegateway.com/passage/?search=${encodeURIComponent(ref)}&version=KJV,ASV,WEB,YLT` },
    { key:"commentary", icon:"📚", label:"Bible Commentary",          desc:"Matthew Henry · Gill · Expositor's", color:"#7B5EA7",
      urlFn:(ref,word)=>`https://www.studylight.org/commentary/kjv/${ref.toLowerCase().replace(/\s/g,"/").replace(/:/g,"-")}.html` },
    { key:"concordance",icon:"📋", label:"Concordance Search",        desc:"Find every verse containing a word", color:"#37474F",
      urlFn:(ref,word)=>`https://www.blueletterbible.org/search/search.cfm?Criteria=${encodeURIComponent(word||"")}&t=KJV` },
    { key:"codex",      icon:"📜", label:"Codex Sinaiticus",          desc:"4th century Greek manuscript online", color:"#6A1B9A",
      urlFn:()=>`https://codexsinaiticus.org/en/manuscript.aspx` },
    { key:"dictio",     icon:"📖", label:"Bible Dictionary",          desc:"People · Places · Definitions · History", color:"#C97D1A",
      urlFn:(ref,word)=>`https://www.biblestudytools.com/dictionary/${encodeURIComponent(word||"israel")}/` },
    { key:"maps",       icon:"🗺️", label:"Bible Atlas / Maps",        desc:"Holy Land geography · Israel history maps", color:"#00838F",
      urlFn:()=>`https://www.biblestudy.org/maps/` },
  ];

  // AI in-app word-level tools (adds Strong's and dictionary)
  const runWordTool = async (toolKey, word, verseText, ref) => {
    const extraPrompts = {
      strongs: `You are a Strong's Concordance. The word "${word}" appears in: "${verseText}" (${ref}).
Provide EXACTLY this format:
STRONG'S NUMBER: H#### or G#### (the actual number)
ORIGINAL WORD: (Hebrew or Greek original + transliteration)
PART OF SPEECH: (noun/verb/adjective etc)
DEFINITION: (Strong's definition verbatim or close to it)
ALL OCCURRENCES: (list 3-4 other verses where this EXACT word appears)
Under 120 words.`,
      dictionary: `You are a Bible Dictionary. Define the biblical/theological concept of "${word}" from ${ref}.
Include: (1) Definition, (2) Biblical significance, (3) First occurrence in scripture, (4) Connection to Israel's covenant.
Under 100 words. Be concise and scholarly.`,
    };
    if (extraPrompts[toolKey]) {
      const cacheKey = `${toolKey}:${word||ref}`;
      if (toolResult[cacheKey]) { setActiveTool(toolKey); return; }
      setActiveTool(toolKey);
      setToolLoading(s=>({...s,[cacheKey]:true}));
      try {
        const res = await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:"claude-sonnet-4-20250514",max_tokens:400,messages:[{role:"user",content:extraPrompts[toolKey]}]})});
        const d = await res.json();
        setToolResult(s=>({...s,[cacheKey]:d.content?.map(c=>c.text||"").join("")||"Unable to load."}));
      } catch { setToolResult(s=>({...s,[`${toolKey}:${word||ref}`]:"Unable to load."})); }
      setToolLoading(s=>({...s,[cacheKey]:false}));
    } else {
      runTool(toolKey, word, verseText, ref);
    }
  };

  return (
    <div style={{position:"relative"}} onClick={()=>{ if(showToolbar) setShowToolbar(false); }}>
      <button className="back-btn" onClick={() => setPage("bible-hub")}>{t.backHub}</button>
      <div className="section-eyebrow">{t.passEyebrow}</div>
      <h2 className="section-h2">{t.passH2}</h2>
      <p className="section-body">{t.passSub}</p>

      <div className="passage-search">
        <input className="passage-input" placeholder="e.g. John 3, Psalm 23, Sirach 2, 1 Enoch 1, Revelation 22" value={search} onChange={e => setSearch(e.target.value)} onKeyDown={e => e.key==="Enter"&&(lookupPassage(search),setPassageQuery(search))} />
        <button className="btn-search" onClick={() => { lookupPassage(search); setPassageQuery(search); }}>{loading ? t.passSearching : t.passSearch}</button>
      </div>

      <select className="version-select-bar" value={selectedVersion} onChange={e => setSelectedVersion(e.target.value)}>
        <optgroup label="── Live API (Full Bible Access) ──">
          {BIBLE_VERSIONS.filter(v=>v.api).map(v => <option key={v.code} value={v.code}>{v.name} ({v.code.toUpperCase()}) ✓ Live</option>)}
        </optgroup>
        <optgroup label="── All Translations ──">
          {BIBLE_VERSIONS.filter(v=>!v.api&&v.lang==="EN").map(v => <option key={v.code} value={v.code}>{v.name} ({v.code})</option>)}
        </optgroup>
        <optgroup label="── Español ──">
          {BIBLE_VERSIONS.filter(v=>v.lang==="ES").map(v => <option key={v.code} value={v.code}>{v.name} ({v.code})</option>)}
        </optgroup>
      </select>

      <div style={{display:"flex",gap:"0.4rem",marginBottom:"1.5rem",flexWrap:"wrap"}}>
        <span style={{fontSize:"0.68rem",fontFamily:"'Cinzel',serif",letterSpacing:"0.1em",padding:"0.28rem 0.75rem",borderRadius:"20px",border:"1px solid var(--border)",background:isApiVersion?"#5A7A52":"var(--cream)",color:isApiVersion?"white":"var(--muted)"}}>
          {isApiVersion?"✓ LIVE API — Any passage searchable":"📚 Embedded library + switch to KJV/ASV/WEB for live access"}
        </span>
      </div>

      {!result && !loading && (
        <div style={{marginBottom:"2rem"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.2em",color:"var(--muted)",marginBottom:"0.7rem"}}>{t.passFeatured}</div>
          <div style={{display:"flex",gap:"0.4rem",marginBottom:"0.9rem",flexWrap:"wrap"}}>
            {FEATURED_GROUPS.map((g,i) => (
              <button key={g.label} onClick={() => setActiveGroup(i)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",padding:"0.42rem 0.9rem",borderRadius:"7px",border:"1px solid var(--border)",cursor:"pointer",background:activeGroup===i?(i===0?"#C4893A":i===1?"#5A7A52":"#7B5EA7"):"white",color:activeGroup===i?"white":"var(--muted)"}}>
                {g.label}
              </button>
            ))}
          </div>
          <div style={{display:"flex",flexWrap:"wrap",gap:"0.45rem"}}>
            {FEATURED_GROUPS[activeGroup].keys.map(k => {
              const p = FEATURED_PASSAGES[k];
              return <button key={k} className="btn-outline" style={{fontSize:"0.72rem",padding:"0.42rem 0.85rem",borderColor:catColor[p.cat]+"55",color:catColor[p.cat]}} onClick={() => { setSearch(p.ref); lookupPassage(k); setPassageQuery(k); }}>{p.ref}</button>;
            })}
          </div>
        </div>
      )}

      {loading && <div style={{textAlign:"center",padding:"3rem",color:"var(--muted)",fontFamily:"'Cinzel',serif",fontSize:"0.78rem",letterSpacing:"0.15em"}}>SEARCHING THE SCRIPTURES…</div>}

      {error && !loading && (
        <div style={{background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"13px",padding:"1.4rem 1.75rem",marginBottom:"1.35rem"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.1em",marginBottom:"0.4rem",color:"var(--rust)"}}>{t.passNotFound}</div>
          <div style={{fontSize:"0.82rem",color:"var(--muted)",lineHeight:1.75}}>{error}</div>
          <button className="btn-gold" style={{marginTop:"1rem",padding:"0.55rem 1.1rem",fontSize:"0.7rem"}} onClick={() => { setError(null); setResult(null); }}>{t.passBackFeatured}</button>
        </div>
      )}

      {result && !loading && (
        <motion.div initial={{opacity:0,y:12}} animate={{opacity:1,y:0}}>
          {/* Passage header */}
          <div style={{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.75rem",flexWrap:"wrap",gap:"0.5rem"}}>
            <div className="passage-ref">{result.ref}</div>
            <div style={{display:"flex",gap:"0.45rem",alignItems:"center",flexWrap:"wrap"}}>
              <span className="passage-version-badge">{result.version || selectedVersion.toUpperCase()}</span>
              {result.fromAPI && <span style={{fontSize:"0.62rem",fontFamily:"'Cinzel',serif",letterSpacing:"0.1em",color:"#5A7A52",border:"1px solid #5A7A52",padding:"0.2rem 0.55rem",borderRadius:"10px"}}>✓ LIVE</span>}
              {result.cat && <span style={{fontSize:"0.62rem",fontFamily:"'Cinzel',serif",letterSpacing:"0.1em",color:catColor[result.cat],border:`1px solid ${catColor[result.cat]}`,padding:"0.2rem 0.55rem",borderRadius:"10px"}}>{result.cat==="APO"?"APOCRYPHA":result.cat}</span>}
            </div>
          </div>

          {/* Selection hint */}
          <div style={{background:"rgba(196,137,58,0.07)",border:"1px solid rgba(196,137,58,0.2)",borderRadius:"9px",padding:"0.6rem 0.9rem",marginBottom:"0.85rem",display:"flex",alignItems:"center",gap:"0.65rem"}}>
            <span style={{fontSize:"1rem"}}>✦</span>
            <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.1em",color:"var(--gold)"}}>SELECT ANY WORD</span>
            <span style={{fontSize:"0.78rem",color:"var(--muted)"}}>to look up Hebrew/Greek root, Strong's number, AI explanation, or cross-references.</span>
          </div>

          {/* Verse blocks — interactive */}
          <div className="passage-card" style={{position:"relative"}}>
            {result.verses.map(v => (
              <div key={v.v} style={{position:"relative"}}>
                <div className={`verse-block${showVerseTools===v.v?" verse-block-active":""}`}
                  style={{cursor:"text",borderRadius:"8px",padding:"0.55rem 0.7rem",transition:"background 0.15s",background:showVerseTools===v.v?"rgba(196,137,58,0.06)":"transparent"}}>
                  <div className="verse-num">{v.v}</div>
                  <div className="verse-text"
                    onMouseUp={e=>{ e.stopPropagation(); handleWordSelect(e, v.t, v.v); }}
                    onTouchEnd={e=>{ e.stopPropagation(); setTimeout(()=>handleWordSelect(e, v.t, v.v),200); }}>
                    {v.t}
                  </div>
                  {/* Per-verse tool button */}
                  <button
                    onClick={e=>{e.stopPropagation();setShowVerseTools(showVerseTools===v.v?null:v.v);setActiveTool(null);setToolResult({});setSelectedWord(null);setShowToolbar(false);}}
                    style={{position:"absolute",right:"0.5rem",top:"50%",transform:"translateY(-50%)",fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.08em",padding:"0.22rem 0.55rem",borderRadius:"6px",background:"transparent",border:"1px solid var(--border)",color:"var(--muted)",cursor:"pointer",opacity:0.7}}>
                    ✦ Tools
                  </button>
                </div>

                {/* Per-verse tools panel */}
                {showVerseTools === v.v && (
                  <div style={{background:"white",border:"1px solid var(--border)",borderRadius:"12px",padding:"0.9rem 1.1rem",marginTop:"0.35rem",marginBottom:"0.5rem",boxShadow:"0 4px 16px rgba(0,0,0,0.08)"}}>
                    {/* Verse reference */}
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.12em",color:"var(--gold)",marginBottom:"0.65rem"}}>
                      {result.ref} : {v.v}
                    </div>

                    {/* Tool buttons row */}
                    <div style={{display:"flex",gap:"0.4rem",flexWrap:"wrap",marginBottom:"0.75rem"}}>
                      {VERSE_TOOLS.map(tool => (
                        <button key={tool.key}
                          onClick={e=>{e.stopPropagation();runTool(tool.key,null,v.t,`${result.ref}:${v.v}`);}}
                          style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",padding:"0.35rem 0.75rem",borderRadius:"8px",border:`1px solid ${tool.color}44`,background:activeTool===tool.key?`${tool.color}18`:"transparent",color:tool.color,cursor:"pointer",transition:"all 0.15s"}}>
                          {tool.label}
                        </button>
                      ))}
                      <button
                        onClick={e=>{e.stopPropagation();copyVerse(v.t,v.v,result.ref);}}
                        style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",padding:"0.35rem 0.75rem",borderRadius:"8px",border:"1px solid var(--border)",background:copiedVerse===v.v?"rgba(90,122,82,0.12)":"transparent",color:copiedVerse===v.v?"#5A7A52":"var(--muted)",cursor:"pointer"}}>
                        {copiedVerse===v.v?"✓ Copied":"📋 Copy"}
                      </button>
                    </div>

                    {/* Tool result */}
                    {activeTool && (
                      <div style={{background:"var(--cream)",borderRadius:"10px",padding:"0.85rem 1rem",borderLeft:`3px solid ${VERSE_TOOLS.find(t=>t.key===activeTool)?.color||"var(--gold)"}`}}>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.12em",color:VERSE_TOOLS.find(t=>t.key===activeTool)?.color||"var(--gold)",marginBottom:"0.4rem"}}>
                          {VERSE_TOOLS.find(t=>t.key===activeTool)?.label}
                        </div>
                        {getToolLoading(activeTool, `${result.ref}:${v.v}`) || getToolLoading(activeTool, null) ? (
                          <div style={{fontSize:"0.8rem",color:"var(--muted)",fontStyle:"italic"}}>Generating…</div>
                        ) : (
                          <div style={{fontSize:"0.84rem",color:"var(--ink)",lineHeight:1.82,whiteSpace:"pre-wrap"}}>
                            {getToolResult(activeTool,`${result.ref}:${v.v}`) || getToolResult(activeTool,null) || ""}
                          </div>
                        )}
                      </div>
                    )}
                  </div>
                )}
              </div>
            ))}
          </div>

          {/* ── WORD SELECTION FLOATING TOOLBAR ── */}
          {showToolbar && selectedWord && (
            <div
              onClick={e=>e.stopPropagation()}
              style={{
                position:"fixed",left:"50%",transform:"translateX(-50%)",
                top:"auto",bottom:"calc(env(safe-area-inset-bottom,0px) + 80px)",
                background:"var(--deep)",borderRadius:"16px",padding:"0.85rem 1rem",
                boxShadow:"0 8px 32px rgba(0,0,0,0.35)",zIndex:1000,
                minWidth:"min(92vw,420px)",maxWidth:"96vw",
                border:"1px solid rgba(196,137,58,0.3)",
              }}>
              {/* Selected word header */}
              <div style={{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.65rem"}}>
                <div>
                  <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",color:"var(--gold-light)"}}>SELECTED: </span>
                  <span style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.1rem",fontStyle:"italic",color:"white",marginLeft:"0.4rem"}}>"{selectedWord.word}"</span>
                </div>
                <button onClick={()=>setShowToolbar(false)} style={{background:"transparent",border:"none",color:"rgba(250,246,238,0.5)",cursor:"pointer",fontSize:"1rem",lineHeight:1}}>✕</button>
              </div>

              {/* Tool buttons */}
              <div style={{display:"flex",gap:"0.4rem",flexWrap:"wrap",marginBottom:activeTool?"0.75rem":"0"}}>
                {WORD_TOOLS.map(tool => (
                  <button key={tool.key}
                    onClick={()=>runWordTool(tool.key,selectedWord.word,selectedWord.verseText,`${result.ref}:${selectedWord.verseNum}`)}
                    style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.08em",padding:"0.4rem 0.8rem",borderRadius:"8px",border:`1px solid ${tool.color}88`,background:activeTool===tool.key?`${tool.color}33`:"transparent",color:activeTool===tool.key?"white":tool.color,cursor:"pointer",transition:"all 0.15s"}}>
                    {tool.label}
                  </button>
                ))}
                <button
                  onClick={()=>{ const key=`${result.ref}:${selectedWord.verseNum}`; runTool('crossref',null,selectedWord.verseText,key); }}
                  style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.08em",padding:"0.4rem 0.8rem",borderRadius:"8px",border:"1px solid #C4893A88",background:activeTool==='crossref'?"#C4893A33":"transparent",color:"#C4893A",cursor:"pointer"}}>
                  🔗 Cross-Refs
                </button>
                <button
                  onClick={()=>runWordTool('dictionary',selectedWord.word,selectedWord.verseText,`${result.ref}:${selectedWord.verseNum}`)}
                  style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.08em",padding:"0.4rem 0.8rem",borderRadius:"8px",border:"1px solid #C97D1A88",background:activeTool==='dictionary'?"#C97D1A33":"transparent",color:"#C97D1A",cursor:"pointer"}}>
                  📖 Dictionary
                </button>
              </div>

              {/* Tool result in toolbar */}
              {activeTool && (
                <div style={{background:"rgba(250,246,238,0.08)",borderRadius:"10px",padding:"0.75rem 0.9rem",borderTop:"1px solid rgba(196,137,58,0.2)",marginTop:"0.5rem",maxHeight:"220px",overflowY:"auto"}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.12em",color:"var(--gold-light)",marginBottom:"0.35rem"}}>
                    {WORD_TOOLS.find(t=>t.key===activeTool)?.label || (activeTool==='crossref'?"🔗 CROSS-REFERENCES":"")}
                  </div>
                  {(getToolLoading(activeTool,selectedWord.word)||getToolLoading(activeTool,`${result.ref}:${selectedWord.verseNum}`)) ? (
                    <div style={{fontSize:"0.78rem",color:"rgba(250,246,238,0.5)",fontStyle:"italic"}}>Generating…</div>
                  ) : (
                    <div style={{fontSize:"0.82rem",color:"rgba(250,246,238,0.85)",lineHeight:1.78,whiteSpace:"pre-wrap"}}>
                      {getToolResult(activeTool,selectedWord.word)||getToolResult(activeTool,`${result.ref}:${selectedWord.verseNum}`)||""}
                    </div>
                  )}
                </div>
              )}
            </div>
          )}

          {/* ── REFERENCE TOOLS PANEL (always shown when passage loaded) ── */}
          <div style={{marginTop:"1.5rem",background:"white",borderRadius:"16px",border:"1px solid var(--border)",overflow:"hidden",boxShadow:"var(--shadow)"}}>
            <div style={{padding:"0.9rem 1.25rem",borderBottom:"1px solid var(--border)",background:"var(--deep)",display:"flex",alignItems:"center",gap:"0.75rem"}}>
              <span style={{fontSize:"1.2rem"}}>🏛️</span>
              <div style={{flex:1}}>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",color:"var(--parchment)"}}>{t.toolsH2||'REFERENCE TOOLS LIBRARY'}</div>
                <div style={{fontSize:"0.72rem",color:"rgba(250,246,238,0.55)"}}>Lexicon · Strong's · Interlinear · Dictionary · Commentary · Maps</div>
              </div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",color:"var(--gold-light)",background:"rgba(196,137,58,0.2)",padding:"0.2rem 0.6rem",borderRadius:"6px"}}>📖 {result.ref}</div>
            </div>
            <div style={{padding:"1rem 1.25rem"}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.12em",color:"var(--muted)",marginBottom:"0.75rem"}}>✦ SELECT A WORD ABOVE TO USE AI TOOLS · OR OPEN THESE REFERENCE TOOLS FOR THIS PASSAGE</div>
              <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(190px,1fr))",gap:"0.55rem"}}>
                {EMBEDDED_TOOLS.map((tool,i) => (
                  <a key={i} href={tool.urlFn(result.ref, selectedWord?.word||"")} target="_blank" rel="noopener noreferrer"
                    style={{display:"flex",alignItems:"flex-start",gap:"0.65rem",padding:"0.72rem 0.9rem",background:"var(--cream)",border:`1px solid ${tool.color}22`,borderRadius:"11px",textDecoration:"none",transition:"all 0.18s",cursor:"pointer",borderLeft:`3px solid ${tool.color}`}}>
                    <span style={{fontSize:"1.15rem",flexShrink:0,marginTop:"1px"}}>{tool.icon}</span>
                    <div style={{flex:1,minWidth:0}}>
                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.05em",color:tool.color,lineHeight:1.3,marginBottom:"0.18rem"}}>{tool.label}</div>
                      <div style={{fontSize:"0.62rem",color:"var(--muted)",lineHeight:1.45}}>{tool.desc}</div>
                    </div>
                    <span style={{color:"var(--muted)",fontSize:"0.7rem",flexShrink:0,marginTop:"1px"}}>↗</span>
                  </a>
                ))}
              </div>
            </div>
          </div>

          {/* ── FULL PASSAGE AI STUDY TOOLS ── */}
          <div style={{marginTop:"1rem",background:"white",borderRadius:"16px",border:"1px solid var(--border)",overflow:"hidden",boxShadow:"var(--shadow)"}}>
            <div style={{padding:"0.9rem 1.25rem",borderBottom:"1px solid var(--border)",background:"var(--cream)",display:"flex",alignItems:"center",gap:"0.75rem"}}>
              <span style={{fontSize:"1.2rem"}}>🤖</span>
              <div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",color:"var(--ink)"}}>{t.toolsH2||'AI PASSAGE STUDY TOOLS'}</div>
                <div style={{fontSize:"0.72rem",color:"var(--muted)"}}>Covenant context · Summary · Key themes · Application</div>
              </div>
            </div>
            <div style={{padding:"0.9rem 1.25rem"}}>
              <div style={{display:"flex",gap:"0.45rem",flexWrap:"wrap",marginBottom:"0.75rem"}}>
                {[
                  {key:"passage_summary",    label:"📖 Passage Summary",      prompt:`Summarize this Bible passage for a covenant study student in 3-4 sentences. What is the main message? Use "YAHAWAH" and "Yahawashi". Reference: ${result.ref}`},
                  {key:"passage_covenant",   label:"📜 Covenant Significance", prompt:`Explain the covenant significance of ${result.ref} for the people of Israel. What covenant obligation or promise does this passage address? Under 100 words. Use "YAHAWAH".`},
                  {key:"passage_questions",  label:"💬 Study Questions",       prompt:`Write 3 Shabbat discussion questions for studying ${result.ref} in a covenant Bible study class. Each question should prompt deeper thinking about identity, law, or restoration.`},
                  {key:"passage_pray",       label:"🙏 Prayer from Passage",   prompt:`Write a short covenant prayer (60-80 words) inspired by ${result.ref}. Address YAHAWAH directly. Tie the prayer to the specific truth in the passage. Conclude "In Yahawashi's name, Amein."`},
                ].map(tool => (
                  <button key={tool.key}
                    onClick={async()=>{
                      if(toolResult[tool.key]){setActiveTool(tool.key);return;}
                      setActiveTool(tool.key);
                      setToolLoading(s=>({...s,[tool.key]:true}));
                      try{
                        const res=await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:"claude-sonnet-4-20250514",max_tokens:400,messages:[{role:"user",content:tool.prompt}]})});
                        const d=await res.json();
                        setToolResult(s=>({...s,[tool.key]:d.content?.map(c=>c.text||"").join("")||""}));
                      }catch{setToolResult(s=>({...s,[tool.key]:"Unable to load."}));}
                      setToolLoading(s=>({...s,[tool.key]:false}));
                    }}
                    style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.07em",padding:"0.42rem 0.85rem",borderRadius:"9px",border:"1px solid var(--border)",background:activeTool===tool.key?"var(--deep)":"white",color:activeTool===tool.key?"var(--parchment)":"var(--ink)",cursor:"pointer",transition:"all 0.18s"}}>
                    {tool.label}
                  </button>
                ))}
              </div>
              {activeTool && (toolResult[activeTool]||getToolLoading(activeTool,activeTool)) && (
                <div style={{background:"var(--cream)",borderRadius:"11px",padding:"1rem 1.1rem",border:"1px solid var(--border)"}}>
                  {toolLoading[activeTool] ? (
                    <div style={{fontSize:"0.82rem",color:"var(--muted)",fontStyle:"italic"}}>Generating…</div>
                  ) : (
                    <>
                      <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.85,whiteSpace:"pre-wrap",marginBottom:"0.65rem"}}>{toolResult[activeTool]}</div>
                      <button onClick={()=>navigator.clipboard?.writeText(toolResult[activeTool])}
                        style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.1em",padding:"0.3rem 0.7rem",borderRadius:"6px",border:"1px solid var(--border)",background:"transparent",color:"var(--muted)",cursor:"pointer"}}>
                        📋 Copy
                      </button>
                    </>
                  )}
                </div>
              )}
            </div>
          </div>

          {/* Bottom nav buttons */}
          <div style={{display:"flex",gap:"0.7rem",marginTop:"1.25rem",flexWrap:"wrap"}}>
            <button className="btn-outline" onClick={() => { setResult(null); setError(null); setSearch(""); setPassageQuery(""); setSelectedWord(null); setShowToolbar(false); setActiveTool(null); setToolResult({}); }}>{t.passNewSearch}</button>
            {!isApiVersion && <button className="btn-gold" style={{fontSize:"0.7rem",padding:"0.55rem 1.1rem"}} onClick={() => { setSelectedVersion("kjv"); lookupPassage(search||result.ref); }}>{t.passLoadKJV}</button>}
            <button className="btn-outline" style={{marginLeft:"auto"}} onClick={()=>navigator.clipboard?.writeText(result.verses.map(v=>`${result.ref}:${v.v} — "${v.t}"`).join("\n"))}>📋 Copy All Verses</button>
          </div>
          {result.fromAPI && <div className="passage-tip">{t.passLiveChapter} {result.version}</div>}
        </motion.div>
      )}
    </div>
  );
}

// ─── TABLE OF NATIONS (Genesis 10) ───────────────────────────────────────────
const TABLE_OF_NATIONS = [
  { num:1,  nation:"ISRAEL",        hebrew:"YASHARAHLA",  ancestor:"12 Tribes",     note:"The covenant nation of YAHAWAH — 12 sons of Jacob/Israel",     color:"#C4893A", highlight:true },
  { num:2,  nation:"WHITE EUROPEANS", hebrew:"AHDAWAM",  ancestor:"EDOM (Esau)",   note:"Edom = Esau, brother of Jacob. Rome/European nations trace to Esau.", color:"#8B3A2A" },
  { num:3,  nation:"INDIA",         hebrew:"IYALAM",     ancestor:"ELAM",          note:"Son of Shem. Persians and Indians trace to Elam.",               color:"#5A7A52" },
  { num:4,  nation:"ASSYRIA",       hebrew:"AHSHAWAR",   ancestor:"ASSHUR",        note:"Son of Shem. The Assyrian empire.",                              color:"#6D4C41" },
  { num:5,  nation:"SYRIA",         hebrew:"AHRAM",      ancestor:"ARAM",          note:"Son of Shem. Aramaic-speaking peoples.",                         color:"#7B5EA7" },
  { num:6,  nation:"ARABS",         hebrew:"YASHAMIAHLA",ancestor:"ISHMAEL",       note:"Son of Abraham by Hagar. Father of the Arab nations.",           color:"#C0392B" },
  { num:7,  nation:"CHINESE",       hebrew:"MAWAAHBA",   ancestor:"MOAB",          note:"Son of Lot. East Asian peoples.",                               color:"#1B3A5C" },
  { num:8,  nation:"JAPANESE",      hebrew:"IMAWAN",     ancestor:"AMMON",         note:"Son of Lot. Connected to far eastern nations.",                  color:"#2E7D32" },
  { num:9,  nation:"ETHIOPIANS",    hebrew:"KAWASH",     ancestor:"CUSH",          note:"Son of Ham. Cushites = East African peoples.",                   color:"#8B3A2A" },
  { num:10, nation:"EGYPTIANS",     hebrew:"MATAZARYAM", ancestor:"MIZRAIM",       note:"Son of Ham. Mizraim = Egypt directly in Hebrew.",                color:"#C97D1A" },
  { num:11, nation:"NORTH AFRICANS",hebrew:"PAWAT",      ancestor:"PHUT",          note:"Son of Ham. Libya and North African peoples.",                   color:"#37474F" },
  { num:12, nation:"SOUTH AFRICANS",hebrew:"KANAIN",     ancestor:"CANAAN",        note:"Son of Ham. The Canaanite peoples — cursed by Noah.",            color:"#6A1B9A" },
  { num:13, nation:"TURKEY",        hebrew:"GAMAR",      ancestor:"GOMER",         note:"Son of Japheth. Turkic peoples and parts of Eastern Europe.",     color:"#00838F" },
  { num:14, nation:"RUSSIA",        hebrew:"MAGAWAG",    ancestor:"MAGOG",         note:"Son of Japheth. Russia and northern European peoples.",          color:"#1565C0" },
  { num:15, nation:"GREEK",         hebrew:"YAWAN",      ancestor:"JAVAN",         note:"Son of Japheth. Greek / Ionian peoples.",                        color:"#2980B9" },
  { num:16, nation:"GERMAN",        hebrew:"ASHKANAZ",   ancestor:"ASHKENAZ",      note:"Son of Gomer. Germanic peoples and Ashkenazim.",                 color:"#37474F" },
  { num:17, nation:"SPANISH",       hebrew:"THARASHYASH",ancestor:"TARSHISH",      note:"Son of Javan. Iberian / Spanish-speaking peoples.",              color:"#B5451B" },
  { num:18, nation:"CYPRUS",        hebrew:"KATHAYAM",   ancestor:"KITTIM",        note:"Son of Javan. Island peoples of the Mediterranean.",             color:"#27AE60" },
];

// ─── 12 TRIBES TODAY — Community Teaching Framework ──────────────────────────
const TRIBES_TODAY = [
  { tribe:"Judah",    modern:"African Americans",                         peoples:"American Blacks / Negroes",          color:"#1B5E20", icon:"🦁",
    keyScriptures:["Deuteronomy 28:68","Joel 3:2","Joel 3:6","Psalms 83:3-4"],
    keyVerse:"Deuteronomy 28:68", verseText:"And the LORD shall bring thee into Egypt again with ships, by the way whereof I spake unto thee, Thou shalt see it no more again: and there ye shall be sold unto your enemies for bondmen and bondwomen, and no man shall buy you.",
    note:"The tribe of Judah is connected through the prophecy of Deuteronomy 28:68 — captivity by ship, sold into bondage. Joel 3:6 describes selling to the Greeks (Europeans). Psalms 83 describes enemies saying 'Come, let us cut them off from being a nation.' This is the community's interpretive framework based on these prophetic signs.",
  },
  { tribe:"Benjamin", modern:"West Indian Blacks / Jamaicans",           peoples:"Commonwealth Caribbean Blacks",      color:"#4527A0", icon:"🐺",
    keyScriptures:["Obadiah 1:19","Deuteronomy 28:68","Amos 9:9"],
    keyVerse:"Obadiah 1:19", verseText:"And they of the south shall possess the mount of Esau; and they of the plain the Philistines: and they shall possess the fields of Ephraim, and the fields of Samaria: and Benjamin shall possess Gilead.",
    note:"Benjamin — closely connected to Judah — is identified with West Indian/Caribbean Black populations in this community's teaching tradition. Obadiah discusses Benjamin's future possession territory and Amos 9:9 covers the sifting of Israel among all nations.",
  },
  { tribe:"Levi",     modern:"Haitians / Haiti",                          peoples:"Haitian people",                     color:"#2980B9", icon:"⚜️",
    keyScriptures:["Deuteronomy 33:8-11","Numbers 18:20","Malachi 2:4-7"],
    keyVerse:"Deuteronomy 33:8", verseText:"And of Levi he said, Let thy Thummim and thy Urim be with thy holy one, whom thou didst prove at Massah, and with whom thou didst strive at the waters of Meribah.",
    note:"The tribe of Levi — the priestly tribe — is connected to Haiti in this teaching. Haiti's history as the first Black nation to declare independence in 1804, its spiritual history, and prophetic parallels with the priestly remnant are studied as interpretive markers.",
  },
  { tribe:"Ephraim",  modern:"Puerto Ricans / Taino Indians",             peoples:"Puerto Rican people",                color:"#C0392B", icon:"🌾",
    keyScriptures:["Isaiah 11:13","Hosea 7:8","Hosea 8:8","Deuteronomy 33:17"],
    keyVerse:"Isaiah 11:13", verseText:"The envy also of Ephraim shall depart, and the adversaries of Judah shall be cut off: Ephraim shall not envy Judah, and Judah shall not vex Ephraim.",
    note:"Ephraim is the dominant son of Joseph. Puerto Ricans are connected to Ephraim in this teaching tradition. Hosea 7:8 says 'Ephraim, he hath mixed himself among the people' — describing identity mixing and loss. Deuteronomy 33:17 mentions the 10,000s of Ephraim.",
  },
  { tribe:"Manasseh", modern:"Cubans / Cuba",                             peoples:"Cuban people",                        color:"#B5451B", icon:"🌾",
    keyScriptures:["Deuteronomy 33:17","Genesis 48:14-20","Amos 9:9"],
    keyVerse:"Deuteronomy 33:17", verseText:"His glory is like the firstling of his bullock, and his horns are like the horns of unicorns: with them he shall push the people together to the ends of the earth: and they are the ten thousands of Ephraim, and they are the thousands of Manasseh.",
    note:"Manasseh — the other son of Joseph — is connected to Cuba in this tradition. Both Ephraim and Manasseh's territories and prophecies are studied alongside the dispersion of Caribbean peoples under Deuteronomy 28 as interpretive markers.",
  },
  { tribe:"Simeon",   modern:"Dominicans / Dominican Republic",           peoples:"Dominican Republic people",          color:"#27AE60", icon:"⚔️",
    keyScriptures:["Genesis 49:5-7","Deuteronomy 28:37","Amos 9:9"],
    keyVerse:"Genesis 49:5", verseText:"Simeon and Levi are brethren; instruments of cruelty are in their habitations.",
    note:"Simeon is connected to the Dominican Republic in this community teaching. Genesis 49 places Simeon as scattered within Israel — which this framework maps to the scattering of Dominican people through diaspora and colonial history.",
  },
  { tribe:"Zebulon",  modern:"Guatemala to Panama / Mayans",              peoples:"Central American indigenous peoples",color:"#2E7D32", icon:"🚢",
    keyScriptures:["Genesis 49:13","Deuteronomy 33:18-19","Isaiah 9:1"],
    keyVerse:"Genesis 49:13", verseText:"Zebulun shall dwell at the haven of the sea; and he shall be for an haven of ships; and his border shall be unto Zidon.",
    note:"Zebulon — the sea-dwelling tribe — is connected to Guatemala through Panama and Mayan peoples in this tradition. Genesis 49:13 mentions dwelling at the haven of the sea. The Mayan civilization's coastal settlements and the geographic corridor of Central America are studied as interpretive markers.",
  },
  { tribe:"Gad",      modern:"Native American Indians",                   peoples:"Indigenous North American peoples",  color:"#6D4C41", icon:"🛡️",
    keyScriptures:["Genesis 49:19","Deuteronomy 33:20-21","1 Chronicles 5:18"],
    keyVerse:"Genesis 49:19", verseText:"Gad, a troop shall overcome him: but he shall overcome at the last.",
    note:"Gad is connected to Native American Indians in this teaching tradition. Genesis 49:19 describes a troop overcoming Gad — connected to the conquest of indigenous peoples of North America. The warrior tradition and territorial patterns are studied alongside the prophecy.",
  },
  { tribe:"Reuben",   modern:"Seminole Indians",                          peoples:"Seminole Nation / Creek peoples",    color:"#C0392B", icon:"🌊",
    keyScriptures:["Genesis 49:3-4","Deuteronomy 33:6","Numbers 32:1-5"],
    keyVerse:"Genesis 49:4", verseText:"Unstable as water, thou shalt not excel; because thou wentest up to thy father's bed; then defiledst thou it: he went up to my couch.",
    note:"Reuben — the firstborn who forfeited his birthright — is connected to the Seminole Nation in this tradition. Deuteronomy 33:6 says 'let Reuben live, and not die.' The Seminole people's history of resistance and survival through the Florida Wars is studied as an interpretive parallel.",
  },
  { tribe:"Asher",    modern:"Colombia to Uruguay / Incas",               peoples:"South American indigenous peoples",  color:"#00838F", icon:"🫒",
    keyScriptures:["Genesis 49:20","Deuteronomy 33:24-25","Judges 5:17"],
    keyVerse:"Genesis 49:20", verseText:"Out of Asher his bread shall be fat, and he shall yield royal dainties.",
    note:"Asher is connected to indigenous peoples of South America from Colombia to Uruguay — the Inca civilization and its descendants. Genesis 49:20 describes Asher yielding royal dainties — the Inca Empire's wealth of agriculture and gold is studied alongside this prophecy.",
  },
  { tribe:"Issachar", modern:"Mexicans / Aztecs",                         peoples:"Mexican people / Aztec descendants",  color:"#7B1FA2", icon:"🌟",
    keyScriptures:["Genesis 49:14-15","1 Chronicles 12:32","Deuteronomy 33:18"],
    keyVerse:"Genesis 49:14-15", verseText:"Issachar is a strong ass couching down between two burdens: And he saw that rest was good, and the land that it was pleasant; and bowed his shoulder to bear, and became a servant unto tribute.",
    note:"Issachar is connected to the Mexican/Aztec people in this teaching tradition. Genesis 49:14-15 describes bowing the shoulder to bear and becoming a servant unto tribute — studied alongside the history of Mexican indigenous peoples under colonial labor tribute systems.",
  },
  { tribe:"Naphtali", modern:"Argentina / Chile",                         peoples:"Argentine and Chilean peoples",       color:"#6A1B9A", icon:"🦌",
    keyScriptures:["Genesis 49:21","Deuteronomy 33:23","Isaiah 9:1-2"],
    keyVerse:"Genesis 49:21", verseText:"Naphtali is a hind let loose: he giveth goodly words.",
    note:"Naphtali is connected to Argentina and Chile in this teaching tradition. Genesis 49:21 describes a hind (deer) let loose — symbolizing freedom and scattered dispersal. Isaiah 9:1-2 covers Naphtali's land being brought into light — studied alongside the southern cone of South America.",
  },
];

// ─── SCRIPTURE NEWS PAGE ─────────────────────────────────────────────────────
// ─── NEWS SOURCES CONFIG ─────────────────────────────────────────────────────
const NEWS_SOURCES = [
  // Ecuador
  { id:"el_universo", name:"El Universo", country:"Ecuador", flag:"🇪🇨", color:"#1B3A5C",
    url:"https://www.eluniverso.com/", rssUrl:"https://www.eluniverso.com/arc/outboundfeeds/rss/?outputType=xml",
    desc:"Ecuador's leading national newspaper", lang:"es" },
  { id:"el_extra",    name:"El Extra",    country:"Ecuador", flag:"🇪🇨", color:"#C0392B",
    url:"https://www.extra.ec/", rssUrl:"https://www.extra.ec/sitemap.xml",
    desc:"Ecuador's popular daily news", lang:"es" },
  // Mexico
  { id:"el_universal_mx", name:"El Universal", country:"Mexico", flag:"🇲🇽", color:"#2E7D32",
    url:"https://www.eluniversal.com.mx/", rssUrl:"https://www.eluniversal.com.mx/rss.xml",
    desc:"Mexico's top national newspaper", lang:"es" },
  { id:"milenio", name:"Milenio", country:"Mexico", flag:"🇲🇽", color:"#6D4C41",
    url:"https://www.milenio.com/", rssUrl:"https://www.milenio.com/rss",
    desc:"Mexico national news & current events", lang:"es" },
  // USA — Dallas
  { id:"dallas_news", name:"Dallas Morning News", country:"USA — Dallas", flag:"🇺🇸", color:"#1B5E20",
    url:"https://www.dallasnews.com/", rssUrl:"https://www.dallasnews.com/arc/outboundfeeds/rss/",
    desc:"North Texas leading newspaper", lang:"en" },
  { id:"wfaa", name:"WFAA Dallas", country:"USA — Dallas", flag:"🇺🇸", color:"#1565C0",
    url:"https://www.wfaa.com/", rssUrl:"https://www.wfaa.com/feeds/syndication/rss/news",
    desc:"Dallas–Fort Worth ABC affiliate", lang:"en" },
  // USA — Miami
  { id:"miami_herald", name:"Miami Herald", country:"USA — Miami", flag:"🇺🇸", color:"#8B3A2A",
    url:"https://www.miamiherald.com/", rssUrl:"https://www.miamiherald.com/arc/outboundfeeds/rss/?outputType=xml",
    desc:"South Florida's leading newspaper", lang:"en" },
  { id:"local10", name:"Local 10 — WPLG Miami", country:"USA — Miami", flag:"🇺🇸", color:"#37474F",
    url:"https://www.local10.com/", rssUrl:"https://www.local10.com/rss",
    desc:"Miami ABC affiliate news", lang:"en" },
];

function ScriptureNewsPage({ setPage, t, goToScripture }) {
  const [news, setNews] = useState([]);
  const [loading, setLoading] = useState(false);
  const [lastFetched, setLastFetched] = useState(null);
  const [activeArticle, setActiveArticle] = useState(null);
  const [expandedVerse, setExpandedVerse] = useState(null);
  const [aiLoading, setAiLoading] = useState({});
  const [aiText, setAiText] = useState({});
  const [activeRegion, setActiveRegion] = useState("all");

  const fetchNews = async () => {
    setLoading(true); setNews([]);
    const prompt = "Search these sources for today's top news: eluniverso.com (Ecuador), extra.ec (Ecuador), eluniversal.com.mx (Mexico), milenio.com (Mexico), dallasnews.com (USA Dallas), wfaa.com (USA Dallas), miamiherald.com (USA Miami), local10.com (USA Miami). Return exactly 5 stories as a JSON array only, no markdown: [{\"headline\":\"max 12 words\",\"source\":\"outlet name\",\"sourceUrl\":\"article url or homepage\",\"location\":\"City Country\",\"locationEmoji\":\"flag emoji\",\"region\":\"Ecuador|Mexico|Dallas|Miami|Global\",\"category\":\"Politics|Economy|Disaster|Conflict|Social\",\"summary\":\"2-3 sentences\",\"propheticNote\":\"1-2 sentence scripture connection, measured\",\"scripture\":\"KJV reference\",\"verseText\":\"full KJV verse\",\"urgency\":\"High|Medium|Low\"}]. Today: " + new Date().toDateString() + ". Report real factual news only.";
    try {
      const res = await fetch("https://api.anthropic.com/v1/messages", {
        method:"POST", headers:{"Content-Type":"application/json"},
        body:JSON.stringify({ model:"claude-sonnet-4-20250514", max_tokens:3000,
          tools:[{ type:"web_search_20250305", name:"web_search" }],
          messages:[{ role:"user", content:prompt }]
        })
      });
      const data = await res.json();
      const txt = (data.content||[]).map(c=>c.text||"").join("");
      const match = txt.match(/\[[\s\S]*\]/);
      if (match) { setNews(JSON.parse(match[0]).slice(0,6)); setLastFetched(new Date()); }
      else setNews([{ headline:"Could not parse headlines", source:"System", location:"—", locationEmoji:"⚠️", region:"Global", category:"System", summary:"API returned a response but headlines could not be parsed. Try refreshing.", propheticNote:"Study the Word.", scripture:"Ezekiel 3:17", verseText:"Son of man, I have made thee a watchman unto the house of Israel.", urgency:"Low" }]);
    } catch { setNews([{ headline:"Connection error", source:"System", location:"—", locationEmoji:"⚠️", region:"Global", category:"System", summary:"Could not connect. Check your internet connection and try again.", propheticNote:"", scripture:"Isaiah 34:16", verseText:"Seek ye out of the book of the LORD, and read: no one of these shall fail.", urgency:"Low" }]); }
    setLoading(false);
  };

  const explainVerse = async (ref, text) => {
    if (aiText[ref]) return;
    setAiLoading(s=>({...s,[ref]:true}));
    try {
      const res = await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:"claude-sonnet-4-20250514",max_tokens:300,messages:[{role:"user",content:"Explain this Bible verse for a covenant study student. Use YAHAWAH for divine name. Under 70 words.\n\n" + ref + ': "' + text + '"'}]})});
      const d = await res.json();
      setAiText(s=>({...s,[ref]:d.content?.map(c=>c.text||"").join("")||""}));
    } catch {}
    setAiLoading(s=>({...s,[ref]:false}));
  };

  const URGENCY = { High:"#C0392B", Medium:"#C4893A", Low:"#5A7A52" };
  const CAT_ICON = { Politics:"🏛️", Economy:"📊", Disaster:"🌊", Conflict:"⚔️", Social:"👥", System:"⚙️" };
  const REGION_COLOR = { Ecuador:"#1B3A5C", Mexico:"#2E7D32", Dallas:"#1B5E20", Miami:"#8B3A2A", Global:"#6D4C41" };
  const REGIONS = ["all","Ecuador","Mexico","Dallas","Miami"];
  const filtered = activeRegion === "all" ? news : news.filter(a => (a.region||"").includes(activeRegion));

  return (
    <div>
      <button className="back-btn" onClick={()=>setPage("bible-hub")}>{t?.backHub||"← Back to Scripture Hub"}</button>

      {/* Hero */}
      <div style={{background:"linear-gradient(135deg,var(--deep),#1A2A18)",borderRadius:"20px",padding:"2rem",marginBottom:"1.5rem",color:"var(--parchment)",position:"relative",overflow:"hidden"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.28em",color:"var(--gold-light)",marginBottom:"0.6rem"}}>📡 CURRENT EVENTS THROUGH A SCRIPTURAL LENS</div>
        <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"clamp(1.4rem,4vw,2.2rem)",fontWeight:700,color:"var(--parchment)",marginBottom:"0.5rem",lineHeight:1.2}}>Scripture Hub Daily News</h2>
        <p style={{fontSize:"0.85rem",color:"rgba(250,246,238,0.65)",lineHeight:1.78,maxWidth:"460px",marginBottom:"1rem"}}>Live headlines from Ecuador · Mexico · Dallas · Miami — interpreted through covenant scripture.</p>
        <div style={{display:"flex",gap:"0.65rem",alignItems:"center",flexWrap:"wrap"}}>
          <button className="btn-gold" onClick={fetchNews} disabled={loading}>{loading ? "⏳ Loading…" : "📡 Fetch Today's Headlines"}</button>
          {lastFetched && <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",color:"rgba(250,246,238,0.4)"}}>Updated: {lastFetched.toLocaleTimeString()}</span>}
        </div>
      </div>

      {/* News Sources Grid */}
      <div style={{background:"white",borderRadius:"16px",border:"1px solid var(--border)",marginBottom:"1.5rem",overflow:"hidden",boxShadow:"var(--shadow)"}}>
        <div style={{padding:"0.8rem 1.25rem",borderBottom:"1px solid var(--border)",background:"var(--cream)",display:"flex",alignItems:"center",gap:"0.75rem",justifyContent:"space-between"}}>
          <div style={{display:"flex",alignItems:"center",gap:"0.6rem"}}>
            <span>🗺️</span>
            <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.1em",color:"var(--ink)"}}>CONNECTED NEWS SOURCES</span>
          </div>
          <span style={{fontSize:"0.7rem",color:"var(--muted)"}}>Click any source to visit directly</span>
        </div>
        {/* Region filter */}
        <div style={{display:"flex",borderBottom:"1px solid var(--border)",overflowX:"auto",scrollbarWidth:"none"}}>
          {REGIONS.map(r=>(
            <button key={r} onClick={()=>setActiveRegion(r)}
              style={{flex:1,minWidth:"70px",fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",padding:"0.55rem 0.3rem",border:"none",borderBottom:"2px solid " + (activeRegion===r?"var(--gold)":"transparent"),background:"transparent",color:activeRegion===r?"var(--gold)":"var(--muted)",cursor:"pointer",whiteSpace:"nowrap",textAlign:"center"}}>
              {r==="all"?"🌎 All":r==="Ecuador"?"🇪🇨 Ecuador":r==="Mexico"?"🇲🇽 Mexico":r==="Dallas"?"🏙️ Dallas":"🌴 Miami"}
            </button>
          ))}
        </div>
        {/* Source cards */}
        <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(190px,1fr))",gap:"0.55rem",padding:"0.9rem 1.1rem"}}>
          {NEWS_SOURCES.filter(s=>activeRegion==="all"||s.country.includes(activeRegion)||s.id.includes(activeRegion.toLowerCase())).map(source=>(
            <a key={source.id} href={source.url} target="_blank" rel="noopener noreferrer"
              style={{display:"flex",alignItems:"flex-start",gap:"0.65rem",padding:"0.72rem 0.9rem",background:"var(--cream)",border:"1px solid " + source.color + "22",borderRadius:"11px",textDecoration:"none",borderLeft:"3px solid " + source.color}}>
              <span style={{fontSize:"1.2rem",flexShrink:0}}>{source.flag}</span>
              <div style={{flex:1}}>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",color:source.color,lineHeight:1.3,marginBottom:"0.12rem"}}>{source.name}</div>
                <div style={{fontSize:"0.6rem",color:"var(--muted)"}}>{source.country} · {source.desc}</div>
              </div>
              <span style={{color:"var(--muted)",fontSize:"0.7rem"}}>↗</span>
            </a>
          ))}
        </div>
      </div>

      {/* Scripture banner */}
      <div style={{background:"var(--cream)",borderRadius:"12px",padding:"0.85rem 1.2rem",marginBottom:"1.5rem",border:"1px solid var(--border)",display:"flex",gap:"1rem",alignItems:"flex-start"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.1em",color:"var(--gold)",flexShrink:0,marginTop:"2px"}}>MATTHEW 24:6-7</div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.95rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.72,flex:1}}>"And ye shall hear of wars and rumours of wars: see that ye be not troubled: for all these things must come to pass, but the end is not yet. For nation shall rise against nation."</div>
        <button onClick={()=>goToScripture&&goToScripture("Matthew 24:6-7")} style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",padding:"0.22rem 0.5rem",borderRadius:"6px",background:"transparent",border:"1px solid var(--gold)",color:"var(--gold)",cursor:"pointer",flexShrink:0}}>📖</button>
      </div>

      {/* Loading */}
      {loading && (
        <div style={{textAlign:"center",padding:"3rem 1rem"}}>
          <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>📡</div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.12em",color:"var(--gold)",marginBottom:"0.5rem"}}>SEARCHING HEADLINES</div>
          <div style={{fontSize:"0.82rem",color:"var(--muted)",lineHeight:1.72}}>El Universo · El Extra · El Universal · Milenio<br/>Dallas Morning News · WFAA · Miami Herald · Local 10</div>
        </div>
      )}

      {/* Empty state */}
      {!loading && news.length === 0 && (
        <div style={{textAlign:"center",padding:"2.5rem 1rem"}}>
          <div style={{fontSize:"3rem",marginBottom:"1rem"}}>📰</div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.78rem",letterSpacing:"0.1em",color:"var(--muted)",marginBottom:"0.75rem"}}>READY TO FETCH TODAY'S HEADLINES</div>
          <p style={{fontSize:"0.85rem",color:"var(--muted)",maxWidth:"360px",margin:"0 auto 1.5rem",lineHeight:1.75}}>Click above to load today's top stories from Ecuador, Mexico, Dallas and Miami — with covenant scripture context.</p>
          <button className="btn-gold" onClick={fetchNews}>📡 Fetch Headlines</button>
        </div>
      )}

      {/* Articles */}
      {news.length > 0 && (
        <div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"1rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
            ✦ TODAY'S TOP {filtered.length} HEADLINES
            <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
          </div>
          {filtered.map((article, i) => {
            const isOpen = activeArticle === i;
            const urgColor = URGENCY[article.urgency]||"var(--gold)";
            return (
              <div key={i} style={{background:"white",borderRadius:"16px",border:"1px solid var(--border)",marginBottom:"0.85rem",overflow:"hidden",boxShadow:"var(--shadow)",borderLeft:"4px solid " + urgColor}}>
                <div style={{padding:"1.1rem 1.35rem",cursor:"pointer",display:"flex",gap:"0.85rem",alignItems:"flex-start"}} onClick={()=>setActiveArticle(isOpen?null:i)}>
                  <span style={{fontSize:"1.4rem",flexShrink:0,marginTop:"2px"}}>{CAT_ICON[article.category]||"📰"}</span>
                  <div style={{flex:1,minWidth:0}}>
                    <div style={{display:"flex",gap:"0.4rem",alignItems:"center",flexWrap:"wrap",marginBottom:"0.25rem"}}>
                      <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",padding:"0.15rem 0.45rem",borderRadius:"5px",background:urgColor + "18",color:urgColor,border:"1px solid " + urgColor + "33"}}>{(article.urgency||"NEWS").toUpperCase()}</span>
                      <span style={{fontSize:"0.75rem"}}>{article.locationEmoji}</span>
                      {article.region && <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.12rem 0.4rem",borderRadius:"4px",background:(REGION_COLOR[article.region]||"#666") + "15",color:REGION_COLOR[article.region]||"#666",border:"1px solid " + (REGION_COLOR[article.region]||"#666") + "33"}}>{(article.region||"").toUpperCase()}</span>}
                      {article.source && <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",color:"var(--muted)"}}>{article.source}</span>}
                    </div>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.83rem",letterSpacing:"0.03em",color:"var(--ink)",lineHeight:1.35,marginBottom:"0.25rem"}}>{article.headline}</div>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",color:"var(--gold)"}}>📖 {article.scripture}</div>
                  </div>
                  <span style={{color:"var(--muted)",fontSize:"0.68rem",transform:isOpen?"rotate(180deg)":"none",transition:"transform 0.2s",flexShrink:0,marginTop:"4px"}}>▼</span>
                </div>
                <AnimatePresence>
                  {isOpen && (
                    <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.22}} style={{borderTop:"1px solid var(--border)"}}>
                      <div style={{padding:"1.1rem 1.35rem"}}>
                        {article.sourceUrl && (
                          <a href={article.sourceUrl} target="_blank" rel="noopener noreferrer"
                            style={{display:"inline-flex",alignItems:"center",gap:"0.4rem",fontFamily:"'Cinzel',serif",fontSize:"0.58rem",color:"var(--gold)",textDecoration:"none",marginBottom:"0.85rem",padding:"0.25rem 0.6rem",border:"1px solid rgba(196,137,58,0.3)",borderRadius:"7px",background:"rgba(196,137,58,0.06)"}}>
                            ↗ {article.source}
                          </a>
                        )}
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.16em",color:"var(--muted)",marginBottom:"0.4rem"}}>📋 SUMMARY</div>
                        <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.82,marginBottom:"1rem"}}>{article.summary}</div>
                        <div style={{background:"var(--deep)",color:"var(--parchment)",borderRadius:"12px",padding:"1rem 1.25rem",marginBottom:"1rem",borderLeft:"3px solid var(--gold)"}}>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",color:"var(--gold-light)",marginBottom:"0.35rem"}}>{article.scripture}</div>
                          <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",lineHeight:1.75}}>"{article.verseText}"</div>
                        </div>
                        <div style={{background:"rgba(196,137,58,0.07)",borderRadius:"10px",padding:"0.85rem 1rem",borderLeft:"3px solid var(--gold)",marginBottom:"1rem"}}>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.14em",color:"var(--gold)",marginBottom:"0.3rem"}}>🔍 SCRIPTURAL CONTEXT</div>
                          <div style={{fontSize:"0.85rem",color:"var(--ink)",lineHeight:1.82}}>{article.propheticNote}</div>
                        </div>
                        <div style={{display:"flex",gap:"0.45rem",flexWrap:"wrap"}}>
                          {goToScripture && <button className="scripture-btn" onClick={()=>goToScripture(article.scripture)}>📖 {article.scripture}</button>}
                          <button className="copy-btn" onClick={()=>{setExpandedVerse(expandedVerse===i?null:i);if(expandedVerse!==i&&!aiText[article.scripture])explainVerse(article.scripture,article.verseText);}}>🤖 {expandedVerse===i?"Hide":"Explain Verse"}</button>
                          <button className="copy-btn" onClick={()=>navigator.clipboard&&navigator.clipboard.writeText(article.headline + "\n" + (article.source||"") + " — " + article.location + "\n\n" + article.summary)}>📋 Copy</button>
                        </div>
                        {expandedVerse===i && (
                          <div style={{marginTop:"0.7rem",background:"rgba(196,137,58,0.06)",borderRadius:"10px",padding:"0.85rem 1rem",border:"1px solid rgba(196,137,58,0.18)"}}>
                            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.12em",color:"var(--gold)",marginBottom:"0.3rem"}}>🤖 AI EXPLANATION</div>
                            {aiLoading[article.scripture] ? <div style={{fontSize:"0.8rem",color:"var(--muted)",fontStyle:"italic"}}>Generating…</div> : <div style={{fontSize:"0.83rem",color:"var(--ink)",lineHeight:1.8}}>{aiText[article.scripture]||"Tap Explain Verse to generate."}</div>}
                          </div>
                        )}
                      </div>
                    </motion.div>
                  )}
                </AnimatePresence>
              </div>
            );
          })}
          <div style={{textAlign:"center",marginTop:"1rem"}}>
            <button className="btn-outline" style={{fontSize:"0.7rem"}} onClick={fetchNews}>🔄 Refresh Headlines</button>
          </div>
        </div>
      )}

      {/* Watchman note */}
      <div style={{background:"var(--cream)",borderRadius:"14px",padding:"1.25rem 1.5rem",marginTop:"1.75rem",border:"1px solid var(--border)"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.5rem"}}>✦ WATCHMAN NOTE</div>
        <div style={{fontSize:"0.85rem",color:"var(--ink)",lineHeight:1.85,marginBottom:"0.75rem"}}>This news section connects current events through a covenant scriptural lens — not prediction or prophecy. Scripture connections are study prompts, not definitive prophetic fulfillments. Pray before you share.</div>
        <div style={{display:"flex",gap:"0.45rem",flexWrap:"wrap"}}>
          <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("Ezekiel 3:17")}>📖 Ezekiel 3:17</button>
          <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("Matthew 24:3-8")}>📖 Matthew 24:3-8</button>
          <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("Luke 21:28")}>📖 Luke 21:28</button>
        </div>
      </div>
    </div>
  );
}

function BiblePlaceholderPage({ icon, title, desc, setPage, t }) {
  return (
    <div>
      <button className="back-btn" onClick={() => setPage("bible-hub")}>{t?.backHub || "← Back to Scripture Hub"}</button>
      <div style={{textAlign:"center",padding:"3rem 1rem"}}>
        <div style={{fontSize:"3rem",marginBottom:"1rem"}}>{icon}</div>
        <div className="section-eyebrow" style={{justifyContent:"center"}}>{title}</div>
        <h2 className="section-h2" style={{textAlign:"center",marginBottom:"0.7rem"}}>{title}</h2>
        <p style={{fontSize:"0.88rem",color:"var(--muted)",maxWidth:"400px",margin:"0 auto 2rem",lineHeight:1.82}}>{desc}</p>
        <button className="btn-gold" onClick={() => setPage("join")}>{t?.joinCtaBtn || "Join Club for Access ✦"}</button>
      </div>
    </div>
  );
}

// ─── JOIN PAGE ────────────────────────────────────────────────────────────────
function JoinPage({ onSuccess, t, lang }) {
  const [form, setForm] = useState({ name:"", email:"", phone:"", prayer:"", gender:"" });
  const [errors, setErrors] = useState({});
  const [submitted, setSubmitted] = useState(false);
  const set = k => e => setForm({ ...form, [k]:e.target.value });

  const validate = () => {
    const e = {};
    if (!form.name.trim()) e.name = t.errorName;
    if (!form.email.trim() || !form.email.includes("@")) e.email = t.errorEmail;
    setErrors(e);
    return Object.keys(e).length === 0;
  };

  const handleSubmit = () => {
    if (validate()) {
      setSubmitted(true);
      // Scroll to top so success screen is visible
      window.scrollTo({ top: 0, behavior: "smooth" });
    }
  };

  const handleContinue = () => {
    onSuccess({ ...form, lang });
  };

  // Determine community links based on form data
  const whatsappLink = (lang === "es" || lang === "fr" || lang === "pt" || lang === "ht")
    ? "https://chat.whatsapp.com/DURN5BiprUzBa6v46bTLgu?mode=gi_t"
    : "https://chat.whatsapp.com/GmdP6Rujeg6EHKJLcwGVlp?mode=gi_t";

  const whatsappLabel = lang==="es" ? "Grupo WhatsApp en Español" : lang==="fr" ? "Groupe WhatsApp Français" : lang==="pt" ? "Grupo WhatsApp Português" : lang==="ht" ? "Gwoup WhatsApp Kreyòl" : "English WhatsApp Group";

  const facebookLink = form.gender === "female"
    ? "https://www.facebook.com/share/1HVo5W9ViE/"
    : "https://www.facebook.com/share/1MKbA8C3xn/";

  const facebookLabel = form.gender === "female"
    ? (lang==="es"?"Grupo de Mujeres":lang==="fr"?"Groupe des Femmes":lang==="pt"?"Grupo de Mulheres":lang==="ht"?"Gwoup Fanm":"Women's Facebook Group")
    : (lang==="es"?"Grupo de Hombres":lang==="fr"?"Groupe des Hommes":lang==="pt"?"Grupo de Homens":lang==="ht"?"Gwoup Gason":"Men's Facebook Group");

  const facebookDesc = form.gender === "female"
    ? (lang==="es"?"Estudio de mujeres · Oración · Comunidad del pacto":lang==="fr"?"Étude femmes · Prière · Communauté":lang==="pt"?"Estudo feminino · Oração · Comunidade":lang==="ht"?"Etid fanm · Lapriyè · Kominote":"Women's study · Prayer · Covenant community")
    : (lang==="es"?"Estudio bíblico · Enseñanza · Comunidad del pacto":lang==="fr"?"Étude biblique · Enseignement · Communauté":lang==="pt"?"Estudo bíblico · Ensino · Comunidade":lang==="ht"?"Etid bib · Ansèyman · Kominote":"Bible study · Teaching · Covenant community");

  const joinWord = lang==="es"?"ENTRAR":lang==="fr"?"REJOINDRE":lang==="pt"?"ENTRAR":lang==="ht"?"RANTRE":"JOIN NOW";

  // ── SUCCESS SCREEN ──
  if (submitted) {
    return (
      <motion.div initial={{opacity:0,y:20}} animate={{opacity:1,y:0}} transition={{duration:0.45}}>
        {/* Welcome banner */}
        <div style={{background:"linear-gradient(135deg,#0D2035,#1A3A2A)",borderRadius:"20px",padding:"2rem 2rem 1.75rem",marginBottom:"1.5rem",color:"var(--parchment)",textAlign:"center",position:"relative",overflow:"hidden"}}>
          <div style={{position:"absolute",top:0,left:0,right:0,bottom:0,background:"radial-gradient(circle at 50% 30%,rgba(196,137,58,0.15) 0%,transparent 65%)",pointerEvents:"none"}} />
          <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>✦</div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.25em",color:"var(--gold-light)",marginBottom:"0.6rem"}}>WELCOME TO THE COVENANT COMMUNITY</div>
          <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"clamp(1.5rem,4vw,2.4rem)",color:"white",marginBottom:"0.5rem",lineHeight:1.2}}>
            {lang==="es"?"¡Bienvenido/a,":lang==="fr"?"Bienvenue,":lang==="pt"?"Bem-vindo/a,":lang==="ht"?"Byenveni,":"Welcome,"} {form.name.split(" ")[0]}!
          </h2>
          <p style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.1rem",fontStyle:"italic",color:"rgba(250,246,238,0.7)",lineHeight:1.75,maxWidth:"440px",margin:"0 auto"}}>
            {lang==="es"?"YAHAWAH te ha llamado por nombre. Eres parte del pacto.":lang==="fr"?"YAHAWAH t'a appelé par ton nom. Tu fais partie de l'alliance.":lang==="pt"?"YAHAWAH te chamou pelo teu nome. Tu fazes parte do pacto.":lang==="ht"?"YAHAWAH rele ou pa non ou. Ou fè pati alyans la.":"YAHAWAH has called you by name. You are part of the covenant."}
          </p>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.12em",color:"rgba(250,246,238,0.45)",marginTop:"0.9rem"}}>Isaiah 43:1 · 1 Peter 2:9</div>
        </div>

        {/* ── STEP 1: WhatsApp ── */}
        <div style={{marginBottom:"1rem"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.2em",color:"var(--muted)",marginBottom:"0.65rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
            <span style={{background:"#25D166",color:"white",borderRadius:"50%",width:"20px",height:"20px",display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:"'Cinzel',serif",fontSize:"0.6rem",flexShrink:0}}>1</span>
            {lang==="es"?"ÚNETE AL GRUPO DE WHATSAPP":lang==="fr"?"REJOINS LE GROUPE WHATSAPP":lang==="pt"?"ENTRE NO GRUPO WHATSAPP":lang==="ht"?"RANTRE NAN GWOUP WHATSAPP LA":"JOIN THE WHATSAPP GROUP"}
          </div>
          <a href={whatsappLink} target="_blank" rel="noopener noreferrer"
            style={{display:"flex",alignItems:"center",gap:"1.1rem",padding:"1.25rem 1.5rem",background:"linear-gradient(135deg,#075E54,#128C7E)",borderRadius:"16px",textDecoration:"none",boxShadow:"0 4px 18px rgba(37,211,102,0.25)",border:"1px solid rgba(37,211,102,0.4)"}}>
            <div style={{width:"52px",height:"52px",borderRadius:"14px",background:"#25D166",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.75rem",flexShrink:0}}>💬</div>
            <div style={{flex:1}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.8rem",letterSpacing:"0.08em",color:"#25D166",marginBottom:"0.2rem"}}>WHATSAPP</div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"1rem",color:"white",marginBottom:"0.2rem"}}>{whatsappLabel}</div>
              <div style={{fontSize:"0.75rem",color:"rgba(255,255,255,0.6)"}}>
                {lang==="es"?"Estudios semanales · Avisos de clase · Comunidad":lang==="fr"?"Études hebdomadaires · Annonces · Communauté":lang==="pt"?"Estudos semanais · Avisos · Comunidade":lang==="ht"?"Etid chak semèn · Avi · Kominote":"Weekly studies · Class alerts · Covenant community"}
              </div>
            </div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",padding:"0.5rem 1.1rem",background:"#25D166",color:"white",borderRadius:"10px",flexShrink:0,fontWeight:600}}>
              {joinWord}
            </div>
          </a>
        </div>

        {/* ── STEP 2: Facebook ── */}
        <div style={{marginBottom:"1rem"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.2em",color:"var(--muted)",marginBottom:"0.65rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
            <span style={{background:"#1877F2",color:"white",borderRadius:"50%",width:"20px",height:"20px",display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:"'Cinzel',serif",fontSize:"0.6rem",flexShrink:0}}>2</span>
            {lang==="es"?"ÚNETE AL GRUPO DE FACEBOOK":lang==="fr"?"REJOINS LE GROUPE FACEBOOK":lang==="pt"?"ENTRE NO GRUPO FACEBOOK":lang==="ht"?"RANTRE NAN GWOUP FACEBOOK LA":"JOIN THE FACEBOOK GROUP"}
          </div>

          {/* If gender was selected, show single targeted group */}
          {form.gender ? (
            <a href={facebookLink} target="_blank" rel="noopener noreferrer"
              style={{display:"flex",alignItems:"center",gap:"1.1rem",padding:"1.25rem 1.5rem",background:"linear-gradient(135deg,#0e3875,#1877F2)",borderRadius:"16px",textDecoration:"none",boxShadow:"0 4px 18px rgba(24,119,242,0.25)",border:"1px solid rgba(24,119,242,0.4)"}}>
              <div style={{width:"52px",height:"52px",borderRadius:"14px",background:"#1877F2",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.75rem",flexShrink:0}}>{form.gender==="female"?"🌸":"⚔️"}</div>
              <div style={{flex:1}}>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.8rem",letterSpacing:"0.08em",color:"#6BA5F5",marginBottom:"0.2rem"}}>FACEBOOK — {form.gender==="female"?"WOMEN":"MEN"}</div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"1rem",color:"white",marginBottom:"0.2rem"}}>{facebookLabel}</div>
                <div style={{fontSize:"0.75rem",color:"rgba(255,255,255,0.6)"}}>{facebookDesc}</div>
              </div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",padding:"0.5rem 1.1rem",background:"#1877F2",color:"white",borderRadius:"10px",flexShrink:0,fontWeight:600}}>
                {joinWord}
              </div>
            </a>
          ) : (
            // No gender selected — show both groups
            <div style={{display:"flex",flexDirection:"column",gap:"0.65rem"}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",color:"var(--muted)",textAlign:"center",padding:"0.35rem"}}>
                {lang==="es"?"Selecciona el grupo que más te corresponde:":lang==="fr"?"Choisis le groupe qui te correspond:":lang==="pt"?"Seleciona o grupo que te corresponde:":lang==="ht"?"Chwazi gwoup ki pi koresponn ak ou:":"Choose the group that applies to you:"}
              </div>
              {[
                { href:"https://www.facebook.com/share/1HVo5W9ViE/", icon:"🌸", label:lang==="es"?"Grupo de Mujeres — Hermanas en el Pacto":lang==="fr"?"Groupe des Femmes — Sœurs dans l'Alliance":lang==="pt"?"Grupo de Mulheres — Irmãs no Pacto":lang==="ht"?"Gwoup Fanm — Sè nan Alyans la":"Women's Group — Sisters in the Covenant", sub:lang==="es"?"Estudio de mujeres · Oración · Comunidad":lang==="fr"?"Étude femmes · Prière · Communauté":lang==="pt"?"Estudo feminino · Oração · Comunidade":lang==="ht"?"Etid fanm · Lapriyè · Kominote":"Women's study · Prayer · Covenant community" },
                { href:"https://www.facebook.com/share/1MKbA8C3xn/", icon:"⚔️", label:lang==="es"?"Grupo de Hombres — Hermanos en el Pacto":lang==="fr"?"Groupe des Hommes — Frères dans l'Alliance":lang==="pt"?"Grupo de Homens — Irmãos no Pacto":lang==="ht"?"Gwoup Gason — Frè nan Alyans la":"Men's Group — Brothers in the Covenant", sub:lang==="es"?"Estudio bíblico · Enseñanza · Comunidad":lang==="fr"?"Étude biblique · Enseignement · Communauté":lang==="pt"?"Estudo bíblico · Ensino · Comunidade":lang==="ht"?"Etid bib · Ansèyman · Kominote":"Bible study · Teaching · Covenant community" }
              ].map((grp,i) => (
                <a key={i} href={grp.href} target="_blank" rel="noopener noreferrer"
                  style={{display:"flex",alignItems:"center",gap:"1rem",padding:"1.1rem 1.35rem",background:"linear-gradient(135deg,#0e3875,#1877F2)",borderRadius:"14px",textDecoration:"none",border:"1px solid rgba(24,119,242,0.35)"}}>
                  <div style={{width:"44px",height:"44px",borderRadius:"12px",background:"rgba(255,255,255,0.15)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.4rem",flexShrink:0}}>{grp.icon}</div>
                  <div style={{flex:1}}>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.82rem",color:"white",marginBottom:"0.18rem"}}>{grp.label}</div>
                    <div style={{fontSize:"0.72rem",color:"rgba(255,255,255,0.6)"}}>{grp.sub}</div>
                  </div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",padding:"0.4rem 0.9rem",background:"#1877F2",color:"white",borderRadius:"8px",flexShrink:0}}>{joinWord}</div>
                </a>
              ))}
            </div>
          )}
        </div>

        {/* Privacy note */}
        <div style={{background:"var(--cream)",borderRadius:"12px",padding:"0.85rem 1.1rem",marginBottom:"1.25rem",border:"1px solid var(--border)",display:"flex",gap:"0.65rem",alignItems:"flex-start"}}>
          <span style={{fontSize:"1rem",flexShrink:0}}>🔒</span>
          <div style={{fontSize:"0.78rem",color:"var(--muted)",lineHeight:1.65}}>
            {lang==="es"?"Estos son grupos privados del Pacto exclusivos para miembros del Club Bíblico. Tu información permanece privada y segura.":lang==="fr"?"Ce sont des groupes privés de l'Alliance réservés aux membres du Club Biblique. Vos informations restent privées et sécurisées.":lang==="pt"?"Estes são grupos privados da Aliança exclusivos para membros do Clube Bíblico. Suas informações permanecem privadas e seguras.":lang==="ht"?"Sa yo se gwoup prive Alyans eksklizif pou manm Klib Bib la. Enfòmasyon ou yo rete prive epi an sekirite.":"These are private Covenant groups exclusively for Bible Club members. Your information remains private and secure."}
          </div>
        </div>

        {/* Continue to app button */}
        <div style={{textAlign:"center"}}>
          <button className="btn-gold" style={{fontSize:"0.8rem",padding:"0.9rem 2.2rem",letterSpacing:"0.12em"}} onClick={handleContinue}>
            {lang==="es"?"Continuar al Club Bíblico →":lang==="fr"?"Continuer vers le Club Biblique →":lang==="pt"?"Continuar para o Clube Bíblico →":lang==="ht"?"Kontinye nan Klib Bib la →":"Continue to Bible Club →"}
          </button>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",color:"var(--muted)",marginTop:"0.6rem"}}>
            {lang==="es"?"¡Ya eres miembro del pacto!":lang==="fr"?"Tu es déjà membre de l'alliance !":lang==="pt"?"Você já é membro do pacto!":lang==="ht"?"Ou deja yon manm alyans!":"You're already a covenant member!"}
          </div>
        </div>
      </motion.div>
    );
  }

  // ── JOIN FORM ──
  return (
    <div>
      <div className="section-eyebrow">{t.navJoin}</div>
      <h2 className="section-h2">{t.joinTitle}</h2>
      <p className="section-body">{t.joinSub}</p>
      <div className="join-grid">
        <div>
          <div className="highlight-list">
            {t.highlights.map(([icon,text]) => (
              <div key={text} className="highlight-item"><span className="highlight-icon">{icon}</span><span className="highlight-text">{text}</span></div>
            ))}
          </div>
          {/* Preview of what they get */}
          <div style={{background:"linear-gradient(135deg,#0D2035,#1A3A2A)",borderRadius:"14px",padding:"1.25rem 1.5rem",marginTop:"1rem",color:"var(--parchment)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"var(--gold-light)",marginBottom:"0.6rem"}}>✦ AFTER JOINING YOU GET ACCESS TO</div>
            {[
              { icon:"💬", label:lang==="es"?"Grupo privado de WhatsApp":lang==="fr"?"Groupe WhatsApp privé":lang==="pt"?"Grupo WhatsApp privado":"Private WhatsApp Group" },
              { icon:"📘", label:lang==="es"?"Grupo de Facebook por género":lang==="fr"?"Groupe Facebook par genre":lang==="pt"?"Grupo Facebook por gênero":"Facebook Group (Men or Women)" },
              { icon:"📖", label:lang==="es"?"Estudio semanal de la Biblia":lang==="fr"?"Étude biblique hebdomadaire":lang==="pt"?"Estudo bíblico semanal":"Weekly Shabbat Bible Study" },
              { icon:"🕯️", label:lang==="es"?"Devocionales diarios del pacto":lang==="fr"?"Dévotionnels quotidiens":"Daily Covenant Devotionals" },
            ].map((item,i) => (
              <div key={i} style={{display:"flex",alignItems:"center",gap:"0.65rem",marginBottom:"0.5rem"}}>
                <span style={{fontSize:"1rem",flexShrink:0}}>{item.icon}</span>
                <span style={{fontSize:"0.82rem",color:"rgba(250,246,238,0.75)"}}>{item.label}</span>
              </div>
            ))}
          </div>
        </div>
        <div className="join-form-card">
          <div className="form-title">{t.joinFormTitle||"Begin Your Covenant Journey"}</div>
          <div className="form-sub">{t.joinFormSub||"Fill out the form below to join the God Did It Bible Club community."}</div>
          <input className="form-input" style={errors.name?{borderColor:"var(--rust)"}:{}} placeholder={t.placeholderName} value={form.name} onChange={set("name")} />
          {errors.name && <div style={{fontSize:"0.72rem",color:"var(--rust)",marginTop:"-0.4rem",marginBottom:"0.5rem"}}>{errors.name}</div>}
          <input className="form-input" style={errors.email?{borderColor:"var(--rust)"}:{}} placeholder={t.placeholderEmail} value={form.email} onChange={set("email")} />
          {errors.email && <div style={{fontSize:"0.72rem",color:"var(--rust)",marginTop:"-0.4rem",marginBottom:"0.5rem"}}>{errors.email}</div>}
          <input className="form-input" placeholder={t.placeholderPhone} value={form.phone} onChange={set("phone")} />
          {/* Gender selector — determines which Facebook group */}
          <select className="form-input" value={form.gender} onChange={set("gender")}
            style={{fontFamily:"'Libre Baskerville',serif",fontSize:"0.88rem",color:form.gender?"var(--ink)":"var(--muted)"}}>
            <option value="">{lang==="es"?"Selecciona tu género (opcional)":lang==="fr"?"Sélectionne ton genre (optionnel)":lang==="pt"?"Selecione seu gênero (opcional)":lang==="ht"?"Chwazi sèks ou (opsyonèl)":"Select your gender (optional)"}</option>
            <option value="female">{lang==="es"?"Mujer / Hermana":lang==="fr"?"Femme / Sœur":lang==="pt"?"Mulher / Irmã":lang==="ht"?"Fanm / Sè":"Sister / Woman"}</option>
            <option value="male">{lang==="es"?"Hombre / Hermano":lang==="fr"?"Homme / Frère":lang==="pt"?"Homem / Irmão":lang==="ht"?"Gason / Frè":"Brother / Man"}</option>
          </select>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",color:"var(--muted)",marginTop:"-0.3rem",marginBottom:"0.6rem"}}>
            {lang==="es"?"↑ Esto determina a qué grupo de Facebook serás dirigido.":lang==="fr"?"↑ Ceci détermine quel groupe Facebook vous sera assigné.":lang==="pt"?"↑ Isso determina para qual grupo do Facebook você será direcionado.":lang==="ht"?"↑ Sa a détèmine nan ki gwoup Facebook ou pral voye.":"↑ This determines which Facebook group you will be directed to."}
          </div>
          <textarea className="form-input" placeholder={t.placeholderPrayer} value={form.prayer} onChange={set("prayer")} />
          <button className="btn-submit" onClick={handleSubmit}>{t.joinSubmit||"Submit & Begin Your Journey ✦"}</button>
          <div className="form-note">{t.joinNote}</div>
          <div style={{textAlign:"center",marginTop:"0.75rem"}}>
            <button onClick={()=>setPage&&setPage("forgot-password")} style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",color:"var(--muted)",background:"transparent",border:"none",cursor:"pointer",textDecoration:"underline"}}>
              {lang==="es"?"¿Olvidaste tu contraseña?":lang==="fr"?"Mot de passe oublié ?":"Forgot password?"}
            </button>
          </div>
        </div>
      </div>
    </div>
  );
}

// ─── WELCOME HERO (post-join) ────────────────────────────────────────────────
function WelcomePage({ member, setPage, startTour, t }) {
  // Determine WhatsApp link based on language
  const lang = member?.lang || "en";
  const whatsappLink = (lang === "es" || lang === "fr" || lang === "pt" || lang === "ht")
    ? "https://chat.whatsapp.com/DURN5BiprUzBa6v46bTLgu?mode=gi_t"
    : "https://chat.whatsapp.com/GmdP6Rujeg6EHKJLcwGVlp?mode=gi_t";

  // Facebook group by gender
  const gender = member?.gender || "";
  const facebookLink = gender === "female"
    ? "https://www.facebook.com/share/1HVo5W9ViE/"
    : "https://www.facebook.com/share/1MKbA8C3xn/";
  const facebookLabel = gender === "female"
    ? (lang==="es"?"Grupo de Mujeres — Facebook":lang==="fr"?"Groupe Femmes — Facebook":lang==="pt"?"Grupo de Mulheres — Facebook":lang==="ht"?"Gwoup Fanm — Facebook":"Women's Group — Facebook")
    : (lang==="es"?"Grupo de Hombres — Facebook":lang==="fr"?"Groupe Hommes — Facebook":lang==="pt"?"Grupo de Homens — Facebook":lang==="ht"?"Gwoup Gason — Facebook":"Men's Group — Facebook");

  const whatsappLabel = lang === "es" ? "Grupo de WhatsApp en Español" : lang === "fr" ? "Groupe WhatsApp Français" : lang === "pt" ? "Grupo WhatsApp Português" : lang === "ht" ? "Gwoup WhatsApp Kreyòl" : "English WhatsApp Group";

  return (
    <div>
      <motion.div initial={{opacity:0,y:20}} animate={{opacity:1,y:0}} transition={{duration:0.5}}>
        <section className="hero" style={{marginBottom:"2.5rem"}}>
          <div className="hero-eyebrow">{t.welcomeEyebrow}</div>
          <h1 className="hero-h1">
            {lang==="es"?"Bienvenido/a,":lang==="fr"?"Bienvenue,":lang==="pt"?"Bem-vindo/a,":lang==="ht"?"Byenveni,":"Welcome,"}<br />
            <em>{member?.name?.split(" ")[0] || "Beloved"}.</em><br />
            {lang==="es"?"Dios Lo Hizo.":lang==="fr"?"Dieu L'a Fait.":lang==="pt"?"Deus Fez Isso.":lang==="ht"?"Bondye Fè L.":"God Did It."}
          </h1>
          <p className="hero-sub">{t.welcomeSub}</p>
          <div className="hero-actions">
            <button className="btn-gold" onClick={startTour}>{t.welcomeCta1}</button>
            <button className="btn-outline-light" onClick={() => setPage("weekly")}>{t.welcomeCta2}</button>
          </div>
        </section>

        {/* ── COMMUNITY LINKS ── */}
        <div style={{background:"linear-gradient(135deg,#0D2035,#1A3A2A)",borderRadius:"20px",padding:"1.75rem 2rem",marginBottom:"2rem",color:"var(--parchment)"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.22em",color:"var(--gold-light)",marginBottom:"0.5rem"}}>✦ JOIN THE COVENANT COMMUNITY</div>
          <h3 style={{fontFamily:"'Cinzel',serif",fontSize:"1.15rem",color:"var(--parchment)",marginBottom:"0.4rem",lineHeight:1.3}}>
            {lang==="es"?"Únete a nuestros grupos de la comunidad":lang==="fr"?"Rejoins nos groupes communautaires":lang==="pt"?"Entre nos nossos grupos comunitários":lang==="ht"?"Jwenn gwoup kominote nou yo":"Join our community groups"}
          </h3>
          <p style={{fontSize:"0.84rem",color:"rgba(250,246,238,0.62)",lineHeight:1.75,marginBottom:"1.25rem"}}>
            {lang==="es"?"Conéctate con la familia del Club Bíblico en WhatsApp y Facebook.":lang==="fr"?"Connecte-toi avec la famille du Club Biblique sur WhatsApp et Facebook.":lang==="pt"?"Conecte-se com a família do Clube Bíblico no WhatsApp e Facebook.":lang==="ht"?"Konekte ak fanmi Klib Bib la sou WhatsApp ak Facebook.":"Connect with the Bible Club family on WhatsApp and Facebook."}
          </p>

          <div style={{display:"flex",flexDirection:"column",gap:"0.75rem"}}>
            {/* WhatsApp — language based */}
            <a href={whatsappLink} target="_blank" rel="noopener noreferrer"
              style={{display:"flex",alignItems:"center",gap:"1rem",padding:"1.1rem 1.4rem",background:"rgba(37,211,102,0.12)",border:"1px solid rgba(37,211,102,0.35)",borderRadius:"14px",textDecoration:"none",transition:"all 0.2s"}}>
              <div style={{width:"44px",height:"44px",borderRadius:"12px",background:"#25D166",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.4rem",flexShrink:0}}>💬</div>
              <div style={{flex:1}}>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.75rem",letterSpacing:"0.06em",color:"#25D166",marginBottom:"0.18rem"}}>WHATSAPP</div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.85rem",color:"var(--parchment)",lineHeight:1.3}}>{whatsappLabel}</div>
                <div style={{fontSize:"0.72rem",color:"rgba(250,246,238,0.5)",marginTop:"0.18rem"}}>
                  {lang==="es"?"Estudios semanales · Anuncios · Comunidad":lang==="fr"?"Études hebdomadaires · Annonces · Communauté":lang==="pt"?"Estudos semanais · Anúncios · Comunidade":lang==="ht"?"Etid chak semèn · Anaons · Kominote":"Weekly studies · Announcements · Community"}
                </div>
              </div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",padding:"0.3rem 0.75rem",background:"#25D166",color:"white",borderRadius:"8px",flexShrink:0}}>
                {lang==="es"?"ENTRAR":lang==="fr"?"REJOINDRE":lang==="pt"?"ENTRAR":lang==="ht"?"RANTRE":"JOIN"}
              </div>
            </a>

            {/* Facebook — gender based */}
            <a href={facebookLink} target="_blank" rel="noopener noreferrer"
              style={{display:"flex",alignItems:"center",gap:"1rem",padding:"1.1rem 1.4rem",background:"rgba(24,119,242,0.12)",border:"1px solid rgba(24,119,242,0.35)",borderRadius:"14px",textDecoration:"none",transition:"all 0.2s"}}>
              <div style={{width:"44px",height:"44px",borderRadius:"12px",background:"#1877F2",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.4rem",flexShrink:0}}>📘</div>
              <div style={{flex:1}}>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.75rem",letterSpacing:"0.06em",color:"#1877F2",marginBottom:"0.18rem"}}>FACEBOOK</div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.85rem",color:"var(--parchment)",lineHeight:1.3}}>{facebookLabel}</div>
                <div style={{fontSize:"0.72rem",color:"rgba(250,246,238,0.5)",marginTop:"0.18rem"}}>
                  {gender==="female"
                    ? (lang==="es"?"Estudio de mujeres · Oración · Comunidad del pacto":lang==="fr"?"Étude femmes · Prière · Communauté de l'alliance":lang==="pt"?"Estudo feminino · Oração · Comunidade da aliança":lang==="ht"?"Etid fanm · Lapriyè · Kominote alyans":"Women's study · Prayer · Covenant community")
                    : (lang==="es"?"Estudio bíblico · Enseñanza · Comunidad del pacto":lang==="fr"?"Étude biblique · Enseignement · Communauté de l'alliance":lang==="pt"?"Estudo bíblico · Ensino · Comunidade da aliança":lang==="ht"?"Etid bib · Ansèyman · Kominote alyans":"Bible study · Teaching · Covenant community")}
                </div>
              </div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",padding:"0.3rem 0.75rem",background:"#1877F2",color:"white",borderRadius:"8px",flexShrink:0}}>
                {lang==="es"?"ENTRAR":lang==="fr"?"REJOINDRE":lang==="pt"?"ENTRAR":lang==="ht"?"RANTRE":"JOIN"}
              </div>
            </a>

            {/* If no gender selected, show both Facebook groups */}
            {!gender && (
              <a href="https://www.facebook.com/share/1HVo5W9ViE/" target="_blank" rel="noopener noreferrer"
                style={{display:"flex",alignItems:"center",gap:"1rem",padding:"0.85rem 1.4rem",background:"rgba(24,119,242,0.07)",border:"1px solid rgba(24,119,242,0.22)",borderRadius:"14px",textDecoration:"none"}}>
                <div style={{width:"36px",height:"36px",borderRadius:"10px",background:"rgba(24,119,242,0.2)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.1rem",flexShrink:0}}>🌸</div>
                <div style={{flex:1}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",color:"#1877F2",marginBottom:"0.1rem"}}>WOMEN'S FACEBOOK GROUP</div>
                  <div style={{fontSize:"0.68rem",color:"rgba(250,246,238,0.5)"}}>Sisters in the covenant</div>
                </div>
                <span style={{color:"rgba(250,246,238,0.4)",fontSize:"0.75rem"}}>↗</span>
              </a>
            )}
          </div>

          <div style={{marginTop:"1rem",padding:"0.75rem 1rem",background:"rgba(196,137,58,0.08)",borderRadius:"10px",border:"1px solid rgba(196,137,58,0.18)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.12em",color:"var(--gold-light)",marginBottom:"0.25rem"}}>📌 {lang==="es"?"NOTA":lang==="fr"?"NOTE":lang==="pt"?"NOTA":lang==="ht"?"NÒT":"NOTE"}</div>
            <div style={{fontSize:"0.78rem",color:"rgba(250,246,238,0.55)",lineHeight:1.65}}>
              {lang==="es"?"Los grupos de WhatsApp y Facebook son comunidades privadas del Pacto para los miembros del Club Bíblico Dios Lo Hizo. Tu información es privada y segura.":lang==="fr"?"Les groupes WhatsApp et Facebook sont des communautés privées de l'Alliance pour les membres du Club Biblique Dieu L'a Fait. Tes informations sont privées et sécurisées.":lang==="pt"?"Os grupos do WhatsApp e Facebook são comunidades privadas da Aliança para os membros do Clube Bíblico Deus Fez Isso. Suas informações são privadas e seguras.":lang==="ht"?"Gwoup WhatsApp ak Facebook yo se kominote prive Alyans pou manm Klib Bib Bondye Fè L. Enfòmasyon ou yo prive epi an sekirite.":"The WhatsApp and Facebook groups are private Covenant communities for God Did It Bible Club members. Your information is private and secure."}
            </div>
          </div>
        </div>

        <div className="section-eyebrow" style={{justifyContent:"center",marginBottom:"0.5rem"}}>{t.welcomeNextSteps}</div>
        <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(200px,1fr))",gap:"1rem",marginBottom:"2.5rem"}}>
          {ONBOARDING_STEPS.slice(1).map((step,i) => (
            <motion.div key={step.id} initial={{opacity:0,y:14}} animate={{opacity:1,y:0}} transition={{delay:0.1+i*0.07}} className="card card-body" style={{cursor:"pointer"}}
              onClick={() => setPage({bible:"bible-hub",study:"weekly",devotional:"devotional",reading:"reading",audio:"audio"}[step.id]||"home")}>
              <div style={{fontSize:"1.75rem",marginBottom:"0.7rem"}}>{step.icon}</div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.78rem",letterSpacing:"0.05em",marginBottom:"0.4rem"}}>{step.title}</div>
              <div style={{fontSize:"0.78rem",color:"var(--muted)",lineHeight:1.65,marginBottom:"0.9rem"}}>{step.desc}</div>
              <button className="btn-text">{step.cta} <span>→</span></button>
            </motion.div>
          ))}
        </div>
      </motion.div>
    </div>
  );
}

// ─── FOOTER ───────────────────────────────────────────────────────────────────
function Footer({ setPage, t }) {
  return (
    <footer className="footer">
      <div className="footer-inner">
        <div>
          <div className="footer-title">{t.navBrand}</div>
          <div className="footer-body">{t.footerSub}</div>
        </div>
        <div className="footer-actions">
          <button className="btn-gold" onClick={() => setPage("weekly")}>{t.footerWeekly}</button>
          <button className="btn-outline" onClick={() => setPage("join")}>{t.footerJoin}</button>
        </div>
      </div>
    </footer>
  );
}

// ─── ANCIENT ISRAEL DATA ─────────────────────────────────────────────────────

// Bible Reader Data
const BIBLE_READER_BOOKS = {
  "Genesis": {
    1: [
      {v:1,t:"In the beginning God created the heaven and the earth."},
      {v:2,t:"And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters."},
      {v:3,t:"And God said, Let there be light: and there was light."},
      {v:4,t:"And God saw the light, that it was good: and God divided the light from the darkness."},
      {v:5,t:"And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day."},
    ],
    12: [
      {v:1,t:"Now the LORD had said unto Abram, Get thee out of thy country, and from thy kindred, and from thy father's house, unto a land that I will shew thee:"},
      {v:2,t:"And I will make of thee a great nation, and I will bless thee, and make thy name great; and thou shalt be a blessing:"},
      {v:3,t:"And I will bless them that bless thee, and curse him that curseth thee: and in thee shall all families of the earth be blessed."},
    ],
  },
  "Exodus": {
    14: [
      {v:13,t:"And Moses said unto the people, Fear ye not, stand still, and see the salvation of the LORD, which he will shew to you to day: for the Egyptians whom ye have seen to day, ye shall see them again no more for ever."},
      {v:14,t:"The LORD shall fight for you, and ye shall hold your peace."},
      {v:21,t:"And Moses stretched out his hand over the sea; and the LORD caused the sea to go back by a strong east wind all that night, and made the sea dry land, and the waters were divided."},
    ],
    20: [
      {v:1,t:"And God spake all these words, saying,"},
      {v:2,t:"I am the LORD thy God, which have brought thee out of the land of Egypt, out of the house of bondage."},
      {v:3,t:"Thou shalt have no other gods before me."},
      {v:4,t:"Thou shalt not make unto thee any graven image, or any likeness of any thing that is in heaven above, or that is in the earth beneath, or that is in the water under the earth."},
      {v:7,t:"Thou shalt not take the name of the LORD thy God in vain; for the LORD will not hold him guiltless that taketh his name in vain."},
      {v:8,t:"Remember the sabbath day, to keep it holy."},
      {v:12,t:"Honour thy father and thy mother: that thy days may be long upon the land which the LORD thy God giveth thee."},
      {v:13,t:"Thou shalt not kill."},
      {v:14,t:"Thou shalt not commit adultery."},
      {v:15,t:"Thou shalt not steal."},
      {v:16,t:"Thou shalt not bear false witness against thy neighbour."},
      {v:17,t:"Thou shalt not covet thy neighbour's house, thou shalt not covet thy neighbour's wife, nor his manservant, nor his maidservant, nor his ox, nor his ass, nor any thing that is thy neighbour's."},
    ],
  },
  "Deuteronomy": {
    28: [
      {v:1,t:"And it shall come to pass, if thou shalt hearken diligently unto the voice of the LORD thy God, to observe and to do all his commandments which I command thee this day, that the LORD thy God will set thee on high above all nations of the earth:"},
      {v:2,t:"And all these blessings shall come on thee, and overtake thee, if thou shalt hearken unto the voice of the LORD thy God."},
      {v:15,t:"But it shall come to pass, if thou wilt not hearken unto the voice of the LORD thy God, to observe to do all his commandments and his statutes which I command thee this day; that all these curses shall come upon thee, and overtake thee:"},
      {v:68,t:"And the LORD shall bring thee into Egypt again with ships, by the way whereof I spake unto thee, Thou shalt see it no more again: and there ye shall be sold unto your enemies for bondmen and bondwomen, and no man shall buy you."},
    ],
  },
  "Isaiah": {
    11: [
      {v:11,t:"And it shall come to pass in that day, that the Lord shall set his hand again the second time to recover the remnant of his people, which shall be left, from Assyria, and from Egypt, and from Pathros, and from Cush, and from Elam, and from Shinar, and from Hamath, and from the islands of the sea."},
      {v:12,t:"And he shall set up an ensign for the nations, and shall assemble the outcasts of Israel, and gather together the dispersed of Judah from the four corners of the earth."},
    ],
  },
  "Daniel": {
    7: [
      {v:13,t:"I saw in the night visions, and, behold, one like the Son of man came with the clouds of heaven, and came to the Ancient of days, and they brought him near before him."},
      {v:14,t:"And there was given him dominion, and glory, and a kingdom, that all people, nations, and languages, should serve him: his dominion is an everlasting dominion, which shall not pass away, and his kingdom that which shall not be destroyed."},
    ],
  },
  "Matthew": {
    15: [
      {v:24,t:"But he answered and said, I am not sent but unto the lost sheep of the house of Israel."},
    ],
  },
  "Romans": {
    11: [
      {v:1,t:"I say then, Hath God cast away his people? God forbid. For I also am an Israelite, of the seed of Abraham, of the tribe of Benjamin."},
      {v:2,t:"God hath not cast away his people which he foreknew. Wot ye not what the scripture saith of Elias? how he maketh intercession to God against Israel, saying,"},
    ],
  },
  "Revelation": {
    21: [
      {v:12,t:"And had a wall great and high, and had twelve gates, and at the gates twelve angels, and names written thereon, which are the names of the twelve tribes of the children of Israel:"},
      {v:19,t:"And the foundations of the wall of the city were garnished with all manner of precious stones. The first foundation was jasper; the second, sapphire; the third, a chalcedony; the fourth, an emerald;"},
      {v:20,t:"The fifth, sardonyx; the sixth, sardius; the seventh, chrysolyte; the eighth, beryl; the ninth, a topaz; the tenth, a chrysoprasus; the eleventh, a jacinth; the twelfth, an amethyst."},
    ],
  },
};

const CROSS_REFS = {
  "Genesis 12": [{ref:"Romans 4:3",text:"Abraham believed God, and it was counted unto him for righteousness."},{ref:"Galatians 3:16",text:"Now to Abraham and his seed were the promises made."},{ref:"Hebrews 11:8",text:"By faith Abraham, when he was called to go out into a place which he should after receive for an inheritance, obeyed."}],
  "Exodus 20": [{ref:"Deuteronomy 5:6-21",text:"The Ten Commandments restated before entry into the land."},{ref:"Matthew 5:17",text:"Think not that I am come to destroy the law, or the prophets: I am not come to destroy, but to fulfil."},{ref:"Romans 7:12",text:"Wherefore the law is holy, and the commandment holy, and just, and good."}],
  "Deuteronomy 28": [{ref:"Leviticus 26:14-46",text:"If ye will not hearken unto me, I will punish you seven times more for your sins."},{ref:"Amos 3:1-2",text:"You only have I known of all the families of the earth."},{ref:"Isaiah 42:22",text:"But this is a people robbed and spoiled; they are all of them snared in holes."}],
  "default": [{ref:"Psalm 147:19-20",text:"He sheweth his word unto Jacob, his statutes and his judgments unto Israel."},{ref:"Amos 3:1-2",text:"Hear this word that the LORD hath spoken against you, O children of Israel."},{ref:"Isaiah 11:11-12",text:"The Lord shall set his hand again to recover the remnant of his people."}],
};

// Articles Data
const ARTICLES = [
  {
    id:1, title:"The Merneptah Stele: Oldest Mention of Israel",
    thumb:"🏛️", thumbBg:"linear-gradient(135deg,#1B3A5C,#2A5A8C)",
    author:"Historical Research Team", date:"March 2024",
    tags:["Archaeology","History"],
    tagColors:{"Archaeology":"#2A9D8F","History":"#1B3A5C"},
    excerpt:"Discovered in 1896, this Egyptian victory stele contains the earliest known extrabiblical mention of Israel as a people.",
    body: [
      {type:"p",text:"Discovered in 1896 by British Egyptologist Flinders Petrie at Thebes, the Merneptah Stele is a granite slab standing over 10 feet tall, dating to approximately 1208 BCE. Commissioned by Pharaoh Merneptah, son of Ramesses the Great, it commemorates military campaigns in Canaan and Libya."},
      {type:"p",text:"Among the conquered peoples listed, one line reads: 'Israel is laid waste, his seed is not.' This is the oldest known extrabiblical reference to Israel as a distinct people group in Canaan — confirming that by 1208 BCE, a people called Israel was already established in the land, exactly as the biblical narrative places them after the Exodus and conquest under Joshua."},
      {type:"scripture",ref:"Amos 3:1-2",text:"Hear this word that the LORD hath spoken against you, O children of Israel, against the whole family which I brought up from the land of Egypt, saying, You only have I known of all the families of the earth: therefore I will punish you for all your iniquities."},
      {type:"p",text:"The determinative hieroglyph used for Israel is that of a 'people' or ethnic group — not a city or nation-state — which aligns with the biblical presentation of Israel as a tribal confederation at that historical stage. This archaeological evidence firmly anchors Israel in Canaan during the same period that Judges and early Joshua describe."},
      {type:"p",text:"Skeptics who once claimed Israel was a late literary invention have been consistently silenced by this stele. The stone does not lie: Israel existed, was recognized by the most powerful empire on earth, and was already formidable enough to be worthy of mention alongside city-states like Gezer, Yanoam, and Ashkelon."},
      {type:"p",text:"Today the stele resides in the Egyptian Museum in Cairo. Every serious student of biblical history should understand its significance: it is the oldest physical artifact that mentions the name Israel — not as mythology, but as undeniable historical record."},
    ],
    refs:["Amos 3:1-2","Exodus 12:41","Joshua 11:23","Judges 1:1"],
  },
  {
    id:2, title:"The 12 Tribes and the High Priest's Breastplate",
    thumb:"💎", thumbBg:"linear-gradient(135deg,#7B3FA0,#4A1F6E)",
    author:"Covenant Studies", date:"February 2024",
    tags:["Identity","Law"],
    tagColors:{"Identity":"#B5451B","Law":"#C97D1A"},
    excerpt:"Twelve stones. Twelve tribes. One breastplate bearing the names of all Israel over the heart of the High Priest forever.",
    body: [
      {type:"p",text:"Exodus 28 describes the breastplate of judgment worn by the High Priest Aaron — a sacred garment embedded with twelve precious stones, each engraved with the name of one of the twelve tribes of Israel. This was not decorative. It was covenantal: the priest bore Israel's names on his chest when he entered the presence of the Most High."},
      {type:"scripture",ref:"Exodus 28:17-21",text:"And thou shalt set in it settings of stones, even four rows of stones: the first row shall be a sardius, a topaz, and a carbuncle: this shall be the first row. And the second row shall be an emerald, a sapphire, and a diamond. And the third row a ligure, an agate, and an amethyst. And the fourth row a beryl, and an onyx, and a jasper: they shall be set in gold in their inclosings. And the stones shall be with the names of the children of Israel, twelve, according to their names, like the engravings of a signet; every one with his name shall they be according to the twelve tribes."},
      {type:"p",text:"Each gemstone carries spiritual and identity weight. The sardius (Reuben) — deep red, representing the firstborn. The emerald (Judah) — green, the royal tribe from whom the Messiah would come. Sapphire (Dan) — deep blue. The pattern of stones reappears in Revelation 21 as the foundations of New Jerusalem, each inscribed with an apostle's name, mirroring the breastplate's structure."},
      {type:"p",text:"The breastplate measured one span — about 9 inches — and was doubled, forming a pouch. Inside it were placed the Urim and Thummim, mysterious objects used for divine inquiry. This means the High Priest literally carried the nation of Israel into God's presence, asking for guidance on their behalf, with their very identities pressed against his heart."},
      {type:"p",text:"Understanding the twelve tribes — their territories, their symbols, their histories — is essential to grasping the full scope of biblical prophecy. When Isaiah speaks of gathering 'the dispersed of Judah from the four corners of the earth,' he is speaking of specific tribes with specific identities, not a generic religious group. The breastplate reminds us: God knows each tribe by name."},
    ],
    refs:["Exodus 28:17-21","Revelation 21:12-20","Isaiah 11:11-12","Numbers 2:2"],
  },
  {
    id:3, title:"Deuteronomy 28: Prophecy or History?",
    thumb:"📜", thumbBg:"linear-gradient(135deg,#B5451B,#7A2A10)",
    author:"Prophetic Studies", date:"January 2024",
    tags:["Prophecy","History"],
    tagColors:{"Prophecy":"#B5451B","History":"#1B3A5C"},
    excerpt:"Written before Israel even entered Canaan, Deuteronomy 28 describes with shocking precision events that would take centuries to unfold.",
    body: [{type:"p",text:"Deuteronomy 28 stands as one of the most astonishing prophetic chapters in all of scripture. Moses delivered these words while Israel still stood east of the Jordan, before they had entered the land — yet the curses described in verses 15-68 read like a detailed history of the last 2,700 years."},{type:"scripture",ref:"Deuteronomy 28:68",text:"And the LORD shall bring thee into Egypt again with ships, by the way whereof I spake unto thee, Thou shalt see it no more again: and there ye shall be sold unto your enemies for bondmen and bondwomen, and no man shall buy you."},{type:"p",text:"The phrase 'into Egypt again with ships' is remarkable — Israel's original captivity in Egypt was overland. A second captivity 'with ships' pointing south toward Africa was fulfilled when the transatlantic slave trade carried captive peoples across the Atlantic. No people group has been shipped into slavery in the way described more literally than the African diaspora."}],
    refs:["Deuteronomy 28:15","Deuteronomy 28:68","Leviticus 26:33","Amos 9:9"],
  },
  {
    id:4, title:"Who Were the Ancient Israelites?",
    thumb:"🗺️", thumbBg:"linear-gradient(135deg,#2A9D8F,#1A5F58)",
    author:"Identity Research", date:"December 2023",
    tags:["Identity","History"],
    tagColors:{"Identity":"#B5451B","History":"#1B3A5C"},
    excerpt:"Examining scripture, archaeology, and history to understand the ethnic and covenant identity of biblical Israel.",
    body: [{type:"p",text:"The question of who the ancient Israelites were is one of the most studied — and most contested — questions in biblical scholarship. Scripture is specific: they were the physical descendants of Jacob (also called Israel), who was the son of Isaac, who was the son of Abraham. Twelve sons of Jacob formed the foundational tribes."},{type:"scripture",ref:"Psalm 147:19-20",text:"He sheweth his word unto Jacob, his statutes and his judgments unto Israel. He hath not dealt so with any nation: and as for his judgments, they have not known them. Praise ye the LORD."},{type:"p",text:"Physical descriptions in scripture, as well as ancient artwork, papyrus records, and DNA research, are increasingly being examined through fresh lenses. What is biblically certain: Israel was a covenant people defined by bloodline AND obedience — the two could not be permanently separated."}],
    refs:["Psalm 147:19-20","Romans 9:4-5","Amos 3:1-2","Genesis 49"],
  },
  {
    id:5, title:"Cyrus the Great and the Persian Restoration",
    thumb:"⚔️", thumbBg:"linear-gradient(135deg,#C97D1A,#8A4A05)",
    author:"Historical Studies", date:"November 2023",
    tags:["History","Archaeology"],
    tagColors:{"History":"#1B3A5C","Archaeology":"#2A9D8F"},
    excerpt:"Isaiah named Cyrus by name 150 years before he was born — and the Persian king fulfilled that prophecy exactly.",
    body: [{type:"p",text:"In Isaiah 44:28 and 45:1, the prophet refers to a king named 'Cyrus' who would command Jerusalem to be rebuilt and the temple's foundation to be laid — a prophecy written approximately 150 years before Cyrus II of Persia was born. When Cyrus conquered Babylon in 539 BCE, he issued a decree permitting captive peoples, including the Jews, to return to their homelands and rebuild their temples."},{type:"scripture",ref:"Isaiah 45:1",text:"Thus saith the LORD to his anointed, to Cyrus, whose right hand I have holden, to subdue nations before him; and I will loose the loins of kings, to open before him the two leaved gates; and the gates shall not be shut."},{type:"p",text:"The Cyrus Cylinder, discovered in 1879 and now in the British Museum, confirms this decree in cuneiform. It records Cyrus allowing displaced peoples to return home and restore their sanctuaries — precisely matching the biblical account in Ezra 1:1-4. This is one of the clearest archaeological-biblical correlations in all of ancient history."}],
    refs:["Isaiah 44:28","Isaiah 45:1","Ezra 1:1-4","2 Chronicles 36:22-23"],
  },
  {
    id:6, title:"The Transatlantic Connection to Deuteronomy 28:68",
    thumb:"⛓️", thumbBg:"linear-gradient(135deg,#1A1208,#3A2A18)",
    author:"Prophetic Research", date:"October 2023",
    tags:["Prophecy","Identity"],
    tagColors:{"Prophecy":"#B5451B","Identity":"#C97D1A"},
    excerpt:"A deep examination of the most controversial verse in Deuteronomy and its connection to the transatlantic slave trade.",
    body: [{type:"p",text:"Deuteronomy 28:68 contains a prophecy so specific and so controversial that many avoid discussing it: 'And the LORD shall bring thee into Egypt again with ships, by the way whereof I spake unto thee, Thou shalt see it no more again: and there ye shall be sold unto your enemies for bondmen and bondwomen, and no man shall buy you.'"},{type:"scripture",ref:"Deuteronomy 28:68",text:"And the LORD shall bring thee into Egypt again with ships, by the way whereof I spake unto thee, Thou shalt see it no more again: and there ye shall be sold unto your enemies for bondmen and bondwomen, and no man shall buy you."},{type:"p",text:"The literal reading: a people identified as Israel would be shipped into slavery — specifically 'into Egypt again with ships.' The word Egypt in Hebrew is Mitsrayim — sometimes interpreted as a symbolic term for bondage and oppression. The phrase 'no man shall buy you' describes not merely slavery, but a condition of being sold so thoroughly that even rescue was foreclosed. Many scholars and teachers in Hebrew Israelite communities identify the transatlantic slave trade as the direct fulfillment of this verse. Whether one accepts that interpretation or not, the verse demands serious engagement."}],
    refs:["Deuteronomy 28:68","Deuteronomy 28:15","Joel 3:6","Amos 9:9"],
  },
];

// Study Guide Data
const LESSONS = [
  {
    id:1, title:"The Patriarchs", period:"Gen 12–50, ~2000 BCE",
    overview:"The story of Israel begins not with a nation but with one man — Abraham (Abram), called out of Ur of the Chaldees by the Most High God. From Abraham came Isaac, from Isaac came Jacob (renamed Israel), and from Jacob came the twelve sons who would become the twelve tribes of Israel. This lesson traces the covenant promises made to the patriarchs and their journey toward fulfillment.",
    scriptures:[
      {ref:"Genesis 12:1-3",text:"Now the LORD had said unto Abram, Get thee out of thy country, and from thy kindred, and from thy father's house, unto a land that I will shew thee: And I will make of thee a great nation..."},
      {ref:"Genesis 15:13-14",text:"And he said unto Abram, Know of a surety that thy seed shall be a stranger in a land that is not theirs, and shall serve them; and they shall afflict them four hundred years..."},
      {ref:"Genesis 32:28",text:"And he said, Thy name shall be called no more Jacob, but Israel: for as a prince hast thou power with God and with men, and hast prevailed."},
      {ref:"Genesis 49:1-2",text:"And Jacob called unto his sons, and said, Gather yourselves together, that I may tell you that which shall befall you in the last days."},
      {ref:"Amos 3:1-2",text:"Hear this word that the LORD hath spoken against you, O children of Israel, against the whole family which I brought up from the land of Egypt..."},
    ],
    timeline:[
      {date:"~2166 BCE",event:"Abraham born in Ur of the Chaldees"},
      {date:"~2091 BCE",event:"God calls Abraham — covenant established (Gen 12)"},
      {date:"~2066 BCE",event:"Isaac born — covenant continues through promised son"},
      {date:"~2006 BCE",event:"Jacob born — receives name 'Israel' after wrestling the angel"},
      {date:"~1898 BCE",event:"Joseph sold into Egypt — beginning of descent into Egypt"},
      {date:"~1876 BCE",event:"Jacob's family (70 persons) descend into Egypt (Gen 46)"},
    ],
    archaeology:"The city of Ur has been extensively excavated. The Royal Tombs of Ur (British Museum) reveal a sophisticated Bronze Age civilization consistent with the patriarchal narratives. The Eblaite tablets (~2400 BCE) contain names nearly identical to those in Genesis, confirming the cultural authenticity of the biblical record. Camels, long disputed by skeptics as an anachronism, have now been confirmed in the Sinai at the relevant periods.",
    quiz:[
      {q:"What was the original name of Abraham before God changed it?",opts:["Isaac","Abram","Jacob","Ur"],ans:1},
      {q:"How many sons did Jacob (Israel) have, forming the foundation of the tribes?",opts:["10","11","12","13"],ans:2},
      {q:"Which son of Jacob was sold into Egypt and later became a ruler there?",opts:["Judah","Reuben","Benjamin","Joseph"],ans:3},
      {q:"What does the name 'Israel' mean?",opts:["Beloved of God","Prince/Ruler with God","Seed of Abraham","Covenant people"],ans:1},
    ],
  },
  {
    id:2, title:"Egyptian Captivity & The Exodus", period:"Exodus 1–15, ~1446 BCE",
    overview:"Four hundred years after Joseph brought his family to Egypt, a new Pharaoh arose who 'knew not Joseph.' What began as honored guests became generations of brutal slavery. The book of Exodus records the raising up of Moses, the ten plagues, the Passover, and the miraculous deliverance through the Red Sea — the central redemptive event of the Old Testament, which all subsequent redemption language points back to.",
    scriptures:[
      {ref:"Exodus 1:7-8",text:"And the children of Israel were fruitful, and increased abundantly, and multiplied, and waxed exceeding mighty; and the land was filled with them. Now there arose up a new king over Egypt, which knew not Joseph."},
      {ref:"Exodus 3:7-8",text:"And the LORD said, I have surely seen the affliction of my people which are in Egypt, and have heard their cry by reason of their taskmasters; for I know their sorrows..."},
      {ref:"Exodus 12:13",text:"And the blood shall be to you for a token upon the houses where ye are: and when I see the blood, I will pass over you, and the plague shall not be upon you to destroy you."},
      {ref:"Exodus 14:13-14",text:"Fear ye not, stand still, and see the salvation of the LORD... The LORD shall fight for you, and ye shall hold your peace."},
      {ref:"Deuteronomy 28:68",text:"And the LORD shall bring thee into Egypt again with ships, by the way whereof I spake unto thee..."},
    ],
    timeline:[
      {date:"~1876 BCE",event:"Israel enters Egypt (70 persons with Jacob)"},
      {date:"~1526 BCE",event:"Moses born — hidden in the Nile, raised in Pharaoh's house"},
      {date:"~1446 BCE",event:"The Exodus — 10 plagues, Passover, Red Sea crossing"},
      {date:"~1446 BCE",event:"The Law given at Mount Sinai (Exodus 20)"},
      {date:"~1406 BCE",event:"40 years of wilderness — entry into Canaan under Joshua"},
    ],
    archaeology:"The Ipuwer Papyrus (Egyptian Museum, Cairo) describes catastrophic plagues — water turned to blood, darkness, widespread death — matching the Exodus account remarkably. The Tell el-Borg fort and Avaris excavations confirm massive Semitic populations in Egypt's delta region exactly where Goshen is placed. Chariot wheels found in the Gulf of Aqaba by Ron Wyatt, though disputed, have renewed interest in alternative Red Sea crossing sites.",
    quiz:[
      {q:"How long were the children of Israel in Egypt according to Exodus 12:40?",opts:["200 years","400 years","430 years","500 years"],ans:2},
      {q:"What was the final plague that caused Pharaoh to let Israel go?",opts:["Darkness","Locusts","Death of firstborn","Water to blood"],ans:2},
      {q:"The Passover lamb's blood was applied to what part of the house?",opts:["The floor","The doorposts and lintel","The roof","The windows"],ans:1},
      {q:"At what mountain did God give the Ten Commandments?",opts:["Mount Hermon","Mount Zion","Mount Carmel","Mount Sinai"],ans:3},
    ],
  },
  {
    id:3, title:"The Law — Leviticus 23 Holy Days", period:"Leviticus–Numbers, ~1446 BCE",
    overview:"After the Exodus, God established His covenant law at Sinai. Leviticus 23 outlines seven annual appointed times — the Feasts of the LORD — which are prophetic rehearsals of God's redemptive plan from Passover to the final harvest. These are not 'Jewish holidays' but the LORD's own appointed times, commanded for Israel throughout all generations.",
    scriptures:[
      {ref:"Leviticus 23:1-2",text:"And the LORD spake unto Moses, saying, Speak unto the children of Israel, and say unto them, Concerning the feasts of the LORD, which ye shall proclaim to be holy convocations, even these are my feasts."},
      {ref:"Leviticus 23:5",text:"In the fourteenth day of the first month at even is the LORD's passover."},
      {ref:"Leviticus 23:24",text:"Speak unto the children of Israel, saying, In the seventh month, in the first day of the month, shall ye have a sabbath, a memorial of blowing of trumpets, an holy convocation."},
      {ref:"Colossians 2:16-17",text:"Let no man therefore judge you in meat, or in drink, or in respect of an holyday, or of the new moon, or of the sabbath days: Which are a shadow of things to come; but the body is of Christ."},
    ],
    timeline:[
      {date:"Spring: 1st Month",event:"Passover (14th) — Feast of Unleavened Bread (15th–21st) — Firstfruits (after Sabbath)"},
      {date:"Spring: 3rd Month",event:"Shavuot / Weeks / Pentecost — 50 days after Firstfruits"},
      {date:"Fall: 7th Month",event:"Yom Teruah / Trumpets (1st) — Yom Kippur / Atonement (10th) — Sukkot / Tabernacles (15th–22nd)"},
    ],
    archaeology:"Ancient Israelite calendrical systems have been confirmed through the Gezer Calendar (~925 BCE), one of the oldest known Hebrew inscriptions, which describes agricultural seasons matching the feast calendar. The Dead Sea Scrolls contain extensive calendar texts showing the importance of the appointed times in Second Temple Judaism.",
    quiz:[
      {q:"Leviticus 23 refers to the feasts as belonging to whom?",opts:["Moses","Israel","The LORD","The High Priest"],ans:2},
      {q:"How many annual appointed times are listed in Leviticus 23?",opts:["5","6","7","8"],ans:2},
      {q:"Pentecost (Shavuot) falls how many days after Firstfruits?",opts:["7","30","40","50"],ans:3},
    ],
  },
  {
    id:4, title:"The Kingdom — Saul, David, Solomon", period:"1 Samuel–1 Kings, ~1050–931 BCE",
    overview:"Israel's demand for a king mirrors the nations around them — a turning point in the covenant relationship. God grants their request, warning of the consequences. Saul fails. David rises as a man after God's own heart, establishes Jerusalem, and receives the eternal covenant that his throne would endure forever. Solomon builds the First Temple but in his later years turns to idolatry, sowing the seeds of the kingdom's division.",
    scriptures:[
      {ref:"1 Samuel 8:7",text:"And the LORD said unto Samuel, Hearken unto the voice of the people in all that they say unto thee: for they have not rejected thee, but they have rejected me, that I should not reign over them."},
      {ref:"2 Samuel 7:12-13",text:"And when thy days be fulfilled, and thou shalt sleep with thy fathers, I will set up thy seed after thee, which shall proceed out of thy bowels, and I will establish his kingdom. He shall build an house for my name, and I will stablish the throne of his kingdom for ever."},
      {ref:"Psalm 89:3-4",text:"I have made a covenant with my chosen, I have sworn unto David my servant, Thy seed will I establish for ever, and build up thy throne to all generations."},
    ],
    timeline:[
      {date:"~1050 BCE",event:"Saul anointed as first king of Israel"},
      {date:"~1010 BCE",event:"David becomes king over all Israel"},
      {date:"~1000 BCE",event:"Jerusalem captured — established as capital"},
      {date:"~970 BCE",event:"Solomon becomes king, begins Temple construction"},
      {date:"~957 BCE",event:"First Temple completed and dedicated (1 Kings 8)"},
      {date:"~931 BCE",event:"Solomon dies — kingdom divides under Rehoboam"},
    ],
    archaeology:"The Tel Dan Stele (~870 BCE) contains the phrase 'House of David' — the first extrabiblical reference to the Davidic dynasty, confirming David as a historical king. The Ophel inscription and City of David excavations have uncovered massive 10th century BCE construction consistent with Solomon's building programs. The Temple Mount itself remains the most contested archaeological site on earth.",
    quiz:[
      {q:"Who was the first king of Israel?",opts:["David","Samuel","Saul","Solomon"],ans:2},
      {q:"Which king built the First Temple in Jerusalem?",opts:["David","Saul","Solomon","Rehoboam"],ans:2},
      {q:"God's covenant with David promised what would endure forever?",opts:["His wealth","His throne and kingdom","His army","His land"],ans:1},
    ],
  },
  {
    id:5, title:"Divided Kingdom & The Captivities", period:"1 Kings 12–2 Kings 25, ~931–586 BCE",
    overview:"After Solomon's death the kingdom splits: ten northern tribes under Jeroboam (Israel/Ephraim), and two southern tribes under Rehoboam (Judah). The northern kingdom falls to Assyria in 722 BCE — those ten tribes scattered, becoming the 'lost tribes of Israel.' The southern kingdom survives until Babylon destroys Jerusalem in 586 BCE, burning the First Temple and taking Judah into captivity.",
    scriptures:[
      {ref:"2 Kings 17:6",text:"In the ninth year of Hoshea the king of Assyria took Samaria, and carried Israel away into Assyria, and placed them in Halah and in Habor by the river of Gozan, and in the cities of the Medes."},
      {ref:"2 Kings 25:9-10",text:"And he burnt the house of the LORD, and the king's house, and all the houses of Jerusalem... And all the army of the Chaldees, that were with the captain of the guard, brake down the walls of Jerusalem round about."},
    ],
    timeline:[
      {date:"~931 BCE",event:"Kingdom divides — Israel (N) and Judah (S)"},
      {date:"~722 BCE",event:"Assyria conquers Northern Kingdom (2 Kings 17)"},
      {date:"~605 BCE",event:"First Babylonian deportation — Daniel taken"},
      {date:"~597 BCE",event:"Second deportation — King Jehoiachin, Ezekiel taken"},
      {date:"~586 BCE",event:"Jerusalem and First Temple destroyed by Nebuchadnezzar"},
    ],
    archaeology:"The Lachish Letters are 21 ostraca found at Lachish describing the Babylonian siege in desperate terms — 'we are watching for the fire signals of Lachish, for we cannot see Azekah.' The Babylonian Chronicle confirms Nebuchadnezzar's campaigns against Judah with precise dating matching the biblical record.",
    quiz:[
      {q:"How many tribes comprised the Northern Kingdom of Israel?",opts:["2","8","10","11"],ans:2},
      {q:"Which empire conquered the Northern Kingdom in 722 BCE?",opts:["Egypt","Babylon","Persia","Assyria"],ans:3},
      {q:"In what year did Babylon destroy the First Temple?",opts:["722 BCE","605 BCE","586 BCE","539 BCE"],ans:2},
    ],
  },
  {
    id:6, title:"The Prophets — Isaiah, Jeremiah, Daniel", period:"8th–6th century BCE",
    overview:"While kings rose and fell, God raised up prophets to call Israel back to covenant faithfulness and to reveal the future. Isaiah prophesies the suffering servant and ultimate restoration. Jeremiah weeps over Jerusalem's destruction and announces a New Covenant. Daniel, in the court of Babylon, receives the most detailed prophetic timeline in scripture — from Babylon to the end of the age.",
    scriptures:[
      {ref:"Isaiah 53:5",text:"But he was wounded for our transgressions, he was bruised for our iniquities: the chastisement of our peace was upon him; and with his stripes we are healed."},
      {ref:"Jeremiah 31:31-33",text:"Behold, the days come, saith the LORD, that I will make a new covenant with the house of Israel, and with the house of Judah... I will put my law in their inward parts, and write it in their hearts."},
      {ref:"Daniel 9:24-25",text:"Seventy weeks are determined upon thy people and upon thy holy city, to finish the transgression... Know therefore and understand, that from the going forth of the commandment to restore and to build Jerusalem unto the Messiah the Prince shall be seven weeks, and threescore and two weeks."},
    ],
    timeline:[
      {date:"~740 BCE",event:"Isaiah begins ministry under King Uzziah"},
      {date:"~627 BCE",event:"Jeremiah called as prophet under Josiah"},
      {date:"~605 BCE",event:"Daniel taken to Babylon — begins prophetic career"},
      {date:"~539 BCE",event:"Daniel's vision of the four kingdoms (Daniel 7)"},
    ],
    archaeology:"The Dead Sea Scrolls include a complete Isaiah scroll (Isaiah Scroll, 1QIsa) dating to ~125 BCE — 1,000 years older than any previously known Hebrew manuscript, yet virtually identical to modern texts. This confirms the extraordinary preservation of the prophetic record. The Jeremiah scroll fragments further confirm the authenticity of the Masoretic text.",
    quiz:[
      {q:"Which prophet announced the New Covenant in Jeremiah 31?",opts:["Isaiah","Ezekiel","Daniel","Jeremiah"],ans:3},
      {q:"Isaiah 53 describes a 'suffering servant' wounded for whose transgressions?",opts:["His own","Israel's","The nations'","Our transgressions"],ans:3},
    ],
  },
  {
    id:7, title:"The Messiah — Matthew, John, Acts", period:"~4 BCE – 70 CE",
    overview:"All the law and the prophets point forward to one person — the Messiah, Yeshua of Nazareth. Born in Bethlehem of the tribe of Judah, descended from David, he fulfilled over 300 specific prophecies. He came 'only to the lost sheep of the house of Israel,' announced the Kingdom of God, died as the ultimate Passover lamb, rose on the Feast of Firstfruits, and poured out the Spirit on Shavuot. His ministry cannot be understood apart from the covenant history of Israel.",
    scriptures:[
      {ref:"Matthew 15:24",text:"But he answered and said, I am not sent but unto the lost sheep of the house of Israel."},
      {ref:"John 1:14",text:"And the Word was made flesh, and dwelt among us, (and we beheld his glory, the glory as of the only begotten of the Father,) full of grace and truth."},
      {ref:"Acts 2:36",text:"Therefore let all the house of Israel know assuredly, that God hath made that same Jesus, whom ye have crucified, both Lord and Christ."},
      {ref:"Romans 11:1-2",text:"I say then, Hath God cast away his people? God forbid. For I also am an Israelite, of the seed of Abraham, of the tribe of Benjamin."},
    ],
    timeline:[
      {date:"~4 BCE",event:"Birth of Yeshua in Bethlehem (Matthew 2)"},
      {date:"~27 CE",event:"Baptism by John — ministry begins"},
      {date:"~30 CE",event:"Passover crucifixion — resurrection on Firstfruits"},
      {date:"~30 CE",event:"Pentecost (Shavuot) — Spirit poured out (Acts 2)"},
      {date:"~70 CE",event:"Titus destroys Second Temple — fulfilling Matthew 24"},
    ],
    archaeology:"The Pilate Stone, discovered in 1961 at Caesarea Maritima, bears the inscription 'Pontius Pilatus, Prefect of Judaea' — confirming the existence of the Roman governor who sentenced Yeshua. The James Ossuary inscription reading 'James, son of Joseph, brother of Jesus' remains one of the most debated artifacts in biblical archaeology.",
    quiz:[
      {q:"Matthew 15:24 says the Messiah was sent to whom?",opts:["All nations","The Jews only","The lost sheep of the house of Israel","The Gentiles"],ans:2},
      {q:"On which feast day was the Spirit poured out in Acts 2?",opts:["Passover","Trumpets","Pentecost (Shavuot)","Tabernacles"],ans:2},
    ],
  },
  {
    id:8, title:"The End Times — Revelation, Daniel 8", period:"Future Fulfillment",
    overview:"The prophetic narrative reaches its culmination in the books of Daniel and Revelation. Both are apocalyptic literature written in symbolic language but grounded in the covenant history of Israel. The end times involve the final regathering of Israel, the great tribulation, the return of the Messiah, the battle of Armageddon, and the establishment of the New Jerusalem. Understanding Israel's identity is the key to unlocking these prophecies.",
    scriptures:[
      {ref:"Daniel 12:1",text:"And at that time shall Michael stand up, the great prince which standeth for the children of thy people: and there shall be a time of trouble, such as never was since there was a nation even to that same time: and at that time thy people shall be delivered, every one that shall be found written in the book."},
      {ref:"Revelation 7:4",text:"And I heard the number of them which were sealed: and there were sealed an hundred and forty and four thousand of all the tribes of the children of Israel."},
      {ref:"Isaiah 11:11-12",text:"And it shall come to pass in that day, that the Lord shall set his hand again the second time to recover the remnant of his people..."},
      {ref:"Revelation 21:12",text:"And had a wall great and high, and had twelve gates, and at the gates twelve angels, and names written thereon, which are the names of the twelve tribes of the children of Israel."},
    ],
    timeline:[
      {date:"Future",event:"Final regathering of Israel from the four corners of the earth (Isaiah 11:11)"},
      {date:"Future",event:"Time of Jacob's Trouble (Jeremiah 30:7) — Great Tribulation"},
      {date:"Future",event:"Return of the Messiah (Revelation 19)"},
      {date:"Future",event:"Millennial Kingdom — Messiah reigns 1,000 years"},
      {date:"Future",event:"New Jerusalem descends (Revelation 21)"},
    ],
    archaeology:"While the future events of Revelation lie ahead, current events in the Middle East, the existence of the modern state of Israel (1948), and the return of Jewish populations to the land after nearly 2,000 years of diaspora are viewed by many scholars as prophetic milestones corresponding to Ezekiel 37 and Isaiah 11.",
    quiz:[
      {q:"Revelation 7 seals 144,000 from how many tribes?",opts:["6","10","12","All tribes"],ans:2},
      {q:"Isaiah 11:11 describes the Lord recovering Israel a 'second time' — what was the first?",opts:["Return from Babylon","The Exodus","Return from Assyria","Return from Egypt"],ans:1},
      {q:"What is the name of the city that descends in Revelation 21?",opts:["Heavenly Zion","New Jerusalem","Mount Moriah","The Holy City"],ans:1},
    ],
  },
];

// Historical Timeline Data
const TIMELINE_EVENTS = [
  {id:1,date:"~2000 BCE",label:"Abraham\ncalled",title:"Abraham Called from Ur",desc:"The Most High God calls Abram out of Ur of the Chaldees, establishing the Abrahamic covenant — the foundational promise from which the nation of Israel would emerge.",scripture:"Genesis 12:1-3",source:"Ur of the Chaldees excavation, University of Pennsylvania",major:true},
  {id:2,date:"~1876 BCE",label:"Israel\nenters Egypt",title:"Israel Enters Egypt",desc:"Jacob (Israel) and his 70 descendants descend into Egypt at the invitation of Joseph. This begins the 430-year sojourn that will culminate in the Exodus.",scripture:"Genesis 46:26-27",source:"Avaris excavation confirms large Semitic settlement in Nile delta",major:false},
  {id:3,date:"~1446 BCE",label:"The\nExodus",title:"The Exodus — Moses Leads Israel Out",desc:"After 430 years in Egypt, God sends Moses with ten plagues. The Passover marks Israel's deliverance, and the Red Sea crossing seals it. The largest event in Old Testament history.",scripture:"Exodus 12:40-42",source:"Ipuwer Papyrus describes catastrophic plagues matching Exodus account",major:true},
  {id:4,date:"~1208 BCE",label:"Merneptah\nStele",title:"Merneptah Stele — Israel Confirmed in Canaan",desc:"Egyptian Pharaoh Merneptah boasts of defeating a people called 'Israel' in Canaan — the oldest extrabiblical mention of Israel's name, confirming their presence in the land.",scripture:"Judges 2:16-18",source:"Merneptah Stele, Egyptian Museum Cairo, discovered 1896",major:true},
  {id:5,date:"~1050 BCE",label:"Saul\nking",title:"Saul — First King of Israel",desc:"Against Samuel's warnings, the people demand a king like the surrounding nations. God grants their request and Saul of Benjamin is anointed the first king of unified Israel.",scripture:"1 Samuel 8:5-7",source:"Archaeological evidence of Iron Age I settlement patterns",major:false},
  {id:6,date:"~1010 BCE",label:"David\nking",title:"David Becomes King of All Israel",desc:"After Saul's death, David of Judah unites the kingdom, captures Jerusalem, and receives the eternal covenant — that his throne would endure forever through his descendant.",scripture:"2 Samuel 7:12-16",source:"Tel Dan Stele (~870 BCE) references 'House of David'",major:true},
  {id:7,date:"~957 BCE",label:"First\nTemple",title:"Solomon Builds the First Temple",desc:"The Temple of Solomon is completed in Jerusalem — the permanent dwelling place for the Ark of the Covenant, replacing the wilderness Tabernacle. It stands for approximately 370 years.",scripture:"1 Kings 8:10-11",source:"Temple Mount excavations confirm Iron Age II construction activity",major:true},
  {id:8,date:"~930 BCE",label:"Kingdom\ndivides",title:"Kingdom Divided — North and South",desc:"After Solomon's death, ten northern tribes rebel under Jeroboam and form the Kingdom of Israel (Ephraim). Two southern tribes remain as the Kingdom of Judah under Rehoboam.",scripture:"1 Kings 12:16-20",source:"Archaeological evidence of two distinct material cultures in this period",major:false},
  {id:9,date:"~722 BCE",label:"Assyria\nconquers N.",title:"Assyria Conquers the Northern Kingdom",desc:"The ten northern tribes are conquered by Assyrian king Shalmaneser V and Sargon II. Israel is scattered throughout Assyria — becoming the 'Lost Ten Tribes' that prophets promise will be regathered.",scripture:"2 Kings 17:6",source:"Sargon II's Annals in the Louvre confirm the conquest of Samaria and deportation of 27,290 Israelites",major:true},
  {id:10,date:"~586 BCE",label:"Babylon\ndestroys",title:"Babylon Destroys Jerusalem and the Temple",desc:"Nebuchadnezzar of Babylon burns the First Temple, tears down Jerusalem's walls, and takes Judah into captivity. The 70-year Babylonian exile begins, fulfilling Jeremiah's prophecy.",scripture:"2 Kings 25:9-11",source:"Babylonian Chronicle (British Museum) confirms capture of Jerusalem",major:true},
  {id:11,date:"~539 BCE",label:"Cyrus\nconquers",title:"Cyrus the Great Conquers Babylon",desc:"Persian king Cyrus II fulfills Isaiah's 150-year-old prophecy — conquering Babylon in a single night and issuing a decree allowing captive peoples to return to their homelands.",scripture:"Isaiah 45:1",source:"Cyrus Cylinder (British Museum) confirms the decree to allow peoples to return",major:true},
  {id:12,date:"~538 BCE",label:"Jews\nreturn",title:"First Return — Jews Permitted to Return",desc:"Under Zerubbabel, about 50,000 Jewish exiles return to Judah and begin rebuilding the Temple. This fulfills Jeremiah's 70-year prophecy (Jeremiah 29:10).",scripture:"Ezra 1:1-4",source:"Cyrus Cylinder, Elephantine Papyri confirm Jewish return",major:false},
  {id:13,date:"~332 BCE",label:"Alexander\nconquers",title:"Alexander the Great Conquers the Levant",desc:"Alexander's rapid conquest brings the entire Middle East under Greek control. Hellenistic culture spreads — setting the stage for the cultural conflicts described in Daniel 8 and the Maccabean revolt.",scripture:"Daniel 8:5-8",source:"Classical sources: Arrian, Plutarch confirm conquest route",major:false},
  {id:14,date:"~167 BCE",label:"Temple\ndesecrated",title:"Antiochus IV Desecrates the Temple",desc:"Syrian-Greek king Antiochus IV Epiphanes sacrifices a pig on the altar, installs an idol of Zeus, and outlaws Torah observance — fulfilling Daniel's 'abomination of desolation.'",scripture:"Daniel 11:31",source:"1 Maccabees, Josephus Antiquities 12.5.4",major:true},
  {id:15,date:"~164 BCE",label:"Maccabean\nRevolt",title:"Maccabean Revolt — Temple Rededicated",desc:"Judas Maccabeus leads a successful revolt against Antiochus IV. The Temple is cleansed and rededicated — celebrated as Hanukkah (Feast of Dedication, John 10:22).",scripture:"John 10:22",source:"1-2 Maccabees, Josephus",major:false},
  {id:16,date:"~63 BCE",label:"Rome\nseizes",title:"Rome — Pompey Seizes Jerusalem",desc:"Roman general Pompey enters Jerusalem and the Holy of Holies. Israel loses political independence. The Roman period begins, setting the stage for the Messiah's birth under Roman occupation.",scripture:"Daniel 2:40",source:"Josephus, Jewish War 1.7.1-4; Roman historical records",major:true},
  {id:17,date:"~4 BCE",label:"Yeshua\nborn",title:"Birth of Yeshua (Jesus) in Bethlehem",desc:"Born in Bethlehem of Judah during the reign of Herod the Great, fulfilling Micah 5:2. Announced to shepherds, visited by Magi. The long-awaited Son of David — Messiah — enters the world.",scripture:"Micah 5:2",source:"Census records (Luke 2:1-2), Josephus on Herod's reign",major:true},
  {id:18,date:"~70 CE",label:"Temple\ndestroyed",title:"Titus Destroys the Second Temple",desc:"Roman general (later Emperor) Titus fulfills Yeshua's prediction (Matthew 24:2) — destroying the Second Temple stone by stone on the 9th of Av, the same date the First Temple was destroyed.",scripture:"Matthew 24:2",source:"Josephus, Jewish War 6-7; Arch of Titus in Rome depicts the menorah being carried away",major:true},
];

// 12 Tribes Data
const TRIBES = [
  {name:"Reuben",  patriarch:"Son of Leah (1st)", symbol:"🌊", gem:"Sardius",    gemEmoji:"🔴", color:"#C0392B", territory:"East of Jordan River",           keyVerse:"Genesis 49:3",  notable:"Firstborn of Jacob; forfeited birthright"},
  {name:"Simeon",  patriarch:"Son of Leah (2nd)", symbol:"⚔️", gem:"Topaz",     gemEmoji:"💚", color:"#27AE60", territory:"Scattered within Judah",          keyVerse:"Genesis 49:5-7",notable:"United with Levi in vengeance; tribe eventually absorbed"},
  {name:"Levi",    patriarch:"Son of Leah (3rd)", symbol:"⚜️", gem:"Carbuncle",  gemEmoji:"🔵", color:"#2980B9", territory:"Cities among all tribes (no territory)", keyVerse:"Numbers 18:20", notable:"Moses, Aaron, all High Priests; Tribe of Priests"},
  {name:"Judah",   patriarch:"Son of Leah (4th)", symbol:"🦁", gem:"Emerald",   gemEmoji:"💚", color:"#1B5E20", territory:"Southern Canaan (Jerusalem)",      keyVerse:"Genesis 49:10", notable:"King David, King Solomon, Yeshua the Messiah"},
  {name:"Dan",     patriarch:"Son of Bilhah (5th)",symbol:"🐍", gem:"Sapphire",  gemEmoji:"💙", color:"#1565C0", territory:"Northern Canaan (Tel Dan)",        keyVerse:"Genesis 49:16", notable:"Samson; tribe associated with judgment"},
  {name:"Naphtali",patriarch:"Son of Bilhah (6th)",symbol:"🦌", gem:"Diamond",  gemEmoji:"💎", color:"#6A1B9A", territory:"Northern Galilee (Sea of Galilee)", keyVerse:"Isaiah 9:1-2",  notable:"Territory where Yeshua began His Galilean ministry"},
  {name:"Gad",     patriarch:"Son of Zilpah (7th)",symbol:"🛡️", gem:"Ligure",   gemEmoji:"🟤", color:"#6D4C41", territory:"East of Jordan (Gilead)",         keyVerse:"Genesis 49:19", notable:"Warriors; settled east of Jordan with Reuben & half-Manasseh"},
  {name:"Asher",   patriarch:"Son of Zilpah (8th)",symbol:"🫒", gem:"Agate",    gemEmoji:"🔵", color:"#00838F", territory:"Coastal Phoenicia (N. Israel)",   keyVerse:"Genesis 49:20", notable:"Bread basket tribe; Anna the prophetess (Luke 2:36)"},
  {name:"Issachar",patriarch:"Son of Leah (9th)", symbol:"🌟", gem:"Amethyst",  gemEmoji:"💜", color:"#7B1FA2", territory:"Valley of Jezreel (Megiddo area)", keyVerse:"1 Chronicles 12:32", notable:"Men with 'understanding of the times'"},
  {name:"Zebulun", patriarch:"Son of Leah (10th)",symbol:"🚢", gem:"Beryl",     gemEmoji:"🟢", color:"#2E7D32", territory:"Galilee (near Nazareth)",         keyVerse:"Genesis 49:13", notable:"Sea-faring tribe; near Nazareth where Yeshua was raised"},
  {name:"Joseph",  patriarch:"Son of Rachel (11th)",symbol:"🌾",gem:"Onyx",     gemEmoji:"⬛", color:"#37474F", territory:"Samaria (via Ephraim & Manasseh)", keyVerse:"Genesis 49:22-24", notable:"Sold into Egypt; became ruler; father of Ephraim & Manasseh"},
  {name:"Benjamin",patriarch:"Son of Rachel (12th)",symbol:"🐺",gem:"Jasper",   gemEmoji:"🟣", color:"#4527A0", territory:"Jerusalem area (incl. Temple Mount)",keyVerse:"Genesis 49:27", notable:"Apostle Paul; King Saul; tribe that remained with Judah"},
];

// ─── TRIBE SCRIPTURE DATABASE ─────────────────────────────────────────────────
// 4 categories per tribe · Expandable accordion · Unlimited entries
const TRIBE_SCRIPTURES = {
  Reuben: {
    prophecies:["Genesis 49:3-4","Deuteronomy 33:6","1 Chronicles 5:1-3","Numbers 26:5-11"],
    curses:["Deuteronomy 28:15","Deuteronomy 28:37","Deuteronomy 28:48","Deuteronomy 28:64","Leviticus 26:33"],
    restoration:["Isaiah 11:11-12","Ezekiel 48:6-7","Ezekiel 37:21-22","Revelation 7:5","Jeremiah 30:3"],
    apocrypha:["2 Esdras 13:40-47","Sirach 44:1-15","Baruch 4:2-4","2 Esdras 15:28-33"],
    location:{ theme:"Eastern lands — pasture and wilderness territory east of Jordan", refs:["Genesis 49:3-4 — Lost firstborn status; would not excel as leader","Numbers 32:1-5 — Reuben desired land suited for cattle and grazing","Joshua 13:15-23 — Received land east of the Jordan River, near wilderness","Deuteronomy 33:6 — Blessed to live and not die among his people"] },
  },
  Simeon: {
    prophecies:["Genesis 49:5-7","Deuteronomy 33:6","Joshua 19:1-9","1 Chronicles 4:24-43"],
    curses:["Deuteronomy 28:37","Deuteronomy 28:41","Deuteronomy 28:64","Leviticus 26:33","Deuteronomy 4:27"],
    restoration:["Ezekiel 48:24-25","Zechariah 10:6","Isaiah 11:12","Revelation 7:7","Jeremiah 31:10"],
    apocrypha:["2 Esdras 13:40-47","Sirach 44:1-15","Baruch 4:37","1 Maccabees 2:19-26"],
    location:{ theme:"Scattered within Judah — no independent territory; later migrated south", refs:["Genesis 49:5-7 — Simeon would be scattered and divided in Israel","Joshua 19:1 — Simeon's inheritance was inside Judah's territory","1 Chronicles 4:39-43 — Simeon later migrated seeking pasture lands","Judges 1:3 — Simeon allied with Judah showing territorial dependence"] },
  },
  Levi: {
    prophecies:["Genesis 49:5-7","Deuteronomy 33:8-11","Numbers 18:20-24","Malachi 2:4-7","Malachi 3:3"],
    curses:["Deuteronomy 28:15","Deuteronomy 28:64","Leviticus 26:33","Nehemiah 1:8","Lamentations 1:3"],
    restoration:["Malachi 3:3","Jeremiah 33:18-22","Ezekiel 44:15-16","Isaiah 66:21","Revelation 7:7"],
    apocrypha:["Sirach 45:6-22","Sirach 50:1-24","1 Maccabees 2:19-28","2 Maccabees 15:12"],
    location:{ theme:"No territorial inheritance — priestly cities among all tribes across Israel", refs:["Genesis 49:7 — Levi would be scattered in Israel as covenant consequence","Numbers 18:20-24 — Levites receive no land; the LORD is their inheritance","Joshua 21:1-42 — Levites assigned 48 cities spread across all tribal territories","Deuteronomy 18:1-2 — The priests and Levites shall have no part nor inheritance with Israel"] },
  },
  Judah: {
    prophecies:["Genesis 49:8-12","Deuteronomy 33:7","1 Chronicles 5:2","Micah 5:2","Isaiah 11:1","Revelation 5:5"],
    curses:["Deuteronomy 28:49-52","Deuteronomy 28:64","Lamentations 1:3","Lamentations 5:1-5","2 Kings 25:1-11","Jeremiah 52:12-16"],
    restoration:["Jeremiah 23:5-6","Isaiah 11:12","Ezekiel 37:16-22","Zechariah 12:7","Romans 11:26","Revelation 5:5"],
    apocrypha:["2 Esdras 12:31-34","1 Maccabees 3:3-9","Baruch 3:5-8","Baruch 4:5-37","Sirach 47:1-11"],
    location:{ theme:"Southern Canaan including Jerusalem — the royal and priestly capital", refs:["Genesis 49:10 — The ruler's sceptre would remain with Judah forever","Joshua 15:1-12 — Judah's territory in southern Canaan including Jerusalem","Micah 5:2 — Messiah would come from Bethlehem Ephratah in Judah","Zechariah 12:7 — The LORD will save the tents of Judah first in the restoration"] },
  },
  Dan: {
    prophecies:["Genesis 49:16-18","Deuteronomy 33:22","Judges 18:1-31","1 Chronicles 2:2"],
    curses:["Deuteronomy 28:29","Deuteronomy 28:37","Deuteronomy 28:64","Leviticus 26:33","Amos 3:1-2"],
    restoration:["Ezekiel 48:1-2","Zechariah 10:6","Isaiah 11:11-12","Jeremiah 31:10","Ezekiel 37:21"],
    apocrypha:["2 Esdras 13:40-47","Sirach 44:1-15","Judith 8:1-4","Judith 9:1-14"],
    location:{ theme:"Migration from southern coast to the far north — Tel Dan", refs:["Genesis 49:16-17 — Dan would judge and be like a serpent in the way","Joshua 19:40-48 — Dan originally lived near the coastal plain (Joppa area)","Judges 18:27-29 — Dan migrated north, captured Laish and renamed it Dan","Deuteronomy 33:22 — Dan described as a lion's whelp leaping from Bashan (north)"] },
  },
  Naphtali: {
    prophecies:["Genesis 49:21","Deuteronomy 33:23","Isaiah 9:1-2","Matthew 4:13-16"],
    curses:["Deuteronomy 28:32","Deuteronomy 28:41","Deuteronomy 28:64","Leviticus 26:33","Nehemiah 1:8"],
    restoration:["Isaiah 9:1-2","Ezekiel 48:3-4","Isaiah 11:11-12","Zechariah 10:6","Revelation 7:6"],
    apocrypha:["Tobit 1:1-22","2 Esdras 13:40-47","Sirach 44:1-15","Baruch 4:2-5"],
    location:{ theme:"Northern Galilee — land of the Sea of Galilee and the beginning of Messiah's ministry", refs:["Genesis 49:21 — Naphtali described as a hind let loose, a free and fertile land","Joshua 19:32-39 — Naphtali inherited land in northern Galilee","Isaiah 9:1-2 — Naphtali associated with Galilee of the nations; great light would dawn there","Matthew 4:13-16 — Yeshua began His ministry in the territory of Naphtali and Zebulun, fulfilling Isaiah"] },
  },
  Gad: {
    prophecies:["Genesis 49:19","Deuteronomy 33:20-21","Joshua 13:24-28","1 Chronicles 5:18-22"],
    curses:["Deuteronomy 28:33","Deuteronomy 28:37","Deuteronomy 28:48","Leviticus 26:33","Amos 3:1-2"],
    restoration:["Ezekiel 48:27-28","Isaiah 11:12","Jeremiah 31:10","Zechariah 10:6","Revelation 7:5"],
    apocrypha:["2 Esdras 13:40-47","Sirach 44:1-15","1 Maccabees 5:9-54","Baruch 4:37"],
    location:{ theme:"Eastern frontier — warrior territory east of the Jordan in Gilead", refs:["Genesis 49:19 — Gad would face raids but overcome and pursue enemies","Joshua 13:24-28 — Gad received land east of the Jordan River in Gilead","Deuteronomy 33:20-21 — Gad described as dwelling like a lion in strong frontier territory","Numbers 32:1-5 — Gad chose land east of Jordan suited for military strength and cattle"] },
  },
  Asher: {
    prophecies:["Genesis 49:20","Deuteronomy 33:24-25","Joshua 19:24-31","Luke 2:36-38"],
    curses:["Deuteronomy 28:33","Deuteronomy 28:41","Deuteronomy 28:64","Leviticus 26:33","Lamentations 1:3"],
    restoration:["Ezekiel 48:2-3","Isaiah 11:11-12","Zechariah 10:6","Jeremiah 31:10","Revelation 7:6"],
    apocrypha:["2 Esdras 13:40-47","Sirach 44:1-15","Baruch 5:5-9","Wisdom of Solomon 5:15-16"],
    location:{ theme:"Coastal fertile region — Mediterranean coast north of Carmel, rich in oil and food", refs:["Genesis 49:20 — Asher's land would yield rich food and delicacies for kings","Deuteronomy 33:24-25 — 'Asher shall dip his foot in oil' — fertile, oil-producing land","Joshua 19:24-31 — Asher's territory along the northern Mediterranean coast","Luke 2:36-38 — Anna the prophetess came from the tribe of Asher; a widow who served in the Temple"] },
  },
  Issachar: {
    prophecies:["Genesis 49:14-15","Deuteronomy 33:18-19","1 Chronicles 12:32","Joshua 19:17-23"],
    curses:["Deuteronomy 28:29","Deuteronomy 28:33","Deuteronomy 28:48","Leviticus 26:33","Nehemiah 1:8"],
    restoration:["Ezekiel 48:25-26","Isaiah 11:11-12","Zechariah 10:6","Jeremiah 31:10","Revelation 7:7"],
    apocrypha:["2 Esdras 13:40-47","Sirach 44:1-15","Baruch 4:2-4","2 Esdras 16:1-17"],
    location:{ theme:"Jezreel Valley — fertile agricultural heartland, breadbasket of Israel", refs:["Genesis 49:14-15 — Issachar as a strong donkey resting between burdens; a tent-dwelling people","Joshua 19:17-23 — Issachar received land in the fertile Jezreel Valley (Valley of Megiddo)","Deuteronomy 33:18-19 — Issachar invited to rejoice in their tents and draw abundance from the earth","1 Chronicles 12:32 — Men of Issachar had understanding of the times — a people known for wisdom in their season"] },
  },
  Zebulun: {
    prophecies:["Genesis 49:13","Deuteronomy 33:18-19","Isaiah 9:1","Matthew 4:15","Joshua 19:10-16"],
    curses:["Deuteronomy 28:33","Deuteronomy 28:37","Deuteronomy 28:64","Leviticus 26:33","Amos 3:1-2"],
    restoration:["Ezekiel 48:26-27","Isaiah 9:1-2","Isaiah 11:12","Zechariah 10:6","Revelation 7:8"],
    apocrypha:["2 Esdras 13:40-47","Sirach 44:1-15","Tobit 1:1","Baruch 3:10-13"],
    location:{ theme:"Galilee — near trade routes and maritime access, Messiah's hometown region", refs:["Genesis 49:13 — Zebulun shall dwell at the haven of the sea and toward Sidon","Joshua 19:10-16 — Zebulun located in northern Israel in Galilee, near Nazareth","Deuteronomy 33:18-19 — Zebulun rejoices in going out, connected to sea trade and commerce","Matthew 4:15 — 'The land of Zebulun' cited in connection with Yeshua's ministry beginning"] },
  },
  Joseph: {
    prophecies:["Genesis 49:22-26","Deuteronomy 33:13-17","Ezekiel 37:16","Amos 5:6","Revelation 7:8"],
    curses:["Deuteronomy 28:32","Deuteronomy 28:41","Deuteronomy 28:64","Leviticus 26:33","2 Kings 17:6","Amos 3:1-2"],
    restoration:["Ezekiel 37:16-22","Hosea 11:9-11","Ezekiel 48:4-5","Zechariah 10:6","Isaiah 11:13","Obadiah 1:18"],
    apocrypha:["2 Esdras 13:40-47","Sirach 44:1-15","Sirach 49:15","Wisdom of Solomon 10:13-14","Baruch 4:2-5"],
    location:{ theme:"Central highlands — the largest and most blessed territories via sons Ephraim and Manasseh", refs:["Genesis 49:22-26 — Joseph as a fruitful bough; branches run over the wall; greatest material blessing","Joshua 16-17 — Ephraim and Manasseh received the largest central highland territories in Israel","Deuteronomy 33:13-17 — Blessed with the precious fruits of heaven, deep water, and the choicest gifts of the earth","Obadiah 1:18 — The house of Joseph will be a flame in the final restoration, devouring the house of Esau"] },
  },
  Benjamin: {
    prophecies:["Genesis 49:27","Deuteronomy 33:12","1 Samuel 9:1-2","Romans 11:1","Philippians 3:5"],
    curses:["Deuteronomy 28:25","Deuteronomy 28:37","Deuteronomy 28:64","Leviticus 26:33","Lamentations 5:2"],
    restoration:["Ezekiel 48:22-23","Obadiah 1:19","Isaiah 11:12","Zechariah 10:6","Romans 11:1-5","Revelation 7:8"],
    apocrypha:["2 Esdras 13:40-47","Sirach 44:1-15","1 Maccabees 2:1-5","Baruch 4:2-4"],
    location:{ theme:"Strategic central territory between Judah and Ephraim — closest tribe to Jerusalem and the Temple", refs:["Genesis 49:27 — Benjamin described as a ravenous wolf devouring prey — strategic and fierce","Joshua 18:11-28 — Benjamin's territory between Judah and Ephraim, including Gibeon and Jericho","Judges 1:21 — Jerusalem partly within Benjamin's original territory; Jebusites not fully displaced","Deuteronomy 33:12 — The beloved of the LORD shall dwell in safety; the LORD shall cover him all day long"] },
  },
};

// Shared covenant curses & restoration for all tribes (shown at bottom)
const SHARED_COVENANT = {
  curses:[
    { ref:"Deuteronomy 28:64", text:"And the LORD shall scatter thee among all people, from the one end of the earth even unto the other.", theme:"Scattering" },
    { ref:"Deuteronomy 28:68", text:"And the LORD shall bring thee into Egypt again with ships… and there ye shall be sold unto your enemies for bondmen and bondwomen, and no man shall buy you.", theme:"Captivity by Ships" },
    { ref:"Deuteronomy 28:48", text:"Therefore shalt thou serve thine enemies which the LORD shall send against thee, in hunger, and in thirst, and in nakedness…", theme:"Servitude" },
    { ref:"Deuteronomy 28:32", text:"Thy sons and thy daughters shall be given unto another people, and thine eyes shall look, and fail with longing for them all the day long.", theme:"Children Taken" },
    { ref:"Deuteronomy 28:37", text:"And thou shalt become an astonishment, a proverb, and a byword, among all nations whither the LORD shall lead thee.", theme:"Byword Among Nations" },
    { ref:"Deuteronomy 28:33", text:"The fruit of thy land, and all thy labours, shall a nation which thou knowest not eat up.", theme:"Land & Labor Stolen" },
    { ref:"Deuteronomy 28:29", text:"And thou shalt be only oppressed and spoiled evermore, and no man shall save thee.", theme:"Oppression Without Justice" },
    { ref:"Deuteronomy 28:34", text:"So that thou shalt be mad for the sight of thine eyes which thou shalt see.", theme:"Psychological Trauma" },
    { ref:"Deuteronomy 28:49", text:"The LORD shall bring a nation against thee from far, from the end of the earth… whose tongue thou shalt not understand.", theme:"Loss of Language" },
    { ref:"Deuteronomy 28:45-46", text:"Moreover all these curses shall come upon thee… and they shall be upon thee for a sign and for a wonder, and upon thy seed for ever.", theme:"Sign & Wonder" },
    { ref:"Hosea 1:9", text:"Then said God, Call his name Lo-ammi: for ye are not my people, and I will not be your God.", theme:"Loss of Identity" },
    { ref:"Amos 3:1-2", text:"Hear this word that the LORD hath spoken against you, O children of Israel… You only have I known of all the families of the earth: therefore I will punish you for all your iniquities.", theme:"Covenant Accountability" },
  ],
  restoration:[
    { ref:"Deuteronomy 30:1-3", text:"When thou shalt call them to mind among all the nations… then the LORD thy God will turn thy captivity, and have compassion upon thee.", theme:"Return Promised" },
    { ref:"Isaiah 11:11-12", text:"The Lord shall set his hand again the second time to recover the remnant of his people… and shall assemble the outcasts of Israel.", theme:"Second Gathering" },
    { ref:"Jeremiah 31:31-33", text:"I will make a new covenant with the house of Israel… I will put my law in their inward parts, and write it in their hearts.", theme:"New Covenant" },
    { ref:"Ezekiel 37:21-22", text:"I will take the children of Israel from among the nations… and make them one nation in the land upon the mountains of Israel.", theme:"Reunification" },
    { ref:"Zechariah 10:6", text:"I will strengthen the house of Judah, and I will save the house of Joseph… for I am the LORD their God, and will hear them.", theme:"Judah & Joseph Restored" },
    { ref:"Baruch 5:5-9", text:"Arise, O Jerusalem, stand on high, and look about toward the east, and behold thy children gathered from the west unto the east.", theme:"Jerusalem Restored" },
    { ref:"Hosea 6:1-2", text:"Come, and let us return unto the LORD: for he hath torn, and he will heal us; he hath smitten, and he will bind us up.", theme:"Healing Through Return" },
  ],
};

// ─── 7 MAJOR CAPTIVITIES DATA ─────────────────────────────────────────────────
const CAPTIVITIES_DATA = [
  {
    id:"egypt", num:1, icon:"🇪🇬", color:"#C4893A",
    title:"Egyptian Bondage", dates:"~1876–1446 BCE",
    type:"bondage",
    summary:"The children of Israel went into Egypt in the days of Joseph, multiplied greatly, and later came under affliction and brutal bondage under a new Pharaoh who did not know Joseph. Four hundred and thirty years of slavery — until the Exodus.",
    scriptures:["Genesis 47:27","Exodus 1:11-14","Exodus 2:23-25","Exodus 3:7-10","Exodus 12:40-41","Exodus 20:2"],
    teaching:"Egypt becomes the foundational biblical symbol of bondage, forced labor, and deliverance. Every future captivity is measured against the Egypt pattern.",
    significance:"The Exodus from Egypt is the central redemptive event of the Old Testament. Every covenant promise points back to it, and every future deliverance is patterned after it. Passover was commanded as a perpetual memorial — so this captivity would never be forgotten.",
    prophetic:"Exodus 20:2 — 'I am the LORD thy God, which have brought thee out of the land of Egypt, out of the house of bondage.' Egypt as a symbol of spiritual bondage appears throughout the prophetic books.",
  },
  {
    id:"assyria", num:2, icon:"⚔️", color:"#8B3A2A",
    title:"Assyrian Captivity", dates:"722 BCE",
    type:"exile",
    summary:"The northern kingdom of Israel (the House of Israel — Ephraim and the ten tribes) rebelled against the covenant, fell into deep idolatry, and was conquered by Assyria under Shalmaneser V and Sargon II. The ten tribes were scattered throughout the Assyrian Empire and became prophetically known as 'the lost sheep of the house of Israel.'",
    scriptures:["2 Kings 17:6","2 Kings 17:18","2 Kings 18:11-12","Hosea 8:8","Amos 5:27","Amos 3:1-2"],
    teaching:"This is the critical turning point where the northern kingdom is scattered. The term 'lost tribes' originates here. Hosea 8:8 says 'Israel is swallowed up; now shall they be among the Gentiles as a vessel wherein is no pleasure.'",
    significance:"The Assyrian captivity is essential for understanding Yeshua's words in Matthew 15:24 — 'I am not sent but unto the lost sheep of the house of Israel.' These were the northern ten tribes, scattered since 722 BCE. James 1:1 writes to 'the twelve tribes which are scattered abroad.'",
    prophetic:"Isaiah 11:11-13 — God will recover the remnant of Israel and Ephraim a second time. Hosea 11:9-11 promises Ephraim will return from the west like a bird.",
  },
  {
    id:"babylon", num:3, icon:"🏛️", color:"#6D4C41",
    title:"Babylonian Captivity", dates:"605–586 BCE",
    type:"exile",
    summary:"Judah was taken into Babylon in three waves — under Nebuchadnezzar — after persistent rebellion, rejection of the prophets, and covenant breaking. The city of Jerusalem was destroyed, the First Temple burned, and the people carried into 70 years of exile.",
    scriptures:["2 Kings 25:1-11","2 Chronicles 36:15-21","Jeremiah 25:8-11","Jeremiah 39:1-9","Lamentations 1:1-5","Daniel 1:1-4"],
    teaching:"Jerusalem and the Temple were judged. This captivity demonstrates that religious heritage, temple proximity, and covenant identity do not cancel disobedience. Even the Temple was not spared.",
    significance:"The Babylonian exile produced some of the greatest prophetic literature — Jeremiah, Lamentations, Ezekiel, and Daniel were all written in or around this period. It also produced the Dead Sea Scrolls community's precursors and the synagogue system as a substitute for the Temple.",
    prophetic:"Jeremiah 29:10 — 'After seventy years be accomplished at Babylon I will visit you and perform my good word.' Daniel 9 prays on the basis of this 70-year prophecy and receives the 70-weeks revelation in return.",
  },
  {
    id:"persia", num:4, icon:"👑", color:"#7B5EA7",
    title:"Persian Dominion", dates:"539 BCE onward",
    type:"dominion",
    summary:"Babylon fell to the Medes and Persians under Cyrus the Great in 539 BCE. Cyrus issued a decree allowing captive peoples to return to their homelands. Some Israelites returned to rebuild the Temple, but the people remained under Gentile imperial rule — first Persian, then others. Full national sovereignty was not restored.",
    scriptures:["Ezra 1:1-4","Ezra 6:14","Nehemiah 1:8-9","Esther 3:8","Daniel 6:25-28","Isaiah 45:1"],
    teaching:"Even though some returned to the land, this was a partial restoration. Israel remained under foreign dominion. This shows the pattern of partial relief under empire — real but not complete. The Gentile nations were still in control.",
    significance:"The Persian period preserved the Jewish community and Temple but under foreign dominion. Ezra and Nehemiah document the reconstruction of Jewish covenant life under empire. Esther shows God's protection of scattered Israel among Gentile nations — a diaspora survival story.",
    prophetic:"Isaiah 45:1 — God named Cyrus by name 150 years before his birth and declared he would rebuild Jerusalem. The Cyrus Cylinder (British Museum) confirms this decree historically.",
  },
  {
    id:"greece", num:5, icon:"🏺", color:"#1B3A5C",
    title:"Greek Oppression / Hellenization", dates:"332–63 BCE",
    type:"persecution",
    summary:"Alexander the Great conquered the land in 332 BCE, bringing it under Greek cultural dominance. After his death, the Seleucid rulers — especially Antiochus IV Epiphanes — launched a violent campaign of forced assimilation, desecrating the Temple, banning Torah observance, and demanding worship of Greek gods. The Maccabean revolt (164 BCE) temporarily restored covenant worship.",
    scriptures:["Daniel 8:21-25","Daniel 11:31-35","1 Maccabees 1:20-24","1 Maccabees 1:41-50","2 Maccabees 6:1-9","John 10:22"],
    teaching:"This period highlights forced assimilation, defilement of holy things, and cultural pressure to abandon covenant life. The faithful remnant resisted and preserved the law under persecution. Daniel prophesied this in vivid detail centuries before it happened.",
    significance:"Antiochus IV's desecration of the Temple in 167 BCE is the 'abomination of desolation' Jesus references in Matthew 24:15. Hanukkah commemorates the Temple's rededication after the Maccabean victory. This period produced 1–2 Maccabees, Judith, and other Apocryphal writings documenting covenant resistance.",
    prophetic:"Daniel 11:31-32 — 'They shall pollute the sanctuary of strength, and shall take away the daily sacrifice, and they shall place the abomination that maketh desolate. And such as do wickedly against the covenant shall he corrupt by flatteries: but the people that do know their God shall be strong, and do exploits.'",
  },
  {
    id:"rome", num:6, icon:"⚖️", color:"#C0392B",
    title:"Roman Captivity & Dispersion", dates:"63 BCE — climax 70 CE",
    type:"exile",
    summary:"Rome conquered Jerusalem under Pompey in 63 BCE. Roman rule brought heavy taxation, political oppression, and the execution of Yeshua the Messiah. The destruction of Jerusalem and the Second Temple by Titus in 70 CE fulfilled Matthew 24:1-2 precisely and scattered Israel more broadly across the Roman world.",
    scriptures:["Luke 21:20-24","Matthew 24:1-2","John 11:47-52","Deuteronomy 28:64","James 1:1","Romans 11:1"],
    teaching:"The Roman period is critical because it connects the gospel accounts directly to the scattering of Israel. The New Testament was written against this background — a covenant people under occupation, awaiting the Kingdom. The destruction of 70 CE scattered Judah widely across the Mediterranean world.",
    significance:"Luke 21:24 — 'Jerusalem shall be trodden down of the Gentiles, until the times of the Gentiles be fulfilled.' This phrase 'times of the Gentiles' defines the entire age between the first and second coming of the Messiah — the age the app is designed to serve. James 1:1 writes to 'the twelve tribes scattered abroad.'",
    prophetic:"Matthew 24:2 — 'There shall not be left here one stone upon another, that shall not be thrown down.' Josephus confirms the destruction took place exactly on the 9th of Av, the same date the First Temple had been destroyed 656 years earlier.",
  },
  {
    id:"diaspora", num:7, icon:"🌍", color:"#2E7D32",
    title:"The Long Diaspora — Modern Scattering", dates:"After Rome into the nations",
    type:"diaspora",
    summary:"After the Roman dispersions, Israelite peoples remained scattered across many lands, often under ongoing oppression, persecution, identity erasure, and displacement. The pattern of Deuteronomy 28:64-68 continued through medieval Europe, the transatlantic world, colonial Africa, and into the modern era.",
    scriptures:["Deuteronomy 28:37","Deuteronomy 28:48","Deuteronomy 28:64-68","Baruch 2:29-35","Ezekiel 36:19-24","Amos 9:9"],
    teaching:"This stage of the covenant consequence is the longest and most dispersed. Amos 9:9 — 'I will sift the house of Israel among all nations, like as corn is sifted in a sieve, yet shall not the least grain fall upon the earth.' YAHAWAH knows where every grain is. The covenant people are remembered even in scattered condition.",
    significance:"Baruch 2:29-35 applies Deuteronomy 28 explicitly to the long diaspora and promises restoration. Ezekiel 36:19-24 describes Israel scattered among the heathen — 'And I scattered them among the heathen, and they were dispersed through the countries; according to their way and according to their doings I judged them.' This is followed immediately by restoration in Ezekiel 37.",
    prophetic:"Amos 9:14-15 — 'And I will bring again the captivity of my people of Israel, and they shall build the waste cities, and inhabit them; and they shall plant vineyards, and drink the wine thereof; they shall also make gardens, and eat the fruit of them. And I will plant them upon their land, and they shall no more be pulled up out of their land which I have given them, saith YAHAWAH thy Power.'",
    hasExpanded: true,
    resources:[...MASTER_RESOURCES.slavery, ...MASTER_RESOURCES.diaspora],
  },
  {
    id:"regather", num:8, icon:"✨", color:"#5A7A52",
    title:"Promise of Regathering — The Captivities Are Not the End",
    dates:"Future Fulfillment",
    type:"restoration",
    summary:"The Bible does not end with captivity. It ends with remembrance, repentance, regathering, cleansing, and kingdom restoration. Every captivity in Israel's history was preceded by a restoration promise. The Most High who scattered will be the same God who gathers.",
    scriptures:["Deuteronomy 30:1-5","Isaiah 11:11-12","Jeremiah 31:7-10","Ezekiel 37:21-22","Baruch 5:5-9","Zechariah 10:6"],
    teaching:"The covenant cycle is: Disobedience → Judgment → Captivity → Repentance → Restoration. Every captivity in scripture is followed by a restoration. The final restoration will be greater than all previous ones combined. Isaiah 11:11 calls it 'a second time' — the first was the Exodus. The second will be the global regathering.",
    significance:"Deuteronomy 30:1-3 was written before Israel even entered the land — Moses prophesied both the captivity AND the restoration in advance. The God who gave the warning also gave the promise of return. No captivity is permanent in the covenant framework.",
    prophetic:"Isaiah 11:11-12 — 'The Lord shall set his hand again the second time to recover the remnant of his people… and shall assemble the outcasts of Israel, and gather together the dispersed of Judah from the four corners of the earth.'",
  },
];

// ─── WOMEN'S STUDY DATA ───────────────────────────────────────────────────────
const WOMEN_STUDY_LESSONS = [
  {
    id:"identity", icon:"👑", color:"#C4893A",
    title:"Who You Are — Covenant Identity for Women",
    subtitle:"You were not created as an afterthought",
    anchor:"Genesis 1:27 · 1 Peter 2:9",
    intro:"The enemy's first attack on humanity was an identity attack — and it was directed at a woman. Understanding who you are in covenant is the foundation of everything else. You are not just Adam's helper. You are created in the image of the Most High, bearer of the covenant, and mother of nations.",
    lessons:[
      { heading:"Created in the Image — Not After", scripture:"Genesis 1:27-28", note:"Both male and female were created in God's image simultaneously. The word 'image' (tselem) means a shadow or representative form. Women carry the divine image fully — not partially." },
      { heading:"The Name 'Woman' — ishah", scripture:"Genesis 2:23", note:"Adam named her ishah — from ish (man). Her name is literally embedded in man's name. She was taken from his side — not his head (to rule) and not his feet (to be trampled), but his side, to stand beside him." },
      { heading:"A Chosen Generation, A Royal Priesthood", scripture:"1 Peter 2:9", note:"This verse is addressed to all of Israel — women included. Royal priesthood. Holy nation. A peculiar people. These titles belong to every covenant woman, not just to ministers or men." },
      { heading:"Daughters of Jerusalem", scripture:"Song of Solomon 1:5", note:"The woman in the Song of Solomon declares herself 'black but comely' — dark in appearance and beautiful. This is one of the clearest physical self-descriptions of a Hebrew woman in all of scripture." },
    ],
    reflection:"What false identity labels have you accepted that contradict what God says you are?",
    assignment:"Write your covenant identity declaration using Genesis 1:27 and 1 Peter 2:9 as your foundation. Read it aloud every morning this week.",
  },
  {
    id:"prophetesses", icon:"🔥", color:"#8B3A2A",
    title:"Women Who Carried the Prophetic Voice",
    subtitle:"The Spirit of prophecy was never for men only",
    anchor:"Joel 2:28 · Acts 2:17",
    intro:"The Most High has always spoken through women. From Miriam leading the women in praise after the Red Sea crossing to Deborah judging a nation to Huldah certifying the Word of God before the king — the prophetic voice of women is woven throughout scripture.",
    lessons:[
      { heading:"Miriam — Prophetess and Worship Leader", scripture:"Exodus 15:20-21 · Micah 6:4", note:"Miriam is explicitly called a prophetess and is listed alongside Moses and Aaron as one of the three leaders of the Exodus. She led the women in worship after the crossing. Micah 6:4 confirms God sent all three to lead Israel." },
      { heading:"Deborah — Judge, Prophetess, and Commander", scripture:"Judges 4:4-5 · Judges 5:7", note:"Deborah judged all of Israel, gave military strategy to Barak, and composed one of the oldest victory songs in scripture (Judges 5). She is called 'a mother in Israel' — her authority was spiritual and civic." },
      { heading:"Huldah — The Prophetess Who Certified Scripture", scripture:"2 Kings 22:14-20", note:"When the Book of the Law was discovered in the Temple, King Josiah sent his priests to Huldah — not to Jeremiah or Zephaniah who were alive at the time. She certified the scroll as authentic and gave the word of the LORD. She was the scripture authority of her day." },
      { heading:"Anna — Prophetess in the Temple", scripture:"Luke 2:36-38", note:"Anna was an 84-year-old widow from the tribe of Asher who served in the Temple with fasting and prayer night and day. She was one of the first to publicly declare that the Messiah had come." },
      { heading:"Philip's Daughters — Prophesying in the Early Church", scripture:"Acts 21:9", note:"Philip the evangelist had four daughters who all prophesied. Paul does not correct this — he documents it as normal covenant expression in the early community." },
    ],
    reflection:"Has the church tradition you come from taught you that prophecy was for men only? How does this scripture record change your understanding?",
    assignment:"Study Judges 4-5 (Deborah and Barak). Write out what kind of spiritual authority Deborah exercised and how it was received by the men around her.",
  },
  {
    id:"mothers", icon:"🌿", color:"#5A7A52",
    title:"Mothers in the Covenant — Legacy Carriers",
    subtitle:"The covenant moved through women",
    anchor:"Proverbs 31:25-26 · Psalm 113:9",
    intro:"The covenant did not just pass through fathers. The mothers of Israel carried it, protected it, and in many cases determined its direction. Sarah, Rebekah, Rachel, Leah, Jochebed, Rahab, Ruth — these women were not background characters. They were covenant carriers.",
    lessons:[
      { heading:"Sarah — Mother of Nations", scripture:"Genesis 17:15-16 · Hebrews 11:11", note:"God changed Sarai's name to Sarah — princess. He said kings of peoples would come from her. Hebrews 11:11 says Sarah received strength to conceive because she judged faithful the One who promised. Her faith was the mechanism of the miracle." },
      { heading:"Rebekah — Who Heard God Directly", scripture:"Genesis 25:22-23", note:"When Rebekah felt the twins struggling in the womb, she went to inquire of the LORD herself — and the LORD spoke to her directly about the two nations in her womb. She did not need her husband to hear from God on her behalf." },
      { heading:"Jochebed — The Mother Who Hid the Deliverer", scripture:"Exodus 2:1-10 · Hebrews 11:23", note:"Moses' mother hid him for three months by faith, defying Pharaoh's death decree. Her act of covenant courage preserved the deliverer of Israel. Hebrews credits this directly to her faith." },
      { heading:"Ruth — Covenant Loyalty Across Culture", scripture:"Ruth 1:16-17 · Ruth 4:17", note:"Ruth was a Moabite woman who chose covenant loyalty above nationality, family, and comfort. Her words in Ruth 1:16 — 'Where thou goest, I will go' — are among the most famous covenant declarations in scripture. She became the great-grandmother of King David and is in the genealogy of Yeshua." },
    ],
    reflection:"Who are the covenant mothers in your life — biological or spiritual — who carried the faith to you? How will you carry it to the next generation?",
    assignment:"Read Ruth 1-4 in full this week. Write out three character qualities you see in Ruth that you want to develop in your own life.",
  },
  {
    id:"women-deuteronomy", icon:"📜", color:"#7B5EA7",
    title:"Women in Deuteronomy 28 — The Covenant Affected Women Specifically",
    subtitle:"The curses described specific sufferings experienced by women",
    anchor:"Deuteronomy 28:32 · Lamentations 1:16-17",
    intro:"Deuteronomy 28 is not a gender-neutral passage. Several verses describe suffering that was specifically experienced by women — children taken, being given to another people, and the profound grief of watching families destroyed. Understanding this helps women see that their suffering was not random — it was prophesied, and it is seen by God.",
    lessons:[
      { heading:"Children Taken — The Mother's Grief", scripture:"Deuteronomy 28:32 · Jeremiah 31:15", note:"'Thy sons and thy daughters shall be given unto another people, and thine eyes shall look, and fail with longing for them all the day long: and there shall be no might in thine hand.' Jeremiah 31:15 calls this Rachel weeping for her children. God noticed specifically the mothers' grief." },
      { heading:"The Betrothed Woman Given to Another", scripture:"Deuteronomy 28:30", note:"One of the specific curses describes a woman being betrothed but then violated by another man — the severing of covenant marriage relationships under oppression. This points to the sexual violence experienced during captivity and enslavement." },
      { heading:"Lamentations — A Woman Personifies Jerusalem", scripture:"Lamentations 1:1-2 · Lamentations 1:16-17", note:"The entire book of Lamentations uses a grieving woman as the voice and image of Jerusalem in captivity. 'Is it nothing to you, all ye that pass by? behold, and see if there be any sorrow like unto my sorrow.' The feminine voice carries the covenant grief." },
      { heading:"The Restoration Promise Addresses Women Directly", scripture:"Isaiah 54:1-6 · Isaiah 62:4", note:"Isaiah 54:1 says 'Sing, O barren, thou that didst not bear; break forth into singing.' God's restoration promise is addressed directly to the woman who suffered. Isaiah 62:4 says 'thou shalt be called Hephzibah' — my delight is in her. God renames the grieving woman with a name of joy." },
    ],
    reflection:"How do you see your personal suffering or the suffering of women in your family line in light of the covenant prophecy of Deuteronomy 28? How does the restoration promise in Isaiah 54 speak to that?",
    assignment:"Read Isaiah 54 in full. Identify every name or description God gives to the covenant woman in that chapter. Write them down and study what each one means.",
  },
  {
    id:"wisdom-women", icon:"💎", color:"#2980B9",
    title:"The Wise Women of Scripture — Wisdom as a Feminine Voice",
    subtitle:"Wisdom herself is a woman in the Hebrew scriptures",
    anchor:"Proverbs 8:1-4 · Sirach 24:1",
    intro:"In Proverbs 8 and Sirach 24, Wisdom (Chokmah in Hebrew) is personified as a woman — standing at the gates, calling out in the streets, speaking before kings, and present at creation. This was not accidental. The Hebrew scriptures consistently connect divine wisdom with a feminine voice. Women who walk in wisdom carry something ancient and sacred.",
    lessons:[
      { heading:"Wisdom Calls at the Gates", scripture:"Proverbs 8:1-4 · Proverbs 9:1-6", note:"Wisdom calls in the streets. She is not hidden. She stands at the crossroads and at the city gates — the places of commerce, justice, and public life. The wise woman speaks into every sphere of society." },
      { heading:"Wisdom Was Present at Creation", scripture:"Proverbs 8:22-31", note:"Wisdom says 'I was set up from everlasting, from the beginning, before the earth was.' She was with God as a master craftsman at creation and rejoiced before Him daily. The feminine voice of wisdom is older than the world." },
      { heading:"The Wise Woman of Abel — Political Wisdom", scripture:"2 Samuel 20:16-22", note:"A wise woman from the city of Abel negotiated with Joab's army to save her entire city. She called herself a 'mother in Israel.' Her political wisdom and negotiating skill ended a military siege. She is unnamed but her wisdom is eternal." },
      { heading:"Sirach's Praise of Wisdom", scripture:"Sirach 24:1-22", note:"Sirach 24 is entirely devoted to Wisdom speaking in her own voice — 'I came out of the mouth of the Most High, and covered the earth as a cloud.' The Apocrypha honors the feminine wisdom tradition that the Protestant canon sometimes underemphasizes." },
    ],
    reflection:"Where in your own life is Wisdom calling you? What gate — family, community, business, ministry — has she placed you at to speak?",
    assignment:"Read Proverbs 8 and Sirach 24 side by side this week. Write out five ways the description of Wisdom mirrors what God is calling you to become.",
  },
  {
    id:"women-restoration", icon:"🌸", color:"#E91E8C",
    title:"Women in the Restoration — You Have a Role in What God is Rebuilding",
    subtitle:"The end-time gathering includes the daughters of Israel",
    anchor:"Isaiah 49:22 · Zephaniah 3:14-17",
    intro:"The prophetic restoration of Israel is not a male-only event. The daughters of Israel are specifically mentioned in restoration prophecy. They will be carried back. They will be honored. They will sing. They will teach their children the truth. The women of the covenant have a specific and irreplaceable role in the final restoration.",
    lessons:[
      { heading:"The Daughters Carried Home", scripture:"Isaiah 49:22 · Isaiah 60:4", note:"'Behold, I will lift up mine hand to the Gentiles, and set up my standard to the people: and they shall bring thy sons in their arms, and thy daughters shall be carried upon their shoulders.' The daughters of Israel are specifically part of the restoration vision." },
      { heading:"Zephaniah's Song Over the Daughter of Zion", scripture:"Zephaniah 3:14-17", note:"'Sing, O daughter of Zion; shout, O Israel; be glad and rejoice with all the heart, O daughter of Jerusalem… The LORD thy God in the midst of thee is mighty; he will save, he will rejoice over thee with joy; he will rest in his love, he will joy over thee with singing.' God sings over His daughter." },
      { heading:"Women Teaching the Next Generation", scripture:"Deuteronomy 6:7 · Titus 2:3-4", note:"The command to teach covenant truth to children was given to both parents. Titus 2 specifically calls older women to teach the younger women — not as a secondary role but as a primary covenant assignment." },
      { heading:"Daughters Who Prophesy in the Last Days", scripture:"Joel 2:28-29 · Acts 2:17", note:"'Your sons and your daughters shall prophesy.' This was the first fulfillment of Joel 2 on Pentecost. The daughters of Israel will prophesy in the restoration — speaking forth the covenant truth to a generation that needs to hear it." },
    ],
    reflection:"What is your specific role in the restoration? What are you carrying — in your family, your community, your covenant life — that belongs to the next generation?",
    assignment:"Write your personal restoration declaration as a covenant woman. Include who you are, what you carry, who you are raising, and what legacy you are building.",
  },
];

// ─── DEUTERONOMY 28 STUDY MODULE ─────────────────────────────────────────────
const DEUT28_THEMES = [
  {
    id:"scatter", num:1, icon:"🌍", title:"Scattered Among All Nations", color:"#8B3A2A",
    mainVerse:"Deuteronomy 28:64",
    mainText:"And the LORD shall scatter thee among all people, from the one end of the earth even unto the other; and there thou shalt serve other gods, which neither thou nor thy fathers have known, even wood and stone.",
    related:["Leviticus 26:33","Deuteronomy 4:27","Nehemiah 1:8","Jeremiah 16:13"],
    discussion:["The Jewish diaspora after Roman destruction of Jerusalem (70 CE)","Global migrations of Israelite peoples across centuries","Hebrew-descended communities preserving traditions on multiple continents","How scattering preserved and also erased covenant identity"],
    historicalNote:"After the Roman siege of Jerusalem in 70 CE, documented by Josephus and confirmed by the Arch of Titus, Jewish populations were dispersed across the Roman Empire and beyond. The pattern of covenant scattering had earlier precedents in the Assyrian exile (722 BCE) and the Babylonian captivity (586 BCE).",
    anchor:"Isaiah 11:11-12",
  },
  {
    id:"servitude", num:2, icon:"⛓️", title:"Serving Enemies in Hunger & Nakedness", color:"#6D4C41",
    mainVerse:"Deuteronomy 28:48",
    mainText:"Therefore shalt thou serve thine enemies which the LORD shall send against thee, in hunger, and in thirst, and in nakedness, and in want of all things: and he shall put a yoke of iron upon thy neck, until he have destroyed thee.",
    related:["Jeremiah 5:19","Lamentations 5:4-5","Isaiah 42:22","Joel 3:6"],
    discussion:["Economic oppression across different periods of history","Loss of land ownership and means of production","Dependency on foreign powers and systems","The yoke of iron as a historical and prophetic pattern"],
    historicalNote:"The phrase 'yoke of iron upon thy neck' has parallels in documented historical periods of forced labor and servitude. Jeremiah 28:13-14 also uses the iron yoke as a symbol of harsh subjugation under Babylon. The principle applies across different historical captivities.",
    anchor:"Jeremiah 30:8",
  },
  {
    id:"ships", num:3, icon:"⛵", title:"Captivity by Ships", color:"#1B3A5C",
    mainVerse:"Deuteronomy 28:68",
    mainText:"And the LORD shall bring thee into Egypt again with ships, by the way whereof I spake unto thee, Thou shalt see it no more again: and there ye shall be sold unto your enemies for bondmen and bondwomen, and no man shall buy you.",
    related:["Joel 3:3","Joel 3:6","Amos 9:9","Isaiah 42:22"],
    discussion:["The unique specification of maritime captivity — 'with ships'","Egypt as a Hebrew symbol for bondage (Exodus 20:2)","Forced maritime transportation in various historical periods","The phrase 'no man shall buy you' — total dispossession","How members interpret this verse in study and discussion"],
    historicalNote:"Biblical scholars note that the original Egyptian captivity was overland. A 'second Egypt' coming 'with ships' points to a distinct future captivity by sea. Members of the club are encouraged to study this verse carefully alongside Joel 3:3-6, Amos 9:9, and Isaiah 42:22, and to bring their own research and questions to the Shabbat discussion.",
    anchor:"Isaiah 43:5-7",
  },
  {
    id:"children", num:4, icon:"👪", title:"Children Taken Away", color:"#7B5EA7",
    mainVerse:"Deuteronomy 28:32",
    mainText:"Thy sons and thy daughters shall be given unto another people, and thine eyes shall look, and fail with longing for them all the day long: and there shall be no might in thine hand.",
    related:["Joel 3:6","Lamentations 5:13","Hosea 9:12","Jeremiah 31:15"],
    discussion:["Family separation as a tool of conquest and subjugation","Cultural erasure through removal of children","Adoption systems that severed covenant heritage","Rachel weeping for her children (Jeremiah 31:15) — a prophetic type"],
    historicalNote:"The separation of families during periods of war, captivity, and forced migration is documented across multiple historical eras. The specific grief described — 'thine eyes shall fail with longing for them' — connects to Lamentations 5 and Rachel's mourning in Jeremiah 31:15, which Yeshua associated with the Herodian massacre in Matthew 2:18.",
    anchor:"Jeremiah 31:15-17",
  },
  {
    id:"yoke", num:5, icon:"⚖️", title:"A Yoke of Iron", color:"#C0392B",
    mainVerse:"Deuteronomy 28:48",
    mainText:"He shall put a yoke of iron upon thy neck, until he have destroyed thee.",
    related:["Jeremiah 28:13-14","Lamentations 1:14","Isaiah 9:4","Nahum 1:13"],
    discussion:["The iron yoke as a symbol of total subjugation","Different from a wooden yoke — heavier, unbreakable without divine intervention","How systems of governance can function as covenant instruments of judgment","The promise of the yoke being broken (Isaiah 9:4)"],
    historicalNote:"Iron yokes were used in the ancient Near East as a symbol of the most severe form of servitude — they could not be broken without external force. Jeremiah 28:13 uses this image when Hananiah broke the wooden yoke, and God responded that iron would replace it under Babylon's rule.",
    anchor:"Isaiah 9:4",
  },
  {
    id:"language", num:6, icon:"🗣️", title:"Loss of Language & Culture", color:"#2980B9",
    mainVerse:"Deuteronomy 28:49",
    mainText:"The LORD shall bring a nation against thee from far, from the end of the earth, as swift as the eagle flieth; a nation whose tongue thou shalt not understand.",
    related:["Isaiah 28:11","Jeremiah 5:15","Ezekiel 3:5-6","1 Corinthians 14:21"],
    discussion:["Forced assimilation and language replacement","The loss of native identity through enforced foreign language","Cultural memory preserved through oral tradition despite language loss","How language connects to covenant identity and knowledge of scripture"],
    historicalNote:"The destruction of native languages has been one of the primary tools of cultural subjugation throughout history. Paul quotes Isaiah 28:11 in 1 Corinthians 14:21 in a New Testament context, showing the prophetic principle carried forward. The pattern described in Deuteronomy 28:49 — a distant nation whose language is incomprehensible — appears in multiple historical invasions.",
    anchor:"Zephaniah 3:9",
  },
  {
    id:"byword", num:7, icon:"😔", title:"A Byword Among Nations", color:"#6A1B9A",
    mainVerse:"Deuteronomy 28:37",
    mainText:"And thou shalt become an astonishment, a proverb, and a byword, among all nations whither the LORD shall lead thee.",
    related:["1 Kings 9:7","2 Chronicles 7:20","Psalm 44:14","Jeremiah 24:9"],
    discussion:["National humiliation as a covenant consequence","The use of stereotypes and caricatures against covenant peoples","Cultural ridicule as a form of dehumanization","How shame operates differently from guilt — and its covenant implications"],
    historicalNote:"The specific word 'byword' (mashal in Hebrew) means to become a proverb — a standard reference for mockery or misfortune. Psalm 44:14 applies this specifically to Israel: 'a byword among the heathen.' The pattern of a covenant people becoming a subject of cultural derision is documented across multiple historical periods and geographic contexts.",
    anchor:"Isaiah 54:4-5",
  },
  {
    id:"land", num:8, icon:"🌾", title:"Land Taken by Foreign Powers", color:"#2E7D32",
    mainVerse:"Deuteronomy 28:33",
    mainText:"The fruit of thy land, and all thy labours, shall a nation which thou knowest not eat up; and thou shalt be only oppressed and crushed alway.",
    related:["Micah 2:2","Nehemiah 9:36-37","Ezekiel 36:1-5","Isaiah 1:7"],
    discussion:["Colonization and land confiscation as covenant themes","Foreign nations benefiting from the labor of occupied peoples","The separation of a people from their land as spiritual and economic displacement","Restoration of the land in eschatological prophecy (Ezekiel 36)"],
    historicalNote:"The prophetic books frequently address the theft of land from Israel's covenant people. Micah 2:2 specifically condemns those who 'covet fields and take them by violence.' Ezekiel 36 frames the entire desolation and restoration of the land in covenant terms, connecting the people's condition to their obedience.",
    anchor:"Ezekiel 36:8-12",
  },
  {
    id:"oppression", num:9, icon:"🏛️", title:"Oppression Without Justice", color:"#00838F",
    mainVerse:"Deuteronomy 28:29",
    mainText:"And thou shalt grope at noonday, as the blind gropeth in darkness, and thou shalt not prosper in thy ways: and thou shalt be only oppressed and spoiled evermore, and no man shall save thee.",
    related:["Isaiah 1:23","Amos 5:12","Ecclesiastes 4:1","Isaiah 59:14-15"],
    discussion:["Systemic oppression and the absence of legal remedy","The blindness metaphor — unable to find justice even in broad daylight","How Amos 5 connects covenant unfaithfulness to social injustice","The promise that the Creator will ultimately vindicate the oppressed"],
    historicalNote:"Amos 5:12 specifically describes a society where the righteous are afflicted, bribes are taken, and the poor are turned away at the gate. This is not merely social commentary — it is presented as a symptom of covenant departure. Isaiah 59:14-15 uses nearly identical language, describing truth fallen in the street and justice turned away backward.",
    anchor:"Psalm 82:1-4",
  },
  {
    id:"trauma", num:10, icon:"🧠", title:"Madness from Oppression", color:"#37474F",
    mainVerse:"Deuteronomy 28:34",
    mainText:"So that thou shalt be mad for the sight of thine eyes which thou shalt see.",
    related:["Deuteronomy 28:28","Lamentations 3:1-20","Psalm 44:17-22","Isaiah 61:1-3"],
    discussion:["Generational trauma and psychological impact of prolonged suffering","The connection between spiritual bondage and mental affliction","How the prophet Jeremiah modeled grief and lament without losing faith","The healing promise of Isaiah 61:1-3 — 'beauty for ashes'"],
    historicalNote:"Modern clinical research on intergenerational trauma (epigenetic studies by Yehuda et al. and others) has documented how the effects of severe trauma can be transmitted across generations. The biblical text anticipated this reality 3,500 years ago. The book of Lamentations is entirely devoted to processing covenantal grief and suffering without abandoning hope.",
    anchor:"Isaiah 61:1-3",
  },
  {
    id:"identity", num:11, icon:"🔍", title:"Loss of Identity", color:"#C97D1A",
    mainVerse:"Hosea 1:9",
    mainText:"Then said God, Call his name Lo-ammi: for ye are not my people, and I will not be your God.",
    related:["Hosea 6:1","Baruch 4:6","Jeremiah 17:4","Isaiah 49:14-16"],
    discussion:["Identity crisis as a covenant consequence — 'Lo-ammi' (not my people)","The difference between identity loss and covenant cancellation","How communities search for their heritage after generations of erasure","The promise of Hosea 2:23 — 'I will say to them which were not my people, Thou art my people'"],
    historicalNote:"The name Lo-ammi is directly reversed in Hosea 2:23 and cited by Paul in Romans 9:25-26 as a prophetic framework for covenant restoration. The theme of a people who have lost their identity but are destined to be restored is one of the central narratives of both the Hebrew prophets and the New Testament apostolic writings.",
    anchor:"Hosea 2:23",
  },
  {
    id:"restoration", num:12, icon:"✨", title:"Restoration — The Covenant Does Not End", color:"#5A7A52",
    mainVerse:"Deuteronomy 30:1-3",
    mainText:"When all these things are come upon thee… and thou shalt call them to mind among all the nations whither the LORD thy God hath driven thee… then the LORD thy God will turn thy captivity, and have compassion upon thee, and will return and gather thee from all the nations.",
    related:["Isaiah 11:11-12","Jeremiah 31:31-33","Ezekiel 37:21-22","Zechariah 10:6","Baruch 5:5-9"],
    discussion:["The curses of Deuteronomy 28 are not the end of the covenant story","Deuteronomy 30 is the direct sequel — repentance triggers restoration","How the covenantal cycle works: Disobedience → Captivity → Repentance → Restoration","The difference between punishment and abandonment — God's covenant is eternal"],
    historicalNote:"Deuteronomy 30 is one of the most important chapters in the Hebrew Bible for understanding the covenant arc. Moses delivered these words before Israel entered the land — anticipating both the curses and the return. Paul references Deuteronomy 30:14 in Romans 10:8, showing the New Testament authors saw this as still-active prophetic truth.",
    anchor:"Isaiah 11:11",
  },
];

// ─── HISTORICAL CONTEXT DATA ──────────────────────────────────────────────────
const HISTORICAL_CONTEXT_ENTRIES = [
  {
    id:"papal-bulls-1452", era:"Late Medieval · 1452–1455", icon:"📜", color:"#8B3A2A",
    title:"Papal Bulls & the Early Atlantic Slave System",
    subtitle:"How religious authority enabled the Portuguese slave trade",
    events:[
      { year:"1452", label:"Dum Diversas", desc:"Pope Nicholas V issued this papal bull authorizing Portugal to 'reduce' certain non-Christian peoples to perpetual slavery, giving religious-legal cover for the expansion of Portuguese activity along the West African coast." },
      { year:"1455", label:"Romanus Pontifex", desc:"A follow-up bull by Nicholas V that extended Portuguese dominion over discovered lands along the African coast and further encouraged the enslavement of non-Christian peoples, consolidating the legal framework for the Atlantic slave enterprise." },
    ],
    historicalNote:"These documents represent one of the earliest instances of official religious-political sanction for a systemic slave trade. They are documented in historical and legal archives and widely cited by historians of the Atlantic world. The connection between religious authority, royal power, and economic exploitation they established would shape the next three centuries.",
    scriptures:["Amos 5:24","Micah 6:8","Proverbs 14:31","Isaiah 1:17"],
    discussion:["How religious institutions have historically intersected with political and economic power","The responsibility of spiritual leaders to speak against injustice (Ezekiel 3:17)","How covenant people should understand oppressive systems in light of Deuteronomy 28","The difference between documented historical facts and unverified personal attributions"],
    source:"Documented in historical scholarship; see also legal-history resources on the Doctrine of Discovery.",
    important:"Historical claims should be grounded in documented evidence. The papal bulls of 1452–1455 are well-attested. Claims assigning direct personal responsibility to specific individuals (beyond what documents show) should be presented as discussion points, not established fact.",
  },
  {
    id:"tordesillas", era:"Renaissance · 1493–1494", icon:"🌍", color:"#1B3A5C",
    title:"The Treaty of Tordesillas & Division of the World",
    subtitle:"How Spain and Portugal divided newly discovered lands",
    events:[
      { year:"1493", label:"Pope Alexander VI — Papal Bulls", desc:"Pope Alexander VI (father of Cesare Borgia) issued Inter Caetera and related bulls granting Spain extensive claims over newly discovered lands in the Atlantic world. These were later adjusted by treaty." },
      { year:"1494", label:"Treaty of Tordesillas", desc:"Spain and Portugal formally divided their spheres of influence in the New World at a line 370 leagues west of Cape Verde. Portugal received Brazil and its African territories; Spain received most of the Americas. This treaty shaped colonial geography for centuries." },
    ],
    historicalNote:"The Treaty of Tordesillas is documented by Britannica and multiple historical sources. Pope Alexander VI's connection was primarily through the 1493 papal bulls — the documentary connection to direct personal funding of the slave trade is not well-established and should be distinguished from his documented political role. The stronger documented chain is: papal bulls (Nicholas V, 1452-55) → Portuguese slave trade → Tordesillas framework (Alexander VI, 1493-94) → colonial expansion.",
    scriptures:["Proverbs 14:31","Isaiah 10:1-3","Amos 5:12","Habakkuk 2:12"],
    discussion:["How colonial systems used religious authority as justification","The long-term effects of land division agreements on indigenous and enslaved peoples","The Doctrine of Discovery and its theological and legal legacy","How Micah 6:8 — 'do justly, love mercy, walk humbly' — applies to institutional power"],
    source:"Documented by Britannica, U.S. State Department archives, and legal history of the Doctrine of Discovery.",
    important:"Distinguish between what is documented (papal bulls, treaty) and what requires more evidence (specific personal financial involvement). Responsible historical teaching presents what is verifiable while encouraging members to do further study.",
  },
  {
    id:"modern-israel", era:"Modern Era · 1917–1948", icon:"⭐", color:"#C97D1A",
    title:"The Modern State of Israel — Key Milestones",
    subtitle:"From the Balfour Declaration to UN Recognition",
    events:[
      { year:"1917", label:"The Balfour Declaration", desc:"The British government formally expressed support for 'the establishment in Palestine of a national home for the Jewish people,' while noting that nothing should prejudice the civil and religious rights of existing non-Jewish communities." },
      { year:"1922", label:"British Mandate for Palestine", desc:"The League of Nations granted Britain the mandate to administer the region, with the Balfour Declaration incorporated. This shaped the political landscape for the next 26 years." },
      { year:"1947", label:"UN Resolution 181 — Partition Plan", desc:"On November 29, 1947, the UN General Assembly voted to recommend partition of the British Mandate into Jewish and Arab states, with special international administration for Jerusalem. This set the stage for independence." },
      { year:"1948", label:"Declaration of the State of Israel", desc:"On May 14, 1948, David Ben-Gurion declared the establishment of the State of Israel. The United States recognized the new state within minutes. Arab nations rejected the partition plan and war followed. These events are confirmed by U.S. State Department documentation and UN records." },
    ],
    historicalNote:"These milestones are documented by U.S. State Department records, the United Nations, and Britannica. The founding of the modern State of Israel in 1948 is one of the most studied events of the 20th century. Its relationship to biblical prophecy — particularly Isaiah 11:11-12, Ezekiel 37, and Deuteronomy 30 — is a subject of active theological discussion across many traditions.",
    scriptures:["Isaiah 11:11-12","Ezekiel 37:21-22","Jeremiah 31:10","Amos 9:14-15","Deuteronomy 30:3-5"],
    discussion:["The theological significance of Jewish return to the land in relation to biblical prophecy","The distinction between modern political Israel and the biblical covenant definition of Israel","Isaiah 11:11 — 'a second time to recover the remnant' — and its prophetic timing","The ongoing theological conversation about which people groups fulfill biblical Israel prophecy","How believers should understand current events in the Middle East through a covenant lens"],
    source:"Documented by U.S. State Department records, UN archives, and encyclopedic historical references.",
    important:"The modern State of Israel is a documented historical and political reality. Its precise relationship to the biblical covenant promises is a subject of sincere theological discussion among scholars and communities of faith. The club's approach is to present the history clearly and encourage members to study the scriptures carefully and discuss.",
  },
];


function BibleReaderPage({ setPage }) {
  const books = Object.keys(BIBLE_READER_BOOKS);
  const [activeBook, setActiveBook] = useState("Genesis");
  const chapData = BIBLE_READER_BOOKS[activeBook] || {};
  const chapters = Object.keys(chapData).map(Number);
  const [activeChapter, setActiveChapter] = useState(chapters[0] || 1);
  const [highlighted, setHighlighted] = useState(new Set());
  const [bookmarks, setBookmarks] = useState(new Set());
  const [searchQ, setSearchQ] = useState("");
  const [searchResults, setSearchResults] = useState(null);

  const verses = chapData[activeChapter] || [];
  const xrefs = CROSS_REFS[`${activeBook} ${activeChapter}`] || CROSS_REFS["default"];

  const toggleHighlight = (v) => setHighlighted(h => { const n=new Set(h); n.has(v)?n.delete(v):n.add(v); return n; });
  const toggleBookmark = (v) => setBookmarks(b => { const n=new Set(b); n.has(v)?n.delete(v):n.add(v); return n; });

  const handleSearch = () => {
    if (!searchQ.trim()) { setSearchResults(null); return; }
    const q = searchQ.toLowerCase();
    const results = [];
    Object.entries(BIBLE_READER_BOOKS).forEach(([book, chs]) => {
      Object.entries(chs).forEach(([ch, vs]) => {
        vs.forEach(v => { if (v.t.toLowerCase().includes(q)) results.push({book, ch, v}); });
      });
    });
    setSearchResults(results);
  };

  return (
    <div>
      <div className="ai-section-hero">
        <div className="ai-eyebrow">✦ ANCIENT ISRAEL STUDY BIBLE</div>
        <h2 className="ai-hero-h1">Scripture Reader</h2>
        <p className="ai-hero-sub">Read the KJV Bible verse by verse. Click any verse to highlight or bookmark it. Cross-references update automatically by book and chapter.</p>
      </div>

      {/* Search bar */}
      <div className="br-search-bar" style={{marginBottom:"1.25rem"}}>
        <input className="br-search-input" placeholder="Search verses by keyword… (e.g. 'Israel', 'covenant', 'blood')" value={searchQ} onChange={e=>{setSearchQ(e.target.value); if(!e.target.value)setSearchResults(null);}} onKeyDown={e=>e.key==="Enter"&&handleSearch()} />
        <button className="btn-search" onClick={handleSearch}>🔍 Search</button>
        {searchResults && <button className="btn-outline" style={{whiteSpace:"nowrap"}} onClick={()=>{setSearchResults(null);setSearchQ("");}}>✕ Clear</button>}
      </div>

      {searchResults ? (
        <div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.14em",color:"#1B3A5C",marginBottom:"0.9rem"}}>{searchResults.length} RESULTS FOR "{searchQ.toUpperCase()}"</div>
          {searchResults.length===0 ? <div className="no-results"><div className="no-results-icon">🔍</div><div className="no-results-text">No verses found</div></div> : (
            <div style={{display:"grid",gap:"0.6rem",maxHeight:"60vh",overflowY:"auto"}}>
              {searchResults.map(({book,ch,v},i) => (
                <div key={i} style={{background:"white",border:"1px solid var(--border)",borderRadius:"11px",padding:"0.85rem 1.1rem",cursor:"pointer"}} onClick={()=>{setActiveBook(book);setActiveChapter(Number(ch));setSearchResults(null);setSearchQ("");}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:"#C97D1A",marginBottom:"0.3rem"}}>{book} {ch}:{v.v}</div>
                  <div style={{fontSize:"0.88rem",lineHeight:1.75,color:"var(--ink)"}}>{v.t}</div>
                </div>
              ))}
            </div>
          )}
        </div>
      ) : (
        <div className="br-layout">
          {/* Book/Chapter sidebar */}
          <div>
            <div className="br-sidebar">
              <div className="br-sidebar-title">BOOKS</div>
              {books.map(b => (
                <button key={b} className={`br-book-btn${activeBook===b?" active":""}`} onClick={()=>{setActiveBook(b); const chs=Object.keys(BIBLE_READER_BOOKS[b]||{}).map(Number); setActiveChapter(chs[0]||1);}}>
                  {b}
                </button>
              ))}
            </div>
            {/* Chapter select */}
            <div style={{marginTop:"0.75rem",background:"white",border:"1px solid var(--border)",borderRadius:"12px",overflow:"hidden",boxShadow:"var(--shadow)"}}>
              <div className="br-sidebar-title">CHAPTERS</div>
              <div className="br-chapter-bar">
                {chapters.map(c => <button key={c} className={`br-ch-btn${activeChapter===c?" active":""}`} onClick={()=>setActiveChapter(c)}>{c}</button>)}
              </div>
            </div>
          </div>

          {/* Main reading area */}
          <div className="br-main">
            <div className="br-ref-header">
              <span className="br-book-title">{activeBook}</span>
              <span className="br-chapter-num">Chapter {activeChapter} · KJV</span>
              {bookmarks.size > 0 && <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",color:"#1B3A5C",padding:"0.2rem 0.55rem",borderRadius:"20px",background:"rgba(27,58,92,0.1)"}}>{bookmarks.size} 🔖</span>}
            </div>
            {verses.length===0 ? (
              <div style={{color:"var(--muted)",fontStyle:"italic",padding:"2rem",textAlign:"center"}}>Select a book and chapter above to begin reading.</div>
            ) : (
              verses.map(v => (
                <div key={v.v} className={`br-verse${highlighted.has(v.v)?" highlighted":""}${bookmarks.has(v.v)?" bookmarked":""}`} onClick={()=>toggleHighlight(v.v)} onDoubleClick={e=>{e.preventDefault();toggleBookmark(v.v);}}>
                  <span className="br-vnum">{v.v}</span>
                  <span className="br-vtext">{v.t}</span>
                </div>
              ))
            )}
            <div style={{marginTop:"1.5rem",fontSize:"0.72rem",color:"var(--muted)",fontStyle:"italic"}}>Click a verse to highlight · Double-click to bookmark</div>
          </div>

          {/* Cross-reference panel */}
          <div className="br-xref-panel">
            <div className="br-xref-title">✦ CROSS-REFERENCES</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.1em",color:"var(--muted)",marginBottom:"0.85rem"}}>{activeBook} {activeChapter}</div>
            {xrefs.map((r,i) => (
              <div key={i} className="br-xref-item">
                <div className="br-xref-ref">{r.ref}</div>
                <div className="br-xref-text">{r.text}</div>
              </div>
            ))}
          </div>
        </div>
      )}
    </div>
  );
}

// ─── ARTICLES PAGE ────────────────────────────────────────────────────────────
const ART_TAG_COLORS = {History:"#1B3A5C",Prophecy:"#B5451B",Archaeology:"#2A9D8F",Identity:"#C97D1A",Law:"#7B3FA0"};

function ArticlesPage({ setPage }) {
  const [activeTag, setActiveTag] = useState("All");
  const [openArticle, setOpenArticle] = useState(null);
  const tags = ["All","History","Prophecy","Archaeology","Identity","Law"];

  const filtered = activeTag==="All" ? ARTICLES : ARTICLES.filter(a=>a.tags.includes(activeTag));

  if (openArticle) {
    const a = openArticle;
    return (
      <div>
        <button className="back-btn" onClick={()=>setOpenArticle(null)}>← Back to Articles</button>
        <div className="article-full">
          <div className="article-full-main">
            <div style={{display:"flex",gap:"0.4rem",flexWrap:"wrap",marginBottom:"0.8rem"}}>
              {a.tags.map(tg=><span key={tg} className="article-tag" style={{background:ART_TAG_COLORS[tg]||"#888"}}>{tg}</span>)}
            </div>
            <h2 className="article-full-h1">{a.title}</h2>
            <div className="article-full-meta">By {a.author} · {a.date}</div>
            <div className="article-full-body">
              {a.body.map((block,i) => {
                if (block.type==="p") return <p key={i}>{block.text}</p>;
                if (block.type==="scripture") return (
                  <div key={i} className="article-scripture">
                    <div>{block.text}</div>
                    <div className="article-scripture-ref">{block.ref}</div>
                  </div>
                );
                return null;
              })}
            </div>
          </div>
          <div className="article-full-sidebar">
            <div className="sidebar-section-title">KEY SCRIPTURES</div>
            {a.refs.map((r,i) => <div key={i} className="sidebar-ref-item">{r}</div>)}
            <div style={{marginTop:"1.25rem",paddingTop:"1.25rem",borderTop:"1px solid var(--border)"}}>
              <div className="sidebar-section-title">RELATED ARTICLES</div>
              {ARTICLES.filter(x=>x.id!==a.id).slice(0,3).map(x=>(
                <div key={x.id} className="sidebar-ref-item" onClick={()=>setOpenArticle(x)} style={{cursor:"pointer",fontFamily:"'Cinzel',serif",fontSize:"0.72rem",lineHeight:1.4}}>{x.title}</div>
              ))}
            </div>
          </div>
        </div>
      </div>
    );
  }

  return (
    <div>
      <div className="ai-section-hero">
        <div className="ai-eyebrow">✦ STUDY ARTICLES</div>
        <h2 className="ai-hero-h1">Ancient Israel Articles</h2>
        <p className="ai-hero-sub">Deep-dive articles on archaeology, prophecy, identity, law, and the historical record of Israel. Click any article to read in full.</p>
      </div>

      <div className="article-filter-bar">
        {tags.map(tg => (
          <button key={tg} className={`art-filter-btn${activeTag===tg?" active":""}`} onClick={()=>setActiveTag(tg)}>{tg}</button>
        ))}
      </div>

      <div className="articles-grid">
        {filtered.map(a => (
          <motion.div key={a.id} className="article-card" whileHover={{y:-3}} onClick={()=>setOpenArticle(a)}>
            <div className="article-thumb">
              <div className="article-thumb-inner" style={{background:a.thumbBg}}>{a.thumb}</div>
            </div>
            <div className="article-body">
              <div className="article-tags">
                {a.tags.map(tg=><span key={tg} className="article-tag" style={{background:ART_TAG_COLORS[tg]||"#888"}}>{tg}</span>)}
              </div>
              <div className="article-title">{a.title}</div>
              <div className="article-meta">{a.author} · {a.date}</div>
              <div className="article-excerpt">{a.excerpt}</div>
            </div>
          </motion.div>
        ))}
      </div>
    </div>
  );
}

// ─── STUDY GUIDE PAGE ─────────────────────────────────────────────────────────
function StudyGuidePage({ setPage }) {
  const [activeLesson, setActiveLesson] = useState(0);
  const [completed, setCompleted] = useState(new Set());
  const [quizAnswers, setQuizAnswers] = useState({});
  const [quizSubmitted, setQuizSubmitted] = useState(false);

  const lesson = LESSONS[activeLesson];

  const handleLessonChange = (idx) => {
    setActiveLesson(idx);
    setQuizAnswers({});
    setQuizSubmitted(false);
  };

  const markComplete = () => {
    setCompleted(c => { const n=new Set(c); n.has(activeLesson)?n.delete(activeLesson):n.add(activeLesson); return n; });
  };

  return (
    <div>
      <div className="ai-section-hero">
        <div className="ai-eyebrow">✦ 8-LESSON CURRICULUM</div>
        <h2 className="ai-hero-h1">Ancient Israel Study Guide</h2>
        <p className="ai-hero-sub">Eight structured lessons from the Patriarchs to the End Times. Each lesson includes scriptures, a historical timeline, archaeological evidence, and a quiz. Track your progress as you go.</p>
        <div style={{marginTop:"1rem",display:"flex",gap:"0.5rem",alignItems:"center"}}>
          <div style={{flex:1,height:"6px",borderRadius:"3px",background:"rgba(245,238,216,0.15)"}}>
            <div style={{height:"100%",borderRadius:"3px",background:"#C97D1A",width:`${(completed.size/LESSONS.length)*100}%`,transition:"width 0.4s"}} />
          </div>
          <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:"rgba(245,238,216,0.6)"}}>{completed.size}/{LESSONS.length} COMPLETE</span>
        </div>
      </div>

      <div className="study-guide-grid">
        {/* Lesson list */}
        <div className="lesson-list">
          {LESSONS.map((l,i) => (
            <button key={l.id} className={`lesson-item${activeLesson===i?" active":""}${completed.has(i)?" completed":""}`} onClick={()=>handleLessonChange(i)}>
              <div className="lesson-num">{completed.has(i)?"✓":l.id}</div>
              <div className="lesson-meta">
                <div className="lesson-meta-title">{l.title}</div>
                <div className="lesson-meta-period">{l.period}</div>
              </div>
              {completed.has(i) && <span className="lesson-check">✓</span>}
            </button>
          ))}
        </div>

        {/* Lesson content */}
        <AnimatePresence mode="wait">
          <motion.div key={activeLesson} initial={{opacity:0,x:14}} animate={{opacity:1,x:0}} exit={{opacity:0,x:-14}} transition={{duration:0.22}} className="lesson-main">
            <div style={{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.5rem",flexWrap:"wrap",gap:"0.6rem"}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.16em",color:"#C97D1A"}}>LESSON {lesson.id}</div>
              <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",padding:"0.22rem 0.65rem",borderRadius:"20px",background:"rgba(27,58,92,0.1)",color:"#1B3A5C"}}>{lesson.period}</span>
            </div>
            <h3 style={{fontFamily:"'Cinzel',serif",fontSize:"1.4rem",color:"#1B3A5C",marginBottom:"1.1rem"}}>{lesson.title}</h3>
            <div className="lesson-overview">{lesson.overview}</div>

            {/* Key Scriptures */}
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.18em",color:"#C97D1A",marginBottom:"0.9rem"}}>KEY SCRIPTURES</div>
            {lesson.scriptures.map((s,i) => (
              <div key={i} className="lesson-scripture-block">
                <div className="lesson-scr-ref">{s.ref}</div>
                <div className="lesson-scr-text">"{s.text}"</div>
              </div>
            ))}

            {/* Timeline */}
            <div className="lesson-timeline" style={{marginTop:"1.75rem"}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.18em",color:"#C97D1A",marginBottom:"0.9rem"}}>HISTORICAL TIMELINE</div>
              {lesson.timeline.map((row,i) => (
                <div key={i} className="timeline-row">
                  <div className="timeline-dot" />
                  <div className="timeline-date">{row.date}</div>
                  <div className="timeline-event">{row.event}</div>
                </div>
              ))}
            </div>

            {/* Archaeological Evidence */}
            <div className="lesson-arch">
              <div className="lesson-arch-title">⛏ ARCHAEOLOGICAL EVIDENCE</div>
              <div className="lesson-arch-text">{lesson.archaeology}</div>
            </div>

            {/* Quiz */}
            <div className="quiz-section">
              <div className="quiz-title">📝 LESSON {lesson.id} QUIZ</div>
              {lesson.quiz.map((q,qi) => (
                <div key={qi} className="quiz-question">
                  <div className="quiz-q-text">{qi+1}. {q.q}</div>
                  {q.opts.map((opt,oi) => {
                    let cls = "quiz-option";
                    if (quizSubmitted) {
                      if (oi===q.ans) cls+=" correct";
                      else if (quizAnswers[qi]===oi && oi!==q.ans) cls+=" wrong";
                    }
                    return (
                      <button key={oi} className={cls} onClick={()=>{ if(!quizSubmitted) setQuizAnswers(a=>({...a,[qi]:oi})); }}>
                        {String.fromCharCode(65+oi)}. {opt}
                      </button>
                    );
                  })}
                </div>
              ))}
              {!quizSubmitted ? (
                <button className="btn-gold quiz-submit" onClick={()=>setQuizSubmitted(true)} disabled={Object.keys(quizAnswers).length<lesson.quiz.length}>
                  Submit Answers
                </button>
              ) : (
                <div style={{fontSize:"0.85rem",color:"#2A9D8F",fontFamily:"'Cinzel',serif",letterSpacing:"0.08em",marginTop:"0.5rem"}}>
                  ✓ Score: {lesson.quiz.filter((_,qi)=>quizAnswers[qi]===lesson.quiz[qi].ans).length}/{lesson.quiz.length} correct
                </div>
              )}
            </div>

            <button className={`lesson-complete-btn${completed.has(activeLesson)?" done":""}`} onClick={markComplete}>
              {completed.has(activeLesson) ? "✓ Lesson Complete" : "Mark Lesson Complete"}
            </button>
          </motion.div>
        </AnimatePresence>
      </div>
    </div>
  );
}

// ─── HISTORICAL TIMELINE PAGE ─────────────────────────────────────────────────
function HistoricalTimelinePage({ setPage }) {
  const [activeEvent, setActiveEvent] = useState(null);
  const trackRef = useRef(null);
  const [isDragging, setIsDragging] = useState(false);
  const [startX, setStartX] = useState(0);
  const [scrollLeft, setScrollLeft] = useState(0);

  const onMouseDown = e => { setIsDragging(true); setStartX(e.pageX - trackRef.current.offsetLeft); setScrollLeft(trackRef.current.scrollLeft); };
  const onMouseMove = e => { if(!isDragging) return; e.preventDefault(); const x=e.pageX-trackRef.current.offsetLeft; trackRef.current.scrollLeft=scrollLeft-(x-startX); };
  const onMouseUp = () => setIsDragging(false);

  const ev = TIMELINE_EVENTS.find(e=>e.id===activeEvent);

  return (
    <div>
      <div className="ai-section-hero">
        <div className="ai-eyebrow">✦ ~2000 BCE – 70 CE</div>
        <h2 className="ai-hero-h1">Historical Timeline of Ancient Israel</h2>
        <p className="ai-hero-sub">18 key events from Abraham to the destruction of the Second Temple. Click any event to expand its details. Drag to scroll the timeline.</p>
      </div>

      <div style={{background:"white",border:"1px solid var(--border)",borderRadius:"18px",marginBottom:"1.5rem",overflow:"hidden",boxShadow:"var(--shadow)"}}>
        <div className="htl-wrap" ref={trackRef} onMouseDown={onMouseDown} onMouseMove={onMouseMove} onMouseUp={onMouseUp} onMouseLeave={onMouseUp}>
          <div className="htl-track">
            {TIMELINE_EVENTS.map(e => (
              <div key={e.id} className={`htl-event${activeEvent===e.id?" active":""}${e.major?" major":""}`} onClick={()=>setActiveEvent(activeEvent===e.id?null:e.id)}>
                <div style={{height:"50px",display:"flex",flexDirection:"column",justifyContent:"flex-end",paddingBottom:"10px"}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",color:"#C97D1A",whiteSpace:"nowrap",textAlign:"center"}}>{e.date}</div>
                </div>
                <div className="htl-dot-wrap">
                  <div className="htl-dot" />
                </div>
                <div style={{paddingTop:"10px",maxWidth:"80px",textAlign:"center"}}>
                  <div style={{fontSize:"0.64rem",color:"var(--muted)",lineHeight:1.3,whiteSpace:"pre-line"}}>{e.label}</div>
                </div>
              </div>
            ))}
          </div>
        </div>
      </div>

      {/* Expanded Event Card */}
      <AnimatePresence mode="wait">
        {ev && (
          <motion.div key={ev.id} initial={{opacity:0,y:16}} animate={{opacity:1,y:0}} exit={{opacity:0,y:-8}} transition={{duration:0.24}} className="htl-card">
            <div style={{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"0.6rem",flexWrap:"wrap",gap:"0.5rem"}}>
              <div>
                <div className="htl-card-date">{ev.date}</div>
                <div className="htl-card-title">{ev.title}</div>
              </div>
              <button onClick={()=>setActiveEvent(null)} style={{background:"none",border:"1px solid var(--border)",borderRadius:"7px",padding:"0.3rem 0.6rem",cursor:"pointer",color:"var(--muted)",fontSize:"0.8rem"}}>✕</button>
            </div>
            <div className="htl-card-desc">{ev.desc}</div>
            <div className="htl-card-row">
              <span className="htl-badge scripture">📖 {ev.scripture}</span>
              <span className="htl-badge source">🏛️ {ev.source}</span>
            </div>
          </motion.div>
        )}
      </AnimatePresence>

      {!activeEvent && (
        <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(300px,1fr))",gap:"0.75rem"}}>
          {TIMELINE_EVENTS.map(e => (
            <div key={e.id} style={{background:"white",border:"1px solid var(--border)",borderRadius:"12px",padding:"0.9rem 1.1rem",cursor:"pointer",transition:"all 0.18s",display:"flex",gap:"0.75rem",alignItems:"flex-start"}} onClick={()=>setActiveEvent(e.id)} className="card">
              <div style={{width:"10px",height:"10px",borderRadius:"50%",background:e.major?"#B5451B":"#C97D1A",flexShrink:0,marginTop:"5px"}} />
              <div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",color:"#C97D1A",marginBottom:"0.18rem"}}>{e.date}</div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.78rem",color:"#1B3A5C",lineHeight:1.3}}>{e.title}</div>
              </div>
            </div>
          ))}
        </div>
      )}
    </div>
  );
}

// ─── 12 TRIBES PAGE ───────────────────────────────────────────────────────────
function TwelveTribesPage({ setPage, goToScripture, t }) {
  const [selectedTribe, setSelectedTribe] = useState(null);
  const [openAccordion, setOpenAccordion] = useState(null); // tribe name with open accordion
  const [sharedTab, setSharedTab]   = useState("curses");   // curses | restoration

  const tribe = selectedTribe ? TRIBES.find(t=>t.name===selectedTribe) : null;

  const SECTION_META = [
    { key:"prophecies",   label:"Tribal Prophecies",              color:"#C4893A", icon:"📜", bg:"rgba(196,137,58,0.1)"  },
    { key:"curses",       label:"Covenant Curses & Scattering",   color:"#8B3A2A", icon:"⛓️", bg:"rgba(139,58,42,0.08)" },
    { key:"restoration",  label:"Restoration Prophecies",          color:"#5A7A52", icon:"🌿", bg:"rgba(90,122,82,0.08)" },
    { key:"apocrypha",    label:"Apocrypha References",            color:"#7B5EA7", icon:"📚", bg:"rgba(123,94,167,0.08)" },
    { key:"location",     label:"Prophecies of Where This Tribe Would Dwell", color:"#1B3A5C", icon:"🗺️", bg:"rgba(27,58,92,0.06)" },
  ];

  return (
    <div>
      <div className="ai-section-hero">
        <div className="ai-eyebrow">✦ THE COVENANT FAMILY · LEVITICUS 23 · GENESIS 49</div>
        <h2 className="ai-hero-h1">{t.tribesTitle||"The 12 Tribes of Israel"}</h2>
        <p className="ai-hero-sub">Each tribe carries a name, a territory, a gemstone, and a prophetic destiny. Click any card to open the full scripture database — tribal prophecies, covenant curses, restoration promises, and Apocrypha references — all in one place.</p>
        <div style={{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginTop:"1.25rem"}}>
          <button className="btn-gold" onClick={() => setPage && setPage("deut28")}>📖 Study Deut. 28 Module</button>
          <button className="btn-outline-light" onClick={() => setPage && setPage("historical")}>🏛️ Historical Context</button>
        </div>
      </div>

      {/* Breastplate Visual */}
      <div className="breastplate-wrap">
        <div className="breastplate-title">THE BREASTPLATE OF AARON — EXODUS 28:17-20</div>
        <div className="breastplate-sub">Four rows · Three stones each · All twelve tribes before the Most High</div>
        <div className="breastplate-grid">
          {TRIBES.map(t => (
            <div key={t.name} className="bp-stone" style={{background:`${t.color}CC`}} onClick={()=>setSelectedTribe(selectedTribe===t.name?null:t.name)}>
              <span className="bp-stone-emoji">{t.gemEmoji}</span>
              <div className="bp-stone-name">{t.name}</div>
              <div className="bp-stone-gem">{t.gem}</div>
            </div>
          ))}
        </div>
      </div>

      {/* Selected tribe quick-view panel */}
      <AnimatePresence mode="wait">
        {tribe && (
          <motion.div key={tribe.name} initial={{opacity:0,y:12}} animate={{opacity:1,y:0}} exit={{opacity:0}} transition={{duration:0.22}}
            style={{background:"white",border:`2px solid ${tribe.color}`,borderRadius:"18px",padding:"1.75rem",marginBottom:"1.5rem",boxShadow:"var(--shadow-lg)"}}>
            <div style={{display:"flex",alignItems:"center",gap:"1rem",marginBottom:"1.25rem",flexWrap:"wrap"}}>
              <div style={{width:"56px",height:"56px",borderRadius:"15px",background:tribe.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.8rem",flexShrink:0}}>{tribe.symbol}</div>
              <div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.4rem",color:tribe.color,fontWeight:700}}>{tribe.name}</div>
                <div style={{fontSize:"0.82rem",color:"var(--muted)"}}>{tribe.patriarch}</div>
              </div>
              <div style={{marginLeft:"auto",fontFamily:"'Cinzel',serif",fontSize:"2rem"}}>{tribe.gemEmoji}</div>
              <button onClick={()=>setSelectedTribe(null)} style={{background:"none",border:"1px solid var(--border)",borderRadius:"7px",padding:"0.3rem 0.6rem",cursor:"pointer",color:"var(--muted)"}}>✕</button>
            </div>
            <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(180px,1fr))",gap:"0.9rem",marginBottom:"1.1rem"}}>
              {[["Gemstone",tribe.gem],["Territory",tribe.territory],["Key Scripture",tribe.keyVerse]].map(([label,val])=>(
                <div key={label} style={{background:"var(--cream)",borderRadius:"10px",padding:"0.75rem 1rem"}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.14em",color:"var(--muted)",marginBottom:"0.28rem"}}>{label}</div>
                  <div style={{fontSize:"0.84rem",color:"var(--ink)",fontWeight:700}}>{val}</div>
                </div>
              ))}
            </div>
            <div style={{padding:"0.9rem 1.1rem",background:tribe.color+"15",borderRadius:"11px",borderLeft:`4px solid ${tribe.color}`,fontFamily:"'Cormorant Garamond',serif",fontSize:"0.95rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.72}}>
              Notable: {tribe.notable}
            </div>
          </motion.div>
        )}
      </AnimatePresence>

      {/* Tribe cards grid — each with expandable scripture accordion */}
      <div className="tribes-grid">
        {TRIBES.map(t => {
          const scripts = TRIBE_SCRIPTURES[t.name] || {};
          const isOpen = openAccordion === t.name;
          return (
            <div key={t.name} className="tribe-card" style={{cursor:"default"}}>
              {/* Card header — click to select for detail panel */}
              <div className="tribe-card-header" style={{background:t.color,cursor:"pointer"}} onClick={()=>setSelectedTribe(selectedTribe===t.name?null:t.name)}>
                <div className="tribe-icon">{t.symbol}</div>
                <div>
                  <div className="tribe-name">{t.name}</div>
                  <div className="tribe-gem">{t.gem} {t.gemEmoji}</div>
                </div>
              </div>
              {/* Card body */}
              <div className="tribe-card-body">
                <div className="tribe-row"><span className="tribe-label">PATRIARCH</span><span className="tribe-value">{t.patriarch}</span></div>
                <div className="tribe-row"><span className="tribe-label">TERRITORY</span><span className="tribe-value">{t.territory}</span></div>
                <div className="tribe-row"><span className="tribe-label">SCRIPTURE</span><span className="tribe-value" style={{color:"#C97D1A",fontFamily:"'Cinzel',serif",fontSize:"0.72rem"}}>{t.keyVerse}</span></div>
                <div className="tribe-scripture">{t.notable}</div>
              </div>

              {/* Accordion toggle button */}
              <button className="tribe-accordion-btn"
                onClick={() => setOpenAccordion(isOpen ? null : t.name)}>
                <span>View Prophecies & Scriptures</span>
                <span style={{fontSize:"0.7rem",transition:"transform 0.25s",display:"inline-block",transform:isOpen?"rotate(180deg)":"rotate(0deg)"}}>▼</span>
              </button>

              {/* Accordion content */}
              <AnimatePresence>
                {isOpen && (
                  <motion.div className="tribe-accordion-content"
                    initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}}
                    exit={{opacity:0,height:0}} transition={{duration:0.25,ease:"easeInOut"}}>
                    {SECTION_META.map(sec => {
                      const raw = scripts[sec.key];
                      if (!raw) return null;
                      // Location is a special object with theme + refs array
                      if (sec.key === "location") {
                        return (
                          <div key={sec.key} className="tribe-scripture-section" style={{background:sec.bg}}>
                            <div className="tribe-section-label" style={{color:sec.color}}>{sec.icon} {sec.label}</div>
                            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.06em",color:sec.color,marginBottom:"0.6rem",fontStyle:"italic"}}>{raw.theme}</div>
                            <div style={{display:"grid",gap:"0.4rem"}}>
                              {(raw.refs||[]).map((ref,i) => (
                                <div key={i} style={{background:"white",borderRadius:"8px",padding:"0.5rem 0.75rem",borderLeft:`3px solid ${sec.color}`,fontSize:"0.8rem",color:"var(--ink)",lineHeight:1.6}}>{ref}</div>
                              ))}
                            </div>
                          </div>
                        );
                      }
                      // Standard array sections
                      const refs = Array.isArray(raw) ? raw : [];
                      if (!refs.length) return null;
                      return (
                        <div key={sec.key} className="tribe-scripture-section" style={{background:sec.bg}}>
                          <div className="tribe-section-label" style={{color:sec.color}}>
                            {sec.icon} {sec.label}
                          </div>
                          <div style={{display:"flex",flexWrap:"wrap",gap:"0.35rem"}}>
                            {refs.map((ref,i) => (
                              <button key={i} onClick={() => goToScripture && goToScripture(ref)}
                                className="tribe-scripture-item scripture-btn"
                                style={{background:`${sec.color}15`,border:`1px solid ${sec.color}35`,color:sec.color}}>
                                📖 {ref}
                              </button>
                            ))}
                          </div>
                        </div>
                      );
                    })}
                  </motion.div>
                )}
              </AnimatePresence>
            </div>
          );
        })}
      </div>

      {/* Shared Covenant Section */}
      <div style={{marginTop:"2.5rem"}}>
        <div className="section-eyebrow" style={{marginBottom:"0.5rem"}}>⚖️ SHARED COVENANT · ALL TWELVE TRIBES</div>
        <h3 style={{fontFamily:"'Cinzel',serif",fontSize:"1.3rem",color:"var(--ink)",marginBottom:"0.4rem"}}>The Covenant Curses & Restoration</h3>
        <p style={{fontSize:"0.84rem",color:"var(--muted)",marginBottom:"1.25rem",lineHeight:1.75}}>These scriptures apply to all twelve tribes collectively — the covenant consequences of national disobedience, and the restoration promises that follow repentance.</p>

        {/* Tab toggle */}
        <div style={{display:"flex",gap:"0",marginBottom:"1.5rem",border:"1px solid var(--border)",borderRadius:"10px",overflow:"hidden",width:"fit-content"}}>
          {[["curses","⛓️ Covenant Curses"],["restoration","🌿 Restoration Promises"]].map(([k,l]) => (
            <button key={k} onClick={()=>setSharedTab(k)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",padding:"0.6rem 1.2rem",border:"none",borderRight:"1px solid var(--border)",background:sharedTab===k?"var(--deep)":"white",color:sharedTab===k?"var(--parchment)":"var(--muted)",cursor:"pointer",transition:"all 0.18s",whiteSpace:"nowrap"}}>
              {l}
            </button>
          ))}
        </div>

        {/* Curse cards */}
        {sharedTab === "curses" && (
          <div style={{display:"grid",gap:"0.75rem"}}>
            {SHARED_COVENANT.curses.map((c,i) => (
              <div key={i} className="covenant-curse-card" style={{borderLeftColor:"#8B3A2A"}}>
                <div className="covenant-curse-theme" style={{color:"#8B3A2A"}}>⛓️ {c.theme}</div>
                <button className="covenant-curse-ref scripture-btn" style={{background:"rgba(139,58,42,0.08)",border:"1px solid rgba(139,58,42,0.25)",color:"#8B3A2A",marginBottom:"0.35rem"}}
                  onClick={() => goToScripture && goToScripture(c.ref)}>📖 {c.ref}</button>
                <div className="covenant-curse-text">"{c.text}"</div>
              </div>
            ))}
            <div style={{textAlign:"center",marginTop:"0.5rem"}}>
              <button className="btn-gold" onClick={() => setPage && setPage("deut28")}>Study the Full Deuteronomy 28 Module →</button>
            </div>
          </div>
        )}

        {/* Restoration cards */}
        {sharedTab === "restoration" && (
          <div style={{display:"grid",gap:"0.75rem"}}>
            {SHARED_COVENANT.restoration.map((r,i) => (
              <div key={i} className="covenant-curse-card" style={{borderLeftColor:"#5A7A52"}}>
                <div className="covenant-curse-theme" style={{color:"#5A7A52"}}>🌿 {r.theme}</div>
                <button className="covenant-curse-ref scripture-btn" style={{background:"rgba(90,122,82,0.08)",border:"1px solid rgba(90,122,82,0.25)",color:"#5A7A52",marginBottom:"0.35rem"}}
                  onClick={() => goToScripture && goToScripture(r.ref)}>📖 {r.ref}</button>
                <div className="covenant-curse-text">"{r.text}"</div>
              </div>
            ))}
          </div>
        )}
      </div>

      <div style={{textAlign:"center",marginTop:"2rem",padding:"1.5rem",background:"var(--cream)",borderRadius:"14px",border:"1px solid var(--border)"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.16em",color:"#1B3A5C",marginBottom:"0.5rem"}}>REVELATION 21:12</div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.15rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.72,maxWidth:"500px",margin:"0 auto"}}>"And had a wall great and high, and had twelve gates, and at the gates twelve angels, and names written thereon, which are the names of the twelve tribes of the children of Israel."</div>
      </div>
    </div>
  );
}

// ─── DEUTERONOMY 28 STUDY MODULE PAGE ────────────────────────────────────────
function Deut28Page({ setPage, goToScripture, t }) {
  const [openTheme, setOpenTheme] = useState(null);

  return (
    <div>
      <div className="ai-section-hero">
        <div className="ai-eyebrow">✦ COVENANT STUDY · DEUTERONOMY 28</div>
        <h2 className="ai-hero-h1">{t.deut28Title||"The Curses of Deuteronomy 28 — Signs & Wonders"}</h2>
        <p className="ai-hero-sub">A structured study of the 12 major themes in Deuteronomy 28:15–68 — the covenant consequences of disobedience — with related scriptures, historical discussion points, and the restoration promise of Deuteronomy 30. The curses are not the end of the story.</p>
        <div style={{background:"rgba(245,238,216,0.1)",border:"1px solid rgba(245,238,216,0.2)",borderRadius:"12px",padding:"1rem 1.25rem",marginTop:"1.25rem",maxWidth:"540px"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.14em",color:"var(--gold-light)",marginBottom:"0.35rem"}}>KEY SCRIPTURE</div>
          <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.05rem",fontStyle:"italic",color:"rgba(245,238,216,0.85)",lineHeight:1.72}}>"Moreover all these curses shall come upon thee… and they shall be upon thee for a sign and for a wonder, and upon thy seed for ever." <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.08em",color:"var(--gold-light)"}}>— Deuteronomy 28:45-46</span></div>
        </div>
      </div>

      {/* Teaching principle banner */}
      <div style={{background:"var(--deep)",borderRadius:"14px",padding:"1.1rem 1.6rem",marginBottom:"2rem",display:"flex",gap:"1rem",alignItems:"flex-start",flexWrap:"wrap"}}>
        <span style={{fontSize:"1.4rem",flexShrink:0}}>⚖️</span>
        <div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.16em",color:"var(--gold-light)",marginBottom:"0.35rem"}}>TEACHING PRINCIPLE</div>
          <div style={{fontSize:"0.86rem",color:"rgba(250,246,238,0.8)",lineHeight:1.78}}>
            Always study Deuteronomy 28 alongside Deuteronomy 30. The covenant arc is: <strong style={{color:"var(--gold-light)"}}>Disobedience → Captivity → Repentance → Restoration.</strong> The curses are a covenant warning — not abandonment. God's promises to Israel are eternal.
          </div>
        </div>
      </div>

      {/* Theme accordion cards */}
      {DEUT28_THEMES.map(theme => {
        const isOpen = openTheme === theme.id;
        return (
          <div key={theme.id} className="deut28-card">
            <div className="deut28-header" onClick={() => setOpenTheme(isOpen ? null : theme.id)}>
              <div className="deut28-icon-wrap" style={{background:`${theme.color}18`,border:`1px solid ${theme.color}33`}}>
                {theme.icon}
              </div>
              <div style={{flex:1}}>
                <div className="deut28-num" style={{color:theme.color}}>THEME {theme.num}</div>
                <div className="deut28-title">{theme.title}</div>
                <div className="deut28-ref" style={{color:theme.color}}>{theme.mainVerse}</div>
              </div>
              <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",color:"var(--muted)",flexShrink:0,transition:"transform 0.25s",display:"inline-block",transform:isOpen?"rotate(180deg)":"rotate(0deg)",marginTop:"4px"}}>▼</span>
            </div>

            <AnimatePresence>
              {isOpen && (
                <motion.div className="deut28-body" initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.25}}>
                  {/* Main verse */}
                  <div className="deut28-verse-block">
                    "{theme.mainText}"
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",color:"var(--gold)",marginTop:"0.55rem",fontStyle:"normal"}}>{theme.mainVerse}</div>
                  </div>

                  {/* Related scriptures */}
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"var(--muted)",marginBottom:"0.55rem",marginTop:"1rem"}}>RELATED SCRIPTURES</div>
                  <div className="deut28-related">
                    {theme.related.map((r,i) => (
                      <button key={i} className="deut28-related-tag" onClick={() => goToScripture && goToScripture(r)}>📖 {r}</button>
                    ))}
                  </div>

                  {/* Historical note */}
                  {theme.historicalNote && (
                    <>
                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"#1B3A5C",marginBottom:"0.55rem",marginTop:"1rem"}}>HISTORICAL NOTE</div>
                      <div className="deut28-hist">{theme.historicalNote}</div>
                    </>
                  )}

                  {/* Discussion questions */}
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.6rem",marginTop:"1rem"}}>SHABBAT DISCUSSION TOPICS</div>
                  {theme.discussion.map((d,i) => (
                    <div key={i} className="deut28-discussion-item">💬 {d}</div>
                  ))}

                  {/* Anchor scripture */}
                  <div style={{marginTop:"1rem",display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"wrap"}}>
                    <div className="deut28-anchor">
                      <span>✦</span> ANCHOR: {theme.anchor}
                    </div>
                    <span style={{fontSize:"0.78rem",color:"var(--muted)"}}>Bring this to your next Shabbat class</span>
                  </div>
                </motion.div>
              )}
            </AnimatePresence>
          </div>
        );
      })}

      {/* Bottom CTA */}
      <div style={{background:"linear-gradient(135deg,var(--deep),#3A2A18)",borderRadius:"18px",padding:"2rem",textAlign:"center",marginTop:"2rem",color:"var(--parchment)"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.18em",color:"var(--gold-light)",marginBottom:"0.5rem"}}>DEUTERONOMY 30:1-3</div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.2rem",fontStyle:"italic",lineHeight:1.8,marginBottom:"1.25rem",maxWidth:"500px",margin:"0 auto 1.25rem"}}>"When thou shalt call them to mind among all the nations… then the LORD thy God will turn thy captivity, and have compassion upon thee."</div>
        <div style={{display:"flex",gap:"0.75rem",justifyContent:"center",flexWrap:"wrap"}}>
          <button className="btn-gold" onClick={() => setPage && setPage("ai-tribes")}>← Return to 12 Tribes</button>
          <button className="btn-outline-light" onClick={() => setPage && setPage("historical")}>🏛️ Historical Context</button>
        </div>
      </div>
    </div>
  );
}

// ─── HISTORICAL CONTEXT PAGE ──────────────────────────────────────────────────
function HistoricalContextPage({ setPage, t }) {
  const [openEntry, setOpenEntry] = useState(null);

  return (
    <div>
      <div className="ai-section-hero">
        <div className="ai-eyebrow">✦ DOCUMENTED HISTORY · RESPONSIBLE SCHOLARSHIP</div>
        <h2 className="ai-hero-h1">{t.histTitle||"Historical Context"}</h2>
        <p className="ai-hero-sub">A scripture-grounded study of documented historical events — papal bulls, colonial treaties, and the modern State of Israel — situated alongside the prophetic framework of the Hebrew scriptures. All claims are grounded in documented historical sources.</p>
      </div>

      <div style={{background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"14px",padding:"1.1rem 1.6rem",marginBottom:"2rem",display:"flex",gap:"0.9rem",alignItems:"flex-start"}}>
        <span style={{fontSize:"1.2rem",flexShrink:0}}>📌</span>
        <div style={{fontSize:"0.84rem",color:"var(--ink)",lineHeight:1.78}}>
          <strong>Teaching approach:</strong> This module presents documented historical facts first, then invites theological reflection. Claims are clearly labeled as documented, disputed, or discussion-based. Members are encouraged to do their own research using primary and reputable sources.
        </div>
      </div>

      {HISTORICAL_CONTEXT_ENTRIES.map(entry => {
        const isOpen = openEntry === entry.id;
        return (
          <div key={entry.id} className="hist-entry">
            <div className="hist-entry-header" style={{borderBottom:`3px solid ${entry.color}`,cursor:"pointer"}} onClick={() => setOpenEntry(isOpen ? null : entry.id)}>
              <div style={{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"1rem"}}>
                <div>
                  <div className="hist-era" style={{color:entry.color}}>{entry.icon} {entry.era}</div>
                  <div className="hist-title">{entry.title}</div>
                  <div className="hist-sub">{entry.subtitle}</div>
                </div>
                <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",color:"var(--muted)",flexShrink:0,transition:"transform 0.25s",display:"inline-block",transform:isOpen?"rotate(180deg)":"rotate(0deg)",marginTop:"4px"}}>▼</span>
              </div>
            </div>

            <AnimatePresence>
              {isOpen && (
                <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.25}}>
                  {/* Timeline */}
                  <div className="hist-timeline">
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:entry.color,marginBottom:"0.9rem"}}>DOCUMENTED TIMELINE</div>
                    {entry.events.map((ev,i) => (
                      <div key={i} className="hist-event-row">
                        <span className="hist-year-badge" style={{background:entry.color}}>{ev.year}</span>
                        <div>
                          <div className="hist-event-label">{ev.label}</div>
                          <div className="hist-event-desc">{ev.desc}</div>
                        </div>
                      </div>
                    ))}
                  </div>

                  {/* Historical note */}
                  <div className="hist-note">
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"#1B3A5C",marginBottom:"0.45rem"}}>📋 HISTORICAL NOTE</div>
                    {entry.historicalNote}
                  </div>

                  {/* Important note */}
                  {entry.important && (
                    <div className="hist-important">
                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"var(--gold)",marginBottom:"0.4rem"}}>⚠️ IMPORTANT — RESPONSIBLE TEACHING</div>
                      {entry.important}
                    </div>
                  )}

                  {/* Anchor scriptures */}
                  <div className="hist-scriptures">
                    <div style={{width:"100%",fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"var(--gold)",marginBottom:"0.55rem"}}>📖 REFLECTIVE SCRIPTURES</div>
                    {entry.scriptures.map((s,i) => (
                      <button key={i} onClick={() => setPage && setPage("bible-passage")}
                        className="scripture-btn" style={{border:`1px solid ${entry.color}44`,background:`${entry.color}10`,color:entry.color}}>
                        📖 {s}
                      </button>
                    ))}
                  </div>

                  {/* Discussion */}
                  <div className="hist-discussion">
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"var(--gold)",marginBottom:"0.65rem"}}>💬 SHABBAT DISCUSSION QUESTIONS</div>
                    {entry.discussion.map((d,i) => (
                      <div key={i} className="hist-discussion-item">
                        <span style={{flexShrink:0,marginTop:"2px"}}>→</span> {d}
                      </div>
                    ))}
                    <div style={{fontSize:"0.75rem",color:"var(--muted)",marginTop:"0.85rem",fontStyle:"italic"}}>Source: {entry.source}</div>
                  </div>
                </motion.div>
              )}
            </AnimatePresence>
          </div>
        );
      })}

      <div style={{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginTop:"2rem",justifyContent:"center"}}>
        <button className="btn-gold" onClick={() => setPage && setPage("ai-tribes")}>← 12 Tribes Page</button>
        <button className="btn-outline" onClick={() => setPage && setPage("deut28")}>📖 Deut. 28 Module</button>
        <button className="btn-outline" onClick={() => setPage && setPage("ai-timeline")}>🗺️ Ancient Timeline</button>
      </div>
    </div>
  );
}



// ─── 7 CAPTIVITIES PAGE ──────────────────────────────────────────────────────
const CAPTIVITY_TYPE_COLORS = { bondage:"#C4893A", exile:"#8B3A2A", dominion:"#7B5EA7", persecution:"#1B3A5C", diaspora:"#2E7D32", restoration:"#5A7A52" };

function CaptivitiesPage({ setPage, goToScripture, t }) {
  const [openCard, setOpenCard] = useState(null);

  return (
    <div>
      <div className="ai-section-hero">
        <div className="ai-eyebrow">✦ COVENANT HISTORY · FROM EGYPT TO THE DIASPORA</div>
        <h2 className="ai-hero-h1">{t.captivTitle||"The 7 Major Captivities of Israel"}</h2>
        <p className="ai-hero-sub">{t.captivSub||"A scripture-first timeline of Israel's major captivities — from Egyptian bondage to the long diaspora."} Each captivity carries covenant significance, prophetic fulfillment, and the promise of restoration. The captivities are not the end of the story.</p>
        <div style={{background:"rgba(245,238,216,0.1)",border:"1px solid rgba(245,238,216,0.2)",borderRadius:"12px",padding:"1rem 1.25rem",marginTop:"1.25rem",maxWidth:"580px"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"var(--gold-light)",marginBottom:"0.3rem"}}>ANCHOR SCRIPTURE · DEUTERONOMY 28:46</div>
          <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.05rem",fontStyle:"italic",color:"rgba(245,238,216,0.82)",lineHeight:1.72}}>"And they shall be upon thee for a sign and for a wonder, and upon thy seed for ever."</div>
        </div>
      </div>

      {/* Visual timeline bar */}
      <div style={{background:"white",borderRadius:"16px",padding:"1.25rem 1.5rem",marginBottom:"2rem",border:"1px solid var(--border)",boxShadow:"var(--shadow)",overflowX:"auto"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.9rem"}}>COVENANT TIMELINE OVERVIEW</div>
        <div style={{display:"flex",alignItems:"center",gap:0,minWidth:"max-content"}}>
          {CAPTIVITIES_DATA.filter(c=>c.id!=="regather").map((c,i,arr) => (
            <div key={c.id} style={{display:"flex",alignItems:"center"}}>
              <div onClick={()=>setOpenCard(openCard===c.id?null:c.id)}
                style={{padding:"0.45rem 0.9rem",borderRadius:"20px",background:c.color,color:"white",cursor:"pointer",fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",whiteSpace:"nowrap",transition:"all 0.18s",transform:openCard===c.id?"scale(1.08)":"scale(1)",boxShadow:openCard===c.id?"0 4px 12px rgba(0,0,0,0.2)":"none"}}>
                {c.icon} {c.dates}
              </div>
              {i < arr.length-1 && <div style={{width:"20px",height:"2px",background:"var(--border)",flexShrink:0}} />}
            </div>
          ))}
          <div style={{display:"flex",alignItems:"center"}}>
            <div style={{width:"20px",height:"2px",background:"var(--sage)",flexShrink:0}} />
            <div style={{padding:"0.45rem 0.9rem",borderRadius:"20px",background:"#5A7A52",color:"white",fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",whiteSpace:"nowrap"}}>✨ Restoration</div>
          </div>
        </div>
      </div>

      {/* Captivity cards */}
      {CAPTIVITIES_DATA.map(c => {
        const isOpen = openCard === c.id;
        const isRestoration = c.type === "restoration";
        return (
          <div key={c.id} style={{background:"white",borderRadius:"18px",overflow:"hidden",boxShadow:"var(--shadow)",border:"1px solid var(--border)",marginBottom:"1rem",borderTop:`3px solid ${c.color}`}}>
            <div style={{padding:"1.25rem 1.6rem",display:"flex",alignItems:"flex-start",gap:"1rem",cursor:"pointer",transition:"background 0.15s"}} onClick={()=>setOpenCard(isOpen?null:c.id)}>
              <div style={{width:"48px",height:"48px",borderRadius:"14px",background:`${c.color}18`,border:`1px solid ${c.color}33`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.4rem",flexShrink:0}}>{c.icon}</div>
              <div style={{flex:1}}>
                <div style={{display:"flex",alignItems:"center",gap:"0.55rem",marginBottom:"0.2rem",flexWrap:"wrap"}}>
                  {!isRestoration && <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.14em",color:c.color}}>CAPTIVITY {c.num}</span>}
                  <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.1em",padding:"0.15rem 0.5rem",borderRadius:"20px",background:`${CAPTIVITY_TYPE_COLORS[c.type]||c.color}18`,color:CAPTIVITY_TYPE_COLORS[c.type]||c.color,border:`1px solid ${c.color}33`}}>{c.type}</span>
                  <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",color:"var(--muted)"}}>{c.dates}</span>
                </div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.9rem",letterSpacing:"0.04em",color:"var(--ink)",marginBottom:"0.18rem",lineHeight:1.3}}>{c.title}</div>
                <div style={{fontSize:"0.8rem",color:"var(--muted)",lineHeight:1.6,maxWidth:"600px"}}>{c.summary.substring(0,120)}…</div>
              </div>
              <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",color:"var(--muted)",flexShrink:0,transition:"transform 0.25s",display:"inline-block",transform:isOpen?"rotate(180deg)":"rotate(0deg)",marginTop:"4px"}}>▼</span>
            </div>

            <AnimatePresence>
              {isOpen && (
                <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.25}}
                  style={{borderTop:"1px solid var(--border)"}}>
                  <div style={{padding:"1.25rem 1.6rem"}}>
                    {/* Full summary */}
                    <div style={{fontSize:"0.88rem",color:"var(--ink)",lineHeight:1.88,marginBottom:"1.25rem"}}>{c.summary}</div>

                    {/* Scriptures */}
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:c.color,marginBottom:"0.6rem"}}>KEY SCRIPTURES</div>
                    <div style={{display:"flex",flexWrap:"wrap",gap:"0.4rem",marginBottom:"1.25rem"}}>
                      {c.scriptures.map((s,i) => (
                        <button key={i} onClick={() => goToScripture && goToScripture(s)}
                          className="scripture-btn" style={{background:`${c.color}12`,border:`1px solid ${c.color}30`,color:c.color}}>
                          📖 {s}
                        </button>
                      ))}
                    </div>

                    {/* Teaching point */}
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:c.color,marginBottom:"0.5rem"}}>TEACHING POINT</div>
                    <div style={{background:"var(--deep)",color:"var(--parchment)",borderRadius:"12px",padding:"1rem 1.25rem",borderLeft:`4px solid ${c.color}`,fontFamily:"'Cormorant Garamond',serif",fontSize:"1.05rem",fontStyle:"italic",lineHeight:1.72,marginBottom:"1.1rem"}}>{c.teaching}</div>

                    {/* Covenant significance */}
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"#1B3A5C",marginBottom:"0.5rem"}}>COVENANT SIGNIFICANCE</div>
                    <div style={{background:"rgba(27,58,92,0.05)",borderRadius:"11px",padding:"0.9rem 1.1rem",borderLeft:"3px solid #1B3A5C",fontSize:"0.84rem",color:"var(--ink)",lineHeight:1.8,marginBottom:"1.1rem"}}>{c.significance}</div>

                    {/* Prophetic */}
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.5rem"}}>PROPHETIC CONNECTION</div>
                    <div style={{background:"var(--cream)",borderRadius:"11px",padding:"0.9rem 1.1rem",border:"1px solid var(--border)",fontSize:"0.84rem",color:"var(--ink)",lineHeight:1.8,marginBottom: c.hasExpanded ? "1.25rem" : "0"}}>{c.prophetic}</div>

                    {/* DIASPORA EXPANDED — Covenant Identity Flow */}
                    {c.id === "diaspora" && (
                      <>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.18em",color:c.color,margin:"1.5rem 0 0.9rem",display:"flex",alignItems:"center",gap:"0.55rem"}}>
                          🌍 COVENANT IDENTITY FLOW — 8 TEACHING STAGES
                          <span style={{flex:1,height:"1px",background:"var(--border)"}} />
                        </div>
                        {DIASPORA_FLOW.map(sec => {
                          const typeColors = {covenant:"#C4893A",warning:"#8B3A2A",identity:"#7B5EA7",oppression:"#6D4C41",captivity:"#C0392B",remembrance:"#2980B9",restoration:"#5A7A52",foundation:"#1B3A5C"};
                          const tc = typeColors[sec.type] || c.color;
                          return (
                            <div key={sec.id} className="diaspora-flow-item" style={{borderLeftColor:tc}}>
                              <div className="diaspora-flow-label" style={{color:tc}}>{sec.label}</div>
                              <div className="diaspora-flow-summary">{sec.summary}</div>
                              <div style={{display:"flex",flexWrap:"wrap",gap:"0.35rem",marginBottom:"0.5rem"}}>
                                {sec.scriptures.map((s,i) => <button key={i} onClick={() => goToScripture && goToScripture(s)} className="scripture-btn" style={{background:`${tc}10`,border:`1px solid ${tc}30`,color:tc}}>📖 {s}</button>)}
                              </div>
                              {sec.note && <div className="diaspora-flow-note">{sec.note}</div>}
                              {sec.resources && <ResourceLinks links={sec.resources} title="RESOURCES" />}
                            </div>
                          );
                        })}

                        {/* Migration Traditions */}
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.18em",color:c.color,margin:"1.5rem 0 0.9rem",display:"flex",alignItems:"center",gap:"0.55rem"}}>
                          🧭 MIGRATION TRADITIONS OF THE LOST TRIBES
                          <span style={{flex:1,height:"1px",background:"var(--border)"}} />
                        </div>
                        <div style={{background:"rgba(196,137,58,0.06)",border:"1px solid rgba(196,137,58,0.2)",borderRadius:"12px",padding:"0.85rem 1.1rem",marginBottom:"0.9rem",fontSize:"0.8rem",color:"var(--muted)",lineHeight:1.75}}>
                          ⚠️ <strong style={{color:"var(--ink)"}}>Teaching Note:</strong> This section contains a mix of scripture, apocrypha, and historical interpretation. Migration theories about the lost tribes are presented as study traditions — not settled fact. Each item is labeled accordingly.
                        </div>
                        {MIGRATION_TRADITIONS.map(sec => {
                          const typeColors = {interpretation:"#C97D1A",historical:"#1B3A5C",geography:"#2E7D32",captivity:"#8B3A2A",restoration:"#5A7A52"};
                          const tc = typeColors[sec.type] || c.color;
                          return (
                            <div key={sec.id} className="diaspora-flow-item" style={{borderLeftColor:tc}}>
                              <div style={{display:"flex",gap:"0.5rem",alignItems:"center",marginBottom:"0.35rem",flexWrap:"wrap"}}>
                                <div className="diaspora-flow-label" style={{color:tc,marginBottom:0}}>{sec.label}</div>
                                <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",padding:"0.15rem 0.45rem",borderRadius:"20px",background:`${tc}15`,border:`1px solid ${tc}33`,color:tc}}>{sec.type === "interpretation" ? "Historical Interpretation" : sec.type}</span>
                              </div>
                              <div className="diaspora-flow-summary">{sec.summary}</div>
                              <div style={{display:"flex",flexWrap:"wrap",gap:"0.35rem",marginBottom:"0.4rem"}}>
                                {[...(sec.scriptures||[]),...(sec.apocrypha||[])].map((s,i) => (
                                  <button key={i} onClick={() => goToScripture && goToScripture(s)} className="scripture-btn" style={{background:`${tc}10`,border:`1px solid ${tc}30`,color:tc}}>📖 {s}</button>
                                ))}
                              </div>
                              {sec.note && <div className="diaspora-flow-note">{sec.note}</div>}
                              {sec.resources && <ResourceLinks links={sec.resources} title="RESOURCES" />}
                            </div>
                          );
                        })}
                      </>
                    )}
                  </div>

                  {/* Resource links for all captivity cards */}
                  {c.resources && <ResourceLinks links={c.resources} title="RESOURCES / EVIDENCE" />}

                  {/* Per-captivity auto resources */}
                  {!c.resources && c.id === "assyria" && <ResourceLinks links={MASTER_RESOURCES.assyria} title="RESOURCES / EVIDENCE" />}
                  {!c.resources && c.id === "babylon" && <ResourceLinks links={MASTER_RESOURCES.babylon} title="RESOURCES / EVIDENCE" />}
                  {!c.resources && c.id === "rome" && <ResourceLinks links={MASTER_RESOURCES.rome} title="RESOURCES / EVIDENCE" />}
                  {!c.resources && c.id === "regather" && <ResourceLinks links={MASTER_RESOURCES.scripture} title="SCRIPTURE RESOURCES" />}
                </motion.div>
              )}
            </AnimatePresence>
          </div>
        );
      })}

      {/* Bottom banner */}
      <div style={{background:"linear-gradient(135deg,var(--deep),#3A2A18)",borderRadius:"18px",padding:"2rem",textAlign:"center",marginTop:"1.5rem",color:"var(--parchment)"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.18em",color:"var(--gold-light)",marginBottom:"0.5rem"}}>DEUTERONOMY 30:3</div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.2rem",fontStyle:"italic",lineHeight:1.8,marginBottom:"1.25rem",maxWidth:"500px",margin:"0 auto 1.25rem"}}>"Then the LORD thy God will turn thy captivity, and have compassion upon thee, and will return and gather thee from all the nations."</div>
        <div style={{display:"flex",gap:"0.75rem",justifyContent:"center",flexWrap:"wrap"}}>
          <button className="btn-gold" onClick={()=>setPage&&setPage("deut28")}>📖 Study Deut. 28 Module</button>
          <button className="btn-outline-light" onClick={()=>setPage&&setPage("ai-tribes")}>12 Tribes Page</button>
        </div>
      </div>
    </div>
  );
}

// ─── WOMEN'S STUDY PAGE ───────────────────────────────────────────────────────
function WomenPage({ setPage, goToScripture, t }) {
  const [activeTab, setActiveTab] = useState("path"); // path | laws | profiles | prayer
  const [openLawCard, setOpenLawCard] = useState(null);
  const [openLawSection, setOpenLawSection] = useState(null);
  const [expandedSections, setExpandedSections] = useState({});
  const [activePathStage, setActivePathStage] = useState(1);
  const [activeProfile, setActiveProfile] = useState(null);
  const [prayerReq, setPrayerReq] = useState("");
  const [prayerName, setPrayerName] = useState("");
  const [prayerSubmitted, setPrayerSubmitted] = useState(false);
  const [aiExplain, setAiExplain] = useState({}); // { ref: text }
  const [aiLoading, setAiLoading] = useState({});
  const [showAllScriptures, setShowAllScriptures] = useState({});

  const lang = "en"; // inherited from t object context
  const TABS = [
    { key:"path",     label:lang==="es"?"🌿 Camino del Pacto":lang==="fr"?"🌿 Chemin de l'Alliance":"🌿 Covenant Path" },
    { key:"laws",     label:lang==="es"?"📜 Leyes":lang==="fr"?"📜 Lois":"📜 Laws for Women" },
    { key:"profiles", label:lang==="es"?"⭐ Mujeres":lang==="fr"?"⭐ Femmes":"⭐ Women of Scripture" },
    { key:"prayer",   label:lang==="es"?"🙏 Oración":lang==="fr"?"🙏 Prière":"🙏 Prayer" },
  ];

  const toggleShowAll = (key) => setShowAllScriptures(s => ({...s, [key]: !s[key]}));

  const explainVerse = async (ref) => {
    if (aiExplain[ref]) return; // already loaded
    setAiLoading(s => ({...s, [ref]: true}));
    try {
      const res = await fetch("https://api.anthropic.com/v1/messages", {
        method:"POST", headers:{"Content-Type":"application/json"},
        body:JSON.stringify({
          model:"claude-sonnet-4-20250514", max_tokens:500,
          messages:[{ role:"user", content:`Explain this Bible verse in plain language for a covenant study student. Include: (1) historical context, (2) Hebrew/Greek meaning if relevant, (3) application for daughters of Israel today. Use "YAHAWAH" for the divine name and "Yahawashi" for the Messiah. Keep it under 120 words.\n\nVerse: ${ref}` }]
        })
      });
      const data = await res.json();
      const text = data.content?.map(c=>c.text||"").join("") || "Unable to load explanation.";
      setAiExplain(s => ({...s, [ref]: text}));
    } catch { setAiExplain(s => ({...s, [ref]: "Unable to load explanation at this time."})); }
    setAiLoading(s => ({...s, [ref]: false}));
  };

  const ScriptureCard = ({ verse, color, goToScripture }) => {
    const [showAI, setShowAI] = useState(false);
    return (
      <div style={{background:"var(--cream)",borderRadius:"12px",padding:"1rem 1.15rem",marginBottom:"0.65rem",border:"1px solid var(--border)",borderLeft:`3px solid ${color||"var(--gold)"}`}}>
        <div style={{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.5rem",marginBottom:"0.45rem"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:color||"var(--gold)",fontWeight:600}}>{verse.ref}</div>
          <div style={{display:"flex",gap:"0.4rem",flexShrink:0}}>
            {goToScripture && (
              <button onClick={()=>goToScripture(verse.ref)} title="Open in Bible reader"
                style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",padding:"0.25rem 0.55rem",borderRadius:"6px",background:"transparent",border:`1px solid ${color||"var(--gold)"}44`,color:color||"var(--gold)",cursor:"pointer"}}>📖</button>
            )}
            <button onClick={()=>{setShowAI(!showAI);if(!showAI&&!aiExplain[verse.ref])explainVerse(verse.ref);}}
              style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",padding:"0.25rem 0.55rem",borderRadius:"6px",background:showAI?`${color||"#C4893A"}22`:"transparent",border:`1px solid ${color||"var(--gold)"}44`,color:color||"var(--gold)",cursor:"pointer"}}>🤖 Explain</button>
            <button onClick={()=>navigator.clipboard&&navigator.clipboard.writeText(`${verse.ref}\n"${verse.text}"`)}
              title="Copy verse"
              style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",padding:"0.25rem 0.55rem",borderRadius:"6px",background:"transparent",border:"1px solid var(--border)",color:"var(--muted)",cursor:"pointer"}}>📋</button>
          </div>
        </div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.78}}>"{verse.text}"</div>
        {showAI && (
          <div style={{marginTop:"0.75rem",background:`${color||"#C4893A"}10`,borderRadius:"9px",padding:"0.75rem 0.9rem",borderTop:"1px solid var(--border)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.14em",color:color||"var(--gold)",marginBottom:"0.35rem"}}>🤖 AI COVENANT EXPLANATION</div>
            {aiLoading[verse.ref] ? (
              <div style={{fontSize:"0.8rem",color:"var(--muted)",fontStyle:"italic"}}>Generating explanation…</div>
            ) : (
              <div style={{fontSize:"0.83rem",color:"var(--ink)",lineHeight:1.8}}>{aiExplain[verse.ref]}</div>
            )}
          </div>
        )}
      </div>
    );
  };

  const currentPath = COVENANT_PATH_WOMEN.find(s=>s.stage===activePathStage)||COVENANT_PATH_WOMEN[0];

  return (
    <div>
      {/* Hero */}
      <div style={{background:"linear-gradient(135deg,#3D0A2A 0%,#6B1A4A 50%,#4A0D35 100%)",borderRadius:"22px",padding:"2.5rem 2rem",marginBottom:"1.5rem",color:"white",position:"relative",overflow:"hidden"}}>
        <div style={{position:"absolute",top:0,right:0,width:"280px",height:"280px",background:"radial-gradient(circle,rgba(255,182,193,0.12) 0%,transparent 70%)",pointerEvents:"none"}} />
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.28em",color:"#F4A7C3",marginBottom:"0.7rem"}}>✦ DAUGHTERS OF THE COVENANT</div>
        <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"clamp(1.5rem,4vw,2.6rem)",fontWeight:700,color:"white",marginBottom:"0.6rem",lineHeight:1.15}}>
          {t.womenHeroTitle||"Women of the Covenant"}
        </h2>
        <p style={{fontSize:"0.88rem",color:"rgba(255,255,255,0.72)",lineHeight:1.8,maxWidth:"500px",marginBottom:"1.1rem"}}>{t.womenHeroSub||"A scripture-first guide for identity, order, and restoration — laws, marriage, motherhood, women of faith, and covenant prophecy."}</p>
        <div style={{display:"flex",gap:"0.65rem",flexWrap:"wrap"}}>
          <button style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",padding:"0.75rem 1.4rem",borderRadius:"9px",background:"#C4893A",color:"white",border:"none",cursor:"pointer"}} onClick={()=>setActiveTab("path")}>🌿 Covenant Path</button>
          <button style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",padding:"0.75rem 1.4rem",borderRadius:"9px",background:"transparent",color:"white",border:"1px solid rgba(255,255,255,0.3)",cursor:"pointer"}} onClick={()=>setActiveTab("laws")}>📜 Laws for Women</button>
          <button style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",padding:"0.75rem 1.4rem",borderRadius:"9px",background:"rgba(255,255,255,0.1)",color:"white",border:"1px solid rgba(255,255,255,0.25)",cursor:"pointer"}} onClick={()=>setActiveTab("profiles")}>⭐ Women of Scripture</button>
        </div>
      </div>

      {/* Opening verse */}
      <div style={{background:"var(--cream)",borderRadius:"14px",padding:"1.25rem 1.6rem",marginBottom:"1.5rem",border:"1px solid var(--border)",textAlign:"center"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"#6B1A4A",marginBottom:"0.4rem"}}>PROVERBS 31:25-26</div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.1rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.78,maxWidth:"500px",margin:"0 auto"}}>"Strength and honour are her clothing; and she shall rejoice in time to come. She openeth her mouth with wisdom; and in her tongue is the law of kindness."</div>
      </div>

      {/* Tab bar */}
      <div style={{display:"flex",gap:"0",marginBottom:"1.75rem",border:"1px solid var(--border)",borderRadius:"12px",overflow:"hidden",flexWrap:"wrap"}}>
        {TABS.map(tab => (
          <button key={tab.key} onClick={()=>setActiveTab(tab.key)}
            style={{flex:1,minWidth:"80px",fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",padding:"0.7rem 0.4rem",border:"none",borderRight:"1px solid var(--border)",background:activeTab===tab.key?"#6B1A4A":"white",color:activeTab===tab.key?"white":"var(--muted)",cursor:"pointer",transition:"all 0.18s",textAlign:"center"}}>
            {tab.label}
          </button>
        ))}
      </div>

      {/* ══════════════════════════════════════════════
          TAB 1: COVENANT PATH — 7 Stages
      ══════════════════════════════════════════════ */}
      {activeTab === "path" && (
        <div>
          {/* Page header */}
          <div style={{marginBottom:"1.35rem"}}>
            <div className="section-eyebrow">✦ {lang==="es"?"UN VIAJE DEL PACTO PARA HIJAS DE ISRAEL":lang==="fr"?"UN VOYAGE D'ALLIANCE POUR LES FILLES D'ISRAËL":"A COVENANT JOURNEY FOR DAUGHTERS OF ISRAEL"}</div>
            <h2 className="section-h2" style={{marginBottom:"0.35rem"}}>
              {lang==="es"?"El Camino del Pacto de las Hijas":lang==="fr"?"Le Chemin de l'Alliance des Filles":"The Daughters of the Covenant Roadmap"}
            </h2>
            <p className="section-body">
              {lang==="es"?"Un viaje de escritura estructurado para hijas del pacto — identidad, carácter, vestimenta, salud, sabiduría, matrimonio y restauración.":lang==="fr"?"Un voyage scripturaire structuré pour les filles de l'alliance — identité, caractère, vêtement, santé, sagesse, mariage et restauration.":"A structured scripture journey for daughters of the covenant — identity, character, dress, health, wisdom, marriage, and restoration."}
            </p>
          </div>

          {/* Stage progress tracker — scrollable chips */}
          <div style={{overflowX:"auto",scrollbarWidth:"none",marginBottom:"1.5rem",paddingBottom:"4px"}}>
            <div style={{display:"flex",gap:"0",minWidth:"max-content",border:"1px solid var(--border)",borderRadius:"12px",overflow:"hidden"}}>
              {COVENANT_PATH_WOMEN.map(stage => (
                <button key={stage.stage}
                  onClick={()=>setActivePathStage(stage.stage)}
                  style={{
                    flexShrink:0, width:"72px", padding:"0.55rem 0.3rem",
                    textAlign:"center", border:"none",
                    borderRight:"1px solid var(--border)",
                    background:activePathStage===stage.stage?"#6B1A4A":"transparent",
                    cursor:"pointer", transition:"all 0.18s",
                    display:"flex", flexDirection:"column", alignItems:"center", gap:"0.18rem"
                  }}>
                  <span style={{fontSize:"1rem"}}>{stage.icon}</span>
                  <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.48rem",letterSpacing:"0.08em",color:activePathStage===stage.stage?"#F4A7C3":"var(--muted)",lineHeight:1}}>{stage.stage}</span>
                  <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.42rem",letterSpacing:"0.04em",color:activePathStage===stage.stage?"rgba(244,167,195,0.8)":"var(--muted)",lineHeight:1.2,maxWidth:"64px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}>{stage.title.split(" ").slice(0,2).join(" ")}</span>
                </button>
              ))}
            </div>
          </div>

          {/* Active stage content */}
          {(() => {
            const currentPath = COVENANT_PATH_WOMEN.find(s=>s.stage===activePathStage)||COVENANT_PATH_WOMEN[0];
            return (
              <div style={{background:"white",borderRadius:"18px",border:"1px solid var(--border)",boxShadow:"var(--shadow)",overflow:"hidden",borderTop:`4px solid ${currentPath.color}`}}>
                {/* Stage header */}
                <div style={{padding:"1.5rem 1.75rem",borderBottom:"1px solid var(--border)"}}>
                  <div style={{display:"inline-flex",alignItems:"center",gap:"0.4rem",background:`${currentPath.color}15`,border:`1px solid ${currentPath.color}33`,borderRadius:"20px",padding:"0.3rem 0.75rem",marginBottom:"0.75rem"}}>
                    <span>{currentPath.icon}</span>
                    <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.14em",color:currentPath.color}}>{lang==="es"?"ETAPA":lang==="fr"?"ÉTAPE":"STAGE"} {currentPath.stage} {lang==="es"?"DE":lang==="fr"?"SUR":"OF"} 12</span>
                  </div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.05rem",letterSpacing:"0.04em",color:"var(--ink)",marginBottom:"0.25rem",lineHeight:1.3}}>
                    {lang==="es"&&currentPath.titleEs ? currentPath.titleEs : lang==="fr"&&currentPath.titleFr ? currentPath.titleFr : currentPath.title}
                  </div>
                  <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.92rem",fontStyle:"italic",color:"var(--muted)",lineHeight:1.65}}>
                    {lang==="es"&&currentPath.subtitleEs ? currentPath.subtitleEs : lang==="fr"&&currentPath.subtitleFr ? currentPath.subtitleFr : currentPath.subtitle}
                  </div>
                </div>

                <div style={{padding:"1.5rem 1.75rem"}}>
                  {/* Study note */}
                  {currentPath.studyNote && (
                    <div style={{background:`${currentPath.color}08`,borderRadius:"12px",padding:"0.9rem 1.1rem",borderLeft:`3px solid ${currentPath.color}`,marginBottom:"1.25rem"}}>
                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.12em",color:currentPath.color,marginBottom:"0.35rem"}}>📖 {lang==="es"?"NOTA DE ESTUDIO":lang==="fr"?"NOTE D'ÉTUDE":"STUDY NOTE"}</div>
                      <div style={{fontSize:"0.85rem",color:"var(--ink)",lineHeight:1.85}}>{currentPath.studyNote}</div>
                    </div>
                  )}

                  {/* Primary scriptures label */}
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.2em",color:currentPath.color,marginBottom:"0.75rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
                    📜 {lang==="es"?"ESCRITURAS PRIMARIAS":lang==="fr"?"ÉCRITURES PRIMAIRES":"PRIMARY SCRIPTURES"} ({currentPath.primaryScriptures.length})
                    <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
                  </div>

                  {/* Scripture cards */}
                  {currentPath.primaryScriptures.map((verse, i) => (
                    <ScriptureCard key={i} verse={verse} color={currentPath.color} goToScripture={goToScripture} />
                  ))}

                  {/* Supporting refs */}
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.16em",color:"var(--muted)",marginTop:"1.1rem",marginBottom:"0.6rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
                    🔗 {lang==="es"?"ESCRITURAS DE APOYO":lang==="fr"?"ÉCRITURES DE SOUTIEN":"SUPPORTING SCRIPTURES"}
                    <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
                  </div>
                  <div style={{display:"flex",flexWrap:"wrap",gap:"0.4rem",marginBottom:"1.25rem"}}>
                    {currentPath.supporting.map((ref,i) => (
                      <button key={i} className="scripture-btn" onClick={()=>goToScripture&&goToScripture(ref)} style={{fontSize:"0.7rem"}}>{ref}</button>
                    ))}
                  </div>

                  {/* Action step */}
                  <div style={{background:`${currentPath.color}08`,border:`1px solid ${currentPath.color}22`,borderRadius:"12px",padding:"1rem 1.25rem",borderLeft:`3px solid ${currentPath.color}`}}>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.14em",color:currentPath.color,marginBottom:"0.4rem"}}>
                      📝 {lang==="es"?"PASO DE ACCIÓN DE ESTA SEMANA":lang==="fr"?"ACTION DE LA SEMAINE":"THIS WEEK'S ACTION STEP"}
                    </div>
                    <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.82}}>{currentPath.action}</div>
                  </div>
                </div>

                {/* Stage navigation */}
                <div style={{padding:"1rem 1.75rem",borderTop:"1px solid var(--border)",background:"var(--cream)",display:"flex",justifyContent:"space-between",alignItems:"center",gap:"0.75rem",flexWrap:"wrap"}}>
                  {activePathStage > 1 ? (
                    <button className="btn-outline" style={{fontSize:"0.65rem",padding:"0.42rem 0.85rem"}} onClick={()=>setActivePathStage(activePathStage-1)}>
                      ← {COVENANT_PATH_WOMEN[activePathStage-2]?.icon} {lang==="es"?"Anterior":lang==="fr"?"Précédent":"Previous"}
                    </button>
                  ) : <div />}
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",color:"var(--muted)"}}>{activePathStage}/12</div>
                  {activePathStage < 12 ? (
                    <button className="btn-gold" style={{fontSize:"0.65rem",padding:"0.42rem 0.85rem"}} onClick={()=>setActivePathStage(activePathStage+1)}>
                      {lang==="es"?"Siguiente":lang==="fr"?"Suivant":"Next"} {COVENANT_PATH_WOMEN[activePathStage]?.icon} →
                    </button>
                  ) : (
                    <button className="btn-gold" style={{fontSize:"0.65rem",padding:"0.42rem 0.85rem"}} onClick={()=>setActivePathStage(1)}>
                      🔄 {lang==="es"?"Comenzar de Nuevo":lang==="fr"?"Recommencer":"Begin Again"}
                    </button>
                  )}
                </div>
              </div>
            );
          })()}

          {/* All 12 stages overview grid */}
          <div style={{marginTop:"2rem"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"#6B1A4A",marginBottom:"1rem",textAlign:"center"}}>
              ✦ {lang==="es"?"LAS 12 ETAPAS DEL CAMINO DEL PACTO":lang==="fr"?"LES 12 ÉTAPES DU CHEMIN DE L'ALLIANCE":"THE FULL 12-STAGE COVENANT PATH"}
            </div>
            <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(165px,1fr))",gap:"0.6rem"}}>
              {COVENANT_PATH_WOMEN.map(stage => (
                <button key={stage.stage} onClick={()=>setActivePathStage(stage.stage)}
                  style={{
                    background:activePathStage===stage.stage?"#6B1A4A":"white",
                    border:`1px solid ${activePathStage===stage.stage?"#6B1A4A":"var(--border)"}`,
                    borderRadius:"13px", padding:"0.9rem", cursor:"pointer",
                    textAlign:"left", transition:"all 0.18s", borderTop:`3px solid ${stage.color}`
                  }}>
                  <div style={{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.3rem"}}>
                    <span style={{fontSize:"1.1rem"}}>{stage.icon}</span>
                    <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.5rem",letterSpacing:"0.1em",color:activePathStage===stage.stage?"#F4A7C3":stage.color}}>{lang==="es"?"ETAPA":lang==="fr"?"ÉTAPE":"STAGE"} {stage.stage}</span>
                  </div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.03em",color:activePathStage===stage.stage?"white":"var(--ink)",lineHeight:1.3}}>
                    {lang==="es"&&stage.titleEs ? stage.titleEs : lang==="fr"&&stage.titleFr ? stage.titleFr : stage.title}
                  </div>
                </button>
              ))}
            </div>
          </div>
        </div>
      )}

      {/* ══════════════════════════════════════════════
          TAB 2: LAWS FOR WOMEN — Full Scripture Database
      ══════════════════════════════════════════════ */}
      {activeTab === "laws" && (
        <div>
          <div style={{marginBottom:"1.25rem"}}>
            <div className="section-eyebrow">📜 LAWS FOR WOMEN</div>
            <h2 className="section-h2">{t.womenLawsFor||"Complete Scripture Database"}</h2>
            <p className="section-body">Every law and commandment in scripture addressed specifically to women — including purity laws, inheritance rights, marriage protections, vows, feast participation, and the mandate of motherhood. Tap any verse to open it in the Bible reader or get an AI explanation.</p>
          </div>

          <div style={{background:"rgba(196,137,58,0.07)",border:"1px solid rgba(196,137,58,0.2)",borderRadius:"10px",padding:"0.65rem 1rem",fontSize:"0.78rem",color:"var(--muted)",lineHeight:1.65,marginBottom:"1.5rem"}}>
            📌 <strong style={{color:"var(--ink)"}}>Study Note:</strong> This database includes Torah law, Apocrypha, and New Testament references. All are labeled by source. Apocrypha books (Sirach, Tobit, Judith, etc.) are included as supported study texts in this community.
          </div>

          {WOMEN_LAWS_STUDY.map(cat => {
            const catOpen = openLawCard === cat.id;
            return (
              <div key={cat.id} style={{background:"white",borderRadius:"18px",overflow:"hidden",boxShadow:"var(--shadow)",border:"1px solid var(--border)",marginBottom:"1.25rem",borderTop:`4px solid ${cat.color}`}}>
                {/* Category header */}
                <div style={{padding:"1.25rem 1.5rem",display:"flex",alignItems:"flex-start",gap:"1rem",cursor:"pointer"}} onClick={()=>setOpenLawCard(catOpen?null:cat.id)}>
                  <div style={{width:"52px",height:"52px",borderRadius:"14px",background:`${cat.color}15`,border:`1px solid ${cat.color}30`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.5rem",flexShrink:0}}>{cat.icon}</div>
                  <div style={{flex:1}}>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.92rem",letterSpacing:"0.04em",color:"var(--ink)",marginBottom:"0.2rem",lineHeight:1.3}}>{cat.title}</div>
                    <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.9rem",fontStyle:"italic",color:"var(--muted)",lineHeight:1.5}}>{cat.subtitle}</div>
                    <div style={{marginTop:"0.4rem",fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.1em",color:cat.color}}>
                      {cat.sections.length} SECTIONS · {cat.sections.reduce((a,s)=>a+(s.primaryScriptures?.length||0),0)} PRIMARY SCRIPTURES
                    </div>
                  </div>
                  <span style={{fontSize:"0.72rem",color:"var(--muted)",transform:catOpen?"rotate(180deg)":"none",transition:"transform 0.25s",flexShrink:0,marginTop:"4px"}}>▲</span>
                </div>

                <AnimatePresence>
                  {catOpen && (
                    <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.28}} style={{borderTop:"1px solid var(--border)"}}>
                      {cat.sections.map((sec, si) => {
                        const sKey = `${cat.id}_${si}`;
                        const secOpen = openLawSection === sKey;
                        const primaryList = sec.primaryScriptures || [];
                        const showAll = showAllScriptures[sKey];
                        const visiblePrimary = showAll ? primaryList : primaryList.slice(0, 4);

                        return (
                          <div key={si} style={{borderBottom:"1px solid var(--border)"}}>
                            {/* Section header */}
                            <div style={{padding:"0.9rem 1.5rem",display:"flex",justifyContent:"space-between",alignItems:"flex-start",cursor:"pointer",gap:"0.75rem",background:secOpen?`${cat.color}06`:"transparent"}}
                              onClick={()=>setOpenLawSection(secOpen?null:sKey)}>
                              <div>
                                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.75rem",letterSpacing:"0.06em",color:cat.color,marginBottom:"0.2rem",lineHeight:1.3}}>{sec.heading}</div>
                                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.08em",color:"var(--muted)"}}>{sec.scripture}</div>
                              </div>
                              <span style={{fontSize:"0.62rem",color:"var(--muted)",transform:secOpen?"rotate(180deg)":"none",transition:"transform 0.2s",flexShrink:0,marginTop:"2px"}}>▼</span>
                            </div>

                            <AnimatePresence>
                              {secOpen && (
                                <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.22}} style={{borderTop:`1px solid ${cat.color}22`,padding:"1.25rem 1.5rem",background:"white"}}>

                                  {/* Teaching note */}
                                  <div style={{background:`${cat.color}08`,borderRadius:"11px",padding:"0.9rem 1.1rem",borderLeft:`3px solid ${cat.color}`,marginBottom:"1.25rem"}}>
                                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.12em",color:cat.color,marginBottom:"0.35rem"}}>📖 TEACHING NOTE</div>
                                    <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.85}}>{sec.note}</div>
                                  </div>

                                  {/* Primary scriptures */}
                                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:cat.color,marginBottom:"0.75rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
                                    ✦ PRIMARY SCRIPTURES ({primaryList.length})
                                    <span style={{flex:1,height:"1px",background:`${cat.color}33`,display:"block"}} />
                                  </div>
                                  {visiblePrimary.map((verse, vi) => (
                                    <ScriptureCard key={vi} verse={verse} color={cat.color} goToScripture={goToScripture} />
                                  ))}
                                  {primaryList.length > 4 && (
                                    <button onClick={()=>toggleShowAll(sKey)}
                                      style={{width:"100%",marginBottom:"1rem",fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",padding:"0.6rem",borderRadius:"9px",border:`1px solid ${cat.color}44`,background:`${cat.color}08`,color:cat.color,cursor:"pointer"}}>
                                      {showAll ? `▲ Show Fewer Scriptures` : `▼ Show All ${primaryList.length} Scriptures`}
                                    </button>
                                  )}

                                  {/* Supporting refs */}
                                  {sec.supporting && sec.supporting.length > 0 && (
                                    <>
                                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.16em",color:"var(--muted)",marginBottom:"0.55rem",marginTop:"0.5rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
                                        🔗 SUPPORTING REFERENCES
                                        <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
                                      </div>
                                      <div style={{display:"flex",flexWrap:"wrap",gap:"0.4rem"}}>
                                        {sec.supporting.map((ref,ri) => (
                                          <button key={ri} className="scripture-btn" onClick={()=>goToScripture&&goToScripture(ref.split(" (")[0])} style={{fontSize:"0.68rem"}}>{ref}</button>
                                        ))}
                                      </div>
                                    </>
                                  )}
                                </motion.div>
                              )}
                            </AnimatePresence>
                          </div>
                        );
                      })}
                    </motion.div>
                  )}
                </AnimatePresence>
              </div>
            );
          })}
        </div>
      )}

      {/* ══════════════════════════════════════════════
          TAB 3: WOMEN OF SCRIPTURE — Profile Gallery
      ══════════════════════════════════════════════ */}
      {activeTab === "profiles" && (
        <div>
          <div style={{marginBottom:"1.25rem"}}>
            <div className="section-eyebrow">⭐ WOMEN WHO CHANGED ISRAEL'S HISTORY</div>
            <h2 className="section-h2">{t.womenOfScripH2||"Women of Scripture"}</h2>
            <p className="section-body">Their names are written. Their actions are recorded. Their faith endures. Each profile includes every scripture where she appears, covenant lessons, and her place in Israel's story.</p>
          </div>

          {activeProfile ? (
            // Profile detail view
            (() => {
              const profile = WOMEN_OF_SCRIPTURE.find(w=>w.name===activeProfile);
              if (!profile) return null;
              return (
                <div>
                  <button className="btn-outline" style={{marginBottom:"1.25rem",fontSize:"0.68rem"}} onClick={()=>setActiveProfile(null)}>← All Women</button>
                  <div style={{background:`linear-gradient(135deg,${profile.color}22,${profile.color}08)`,borderRadius:"18px",border:`1px solid ${profile.color}33`,padding:"1.75rem 2rem",marginBottom:"1.5rem"}}>
                    <div style={{display:"flex",alignItems:"flex-start",gap:"1.25rem",flexWrap:"wrap"}}>
                      <div style={{width:"72px",height:"72px",borderRadius:"18px",background:`${profile.color}22`,border:`2px solid ${profile.color}44`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"2rem",flexShrink:0}}>{profile.icon}</div>
                      <div style={{flex:1}}>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.14em",color:profile.color,marginBottom:"0.25rem"}}>{profile.tribe}</div>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.4rem",color:"var(--ink)",marginBottom:"0.18rem"}}>{profile.name}</div>
                        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",color:"var(--muted)"}}>{profile.title}</div>
                      </div>
                    </div>
                    <div style={{marginTop:"1.1rem",fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:profile.color,marginBottom:"0.4rem"}}>KEY VERSE · {profile.keyVerse}</div>
                    <div style={{fontSize:"0.88rem",color:"var(--ink)",lineHeight:1.85}}>{profile.summary}</div>
                  </div>

                  {/* All scriptures */}
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:profile.color,marginBottom:"0.75rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
                    📖 ALL SCRIPTURES FOR {profile.name.toUpperCase()} ({profile.scriptures.length})
                    <span style={{flex:1,height:"1px",background:`${profile.color}33`,display:"block"}} />
                  </div>
                  {profile.scriptures.map((verse,i) => (
                    <ScriptureCard key={i} verse={verse} color={profile.color} goToScripture={goToScripture} />
                  ))}

                  {/* Covenant lessons */}
                  <div style={{marginTop:"1.5rem",background:"white",borderRadius:"14px",padding:"1.25rem 1.5rem",border:"1px solid var(--border)",borderLeft:`4px solid ${profile.color}`}}>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:profile.color,marginBottom:"0.75rem"}}>✦ COVENANT LESSONS FROM {profile.name.toUpperCase()}</div>
                    {profile.lessons.map((lesson,i) => (
                      <div key={i} style={{display:"flex",alignItems:"flex-start",gap:"0.6rem",marginBottom:"0.6rem"}}>
                        <span style={{color:profile.color,fontSize:"0.8rem",flexShrink:0,marginTop:"2px"}}>✦</span>
                        <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.75}}>{lesson}</div>
                      </div>
                    ))}
                  </div>

                  <div style={{display:"flex",gap:"0.65rem",marginTop:"1.25rem",flexWrap:"wrap"}}>
                    <button className="btn-outline" onClick={()=>setActiveProfile(null)}>← All Women of Scripture</button>
                    {WOMEN_OF_SCRIPTURE.findIndex(w=>w.name===activeProfile)<WOMEN_OF_SCRIPTURE.length-1 && (
                      <button className="btn-gold" style={{fontSize:"0.68rem"}} onClick={()=>{
                        const idx=WOMEN_OF_SCRIPTURE.findIndex(w=>w.name===activeProfile);
                        setActiveProfile(WOMEN_OF_SCRIPTURE[idx+1].name);
                      }}>Next Profile →</button>
                    )}
                  </div>
                </div>
              );
            })()
          ) : (
            // Gallery view
            <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(200px,1fr))",gap:"0.9rem"}}>
              {WOMEN_OF_SCRIPTURE.map(woman => (
                <button key={woman.name} onClick={()=>setActiveProfile(woman.name)}
                  style={{background:"white",border:"1px solid var(--border)",borderRadius:"16px",padding:"1.25rem 1.1rem",cursor:"pointer",textAlign:"left",transition:"all 0.2s",boxShadow:"var(--shadow)",borderTop:`3px solid ${woman.color}`}}>
                  <div style={{fontSize:"2rem",marginBottom:"0.5rem"}}>{woman.icon}</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.85rem",color:"var(--ink)",marginBottom:"0.18rem"}}>{woman.name}</div>
                  <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.82rem",fontStyle:"italic",color:"var(--muted)",marginBottom:"0.5rem",lineHeight:1.4}}>{woman.title}</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.1em",color:woman.color}}>{woman.scriptures.length} SCRIPTURES · {woman.tribe}</div>
                </button>
              ))}
            </div>
          )}
        </div>
      )}

      {/* ══════════════════════════════════════════════
          TAB 4: PRAYER
      ══════════════════════════════════════════════ */}
      {activeTab === "prayer" && (
        <div>
          <DailyPrayerWidget compact={false} />
          <div className="prayer-req-form" style={{marginTop:"1.5rem"}}>
            <div className="prayer-req-title">🙏 {t.womenPrayerTitle||"WOMEN'S PRAYER REQUEST"}</div>
            <div className="prayer-req-sub">Submit your prayer request to be prayed over by the women's covenant community during Shabbat class. Your request is confidential unless you choose to share it.</div>
            {prayerSubmitted ? (
              <div style={{textAlign:"center",padding:"1.5rem 0"}}>
                <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>✦</div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"1rem",color:"var(--gold-light)",marginBottom:"0.5rem"}}>{t.womenPrayerReceived||"Prayer Received"}</div>
                <div style={{fontSize:"0.85rem",color:"rgba(250,246,238,0.65)",lineHeight:1.75}}>Thank you, {prayerName||"sister"}. Your request has been submitted. It will be brought before YAHAWAH in our next Shabbat prayer session.</div>
                <button className="copy-btn" style={{margin:"1rem auto 0",display:"flex"}} onClick={()=>{setPrayerSubmitted(false);setPrayerReq("");setPrayerName("");}}>Submit Another →</button>
              </div>
            ) : (
              <>
                <input placeholder={t.womenPrayerName||"Your name (optional)"} value={prayerName} onChange={e=>setPrayerName(e.target.value)}
                  style={{width:"100%",background:"rgba(250,246,238,0.08)",border:"1px solid rgba(196,137,58,0.25)",borderRadius:"9px",padding:"0.65rem 0.9rem",color:"var(--parchment)",fontFamily:"'Libre Baskerville',serif",fontSize:"0.84rem",outline:"none",marginBottom:"0.75rem"}} />
                <textarea className="prayer-req-textarea" placeholder={t.womenPrayerTextarea||"Write your prayer request here — health, family, identity, provision, restoration, spiritual breakthrough…"} value={prayerReq} onChange={e=>setPrayerReq(e.target.value)} />
                <div style={{display:"flex",gap:"0.65rem",marginTop:"0.85rem",flexWrap:"wrap"}}>
                  <button className="btn-gold" style={{flex:1}} disabled={!prayerReq.trim()} onClick={()=>setPrayerSubmitted(true)}>{t.womenPrayerSubmit||"Submit Prayer Request ✦"}</button>
                  {prayerReq && <button className="copy-btn" onClick={()=>navigator.clipboard&&navigator.clipboard.writeText(`Prayer Request${prayerName?` — ${prayerName}`:""}\n\n${prayerReq}`)}>📋 Copy</button>}
                </div>
                <div style={{marginTop:"1rem",padding:"0.85rem 1rem",background:"rgba(250,246,238,0.06)",borderRadius:"9px",border:"1px solid rgba(196,137,58,0.2)"}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.14em",color:"var(--gold-light)",marginBottom:"0.3rem"}}>ISAIAH 54:17</div>
                  <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.95rem",fontStyle:"italic",color:"rgba(250,246,238,0.7)",lineHeight:1.72}}>"No weapon that is formed against thee shall prosper; and every tongue that shall rise against thee in judgment thou shalt condemn. This is the heritage of the servants of YAHAWAH."</div>
                </div>
              </>
            )}
          </div>
        </div>
      )}

      {/* Closing banner */}
      <div style={{background:"linear-gradient(135deg,#3D0A2A,#6B1A4A)",borderRadius:"18px",padding:"2rem",textAlign:"center",marginTop:"2rem",color:"white"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"#F4A7C3",marginBottom:"0.4rem"}}>ZEPHANIAH 3:17</div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.1rem",fontStyle:"italic",lineHeight:1.8,marginBottom:"1.1rem",maxWidth:"480px",margin:"0 auto 1.1rem"}}>"The LORD thy God in the midst of thee is mighty; he will save, he will rejoice over thee with joy; he will rest in his love, he will joy over thee with singing."</div>
        <div style={{display:"flex",gap:"0.65rem",justifyContent:"center",flexWrap:"wrap"}}>
          <button className="btn-gold" onClick={()=>setPage&&setPage("devotional")}>🕯️ Covenant Devotional</button>
          <button style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",padding:"0.75rem 1.4rem",borderRadius:"9px",background:"transparent",color:"white",border:"1px solid rgba(255,255,255,0.3)",cursor:"pointer"}} onClick={()=>setPage&&setPage("ai-tribes")}>12 Tribes Page</button>
        </div>
      </div>
    </div>
  );
}

// ─── LIVE STREAM PAGE ────────────────────────────────────────────────────────
function LiveStreamPage({ setPage, t }) {
  const [chatMessages, setChatMessages] = useState([
    { id:1, name:"Sis. Rachel", initials:"SR", color:"#C4893A", text:"Shabbat Shalom everyone! 🙏", time:"10:02 AM" },
    { id:2, name:"Bro. Marcus", initials:"BM", color:"#5A7A52", text:"Ready for this week's teaching! Let's go", time:"10:03 AM" },
    { id:3, name:"Sis. Miriam", initials:"SM", color:"#7B5EA7", text:"Just joined from Haiti 🇭🇹 Blessed to be here", time:"10:04 AM" },
    { id:4, name:"Host", initials:"GD", color:"#8B3A2A", text:"Welcome family! Class starts in 5 minutes. Get your notes ready 📖", time:"10:05 AM" },
  ]);
  const [chatInput, setChatInput] = useState("");
  const [userName, setUserName] = useState("Guest");
  const [activeTab, setActiveTab] = useState("schedule");
  const [showClassModal, setShowClassModal] = useState(false);
  const chatRef = useRef(null);

  const currentClass = getCurrentShabbatClass();
  const overlapInfo = detectSabbathFeastOverlap();
  const lang = t?.lang || "en";

  const sendMessage = () => {
    if (!chatInput.trim()) return;
    const newMsg = { id:chatMessages.length+1, name:userName||"Guest", initials:(userName||"G").slice(0,2).toUpperCase(), color:"#C4893A", text:chatInput.trim(), time:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}) };
    setChatMessages(m => [...m, newMsg]);
    setChatInput("");
    setTimeout(() => { if (chatRef.current) chatRef.current.scrollTop = chatRef.current.scrollHeight; }, 50);
  };

  const nextMain = SHABBAT_SCHEDULE.find(s => s.type === "main");

  return (
    <div>
      {/* ── SABBATH + FEAST OVERLAP ALERT ── */}
      {overlapInfo.overlap && overlapInfo.feast && (
        <div style={{background:`linear-gradient(135deg,${overlapInfo.feast.color},${overlapInfo.feast.color}BB)`,borderRadius:"14px",padding:"1rem 1.35rem",marginBottom:"1.25rem",color:"white",display:"flex",alignItems:"center",gap:"0.85rem"}}>
          <span style={{fontSize:"1.5rem",flexShrink:0}}>{overlapInfo.feast.icon}</span>
          <div style={{flex:1}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.16em",color:"rgba(255,255,255,0.75)",marginBottom:"0.2rem"}}>
              {lang==="es"?"⚠️ ESTE SHABAT ES TAMBIÉN UN DÍA SANTO":lang==="fr"?"⚠️ CE SABBAT EST AUSSI UN JOUR SAINT":"⚠️ THIS SABBATH IS ALSO A HIGH HOLY DAY"}
            </div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.88rem",color:"white",marginBottom:"0.15rem"}}>
              {lang==="es"?"Shabat + ":lang==="fr"?"Sabbat + ":"Weekly Sabbath + "}{overlapInfo.feast.name}
            </div>
            <div style={{fontSize:"0.75rem",color:"rgba(255,255,255,0.7)"}}>{overlapInfo.feast.scripture.split(" · ")[0]}</div>
          </div>
          <button onClick={()=>setPage("feasts")} style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",padding:"0.4rem 0.85rem",borderRadius:"8px",background:"rgba(255,255,255,0.2)",border:"1px solid rgba(255,255,255,0.3)",color:"white",cursor:"pointer",flexShrink:0}}>
            {lang==="es"?"Ver Fiesta":lang==="fr"?"Voir Fête":"View Feast"}
          </button>
        </div>
      )}

      {/* ── UPCOMING SHABBAT CLASS CARD — 7-STAGE SYSTEM ── */}
      <div style={{background:`linear-gradient(135deg,${currentClass.color}22,${currentClass.color}08)`,borderRadius:"18px",border:`1px solid ${currentClass.color}33`,padding:"1.4rem 1.6rem",marginBottom:"1.5rem"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.2em",color:currentClass.color,marginBottom:"0.5rem"}}>
          🕯️ {lang==="es"?"PRÓXIMA CLASE DE SHABAT":lang==="fr"?"PROCHAINE CLASSE DU SABBAT":"UPCOMING SHABBAT CLASS"}
        </div>
        <div style={{display:"flex",alignItems:"flex-start",gap:"0.85rem",marginBottom:"0.75rem"}}>
          <span style={{fontSize:"1.6rem",flexShrink:0}}>{currentClass.icon}</span>
          <div style={{flex:1}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"1rem",color:"var(--ink)",marginBottom:"0.15rem"}}>{currentClass.title?.[lang]||currentClass.title?.en}</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.08em",color:currentClass.color,marginBottom:"0.18rem"}}>Stage {currentClass.stage} — {currentClass.stageName}</div>
            <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.92rem",fontStyle:"italic",color:"var(--muted)",lineHeight:1.5}}>{currentClass.topic?.[lang]||currentClass.topic?.en}</div>
          </div>
        </div>
        <div style={{fontSize:"0.8rem",color:"var(--muted)",marginBottom:"1rem"}}>{lang==="es"?"Cada Sábado · 10:00 AM CST":lang==="fr"?"Chaque Samedi · 10h00 CST":"Every Saturday · 10:00 AM CST"}</div>
        <div style={{display:"flex",gap:"0.5rem",flexWrap:"wrap"}}>
          <a href={LIVE_STREAMS[0].url} target="_blank" rel="noreferrer"
            style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",padding:"0.48rem 0.95rem",borderRadius:"8px",background:"#FF0000",color:"white",textDecoration:"none"}}>▶️ YouTube</a>
          <a href={LIVE_STREAMS[1].url} target="_blank" rel="noreferrer"
            style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",padding:"0.48rem 0.95rem",borderRadius:"8px",background:"#1877F2",color:"white",textDecoration:"none"}}>📘 Facebook</a>
          <a href={LIVE_STREAMS[3].url} target="_blank" rel="noreferrer"
            style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",padding:"0.48rem 0.95rem",borderRadius:"8px",background:"#2D8CFF",color:"white",textDecoration:"none"}}>💻 Zoom</a>
          <button onClick={()=>setShowClassModal(true)}
            style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",padding:"0.48rem 0.95rem",borderRadius:"8px",background:`${currentClass.color}18`,border:`1px solid ${currentClass.color}44`,color:currentClass.color,cursor:"pointer"}}>
            📋 {lang==="es"?"Descripción de Clase":lang==="fr"?"Description du Cours":"Class Description"}
          </button>
        </div>
      </div>

      {/* Hero */}
      <div className="live-hero">
        <div className="live-badge">
          <div className="live-dot" />
          LIVE STREAMING · SHABBAT CLASSES
        </div>
        <h2 className="live-hero-h1">Watch. Study. <em>Be Changed.</em></h2>
        <p className="live-hero-sub">Join live Shabbat classes every Saturday morning and Wednesday evenings. Stream on YouTube, Facebook, Instagram, or join the interactive Zoom class.</p>
        <div style={{display:"flex",gap:"0.75rem",flexWrap:"wrap",marginTop:"1.5rem"}}>
          <a href={LIVE_STREAMS[0].url} target="_blank" rel="noreferrer" className="btn-gold" style={{textDecoration:"none"}}>▶️ Watch on YouTube</a>
          <a href={LIVE_STREAMS[0].subscribeUrl} target="_blank" rel="noreferrer" style={{fontFamily:"'Cinzel',serif",fontSize:"0.73rem",letterSpacing:"0.12em",padding:"0.82rem 1.6rem",borderRadius:"9px",background:"#FF0000",color:"white",border:"none",cursor:"pointer",textDecoration:"none",display:"inline-block"}}>🔔 Subscribe & Notify</a>
          <a href={LIVE_STREAMS[3].url} target="_blank" rel="noreferrer" style={{fontFamily:"'Cinzel',serif",fontSize:"0.73rem",letterSpacing:"0.12em",padding:"0.82rem 1.6rem",borderRadius:"9px",background:"transparent",color:"white",border:"1px solid rgba(255,255,255,0.3)",cursor:"pointer",textDecoration:"none",display:"inline-block"}}>💻 Join Zoom Class</a>
        </div>
      </div>

      {/* Next Class Banner */}
      {nextMain && (
        <div className="live-banner" style={{marginBottom:"2rem"}}>
          <div className="live-banner-left">
            <div className="live-banner-dot" />
            <div>
              <div className="live-banner-label">NEXT MAIN CLASS</div>
              <div className="live-banner-title">{nextMain.title}</div>
              <div className="live-banner-time">{nextMain.day} · {nextMain.time} · {nextMain.reminder}</div>
            </div>
          </div>
          <div style={{display:"flex",gap:"0.5rem",flexWrap:"wrap"}}>
            {nextMain.platforms.map(p => {
              const platform = LIVE_STREAMS.find(ls => ls.id === p);
              return platform ? (
                <a key={p} href={platform.url} target="_blank" rel="noreferrer"
                  style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",padding:"0.45rem 0.9rem",borderRadius:"8px",background:PLATFORM_COLORS[p]||"#333",color:"white",textDecoration:"none",border:"none",cursor:"pointer"}}>
                  {platform.icon} {platform.name}
                </a>
              ) : null;
            })}
          </div>
        </div>
      )}

      {/* Main layout: video embed + mega chat */}
      <div className="live-stream-layout">
        {/* Left: embed + platform cards */}
        <div>
          {/* YouTube embed placeholder */}
          <div className="live-embed">
            <div style={{textAlign:"center",color:"rgba(255,255,255,0.5)"}}>
              <div style={{fontSize:"3rem",marginBottom:"0.75rem"}}>▶️</div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.14em",marginBottom:"0.15rem",color:"rgba(255,255,255,0.7)"}}>ROCK DID IT · LIVE STREAM</div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",marginBottom:"0.9rem",color:"rgba(255,255,255,0.45)"}}>@realrockdidit · Saturdays 10 AM CST</div>
              <div style={{display:"flex",gap:"0.6rem",justifyContent:"center",flexWrap:"wrap"}}>
                <a href={LIVE_STREAMS[0].url} target="_blank" rel="noreferrer"
                  style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.12em",padding:"0.7rem 1.4rem",borderRadius:"9px",background:"#FF0000",color:"white",textDecoration:"none",display:"inline-block"}}>
                  ▶️ Watch Live
                </a>
                <a href={LIVE_STREAMS[0].subscribeUrl} target="_blank" rel="noreferrer"
                  style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.12em",padding:"0.7rem 1.4rem",borderRadius:"9px",background:"rgba(255,255,255,0.12)",color:"white",textDecoration:"none",display:"inline-block",border:"1px solid rgba(255,255,255,0.25)"}}>
                  🔔 Subscribe & Notify
                </a>
              </div>
            </div>
          </div>

          {/* Tab selector */}
          <div style={{display:"flex",gap:"0",marginBottom:"1.25rem",border:"1px solid var(--border)",borderRadius:"10px",overflow:"hidden",width:"fit-content"}}>
            {[["schedule","📅 Schedule"],["platforms","📡 Platforms"]].map(([key,label]) => (
              <button key={key} onClick={() => setActiveTab(key)}
                style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.1em",padding:"0.55rem 1.1rem",border:"none",borderRight:"1px solid var(--border)",background:activeTab===key?"var(--deep)":"white",color:activeTab===key?"var(--parchment)":"var(--muted)",cursor:"pointer",transition:"all 0.18s",whiteSpace:"nowrap"}}>
                {label}
              </button>
            ))}
          </div>

          {/* Schedule tab */}
          {activeTab === "schedule" && (
            <div>
              <div className="section-eyebrow" style={{marginBottom:"1rem"}}>SHABBAT CLASS SCHEDULE</div>
              <div className="schedule-list">
                {SHABBAT_SCHEDULE.map(item => (
                  <div key={item.id} className="schedule-item">
                    <div className="schedule-type-dot" style={{background:SCHEDULE_TYPE_COLORS[item.type]||"#ccc"}} />
                    <div>
                      <div className="schedule-day">{item.day}</div>
                      <div className="schedule-time">{item.time}</div>
                      <div className="schedule-title">{item.title}</div>
                      <div style={{marginTop:"0.5rem"}} className="schedule-platforms">
                        {item.platforms.map(p => {
                          const platform = LIVE_STREAMS.find(ls => ls.id === p);
                          return <span key={p} className="schedule-platform-tag" style={{borderColor:PLATFORM_COLORS[p]+"44",color:PLATFORM_COLORS[p]}}>{platform?.icon} {platform?.name}</span>;
                        })}
                      </div>
                    </div>
                    <div style={{textAlign:"right"}}>
                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.56rem",letterSpacing:"0.1em",color:"var(--muted)",marginBottom:"0.5rem"}}>{item.reminder}</div>
                      {item.platforms[0] && (
                        <a href={LIVE_STREAMS.find(ls=>ls.id===item.platforms[0])?.url||"#"} target="_blank" rel="noreferrer"
                          style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",padding:"0.38rem 0.8rem",borderRadius:"7px",background:PLATFORM_COLORS[item.platforms[0]]||"var(--gold)",color:"white",textDecoration:"none",display:"inline-block"}}>
                          Join →
                        </a>
                      )}
                    </div>
                  </div>
                ))}
              </div>

              {/* Class flow card */}
              <div style={{background:"var(--deep)",borderRadius:"16px",padding:"1.5rem 1.75rem",marginTop:"1.25rem"}}>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.18em",color:"var(--gold-light)",marginBottom:"1rem"}}>SHABBAT CLASS FLOW — 60 MINUTES</div>
                <div className="shabbat-flow" style={{gap:"0.6rem"}}>
                  {SHABBAT_FLOW.map(step => (
                    <div key={step.step} style={{background:"rgba(250,246,238,0.06)",border:"1px solid rgba(196,137,58,0.2)",borderRadius:"10px",padding:"0.7rem 0.85rem",display:"flex",alignItems:"center",gap:"0.6rem"}}>
                      <span style={{fontSize:"1.1rem",flexShrink:0}}>{step.icon}</span>
                      <div>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.1em",color:"rgba(250,246,238,0.4)",marginBottom:"0.1rem"}}>STEP {step.step}</div>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.04em",color:"var(--parchment)",lineHeight:1.3}}>{step.label}</div>
                        <div style={{fontSize:"0.62rem",color:"rgba(250,246,238,0.45)"}}>{step.time}</div>
                      </div>
                    </div>
                  ))}
                </div>
              </div>
            </div>
          )}

          {/* Platforms tab */}
          {activeTab === "platforms" && (
            <div>
              <div className="section-eyebrow" style={{marginBottom:"1rem"}}>STREAMING PLATFORMS</div>
              <div className="platform-grid">
                {LIVE_STREAMS.map(p => (
                  <a key={p.id} href={p.url} target="_blank" rel="noreferrer" className="platform-card">
                    <div className="platform-card-header">
                      <div className="platform-icon-wrap" style={{background:p.color+"22",border:`1px solid ${p.color}44`}}>
                        <span>{p.icon}</span>
                      </div>
                      <div>
                        <div className="platform-name">{p.name}</div>
                        <div className="platform-handle">{p.handle}</div>
                      </div>
                    </div>
                    <div className="platform-desc">{p.desc}</div>
                    <div className="platform-features">
                      {p.features.map(f => <span key={f} className="platform-feat">{f}</span>)}
                    </div>
                    <div className="platform-cta" style={{background:p.color}}>
                      <span>Watch / Join</span>
                      <span>→</span>
                    </div>
                  </a>
                ))}
              </div>
            </div>
          )}
        </div>

        {/* Right: Mega Chat */}
        <div>
          <div className="section-eyebrow" style={{marginBottom:"0.75rem"}}>💬 MEGA CHAT</div>
          <div className="mega-chat-wrap">
            <div className="mega-chat-header">
              <div className="mega-chat-title">
                <div className="live-dot" />
                SHABBAT CHAT
              </div>
              <div style={{display:"flex",gap:"0.5rem",alignItems:"center"}}>
                <input value={userName} onChange={e => setUserName(e.target.value)} placeholder="Your name"
                  style={{background:"rgba(250,246,238,0.08)",border:"1px solid rgba(196,137,58,0.25)",borderRadius:"6px",padding:"0.3rem 0.6rem",color:"var(--parchment)",fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.08em",width:"90px",outline:"none"}} />
                <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.1em",color:"rgba(250,246,238,0.35)"}}>{chatMessages.length} msgs</span>
              </div>
            </div>
            <div className="mega-chat-messages" ref={chatRef}>
              {chatMessages.map(msg => (
                <div key={msg.id} className="chat-msg">
                  <div className="chat-avatar" style={{background:msg.color}}>{msg.initials}</div>
                  <div className="chat-bubble">
                    <div className="chat-name" style={{color:msg.color}}>{msg.name}</div>
                    <div className="chat-text">{msg.text}</div>
                    <div className="chat-time">{msg.time}</div>
                  </div>
                </div>
              ))}
            </div>
            <div className="chat-input-row">
              <input className="chat-input" placeholder="Type your message..." value={chatInput}
                onChange={e => setChatInput(e.target.value)}
                onKeyDown={e => e.key === "Enter" && sendMessage()} />
              <button className="chat-send" onClick={sendMessage}>Send</button>
            </div>
          </div>

          {/* Prayer request box */}
          <div style={{background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"14px",padding:"1.25rem",marginTop:"1rem"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.65rem"}}>🙏 PRAYER REQUEST</div>
            <textarea placeholder="Submit a prayer request to be prayed over during class..."
              style={{width:"100%",minHeight:"80px",border:"1px solid var(--border)",borderRadius:"9px",padding:"0.75rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.84rem",resize:"vertical",outline:"none",background:"white",color:"var(--ink)"}} />
            <button className="btn-gold" style={{marginTop:"0.6rem",width:"100%",textAlign:"center"}}>Submit Prayer Request</button>
          </div>
        </div>
      </div>

      {/* Class Description Modal */}
      <AnimatePresence>
        {showClassModal && (
          <ShabbatClassModal classData={currentClass} lang={lang} onClose={()=>setShowClassModal(false)} goToScripture={()=>{}} />
        )}
      </AnimatePresence>
    </div>
  );
}

// ─── ANCIENT ISRAEL HUB PAGE ─────────────────────────────────────────────────
const AI_SECTIONS = [
  { key:"ai-reader",   icon:"📖", title:"Bible Reader",       sub:"KJV · Highlight · Bookmark · Cross-refs" },
  { key:"ai-articles", icon:"📰", title:"Study Articles",     sub:"Archaeology · Prophecy · Identity · History" },
  { key:"ai-study",    icon:"📚", title:"Study Guide",        sub:"8 Lessons · Quizzes · Progress Tracker" },
  { key:"ai-timeline", icon:"🗺️", title:"Historical Timeline",sub:"18 Events · 2000 BCE – 70 CE · Interactive" },
  { key:"ai-tribes",   icon:"💎", title:"The 12 Tribes",      sub:"Breastplate · Gemstones · Territories" },
];

function AncientIsraelHubPage({ setPage, goToScripture }) {
  const [lostTribesOpen, setLostTribesOpen] = useState(false);
  const [activeTribe, setActiveTribe] = useState(null);
  const [tableOpen, setTableOpen] = useState(false);

  const selectedTribeData = TRIBES_TODAY.find(t=>t.tribe===activeTribe);

  return (
    <div>
      <div className="ai-section-hero" style={{marginBottom:"2.5rem"}}>
        <div className="ai-eyebrow">✦ COVENANT HISTORY · SCRIPTURE · ARCHAEOLOGY</div>
        <h1 style={{fontFamily:"'Cinzel',serif",fontSize:"clamp(1.8rem,5vw,3.2rem)",fontWeight:700,color:"#F5EED8",marginBottom:"0.8rem",lineHeight:1.1}}>
          Ancient Israel<br /><em style={{fontFamily:"'Cormorant Garamond',serif",color:"#C97D1A",fontStyle:"italic",fontSize:"1.08em"}}>Study Bible</em>
        </h1>
        <p style={{fontSize:"0.95rem",color:"rgba(245,238,216,0.7)",maxWidth:"540px",lineHeight:1.85,marginBottom:"1.5rem"}}>
          Five deep-study sections covering the full covenant narrative — from Abraham to the End Times. Bible Reader, scholarly articles, structured lessons, interactive timeline, and the twelve tribes in full detail.
        </p>
        <div style={{display:"flex",gap:"1rem",flexWrap:"wrap"}}>
          <button className="btn-gold" onClick={()=>setPage("ai-study")}>📚 Begin Study Guide →</button>
          <button className="btn-outline-light" onClick={()=>setPage("ai-reader")}>📖 Open Bible Reader</button>
        </div>
      </div>

      <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(280px,1fr))",gap:"1.1rem",marginBottom:"2rem"}}>
        {AI_SECTIONS.map((s,i) => (
          <motion.div key={s.key} className="card card-body" whileHover={{y:-3}} style={{cursor:"pointer",borderTop:`3px solid ${["#C97D1A","#1B3A5C","#2A9D8F","#B5451B","#7B3FA0"][i]}`}}
            onClick={()=>setPage(s.key)}>
            <div style={{fontSize:"2rem",marginBottom:"0.8rem"}}>{s.icon}</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.88rem",letterSpacing:"0.05em",marginBottom:"0.4rem",color:"var(--ink)"}}>{s.title}</div>
            <div style={{fontSize:"0.78rem",color:"var(--muted)",lineHeight:1.65,marginBottom:"1rem"}}>{s.sub}</div>
            <button className="btn-text">Enter Section <span>→</span></button>
          </motion.div>
        ))}
      </div>

      {/* Quick stats */}
      <div style={{background:"var(--deep)",borderRadius:"18px",padding:"1.75rem 2rem",display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(140px,1fr))",gap:"1.25rem",textAlign:"center",marginBottom:"2rem"}}>
        {[["18","Timeline Events"],["8","Study Lessons"],["6","Deep Articles"],["12","Tribes Covered"],["~2000","Years of History"]].map(([n,l])=>(
          <div key={l}>
            <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"2.4rem",fontWeight:700,color:"#C97D1A",lineHeight:1}}>{n}</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.12em",color:"rgba(245,238,216,0.5)",marginTop:"0.3rem"}}>{l}</div>
          </div>
        ))}
      </div>

      {/* ══════════════════════════════════════════
          WHERE ARE THE LOST TRIBES TODAY?
      ══════════════════════════════════════════ */}
      <div style={{background:"white",borderRadius:"20px",border:"1px solid var(--border)",overflow:"hidden",boxShadow:"var(--shadow)",marginBottom:"1.5rem"}}>
        {/* Section header */}
        <div style={{background:"linear-gradient(135deg,#1B3A5C,#0D2035)",padding:"1.5rem 1.75rem",cursor:"pointer",display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"1rem"}}
          onClick={()=>setLostTribesOpen(!lostTribesOpen)}>
          <div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.22em",color:"#C97D1A",marginBottom:"0.45rem"}}>✦ COMMUNITY TEACHING SECTION</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.25rem",color:"#F5EED8",marginBottom:"0.3rem",lineHeight:1.2}}>🗺️ Where Are the Lost Tribes Today?</div>
            <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.9rem",fontStyle:"italic",color:"rgba(245,238,216,0.6)",lineHeight:1.65}}>The 12-tribe identification framework studied by this community — grounded in Deuteronomy 28, Genesis 49, and Isaiah 11:12.</div>
          </div>
          <span style={{color:"#C97D1A",fontSize:"0.75rem",transform:lostTribesOpen?"rotate(180deg)":"none",transition:"transform 0.25s",flexShrink:0,marginTop:"4px"}}>▼</span>
        </div>

        <AnimatePresence>
          {lostTribesOpen && (
            <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.3}}>
              <div style={{padding:"1.5rem 1.75rem"}}>

                {/* Study note */}
                <div style={{background:"rgba(196,137,58,0.08)",border:"1px solid rgba(196,137,58,0.22)",borderRadius:"12px",padding:"1rem 1.25rem",marginBottom:"1.5rem",borderLeft:"3px solid var(--gold)"}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.14em",color:"var(--gold)",marginBottom:"0.4rem"}}>⚠️ TEACHING FRAMEWORK NOTE</div>
                  <div style={{fontSize:"0.85rem",color:"var(--ink)",lineHeight:1.85,marginBottom:"0.65rem"}}>The tribal identifications below are <strong>community teaching traditions</strong>, not universally settled historical or genetic fact. They are derived from interpretive study of Deuteronomy 28, Genesis 49, Joel 3, Amos 9, and Isaiah 11:12 — using prophetic signs as identification markers rather than genetic or archaeological evidence. Study these with prayer and discernment.</div>
                  <div style={{display:"flex",gap:"0.4rem",flexWrap:"wrap"}}>
                    <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("Deuteronomy 28:15-68")}>📖 Deuteronomy 28</button>
                    <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("Genesis 49:1-28")}>📖 Genesis 49</button>
                    <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("Isaiah 11:12")}>📖 Isaiah 11:12</button>
                    <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("James 1:1")}>📖 James 1:1</button>
                  </div>
                </div>

                {/* 2 Esdras 6:56 anchor verse */}
                <div style={{background:"var(--deep)",color:"var(--parchment)",borderRadius:"14px",padding:"1.25rem 1.6rem",marginBottom:"1.5rem",borderLeft:"4px solid var(--gold)"}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.14em",color:"var(--gold-light)",marginBottom:"0.5rem"}}>📜 2 ESDRAS 6:56 — THE NATIONS MADE FOR ISRAEL</div>
                  <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.1rem",fontStyle:"italic",lineHeight:1.82,marginBottom:"0.75rem"}}>"As for the other people, which also came of Adam, thou hast said that they are nothing, but be like unto spittle: and hast likened the abundance of them unto a drop that falleth from a vessel."</div>
                  <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",lineHeight:1.82,marginBottom:"0.75rem"}}>"And now, O Lord, behold, these heathen, which have ever been reputed as nothing, have begun to be lords over us, and to devour us. But we thy people, whom thou hast called thy firstborn, thy only begotten, and thy fervent lover, are given into their hands."</div>
                  <div style={{fontSize:"0.78rem",color:"rgba(250,246,238,0.55)",lineHeight:1.65}}>2 Esdras 6:56 establishes that in Ezdras' prayer, YAHAWAH's people — the covenant nation of Israel — are identified as distinct from the surrounding nations (heathen). This Apocryphal text is used in this community to underscore that YAHAWAH recognizes a specific people as His firstborn, His only begotten.</div>
                  <button onClick={()=>goToScripture&&goToScripture("2 Esdras 6:56")} style={{marginTop:"0.6rem",fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",padding:"0.4rem 0.85rem",borderRadius:"7px",background:"rgba(196,137,58,0.22)",border:"1px solid var(--gold)",color:"var(--gold-light)",cursor:"pointer"}}>📖 Open 2 Esdras 6</button>
                </div>

                {/* Tribe identification grid */}
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--muted)",marginBottom:"1rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
                  🗺️ COMMUNITY TRIBE IDENTIFICATION CHART
                  <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
                </div>

                {activeTribe ? (
                  // Tribe detail view
                  (() => {
                    const td = selectedTribeData;
                    return (
                      <div>
                        <button className="btn-outline" style={{marginBottom:"1.1rem",fontSize:"0.68rem"}} onClick={()=>setActiveTribe(null)}>← All 12 Tribes</button>
                        <div style={{background:`linear-gradient(135deg,${td.color}18,${td.color}08)`,borderRadius:"16px",border:`1px solid ${td.color}33`,padding:"1.5rem 1.75rem",marginBottom:"1.25rem"}}>
                          <div style={{display:"flex",alignItems:"center",gap:"1rem",marginBottom:"0.75rem",flexWrap:"wrap"}}>
                            <span style={{fontSize:"2rem"}}>{td.icon}</span>
                            <div>
                              <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.2rem",color:"var(--ink)"}}>{td.tribe}</div>
                              <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",color:"var(--muted)",lineHeight:1.4}}>{td.peoples}</div>
                            </div>
                          </div>
                          <div style={{display:"inline-flex",alignItems:"center",gap:"0.4rem",background:`${td.color}18`,border:`1px solid ${td.color}33`,borderRadius:"20px",padding:"0.3rem 0.85rem",marginBottom:"0.75rem"}}>
                            <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.12em",color:td.color}}>📍 COMMUNITY IDENTIFICATION: {td.modern.toUpperCase()}</span>
                          </div>
                          <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.85}}>{td.note}</div>
                        </div>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:td.color,marginBottom:"0.7rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
                          📖 KEY PROPHECY SCRIPTURES
                          <span style={{flex:1,height:"1px",background:`${td.color}33`,display:"block"}} />
                        </div>
                        <div style={{background:"var(--deep)",color:"var(--parchment)",borderRadius:"12px",padding:"1.1rem 1.4rem",marginBottom:"1rem",borderLeft:`3px solid ${td.color}`}}>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",color:"var(--gold-light)",marginBottom:"0.4rem"}}>{td.keyVerse}</div>
                          <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",lineHeight:1.75}}>"{td.verseText}"</div>
                        </div>
                        <div style={{display:"flex",flexWrap:"wrap",gap:"0.4rem",marginBottom:"1.1rem"}}>
                          {td.keyScriptures.map((ref,i)=>(
                            <button key={i} className="scripture-btn" onClick={()=>goToScripture&&goToScripture(ref)}>📖 {ref}</button>
                          ))}
                        </div>
                        <button className="btn-outline" onClick={()=>setActiveTribe(null)}>← All 12 Tribes</button>
                      </div>
                    );
                  })()
                ) : (
                  // Tribe grid
                  <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(185px,1fr))",gap:"0.7rem"}}>
                    {TRIBES_TODAY.map(tribe => (
                      <button key={tribe.tribe} onClick={()=>setActiveTribe(tribe.tribe)}
                        style={{background:"white",border:`1px solid ${tribe.color}33`,borderRadius:"13px",padding:"0.9rem 1rem",cursor:"pointer",textAlign:"left",transition:"all 0.18s",boxShadow:"0 1px 4px rgba(0,0,0,0.06)",borderTop:`3px solid ${tribe.color}`}}>
                        <div style={{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.35rem"}}>
                          <span style={{fontSize:"1.2rem"}}>{tribe.icon}</span>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.78rem",letterSpacing:"0.04em",color:"var(--ink)"}}>{tribe.tribe}</div>
                        </div>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.06em",color:tribe.color,lineHeight:1.35}}>{tribe.modern}</div>
                      </button>
                    ))}
                  </div>
                )}
              </div>
            </motion.div>
          )}
        </AnimatePresence>
      </div>

      {/* TABLE OF NATIONS — Genesis 10 */}
      <div style={{background:"white",borderRadius:"20px",border:"1px solid var(--border)",overflow:"hidden",boxShadow:"var(--shadow)",marginBottom:"1.5rem"}}>
        <div style={{background:"linear-gradient(135deg,#3D0A2A,#6B1A4A)",padding:"1.5rem 1.75rem",cursor:"pointer",display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"1rem"}}
          onClick={()=>setTableOpen(!tableOpen)}>
          <div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.22em",color:"#F4A7C3",marginBottom:"0.45rem"}}>✦ GENESIS 10 · STUDY RESOURCE</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.25rem",color:"white",marginBottom:"0.3rem",lineHeight:1.2}}>📜 The Table of Nations (Genesis 10)</div>
            <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.9rem",fontStyle:"italic",color:"rgba(255,255,255,0.6)",lineHeight:1.65}}>Hebrew names and their modern nation correspondences — the sons of Noah and their descendants.</div>
          </div>
          <span style={{color:"#F4A7C3",fontSize:"0.75rem",transform:tableOpen?"rotate(180deg)":"none",transition:"transform 0.25s",flexShrink:0,marginTop:"4px"}}>▼</span>
        </div>

        <AnimatePresence>
          {tableOpen && (
            <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.3}}>
              <div style={{padding:"1.5rem 1.75rem"}}>
                <div style={{background:"rgba(107,26,74,0.06)",borderRadius:"12px",padding:"0.9rem 1.1rem",marginBottom:"1.25rem",borderLeft:"3px solid #6B1A4A"}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.12em",color:"#6B1A4A",marginBottom:"0.35rem"}}>📖 GENESIS 10:1</div>
                  <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.75}}>"Now these are the generations of the sons of Noah, Shem, Ham, and Japheth: and unto them were sons born after the flood."</div>
                  <div style={{fontSize:"0.78rem",color:"var(--muted)",marginTop:"0.5rem",lineHeight:1.65}}>This community uses the Hebrew names from Genesis 10 to identify the origins of modern nations. Note: These are scholarly and interpretive traditions — approaches vary across communities and academies.</div>
                </div>

                <div style={{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"1.25rem"}}>
                  <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("Genesis 10:1-32")}>📖 Genesis 10 (Full)</button>
                  <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("Genesis 9:18-19")}>📖 Genesis 9:18-19</button>
                  <button className="scripture-btn" onClick={()=>goToScripture&&goToScripture("1 Chronicles 1:1-23")}>📖 1 Chronicles 1</button>
                </div>

                {/* Table header row */}
                <div style={{display:"grid",gridTemplateColumns:"2rem 1fr 1fr 1fr",gap:"0.5rem",padding:"0.5rem 0.75rem",borderBottom:"2px solid var(--border)",marginBottom:"0.4rem"}}>
                  {["#","MODERN NATION","HEBREW NAME / ANCESTOR","NOTE"].map(h=>(
                    <div key={h} style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.1em",color:"var(--muted)"}}>{h}</div>
                  ))}
                </div>

                {TABLE_OF_NATIONS.map(row => (
                  <div key={row.num} style={{display:"grid",gridTemplateColumns:"2rem 1fr 1fr 1fr",gap:"0.5rem",padding:"0.55rem 0.75rem",borderBottom:"1px solid var(--border)",background:row.highlight?"rgba(196,137,58,0.08)":"transparent",borderRadius:row.highlight?"8px":"0"}}>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",color:"var(--muted)",alignSelf:"center"}}>{row.num}</div>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.04em",color:row.color||"var(--ink)",fontWeight:row.highlight?700:400,alignSelf:"center",lineHeight:1.3}}>{row.nation}{row.highlight?" ✦":""}</div>
                    <div style={{alignSelf:"center"}}>
                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.06em",color:"var(--ink)"}}>{row.hebrew}</div>
                      <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.75rem",fontStyle:"italic",color:"var(--muted)"}}>{row.ancestor}</div>
                    </div>
                    <div style={{fontSize:"0.72rem",color:"var(--muted)",lineHeight:1.55,alignSelf:"center"}}>{row.note}</div>
                  </div>
                ))}

                <div style={{marginTop:"1.1rem",padding:"0.85rem 1rem",background:"rgba(196,137,58,0.06)",borderRadius:"10px",border:"1px solid rgba(196,137,58,0.2)"}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.14em",color:"var(--gold)",marginBottom:"0.35rem"}}>📌 STUDY NOTE</div>
                  <div style={{fontSize:"0.82rem",color:"var(--ink)",lineHeight:1.8}}>The Table of Nations correspondences above reflect the interpretive tradition taught in this community. Nation-to-ancestor mapping is a field of ongoing scholarly discussion. These are offered as a study framework, not as absolute settled genealogy.</div>
                </div>
              </div>
            </motion.div>
          )}
        </AnimatePresence>
      </div>
    </div>
  );
}

// Sub-nav bar shown when inside Ancient Israel section
function AncientIsraelSubNav({ page, setPage }) {
  return (
    <div style={{background:"#0D2035",borderBottom:"1px solid rgba(201,125,26,0.25)",padding:"0 1.5rem"}}>
      <div style={{maxWidth:"1280px",margin:"0 auto",display:"flex",alignItems:"center",gap:"0.2rem",overflowX:"auto",scrollbarWidth:"none"}}>
        <button onClick={()=>setPage("ancient-israel")}
          style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",padding:"0.72rem 0.9rem",border:"none",background:"transparent",color:"rgba(245,238,216,0.45)",cursor:"pointer",whiteSpace:"nowrap",borderBottom:`2px solid ${"ancient-israel"===page?"#C97D1A":"transparent"}`,transition:"all 0.18s"}}>
          ← Hub
        </button>
        {AI_SECTIONS.map(s=>(
          <button key={s.key} onClick={()=>setPage(s.key)}
            style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",padding:"0.72rem 0.9rem",border:"none",background:"transparent",color:page===s.key?"#C97D1A":"rgba(245,238,216,0.55)",cursor:"pointer",whiteSpace:"nowrap",borderBottom:`2px solid ${page===s.key?"#C97D1A":"transparent"}`,transition:"all 0.18s"}}>
            {s.icon} {s.title}
          </button>
        ))}
      </div>
    </div>
  );
}

// ─── FEAST PAGE (full standalone feast calendar) ─────────────────────────────
function FeastPage({ setPage, goToScripture, t }) {
  const [filter, setFilter] = useState("all");
  const [expandedId, setExpandedId] = useState(null);
  const [activeTab, setActiveTab] = useState("upcoming"); // upcoming | all | shabbat

  const filtered = HOLY_FEASTS.filter(f => {
    if (filter === "all") return true;
    if (filter === "shabbat") return f.id === "shabbat";
    if (filter === "mandatory") return f.mandatory;
    return f.type === filter;
  });

  const sorted = [...filtered].sort((a, b) => {
    const da = getNextFeastDate(a);
    const db = getNextFeastDate(b);
    if (!da && !db) return 0; if (!da) return 1; if (!db) return -1;
    return da - db;
  });

  const nextMajor = HOLY_FEASTS.filter(f=>f.id!=="shabbat").sort((a,b)=>{
    const da=getNextFeastDate(a), db=getNextFeastDate(b);
    if(!da&&!db)return 0;if(!da)return 1;if(!db)return -1; return da-db;
  }).find(f=>{ const d=getNextFeastDate(f); const cd=getCountdown(d); return cd&&!cd.past; });

  const shabbat = HOLY_FEASTS.find(f=>f.id==="shabbat");
  const nextShabbat = getNextFeastDate(shabbat);
  const shabbatCD = getCountdown(nextShabbat);

  const FEAST_FILTERS = [
    { key:"all",            label:"All" },
    { key:"mandatory",      label:"Mandatory" },
    { key:"shabbat",        label:"Shabbat" },
    { key:"calendar-start", label:"New Year" },
    { key:"spring",         label:"Spring" },
    { key:"fall",           label:"Fall" },
    { key:"additional",     label:"Additional" },
  ];

  return (
    <div>
      {/* Hero */}
      <div style={{background:"linear-gradient(135deg,var(--deep),#1A2A0A)",borderRadius:"20px",padding:"2rem 2rem 1.75rem",marginBottom:"1.75rem",color:"var(--parchment)",position:"relative",overflow:"hidden"}}>
        <div style={{position:"absolute",top:0,right:0,width:"200px",height:"200px",background:"radial-gradient(circle,rgba(196,137,58,0.15) 0%,transparent 70%)",pointerEvents:"none"}} />
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.28em",color:"var(--gold-light)",marginBottom:"0.65rem"}}>✦ LEVITICUS 23 · THE LORD'S APPOINTED TIMES</div>
        <h1 style={{fontFamily:"'Cinzel',serif",fontSize:"clamp(1.6rem,4vw,2.6rem)",fontWeight:700,color:"var(--parchment)",marginBottom:"0.55rem",lineHeight:1.15}}>{t.feastTitle||"Holy Feast Calendar"}</h1>
        <p style={{fontSize:"0.88rem",color:"rgba(250,246,238,0.65)",lineHeight:1.8,maxWidth:"480px",marginBottom:"1.1rem"}}>{t.feastSub||"YAHAWAH's mandatory appointed times — Shabbat, Passover, Shavuot, Yom Teruah, Yom Kippur, Sukkot, and more — with live countdowns and observance guides."}</p>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",color:"rgba(250,246,238,0.5)",lineHeight:1.75,maxWidth:"440px"}}>"Speak unto the children of Israel, and say unto them, Concerning the feasts of the LORD, which ye shall proclaim to be holy convocations, even these are my feasts." — Leviticus 23:2</div>
      </div>

      {/* Shabbat strip */}
      <div className="shabbat-strip" style={{marginBottom:"1.25rem"}}>
        <div style={{display:"flex",alignItems:"center",gap:"0.9rem"}}>
          <span style={{fontSize:"1.6rem"}}>🕯️</span>
          <div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.18em",color:"var(--gold-light)",marginBottom:"0.18rem"}}>{t.feastWeeklyShabbat||"WEEKLY SHABBAT"}</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.88rem",color:"var(--parchment)"}}>
              {shabbatCD&&!shabbatCD.past ? `${shabbatCD.days}d ${shabbatCD.hours}h ${shabbatCD.minutes}m until Shabbat` : "Shabbat Shalom! 🕯️"}
            </div>
            <div style={{fontSize:"0.72rem",color:"rgba(250,246,238,0.5)"}}>Friday sunset → Saturday sunset · Exodus 20:8-11</div>
          </div>
        </div>
        <div style={{display:"flex",gap:"0.5rem",flexWrap:"wrap"}}>
          <button className="btn-gold" style={{flexShrink:0}} onClick={() => setPage("livestream")}>{t.feastJoinShabbat||"Join Shabbat Class →"}</button>
          <button className="btn-outline-light" style={{flexShrink:0,fontSize:"0.68rem"}} onClick={() => goToScripture&&goToScripture("Exodus 20:8-11")}>📖 Exodus 20:8</button>
        </div>
      </div>

      {/* Next major feast countdown */}
      {nextMajor && (() => {
        const nd = getNextFeastDate(nextMajor);
        const cd = getCountdown(nd);
        return cd && !cd.past ? (
          <div style={{background:`linear-gradient(135deg,${nextMajor.color},${nextMajor.color}BB)`,borderRadius:"18px",padding:"1.5rem 1.75rem",marginBottom:"1.5rem",color:"white"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.18em",color:"rgba(255,255,255,0.65)",marginBottom:"0.35rem"}}>{t.feastNextFeast||"NEXT FEAST APPROACHING"}</div>
            <div style={{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"1rem"}}>
              <div style={{display:"flex",alignItems:"center",gap:"1rem"}}>
                <span style={{fontSize:"2.5rem"}}>{nextMajor.icon}</span>
                <div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.3rem",fontWeight:700,marginBottom:"0.2rem"}}>{nextMajor.name}</div>
                  <div style={{fontSize:"0.78rem",color:"rgba(255,255,255,0.7)"}}>{nextMajor.hebrew} · {nextMajor.scripture.split(" · ")[0]}</div>
                  <div style={{fontSize:"0.72rem",color:"rgba(255,255,255,0.55)",marginTop:"0.18rem"}}>{nextMajor.dates}</div>
                </div>
              </div>
              <div style={{display:"flex",gap:"1.2rem",alignItems:"baseline"}}>
                {cd.days>0&&<div style={{textAlign:"center"}}><div style={{fontFamily:"'Cinzel',serif",fontSize:"2.2rem",fontWeight:700,lineHeight:1}}>{cd.days}</div><div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",opacity:0.65}}>DAYS</div></div>}
                <div style={{textAlign:"center"}}><div style={{fontFamily:"'Cinzel',serif",fontSize:"2.2rem",fontWeight:700,lineHeight:1}}>{String(cd.hours).padStart(2,"0")}</div><div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",opacity:0.65}}>HRS</div></div>
                <div style={{textAlign:"center"}}><div style={{fontFamily:"'Cinzel',serif",fontSize:"2.2rem",fontWeight:700,lineHeight:1}}>{String(cd.minutes).padStart(2,"0")}</div><div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",opacity:0.65}}>MIN</div></div>
              </div>
            </div>
            <div style={{marginTop:"1rem",display:"flex",gap:"0.5rem",flexWrap:"wrap"}}>
              <button onClick={()=>setExpandedId(nextMajor.id)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",padding:"0.5rem 1rem",borderRadius:"8px",background:"rgba(255,255,255,0.2)",border:"1px solid rgba(255,255,255,0.3)",color:"white",cursor:"pointer"}}>📖 Observance Guide</button>
              {goToScripture && <button onClick={()=>goToScripture(nextMajor.scripture.split(" · ")[0])} style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",padding:"0.5rem 1rem",borderRadius:"8px",background:"transparent",border:"1px solid rgba(255,255,255,0.25)",color:"rgba(255,255,255,0.8)",cursor:"pointer"}}>📜 {nextMajor.scripture.split(" · ")[0]}</button>}
            </div>
          </div>
        ) : null;
      })()}

      {/* Filter tabs */}
      <div style={{display:"flex",gap:"0",marginBottom:"1.25rem",border:"1px solid var(--border)",borderRadius:"11px",overflow:"hidden",overflowX:"auto",scrollbarWidth:"none"}}>
        {FEAST_FILTERS.map(f => (
          <button key={f.key} onClick={()=>setFilter(f.key)}
            style={{flex:1,minWidth:"80px",fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.08em",padding:"0.62rem 0.4rem",border:"none",borderRight:"1px solid var(--border)",background:filter===f.key?"var(--deep)":"white",color:filter===f.key?"var(--gold-light)":"var(--muted)",cursor:"pointer",transition:"all 0.18s",whiteSpace:"nowrap",textAlign:"center"}}>
            {f.label}
          </button>
        ))}
      </div>

      {/* Scripture basis note */}
      <div style={{background:"rgba(196,137,58,0.07)",border:"1px solid rgba(196,137,58,0.2)",borderRadius:"10px",padding:"0.65rem 1rem",marginBottom:"1.25rem",display:"flex",gap:"0.75rem",alignItems:"center"}}>
        <span style={{fontSize:"1rem",flexShrink:0}}>📜</span>
        <div style={{fontSize:"0.78rem",color:"var(--muted)",lineHeight:1.65}}>
          <strong style={{color:"var(--ink)"}}>Leviticus 23:2</strong> — "These are the feasts of YAHAWAH, even holy convocations, which ye shall proclaim in their seasons." These are not Jewish holidays — they are YAHAWAH's appointed times, commanded to Israel forever.
        </div>
        {goToScripture && <button onClick={()=>goToScripture("Leviticus 23")} style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",padding:"0.3rem 0.7rem",borderRadius:"7px",border:"1px solid var(--gold)",color:"var(--gold)",background:"transparent",cursor:"pointer",flexShrink:0}}>📖 Read</button>}
      </div>

      {/* Feast cards */}
      <div style={{display:"flex",flexDirection:"column",gap:"0.75rem"}}>
        {sorted.map(feast => {
          const nd = getNextFeastDate(feast);
          const cd = nd ? getCountdown(nd) : null;
          const isExpanded = expandedId === feast.id;
          const isUpcoming = cd && !cd.past;

          return (
            <div key={feast.id} style={{background:"white",borderRadius:"16px",border:"1px solid var(--border)",overflow:"hidden",boxShadow:"var(--shadow)",borderLeft:`4px solid ${feast.color}`}}>
              {/* Feast header */}
              <div style={{padding:"1.1rem 1.35rem",cursor:"pointer",display:"flex",gap:"1rem",alignItems:"center"}}
                onClick={()=>setExpandedId(isExpanded?null:feast.id)}>
                <span style={{fontSize:"1.8rem",flexShrink:0}}>{feast.icon}</span>
                <div style={{flex:1,minWidth:0}}>
                  <div style={{display:"flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.2rem"}}>
                    <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.85rem",letterSpacing:"0.04em",color:"var(--ink)"}}>{feast.name}</span>
                    <span style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.88rem",fontStyle:"italic",color:"var(--muted)"}}>{feast.hebrew}</span>
                    {feast.mandatory && <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",padding:"0.18rem 0.5rem",borderRadius:"5px",background:`${feast.color}18`,color:feast.color,border:`1px solid ${feast.color}33`}}>MANDATORY</span>}
                  </div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.06em",color:"var(--muted)"}}>{feast.dates}</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.08em",color:feast.color,marginTop:"0.12rem"}}>{feast.scripture.split(" · ")[0]}</div>
                </div>
                {/* Countdown badge */}
                <div style={{flexShrink:0,textAlign:"center"}}>
                  {isUpcoming && cd ? (
                    <div style={{background:`${feast.color}15`,border:`1px solid ${feast.color}33`,borderRadius:"10px",padding:"0.4rem 0.65rem",minWidth:"60px"}}>
                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"1rem",fontWeight:700,color:feast.color,lineHeight:1}}>{cd.days>0?cd.days:String(cd.hours).padStart(2,"0")}</div>
                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.48rem",letterSpacing:"0.1em",color:feast.color,opacity:0.75}}>{cd.days>0?"DAYS":"HRS"}</div>
                    </div>
                  ) : (
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.08em",color:"var(--muted)",textAlign:"center"}}>
                      {feast.id==="shabbat"?"WEEKLY":"ANNUAL"}
                    </div>
                  )}
                  <span style={{fontSize:"0.62rem",color:"var(--muted)",transform:isExpanded?"rotate(180deg)":"none",transition:"transform 0.2s",display:"block",marginTop:"0.25rem"}}>▼</span>
                </div>
              </div>

              {/* Expanded observance guide */}
              <AnimatePresence>
                {isExpanded && (
                  <motion.div initial={{opacity:0,height:0}} animate={{opacity:1,height:"auto"}} exit={{opacity:0,height:0}} transition={{duration:0.25}}>
                    <div style={{borderTop:`1px solid ${feast.color}22`,padding:"1.25rem 1.35rem",background:`${feast.color}04`}}>
                      {/* Summary */}
                      <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.82,marginBottom:"1.1rem"}}>{feast.summary}</div>

                      {/* Scripture buttons */}
                      <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.14em",color:feast.color,marginBottom:"0.55rem"}}>📜 SCRIPTURE REFERENCES</div>
                      <div style={{display:"flex",flexWrap:"wrap",gap:"0.4rem",marginBottom:"1.1rem"}}>
                        {feast.scripture.split(" · ").map((ref,i) => (
                          <button key={i} className="scripture-btn" style={{fontSize:"0.68rem"}} onClick={()=>goToScripture&&goToScripture(ref)}>📖 {ref}</button>
                        ))}
                      </div>

                      {/* Observance checklist */}
                      {feast.observance && feast.observance.length > 0 && (
                        <>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.14em",color:feast.color,marginBottom:"0.55rem"}}>✦ HOW TO OBSERVE</div>
                          <div style={{display:"flex",flexDirection:"column",gap:"0.4rem",marginBottom:"1rem"}}>
                            {feast.observance.map((step,i) => (
                              <div key={i} style={{display:"flex",alignItems:"flex-start",gap:"0.6rem",padding:"0.5rem 0.75rem",background:"white",borderRadius:"9px",border:"1px solid var(--border)"}}>
                                <span style={{color:feast.color,fontSize:"0.8rem",flexShrink:0,marginTop:"1px"}}>✦</span>
                                <span style={{fontSize:"0.84rem",color:"var(--ink)",lineHeight:1.65}}>{step}</span>
                              </div>
                            ))}
                          </div>
                        </>
                      )}

                      {/* Prep checklist */}
                      {feast.prepChecklist && feast.prepChecklist.length > 0 && (
                        <>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.14em",color:feast.color,marginBottom:"0.55rem"}}>📋 PREPARATION CHECKLIST</div>
                          <div style={{display:"flex",flexDirection:"column",gap:"0.3rem",marginBottom:"1rem"}}>
                            {feast.prepChecklist.map((item,i) => (
                              <div key={i} style={{display:"flex",alignItems:"center",gap:"0.6rem",padding:"0.42rem 0.75rem",background:"var(--cream)",borderRadius:"8px",border:"1px solid var(--border)"}}>
                                <span style={{width:"16px",height:"16px",borderRadius:"4px",border:`2px solid ${feast.color}`,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"}}>
                                  <span style={{fontSize:"0.6rem",color:feast.color}}>□</span>
                                </span>
                                <span style={{fontSize:"0.82rem",color:"var(--ink)",lineHeight:1.6}}>{item}</span>
                              </div>
                            ))}
                          </div>
                        </>
                      )}

                      {/* Covenant significance */}
                      {feast.covenantNote && (
                        <div style={{background:`${feast.color}10`,borderRadius:"11px",padding:"0.9rem 1.1rem",borderLeft:`3px solid ${feast.color}`,marginBottom:"0.75rem"}}>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.12em",color:feast.color,marginBottom:"0.35rem"}}>⚖️ COVENANT SIGNIFICANCE</div>
                          <div style={{fontSize:"0.84rem",color:"var(--ink)",lineHeight:1.82}}>{feast.covenantNote}</div>
                        </div>
                      )}

                      {/* Scripture-Only Observance Instructions */}
                      {feast.scriptureObservance && feast.scriptureObservance.length > 0 && (
                        <div style={{background:"var(--deep)",borderRadius:"12px",padding:"1rem 1.25rem",marginBottom:"0.75rem",borderLeft:"3px solid var(--gold)"}}>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"var(--gold-light)",marginBottom:"0.65rem"}}>
                            📜 HOW TO OBSERVE — SCRIPTURE ONLY
                          </div>
                          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",color:"rgba(250,246,238,0.45)",marginBottom:"0.6rem",lineHeight:1.5}}>
                            STRICT RULE: Only scripture-based instructions. No modern opinion.
                          </div>
                          {feast.scriptureObservance.map((line,si)=>(
                            <div key={si} style={{display:"flex",alignItems:"flex-start",gap:"0.5rem",marginBottom:"0.5rem"}}>
                              <span style={{color:"var(--gold)",fontSize:"0.7rem",flexShrink:0,marginTop:"2px"}}>✦</span>
                              <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.92rem",fontStyle:"italic",color:"rgba(250,246,238,0.82)",lineHeight:1.72}}>{line}</div>
                            </div>
                          ))}
                        </div>
                      )}

                      <div style={{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginTop:"0.25rem"}}>
                        {goToScripture && (
                          <button onClick={()=>goToScripture("Leviticus 23")} className="btn-outline" style={{fontSize:"0.65rem",padding:"0.4rem 0.85rem"}}>📜 Leviticus 23</button>
                        )}
                        <button onClick={()=>setPage&&setPage("weekly")} className="btn-outline" style={{fontSize:"0.65rem",padding:"0.4rem 0.85rem"}}>📖 Weekly Study</button>
                      </div>
                    </div>
                  </motion.div>
                )}
              </AnimatePresence>
            </div>
          );
        })}
      </div>

      {/* Restoration banner */}
      <div style={{background:"linear-gradient(135deg,var(--deep),#1A2A0A)",borderRadius:"18px",padding:"1.75rem 2rem",marginTop:"2rem",textAlign:"center",color:"var(--parchment)"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.2em",color:"var(--gold-light)",marginBottom:"0.4rem"}}>ISAIAH 66:23</div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.1rem",fontStyle:"italic",lineHeight:1.8,marginBottom:"1.1rem",maxWidth:"480px",margin:"0 auto 1.1rem"}}>"And it shall come to pass, that from one new moon to another, and from one sabbath to another, shall all flesh come to worship before me, saith the LORD."</div>
        <div style={{display:"flex",gap:"0.65rem",justifyContent:"center",flexWrap:"wrap"}}>
          <button className="btn-gold" onClick={()=>setPage("livestream")}>🕯️ Join Shabbat Class</button>
          <button className="btn-outline-light" onClick={()=>goToScripture&&goToScripture("Isaiah 66:23")}>📖 Isaiah 66:23</button>
        </div>
      </div>
    </div>
  );
}


// ═══════════════════════════════════════════════════════════════════════════════
// ██████ ROCK DID IT™ GLOBAL ECOSYSTEM CONFIG ████████████████████████████████
// Portal: goddiditbible.rockdidit.com
// System: GOD DID IT BIBLE CLUB / Dios Lo Hizo
// ═══════════════════════════════════════════════════════════════════════════════
const CONFIG = {
  // ─── Portal Identity ──────────────────────────────────────────────────────
  PORTAL_ID:            "goddidit-bible-club",
  PORTAL_NAME:          "God Did It Bible Club",
  PORTAL_DOMAIN:        "goddiditbible.rockdidit.com",
  PORTAL_VERSION:       "3.0.0",

  // ─── Feature Flags ────────────────────────────────────────────────────────
  ENABLE_AUTH:          false,   // set true when /auth backend is live
  ENABLE_LOCAL_SAVE:    true,    // localStorage for bookmarks, notes, progress
  ENABLE_ZAPIER:        false,   // set true + add URL when Zapier webhook ready
  ENABLE_ERP_SYNC:      false,   // set true when ERP API is live
  ENABLE_UNIVERSAL_API: false,   // set true when Rock Did It universal backend live
  ENABLE_EMAIL_RESET:   false,   // set true when EmailJS or backend email is wired

  // ─── Endpoints (fill when backend is ready) ───────────────────────────────
  ZAPIER_WEBHOOK_URL:   "",      // e.g. "https://hooks.zapier.com/hooks/catch/..."
  ERP_API_URL:          "",      // e.g. "https://erp.rockdidit.com/api"
  UNIVERSAL_API_BASE:   "",      // e.g. "https://api.rockdidit.com/v1"
  EMAILJS_SERVICE_ID:   "",      // EmailJS service ID for password reset
  EMAILJS_TEMPLATE_ID:  "",      // EmailJS template ID
  EMAILJS_PUBLIC_KEY:   "",      // EmailJS public key

  // ─── Support ──────────────────────────────────────────────────────────────
  SUPPORT_EMAIL:        "goditbibleclub@gmail.com",
  WHATSAPP_EN:          "https://chat.whatsapp.com/GmdP6Rujeg6EHKJLcwGVlp?mode=gi_t",
  WHATSAPP_ES:          "https://chat.whatsapp.com/DURN5BiprUzBa6v46bTLgu?mode=gi_t",
};

// ─── Universal Ecosystem Event Dispatcher ─────────────────────────────────────
// All user events that should eventually sync to ERP / Zapier / Sheets
async function dispatchEcosystemEvent(eventType, payload) {
  const event = {
    portalId: CONFIG.PORTAL_ID,
    eventType,
    timestamp: new Date().toISOString(),
    ...payload,
  };

  // Layer 1: localStorage (always works offline)
  try {
    const history = JSON.parse(localStorage.getItem("gdbc_history")||"[]");
    history.unshift({ ...event, id: Date.now() });
    localStorage.setItem("gdbc_history", JSON.stringify(history.slice(0, 100)));
  } catch {}

  // Layer 2: Zapier webhook (when enabled)
  if (CONFIG.ENABLE_ZAPIER && CONFIG.ZAPIER_WEBHOOK_URL) {
    try {
      await fetch(CONFIG.ZAPIER_WEBHOOK_URL, {
        method:"POST",
        headers:{"Content-Type":"application/json"},
        body: JSON.stringify(event),
      });
    } catch (e) { console.warn("Zapier webhook failed:", e.message); }
  }

  // Layer 3: Universal API (when enabled)
  if (CONFIG.ENABLE_UNIVERSAL_API && CONFIG.UNIVERSAL_API_BASE) {
    try {
      await fetch(`${CONFIG.UNIVERSAL_API_BASE}/api/zapier/event`, {
        method:"POST",
        headers:{"Content-Type":"application/json"},
        body: JSON.stringify(event),
      });
    } catch (e) { console.warn("Universal API failed:", e.message); }
  }
}

// ─── Auth Service (structure ready, activate when backend live) ───────────────
const AuthService = {
  async register(data) {
    if (!CONFIG.ENABLE_AUTH) {
      // Offline: save to localStorage
      localStorage.setItem("gdbc_member", JSON.stringify({ ...data, id: Date.now() }));
      return { ok:true, user:data };
    }
    const res = await fetch(`${CONFIG.UNIVERSAL_API_BASE}/auth/register`, {
      method:"POST", headers:{"Content-Type":"application/json"}, body:JSON.stringify(data),
    });
    return res.json();
  },
  async login(email, password) {
    if (!CONFIG.ENABLE_AUTH) return { ok:false, error:"Auth not enabled" };
    const res = await fetch(`${CONFIG.UNIVERSAL_API_BASE}/auth/login`, {
      method:"POST", headers:{"Content-Type":"application/json"}, body:JSON.stringify({email,password}),
    });
    return res.json();
  },
  async forgotPassword(email, lang) {
    // Layer 1: EmailJS (client-side, no backend needed)
    if (CONFIG.EMAILJS_SERVICE_ID && window.emailjs) {
      return window.emailjs.send(CONFIG.EMAILJS_SERVICE_ID, CONFIG.EMAILJS_TEMPLATE_ID, {
        to_email: email,
        language: lang || "en",
        reset_link: `${CONFIG.PORTAL_DOMAIN}/reset-password`,
        support_email: CONFIG.SUPPORT_EMAIL,
      }, CONFIG.EMAILJS_PUBLIC_KEY);
    }
    // Layer 2: Universal API endpoint
    if (CONFIG.ENABLE_AUTH && CONFIG.UNIVERSAL_API_BASE) {
      const res = await fetch(`${CONFIG.UNIVERSAL_API_BASE}/auth/forgot-password`, {
        method:"POST", headers:{"Content-Type":"application/json"}, body:JSON.stringify({email,lang}),
      });
      return res.json();
    }
    // Layer 3: Simulate (dev mode — shows success screen, no real email)
    return { ok:true, simulated:true };
  },
  async saveProgress(userId, progressData) {
    if (!CONFIG.ENABLE_UNIVERSAL_API) {
      localStorage.setItem("gdbc_progress", JSON.stringify(progressData));
      return { ok:true };
    }
    const res = await fetch(`${CONFIG.UNIVERSAL_API_BASE}/api/progress/save`, {
      method:"POST", headers:{"Content-Type":"application/json"},
      body:JSON.stringify({ userId, ...progressData }),
    });
    return res.json();
  },
};

// ═══════════════════════════════════════════════════════════════════════════════
// END ROCK DID IT CONFIG
// ═══════════════════════════════════════════════════════════════════════════════


const SHABBAT_CLASSES = [
  {
    id:"shabbat-stage-1", stage:1, stageName:"Identity", stageNameEs:"Identidad", stageNameFr:"Identité",
    color:"#8B3A2A", icon:"🔍",
    title:{en:"Shabbat Morning Study",es:"Estudio de la Mañana de Shabat",fr:"Étude du Matin du Sabbat"},
    topic:{en:"Remember Who You Are — Covenant Identity",es:"Recuerda Quién Eres — Identidad del Pacto",fr:"Souviens-toi de qui tu es — Identité de l'Alliance"},
    description:{en:"This class explores the lost identity of the covenant nation Israel. Who were they? Where did they go? What signs identify them today? Students will trace identity through scripture, prophecy, and covenant signs — beginning with YAHAWAH's own declarations.",es:"Esta clase explora la identidad perdida de la nación del pacto Israel. ¿Quiénes eran? ¿A dónde fueron? ¿Qué señales los identifican hoy?",fr:"Cette classe explore l'identité perdue de la nation d'alliance Israël."},
    whyMatters:{en:"You cannot return to what you do not know you left. Identity is the foundation of every other covenant truth.",es:"No puedes regresar a lo que no sabes que dejaste. La identidad es el fundamento de toda verdad del pacto.",fr:"Tu ne peux pas revenir à ce que tu ne sais pas avoir quitté. L'identité est le fondement de toute vérité d'alliance."},
    prepNote:{en:"Please read, highlight, and journal the scriptures below before class. Bring notes and questions for discussion.",es:"Por favor lee, subraya y escribe en tu diario las escrituras a continuación antes de la clase.",fr:"Veuillez lire, surligner et noter les écritures ci-dessous avant le cours."},
    scriptures:{
      ot:["Hosea 1:9-10","Deuteronomy 7:6","Exodus 11:7","Isaiah 43:1-2","Isaiah 44:1","Isaiah 48:1","Deuteronomy 14:2","Amos 3:2"],
      apocrypha:["Baruch 4:28","Baruch 2:30-32","2 Esdras 6:56","Baruch 4:5-7","Sirach 44:1"],
      nt:["Romans 9:25-26","1 Peter 2:9","Romans 11:1-2","Galatians 3:29","Revelation 7:4","Hosea 2:23","James 1:1"],
    },
  },
  {
    id:"shabbat-stage-2", stage:2, stageName:"Covenant", stageNameEs:"Pacto", stageNameFr:"Alliance",
    color:"#C4893A", icon:"📜",
    title:{en:"Shabbat Morning Study",es:"Estudio de la Mañana de Shabat",fr:"Étude du Matin du Sabbat"},
    topic:{en:"The Covenant Contract — Two Outcomes",es:"El Contrato del Pacto — Dos Resultados",fr:"Le Contrat de l'Alliance — Deux Résultats"},
    description:{en:"This class covers the covenant agreement between YAHAWAH and Israel — the most important legal document in all of scripture. Blessings for obedience. Curses for disobedience. Students will walk through Deuteronomy 28 and understand why history unfolded exactly as prophesied.",es:"Esta clase cubre el acuerdo del pacto entre YAHAWAH e Israel — el documento legal más importante de toda la escritura.",fr:"Cette classe couvre l'accord d'alliance entre YAHAWAH et Israël."},
    whyMatters:{en:"You cannot understand the last 2,700 years of history without reading Deuteronomy 28. The covenant was not theoretical — it was prophetic.",es:"No puedes entender los últimos 2,700 años de historia sin leer Deuteronomio 28.",fr:"Tu ne peux pas comprendre les 2 700 dernières années d'histoire sans lire le Deutéronome 28."},
    prepNote:{en:"Read all 68 verses of Deuteronomy 28 before class. Circle every verse you recognize from history.",es:"Lee los 68 versículos de Deuteronomio 28 antes de clase.",fr:"Lisez les 68 versets du Deutéronome 28 avant le cours."},
    scriptures:{
      ot:["Deuteronomy 28:1-2","Deuteronomy 28:15","Deuteronomy 28:46","Deuteronomy 28:68","Leviticus 26:3-4","Leviticus 26:14-16","Deuteronomy 30:1-3","Jeremiah 11:3-4"],
      apocrypha:["Baruch 1:15-22","Baruch 4:12-14","2 Esdras 1:5-6","Sirach 2:7-9","1 Maccabees 2:27"],
      nt:["Revelation 22:14","Galatians 3:10","Romans 10:4","Matthew 5:17","John 14:15","James 2:10","1 John 3:4"],
    },
  },
  {
    id:"shabbat-stage-3", stage:3, stageName:"Signs", stageNameEs:"Señales", stageNameFr:"Signes",
    color:"#6D4C41", icon:"⛓️",
    title:{en:"Shabbat Morning Study",es:"Estudio de la Mañana de Shabat",fr:"Étude du Matin du Sabbat"},
    topic:{en:"The Signs and Wonders of Judgment — Upon the Seed Forever",es:"Las Señales y Maravillas del Juicio — Sobre la Simiente Para Siempre",fr:"Les Signes et Prodiges du Jugement — Sur la Descendance Pour Toujours"},
    description:{en:"The curses of Deuteronomy 28 were not accidental — they were called 'signs and wonders' upon the seed forever. This class connects the prophetic punishments to observable historical events, including the transatlantic slave trade, scattering, and oppression.",es:"Las maldiciones de Deuteronomio 28 no fueron accidentales — fueron llamadas 'señales y maravillas' sobre la simiente para siempre.",fr:"Les malédictions du Deutéronome 28 n'étaient pas accidentelles."},
    whyMatters:{en:"Punishment makes sense only when covenant is understood. Suffering without context produces despair. Suffering within covenant context produces repentance and hope.",es:"El castigo tiene sentido solo cuando el pacto es entendido.",fr:"La punition n'a de sens que lorsque l'alliance est comprise."},
    prepNote:{en:"Read Deuteronomy 28:46-68 carefully. Write in your journal: What historical events do these verses bring to mind?",es:"Lee Deuteronomio 28:46-68 cuidadosamente. Escribe en tu diario.",fr:"Lisez attentivement Deutéronome 28:46-68."},
    scriptures:{
      ot:["Deuteronomy 28:46","Deuteronomy 28:48","Deuteronomy 28:68","Deuteronomy 28:37","Amos 9:9","Isaiah 42:22","Jeremiah 30:7","Psalm 83:3-4"],
      apocrypha:["Baruch 1:11-12","Baruch 3:9-12","2 Maccabees 5:17-20","2 Esdras 1:7-9","Sirach 23:24-26"],
      nt:["Luke 21:24","Romans 11:25","Matthew 24:21","Revelation 6:9-11","1 Corinthians 10:11","Romans 9:27","Luke 19:43-44"],
    },
  },
  {
    id:"shabbat-stage-4", stage:4, stageName:"Law", stageNameEs:"Ley", stageNameFr:"Loi",
    color:"#1B3A5C", icon:"⚖️",
    title:{en:"Shabbat Morning Study",es:"Estudio de la Mañana de Shabat",fr:"Étude du Matin du Sabbat"},
    topic:{en:"The Laws That Set Us Apart — Covenant Life is Visible",es:"Las Leyes Que Nos Diferencian — La Vida del Pacto es Visible",fr:"Les Lois Qui Nous Distinguent — La Vie d'Alliance est Visible"},
    description:{en:"Covenant life is visible. YAHAWAH gave commandments governing dress, food, holy days, marriage, and moral conduct to identify and sanctify His people. This class systematically covers the laws that still define covenant identity and daily obedience.",es:"La vida del pacto es visible. YAHAWAH dio mandamientos sobre vestimenta, alimentos, días santos, matrimonio y conducta moral.",fr:"La vie d'alliance est visible."},
    whyMatters:{en:"The law is not legalism — it is covenant infrastructure. Without it, covenant identity is theoretical but not visible.",es:"La ley no es legalismo — es infraestructura del pacto.",fr:"La loi n'est pas un légalisme — c'est l'infrastructure de l'alliance."},
    prepNote:{en:"Study each law category below. Ask: What does this law protect? What does it reveal about covenant identity?",es:"Estudia cada categoría de ley a continuación.",fr:"Étudiez chaque catégorie de loi ci-dessous."},
    scriptures:{
      ot:["Deuteronomy 22:5","Leviticus 11:2-3","Leviticus 11:7-8","Leviticus 23:2-3","Exodus 20:8-11","Leviticus 19:28","Numbers 15:38-40","Deuteronomy 14:3"],
      apocrypha:["Sirach 3:1-6","Sirach 7:27-28","1 Maccabees 1:41-64","2 Maccabees 6:1-11","Baruch 4:1-3","Tobit 4:5-9"],
      nt:["Matthew 5:17","Matthew 19:16-17","1 Timothy 2:9-10","Hebrews 13:4","1 Peter 3:3-4","Revelation 12:17","Revelation 14:12","James 2:17"],
    },
  },
  {
    id:"shabbat-stage-5", stage:5, stageName:"Messiah", stageNameEs:"Mesías", stageNameFr:"Messie",
    color:"#5A7A52", icon:"✦",
    title:{en:"Shabbat Morning Study",es:"Estudio de la Mañana de Shabat",fr:"Étude du Matin du Sabbat"},
    topic:{en:"The Messiah Fulfilled the Prophecy of Sacrifice",es:"El Mesías Cumplió la Profecía del Sacrificio",fr:"Le Messie a Accompli la Prophétie du Sacrifice"},
    description:{en:"Yahawashi did not come to destroy the law or the prophets. He came to fulfill the prophetic role of sacrifice spoken by all the prophets beforehand. This class traces the connection between the law, the prophets, the offerings, and the Messiah's mission to the lost house of Israel.",es:"Yahawashi no vino a destruir la ley ni los profetas. Vino a cumplir el papel profético del sacrificio.",fr:"Yahawashi n'est pas venu détruire la loi ou les prophètes."},
    whyMatters:{en:"Understanding who Yahawashi was sent to changes how you read the entire New Testament. He came to specific people with a specific mission.",es:"Entender a quién fue enviado Yahawashi cambia cómo lees todo el Nuevo Testamento.",fr:"Comprendre à qui Yahawashi a été envoyé change la façon dont tu lis tout le Nouveau Testament."},
    prepNote:{en:"Read Isaiah 53 in full before class. Then read Matthew 15:24. Write in your journal what you observe about the Messiah's specific mission.",es:"Lee Isaías 53 completo antes de clase. Luego lee Mateo 15:24.",fr:"Lisez Ésaïe 53 en entier avant le cours."},
    scriptures:{
      ot:["Isaiah 53:1-12","Isaiah 9:6-7","Psalm 40:6-8","Daniel 9:26","Zechariah 12:10","Genesis 22:7-14","Exodus 12:1-14","Leviticus 16:29-34"],
      apocrypha:["Wisdom of Solomon 2:12-20","Sirach 24:23","Baruch 3:35-37","2 Maccabees 7:32-33","1 Esdras 8:88-90","Tobit 13:1"],
      nt:["Matthew 5:17","Matthew 15:24","Luke 24:44","John 1:29","Acts 3:18","Hebrews 10:1-10","1 Peter 1:18-21","Revelation 5:5-6"],
    },
  },
  {
    id:"shabbat-stage-6", stage:6, stageName:"Diaspora", stageNameEs:"Diáspora", stageNameFr:"Diaspora",
    color:"#7B5EA7", icon:"🌍",
    title:{en:"Shabbat Morning Study",es:"Estudio de la Mañana de Shabat",fr:"Étude du Matin du Sabbat"},
    topic:{en:"Scattered Among the Nations — The Diaspora of Israel",es:"Esparcidos Entre las Naciones — La Diáspora de Israel",fr:"Dispersés parmi les Nations — La Diaspora d'Israël"},
    description:{en:"Israel was scattered in stages: the Assyrian exile removed the northern ten tribes. The Babylonian captivity removed Judah. The Roman destruction of Jerusalem finalized the global dispersion. Some traditions study the later diasporas through prophecy and observed historical patterns.",es:"Israel fue esparcido en etapas: el exilio asirio llevó a las diez tribus del norte.",fr:"Israël a été dispersé par étapes."},
    whyMatters:{en:"Hosea 8:8 says Israel was swallowed up — absorbed, not annihilated. The covenant people exist today hidden among the nations.",es:"Oseas 8:8 dice que Israel fue devorado — absorbido, no aniquilado.",fr:"Osée 8:8 dit qu'Israël a été avalé — absorbé, non anéanti."},
    prepNote:{en:"Read 2 Kings 17:1-23 before class. Write in your journal: Where did the ten tribes go? What happened to their identity?",es:"Lee 2 Reyes 17:1-23 antes de clase.",fr:"Lisez 2 Rois 17:1-23 avant le cours."},
    scriptures:{
      ot:["Hosea 8:8","2 Kings 17:6","2 Kings 18:11","Amos 9:9","Joel 3:2","Joel 3:6","Isaiah 11:12","Jeremiah 3:6-8"],
      apocrypha:["2 Esdras 13:40-45","2 Esdras 1:38-40","Baruch 2:13-14","1 Maccabees 1:11","Baruch 4:15-19","Sirach 36:1-5"],
      nt:["James 1:1","Matthew 15:24","Romans 11:25-26","Revelation 18:4","Luke 21:24","Acts 26:7","John 10:16","1 Peter 1:1"],
    },
  },
  {
    id:"shabbat-stage-7", stage:7, stageName:"Restoration", stageNameEs:"Restauración", stageNameFr:"Restauration",
    color:"#2E7D32", icon:"✨",
    title:{en:"Shabbat Morning Study",es:"Estudio de la Mañana de Shabat",fr:"Étude du Matin du Sabbat"},
    topic:{en:"Restoration, Jacob's Trouble, and the Kingdom",es:"Restauración, la Angustia de Jacob, y el Reino",fr:"Restauration, la Détresse de Jacob, et le Royaume"},
    description:{en:"Scattering is not the end. Scripture speaks of Jacob's trouble — the final tribulation before the Messiah's return and the regathering of the 12 tribes. The dry bones will live. The outcasts will be gathered. Twelve gates of New Jerusalem bear the names of the twelve tribes.",es:"La dispersión no es el final. La escritura habla de la angustia de Jacob.",fr:"La dispersion n'est pas la fin."},
    whyMatters:{en:"Knowing where the story ends changes how you live today. You are not in permanent captivity — you are in a covenant process.",es:"Saber dónde termina la historia cambia cómo vives hoy.",fr:"Savoir où l'histoire se termine change ta façon de vivre aujourd'hui."},
    prepNote:{en:"Read Ezekiel 37 in full. Then read Revelation 21:9-14. Write: What does the end of the covenant story look like according to scripture?",es:"Lee Ezequiel 37 completo. Luego lee Apocalipsis 21:9-14.",fr:"Lisez Ézéchiel 37 en entier. Puis lisez Apocalypse 21:9-14."},
    scriptures:{
      ot:["Jeremiah 30:7","Ezekiel 37:1-14","Ezekiel 37:21-22","Isaiah 11:12","Isaiah 43:5-6","Amos 9:14-15","Deuteronomy 30:3","Zephaniah 3:14-15"],
      apocrypha:["Baruch 5:5-9","2 Esdras 6:25-28","Baruch 4:36-37","Sirach 36:10-11","2 Esdras 13:12-13","1 Maccabees 14:4-5"],
      nt:["Revelation 21:12","Revelation 7:4","Romans 11:26","Luke 1:68-71","Acts 1:6","Matthew 24:31","Revelation 22:3-5","Isaiah 66:23"],
    },
  },
];

// Get current Shabbat class stage (cycles 1-7 by ISO week number)
function getCurrentShabbatClass() {
  const weekNum = Math.floor((Date.now() - new Date(new Date().getFullYear(), 0, 1)) / (7 * 24 * 60 * 60 * 1000));
  const stageIdx = weekNum % 7;
  return SHABBAT_CLASSES[stageIdx] || SHABBAT_CLASSES[0];
}

// ─── SABBATH + FEAST OVERLAP DETECTION ───────────────────────────────────────
function detectSabbathFeastOverlap() {
  const now = new Date();
  // Get next Friday
  const nextFriday = new Date();
  const dayOfWeek = nextFriday.getDay();
  const daysUntilFriday = (5 - dayOfWeek + 7) % 7 || 7;
  nextFriday.setDate(nextFriday.getDate() + daysUntilFriday);
  nextFriday.setHours(18, 0, 0, 0); // sunset approx

  // Check if next Sabbath (Fri sunset - Sat sunset) overlaps with any feast
  const nextSat = new Date(nextFriday);
  nextSat.setDate(nextSat.getDate() + 1);

  for (const feast of HOLY_FEASTS) {
    if (feast.id === "shabbat" || !feast.date2026) continue;
    const feastDate = new Date(feast.date2026);
    const feastEnd = feast.daysLong ? new Date(feastDate.getTime() + feast.daysLong * 86400000) : feastDate;

    // Check if next Saturday falls within feast window (±3 days)
    const withinRange = nextSat >= feastDate && nextSat <= feastEnd;
    const nearFeast = Math.abs(nextSat - feastDate) < 3 * 24 * 60 * 60 * 1000;

    if (withinRange || nearFeast) {
      return { overlap: true, feast, daysUntilFriday };
    }
  }
  return { overlap: false, feast: null, daysUntilFriday };
}

// ─── WHATSAPP NOTIFICATION ENGINE ────────────────────────────────────────────
const WHATSAPP_LINKS = {
  es: "https://chat.whatsapp.com/DURN5BiprUzBa6v46bTLgu?mode=gi_t",
  fr: "https://chat.whatsapp.com/DURN5BiprUzBa6v46bTLgu?mode=gi_t",
  pt: "https://chat.whatsapp.com/DURN5BiprUzBa6v46bTLgu?mode=gi_t",
  ht: "https://chat.whatsapp.com/DURN5BiprUzBa6v46bTLgu?mode=gi_t",
  en: "https://chat.whatsapp.com/GmdP6Rujeg6EHKJLcwGVlp?mode=gi_t",
};

function buildReminderMessage(lang, type, data) {
  const msgs = {
    sabbath: {
      en:"Shabbat Shalom! Reminder: Sabbath begins at sunset Friday. Join the upcoming class and prepare your household in peace.",
      es:"Shabat Shalom. Recordatorio: el Shabat comienza al atardecer del viernes. Únete a la próxima clase y prepara tu hogar en paz.",
      fr:"Shabbat Shalom. Rappel : le Sabbat commence au coucher du soleil vendredi. Rejoignez la prochaine classe et préparez votre foyer dans la paix.",
    },
    feast: {
      en:`Reminder: The Feast of ${data?.name||"YAHAWAH"} is approaching. Review the scriptures, preparation notes, and class details in the app.`,
      es:`Recordatorio: La fiesta de ${data?.name||"YAHAWAH"} se acerca. Revisa las escrituras, notas de preparación y detalles de la clase en la app.`,
      fr:`Rappel : la fête de ${data?.name||"YAHAWAH"} approche. Consultez les écritures, les notes de préparation et les détails de la classe dans l'application.`,
    },
    abib: {
      en:"Biblical New Year Reminder: Abib has begun — the beginning of months and the start of spring according to scripture. (Exodus 12:2)",
      es:"Recordatorio del Año Nuevo Bíblico: Abib ha comenzado — el principio de los meses y el inicio de la primavera según la escritura. (Éxodo 12:2)",
      fr:"Rappel de la Nouvelle Année Biblique : Abib a commencé — le commencement des mois et le début du printemps selon l'Écriture. (Exode 12:2)",
    },
    overlap: {
      en:`Special Reminder: This upcoming Sabbath also falls within ${data?.name||"a Feast of YAHAWAH"}. Review the holy day instructions and class updates in the app.`,
      es:`Recordatorio Especial: Este próximo Shabat también cae dentro de ${data?.name||"una Fiesta del Señor"}. Revisa las instrucciones del día santo.`,
      fr:`Rappel spécial : ce prochain Sabbat tombe aussi pendant ${data?.name||"une Fête de l'Éternel"}. Consultez les instructions du jour saint.`,
    },
  };
  return (msgs[type]?.[lang] || msgs[type]?.en || "");
}

// Placeholder for future WhatsApp Business API integration
function sendWhatsAppReminder(type, payload) {
  // Future: connect to Twilio WhatsApp API or Meta Cloud API
  // For now: open WhatsApp community link
  const lang = payload?.lang || "en";
  const message = buildReminderMessage(lang, type, payload?.feast);
  const waLink = WHATSAPP_LINKS[lang] || WHATSAPP_LINKS.en;
  window.open(waLink, '_blank');
  return message;
}

// ─── VERSE CARD COMPONENT ────────────────────────────────────────────────────
function VerseCard({ reference, text, version, color, compact, onSave, onShare }) {
  const [saved, setSaved] = useState(false);
  const [copied, setCopied] = useState(false);
  const cardColor = color || "#C4893A";

  const handleSave = () => {
    try {
      const existing = JSON.parse(localStorage.getItem("gdbc_saved") || "[]");
      if (!existing.some(s => s.ref === reference)) {
        const updated = [{ id: Date.now(), ref: reference, text, saved_on: new Date().toLocaleDateString() }, ...existing];
        localStorage.setItem("gdbc_saved", JSON.stringify(updated));
      }
      setSaved(true);
      setTimeout(() => setSaved(false), 2500);
      if (onSave) onSave({ reference, text });
    } catch {}
  };

  const handleShare = () => {
    const shareText = `${reference}\n"${text}"\n— ${version || "KJV"}\n\nGod Did It Bible Club`;
    if (navigator.share) {
      navigator.share({ title: reference, text: shareText }).catch(() => {});
    } else {
      navigator.clipboard?.writeText(shareText);
      setCopied(true);
      setTimeout(() => setCopied(false), 2000);
    }
    if (onShare) onShare({ reference, text });
  };

  if (compact) {
    return (
      <div style={{background:"var(--cream)",borderRadius:"11px",padding:"0.85rem 1.05rem",marginBottom:"0.5rem",border:"1px solid var(--border)",borderLeft:`3px solid ${cardColor}`}}>
        <div style={{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.4rem",marginBottom:"0.3rem"}}>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",color:cardColor}}>{reference}</div>
          <div style={{display:"flex",gap:"0.3rem",flexShrink:0}}>
            <button onClick={handleSave} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.18rem 0.45rem",borderRadius:"5px",border:`1px solid ${saved?"#5A7A52":cardColor+"44"}`,color:saved?"#5A7A52":cardColor,background:saved?"rgba(90,122,82,0.1)":"transparent",cursor:"pointer"}}>{saved?"✓":"🔖"}</button>
            <button onClick={handleShare} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.18rem 0.45rem",borderRadius:"5px",border:"1px solid var(--border)",color:"var(--muted)",background:"transparent",cursor:"pointer"}}>{copied?"✓":"📤"}</button>
          </div>
        </div>
        <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"0.95rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.72}}>"{text}"</div>
      </div>
    );
  }

  return (
    <div style={{background:"white",borderRadius:"16px",border:"1px solid var(--border)",padding:"1.25rem 1.4rem",marginBottom:"0.75rem",boxShadow:"var(--shadow)",borderTop:`3px solid ${cardColor}`}}>
      <div style={{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.5rem",marginBottom:"0.5rem"}}>
        <div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.1em",color:cardColor,marginBottom:"0.12rem"}}>{reference}</div>
          {version && <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.08em",color:"var(--muted)"}}>{version}</div>}
        </div>
        <div style={{display:"flex",gap:"0.4rem",flexShrink:0}}>
          <button onClick={handleSave}
            style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.06em",padding:"0.3rem 0.7rem",borderRadius:"8px",border:`1px solid ${saved?"#5A7A52":cardColor+"44"}`,color:saved?"#5A7A52":cardColor,background:saved?"rgba(90,122,82,0.1)":"transparent",cursor:"pointer",transition:"all 0.18s"}}>
            {saved?"✓ Saved":"🔖 Save"}
          </button>
          <button onClick={handleShare}
            style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.06em",padding:"0.3rem 0.7rem",borderRadius:"8px",border:"1px solid var(--border)",color:"var(--muted)",background:"transparent",cursor:"pointer"}}>
            {copied?"✓ Copied":"📤 Share"}
          </button>
        </div>
      </div>
      <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1.05rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.78}}>"{text}"</div>
    </div>
  );
}

// ─── ACCOUNT PAGE ─────────────────────────────────────────────────────────────
// ─── FORGOT PASSWORD / RESET PAGE ────────────────────────────────────────────
function ForgotPasswordPage({ setPage, lang }) {
  const [email, setEmail] = useState("");
  const [step, setStep] = useState("request"); // request | sent | reset | done
  const [code, setCode] = useState("");
  const [newPassword, setNewPassword] = useState("");
  const [confirm, setConfirm] = useState("");
  const [error, setError] = useState("");
  const [loading, setLoading] = useState(false);

  const l = lang || "en";

  const LABELS = {
    title:      { en:"Forgot Your Password?",         es:"¿Olvidaste tu Contraseña?",        fr:"Mot de Passe Oublié?" },
    sub:        { en:"Enter your email and we'll send you reset instructions.", es:"Ingresa tu correo y te enviaremos instrucciones.", fr:"Entrez votre email et nous vous enverrons les instructions." },
    email:      { en:"Your email address",             es:"Tu correo electrónico",             fr:"Votre adresse email" },
    sendBtn:    { en:"Send Reset Instructions",        es:"Enviar Instrucciones",              fr:"Envoyer les Instructions" },
    sentTitle:  { en:"Check Your Email",               es:"Revisa Tu Correo",                  fr:"Vérifiez Votre Email" },
    sentSub:    { en:"We sent reset steps to",         es:"Enviamos instrucciones a",          fr:"Nous avons envoyé les instructions à" },
    sentNote:   { en:"Check your inbox and spam folder. The reset link expires in 24 hours.", es:"Revisa tu bandeja de entrada y spam. El enlace expira en 24 horas.", fr:"Vérifiez votre boîte de réception et les spams. Le lien expire dans 24 heures." },
    codeLabel:  { en:"Enter the 6-digit code from your email:", es:"Ingresa el código de 6 dígitos:", fr:"Entrez le code à 6 chiffres:" },
    newPass:    { en:"New Password",                   es:"Nueva Contraseña",                  fr:"Nouveau Mot de Passe" },
    confirmPass:{ en:"Confirm New Password",           es:"Confirmar Nueva Contraseña",        fr:"Confirmer le Nouveau Mot de Passe" },
    resetBtn:   { en:"Reset Password",                 es:"Restablecer Contraseña",            fr:"Réinitialiser le Mot de Passe" },
    doneTitle:  { en:"Password Reset!",                es:"¡Contraseña Restablecida!",         fr:"Mot de Passe Réinitialisé!" },
    doneSub:    { en:"Your password has been updated. You can now sign in with your new password.", es:"Tu contraseña ha sido actualizada.", fr:"Votre mot de passe a été mis à jour." },
    backLogin:  { en:"Back to Sign In",                es:"Volver al Inicio",                  fr:"Retour à la Connexion" },
    backJoin:   { en:"Join the Bible Club",            es:"Unirse al Club Bíblico",            fr:"Rejoindre le Club Biblique" },
  };
  const T = k => LABELS[k]?.[l] || LABELS[k]?.en || k;

  const handleSendReset = async () => {
    if (!email.trim() || !email.includes("@")) { setError(l==="es"?"Ingresa un correo válido":l==="fr"?"Entrez un email valide":"Enter a valid email address"); return; }
    setError(""); setLoading(true);
    // Future: POST to ROCKDIDIT_CONFIG.AUTH.FORGOT_PASSWORD
    // For now: simulate email send with instructions
    setTimeout(() => {
      setLoading(false);
      setStep("sent");
      // Log the event
      dispatchEcosystemEvent("forgot_password_requested", { email, portal: ROCKDIDIT_CONFIG.PORTAL_ID });
    }, 1200);
  };

  const handleVerifyCode = () => {
    if (code.length < 4) { setError(l==="es"?"Ingresa el código completo":l==="fr"?"Entrez le code complet":"Enter the complete code"); return; }
    setError(""); setStep("reset");
  };

  const handleReset = () => {
    if (newPassword.length < 8) { setError(l==="es"?"La contraseña debe tener al menos 8 caracteres":l==="fr"?"Le mot de passe doit avoir au moins 8 caractères":"Password must be at least 8 characters"); return; }
    if (newPassword !== confirm) { setError(l==="es"?"Las contraseñas no coinciden":l==="fr"?"Les mots de passe ne correspondent pas":"Passwords do not match"); return; }
    setError(""); setLoading(true);
    // Future: POST to ROCKDIDIT_CONFIG.AUTH.RESET_PASSWORD
    setTimeout(() => { setLoading(false); setStep("done"); }, 1000);
  };

  return (
    <div style={{maxWidth:"440px",margin:"0 auto",padding:"2rem 1rem"}}>
      {step === "request" && (
        <motion.div initial={{opacity:0,y:16}} animate={{opacity:1,y:0}}>
          <div style={{textAlign:"center",marginBottom:"2rem"}}>
            <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>🔐</div>
            <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"1.4rem",color:"var(--ink)",marginBottom:"0.4rem"}}>{T("title")}</h2>
            <p style={{fontSize:"0.87rem",color:"var(--muted)",lineHeight:1.75}}>{T("sub")}</p>
          </div>
          <div style={{background:"white",borderRadius:"16px",padding:"1.75rem",border:"1px solid var(--border)",boxShadow:"var(--shadow)"}}>
            <input value={email} onChange={e=>setEmail(e.target.value)}
              placeholder={T("email")} type="email"
              style={{width:"100%",background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"9px",padding:"0.75rem 1rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.88rem",color:"var(--ink)",outline:"none",marginBottom:"0.75rem"}}
              onKeyDown={e=>e.key==="Enter"&&handleSendReset()}
            />
            {error && <div style={{fontSize:"0.75rem",color:"var(--rust)",marginBottom:"0.6rem"}}>{error}</div>}
            <button className="btn-submit" onClick={handleSendReset} disabled={loading} style={{width:"100%",marginBottom:"0.75rem"}}>
              {loading ? "⏳ Sending…" : T("sendBtn")}
            </button>
            <button onClick={()=>setPage("join")} style={{width:"100%",fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.1em",padding:"0.6rem",borderRadius:"9px",border:"1px solid var(--border)",background:"transparent",color:"var(--muted)",cursor:"pointer"}}>
              ← {T("backJoin")}
            </button>
          </div>
        </motion.div>
      )}

      {step === "sent" && (
        <motion.div initial={{opacity:0,y:16}} animate={{opacity:1,y:0}}>
          <div style={{textAlign:"center",marginBottom:"2rem"}}>
            <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>📧</div>
            <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"1.4rem",color:"var(--ink)",marginBottom:"0.4rem"}}>{T("sentTitle")}</h2>
            <p style={{fontSize:"0.87rem",color:"var(--muted)",lineHeight:1.75}}>{T("sentSub")} <strong>{email}</strong></p>
          </div>
          <div style={{background:"white",borderRadius:"16px",padding:"1.75rem",border:"1px solid var(--border)",boxShadow:"var(--shadow)"}}>
            <div style={{background:"rgba(196,137,58,0.08)",borderRadius:"10px",padding:"1rem",borderLeft:"3px solid var(--gold)",marginBottom:"1.25rem"}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.12em",color:"var(--gold)",marginBottom:"0.4rem"}}>📋 RESET STEPS</div>
              <div style={{fontSize:"0.84rem",color:"var(--ink)",lineHeight:1.85}}>
                {l==="es"?"1. Revisa tu bandeja de entrada (y carpeta de spam)\n2. Abre el correo de God Did It Bible Club\n3. Haz clic en el enlace de restablecimiento\n4. Ingresa tu nueva contraseña\n5. ¡Inicia sesión con tu nueva contraseña!":l==="fr"?"1. Vérifiez votre boîte de réception (et les spams)\n2. Ouvrez l'email de God Did It Bible Club\n3. Cliquez sur le lien de réinitialisation\n4. Entrez votre nouveau mot de passe\n5. Connectez-vous avec votre nouveau mot de passe!":"1. Check your inbox (and spam folder)\n2. Open the email from God Did It Bible Club\n3. Click the reset link in the email\n4. Enter your new password\n5. Sign in with your new password!"}
              </div>
            </div>
            <div style={{fontSize:"0.78rem",color:"var(--muted)",marginBottom:"1.25rem",lineHeight:1.65}}>{T("sentNote")}</div>
            <button className="btn-gold" onClick={()=>setStep("verify")} style={{width:"100%",marginBottom:"0.65rem"}}>
              {l==="es"?"Tengo el código →":l==="fr"?"J'ai le code →":"I Have the Code →"}
            </button>
            <button onClick={handleSendReset} style={{width:"100%",fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",padding:"0.6rem",borderRadius:"9px",border:"1px solid var(--border)",background:"transparent",color:"var(--muted)",cursor:"pointer"}}>
              {l==="es"?"Reenviar correo":l==="fr"?"Renvoyer l'email":"Resend email"}
            </button>
          </div>
        </motion.div>
      )}

      {step === "verify" && (
        <motion.div initial={{opacity:0,y:16}} animate={{opacity:1,y:0}}>
          <div style={{textAlign:"center",marginBottom:"1.5rem"}}>
            <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>🔢</div>
            <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"1.3rem",color:"var(--ink)"}}>{T("codeLabel")}</h2>
          </div>
          <div style={{background:"white",borderRadius:"16px",padding:"1.75rem",border:"1px solid var(--border)",boxShadow:"var(--shadow)"}}>
            <input value={code} onChange={e=>setCode(e.target.value.replace(/\D/g,"").slice(0,6))}
              placeholder="000000" maxLength={6} type="text"
              style={{width:"100%",background:"var(--cream)",border:"2px solid var(--gold)",borderRadius:"9px",padding:"0.9rem 1rem",fontFamily:"'Cinzel',serif",fontSize:"1.4rem",letterSpacing:"0.3em",color:"var(--ink)",outline:"none",textAlign:"center",marginBottom:"0.75rem"}}
            />
            {error && <div style={{fontSize:"0.75rem",color:"var(--rust)",marginBottom:"0.6rem"}}>{error}</div>}
            <button className="btn-gold" onClick={handleVerifyCode} style={{width:"100%"}}>{l==="es"?"Verificar Código":l==="fr"?"Vérifier le Code":"Verify Code"}</button>
          </div>
        </motion.div>
      )}

      {step === "reset" && (
        <motion.div initial={{opacity:0,y:16}} animate={{opacity:1,y:0}}>
          <div style={{textAlign:"center",marginBottom:"1.5rem"}}>
            <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>🔑</div>
            <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"1.3rem",color:"var(--ink)"}}>{T("resetBtn")}</h2>
          </div>
          <div style={{background:"white",borderRadius:"16px",padding:"1.75rem",border:"1px solid var(--border)",boxShadow:"var(--shadow)"}}>
            <input value={newPassword} onChange={e=>setNewPassword(e.target.value)} placeholder={T("newPass")} type="password"
              style={{width:"100%",background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"9px",padding:"0.75rem 1rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.88rem",color:"var(--ink)",outline:"none",marginBottom:"0.65rem"}} />
            <input value={confirm} onChange={e=>setConfirm(e.target.value)} placeholder={T("confirmPass")} type="password"
              style={{width:"100%",background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"9px",padding:"0.75rem 1rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.88rem",color:"var(--ink)",outline:"none",marginBottom:"0.75rem"}} />
            {error && <div style={{fontSize:"0.75rem",color:"var(--rust)",marginBottom:"0.6rem"}}>{error}</div>}
            <button className="btn-submit" onClick={handleReset} disabled={loading} style={{width:"100%"}}>
              {loading ? "⏳ Resetting…" : T("resetBtn")}
            </button>
          </div>
        </motion.div>
      )}

      {step === "done" && (
        <motion.div initial={{opacity:0,scale:0.9}} animate={{opacity:1,scale:1}} style={{textAlign:"center",padding:"2rem 0"}}>
          <div style={{fontSize:"3rem",marginBottom:"1rem"}}>✅</div>
          <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"1.4rem",color:"var(--ink)",marginBottom:"0.5rem"}}>{T("doneTitle")}</h2>
          <p style={{fontSize:"0.87rem",color:"var(--muted)",lineHeight:1.75,marginBottom:"1.5rem"}}>{T("doneSub")}</p>
          <button className="btn-gold" onClick={()=>setPage("join")}>{T("backLogin")}</button>
        </motion.div>
      )}
    </div>
  );
}

function AccountPage({ setPage, lang, setLang, t }) {
  const [activeTab, setActiveTab] = useState("profile");
  const [profile, setProfile] = useState(() => {
    try { return JSON.parse(localStorage.getItem("gdbc_profile") || '{"name":"","lang":"en"}'); } catch { return {name:"",lang:"en"}; }
  });
  const [saved, setSaved] = useState(() => {
    try { return JSON.parse(localStorage.getItem("gdbc_saved") || "[]"); } catch { return []; }
  });
  const [notes, setNotes] = useState(() => {
    try { return JSON.parse(localStorage.getItem("gdbc_notes") || "[]"); } catch { return []; }
  });
  const [history, setHistory] = useState(() => {
    try { return JSON.parse(localStorage.getItem("gdbc_history") || "[]"); } catch { return []; }
  });
  const [remindPrefs, setRemindPrefs] = useState(() => {
    try { return JSON.parse(localStorage.getItem("gdbc_reminders") || '{"inApp":true,"browser":false,"whatsapp":false,"sabbath":true,"feasts":true}'); } catch { return {inApp:true,browser:false,whatsapp:false,sabbath:true,feasts:true}; }
  });
  const [saved_profile, setSavedProfile] = useState(false);

  const saveProfile = () => {
    try { localStorage.setItem("gdbc_profile", JSON.stringify(profile)); } catch {}
    if (profile.lang && profile.lang !== lang) setLang(profile.lang);
    setSavedProfile(true);
    setTimeout(() => setSavedProfile(false), 2000);
  };

  const clearHistory = () => {
    setHistory([]);
    try { localStorage.removeItem("gdbc_history"); } catch {}
  };

  const removeSaved = (id) => {
    const updated = saved.filter(s => s.id !== id);
    setSaved(updated);
    try { localStorage.setItem("gdbc_saved", JSON.stringify(updated)); } catch {}
  };

  const deleteNote = (id) => {
    const updated = notes.filter(n => n.id !== id);
    setNotes(updated);
    try { localStorage.setItem("gdbc_notes", JSON.stringify(updated)); } catch {}
  };

  const togglePref = (key) => {
    const updated = { ...remindPrefs, [key]: !remindPrefs[key] };
    setRemindPrefs(updated);
    try { localStorage.setItem("gdbc_reminders", JSON.stringify(updated)); } catch {}
  };

  const TABS = [
    { key:"profile",   icon:"👤", label:lang==="es"?"Perfil":lang==="fr"?"Profil":"Profile" },
    { key:"bookmarks", icon:"🔖", label:lang==="es"?"Guardados":lang==="fr"?"Favoris":"Bookmarks" },
    { key:"notes",     icon:"📝", label:lang==="es"?"Notas":lang==="fr"?"Notes":"Notes" },
    { key:"history",   icon:"🕐", label:lang==="es"?"Historial":lang==="fr"?"Historique":"History" },
    { key:"reminders", icon:"🔔", label:lang==="es"?"Avisos":lang==="fr"?"Rappels":"Reminders" },
    { key:"resources", icon:"📚", label:lang==="es"?"Recursos":lang==="fr"?"Ressources":"Resources" },
  ];

  const RESOURCES = [
    { icon:"📖", title:"Blue Letter Bible", desc:"Strong's · Lexicon · Interlinear", url:"https://www.blueletterbible.org/", color:"#8B3A2A" },
    { icon:"📜", title:"BibleGateway", desc:"Multiple translations · KJV · ASV · WEB", url:"https://www.biblegateway.com/", color:"#1B3A5C" },
    { icon:"🔤", title:"Interlinear Bible", desc:"Word-for-word Hebrew/Greek", url:"https://biblehub.com/interlinear/", color:"#6D4C41" },
    { icon:"✡️", title:"Hebrew Lexicon", desc:"OT original words · Root meanings", url:"https://biblehub.com/hebrew/", color:"#8B3A2A" },
    { icon:"🏛️", title:"Greek Lexicon", desc:"NT original words · Koine Greek", url:"https://biblehub.com/greek/", color:"#1B3A5C" },
    { icon:"📜", title:"Codex Sinaiticus", desc:"4th century manuscript online", url:"https://codexsinaiticus.org/en/", color:"#6A1B9A" },
    { icon:"📚", title:"Bible Commentary", desc:"Matthew Henry · Gill's Exposition", url:"https://www.studylight.org/commentary/", color:"#7B5EA7" },
    { icon:"🗺️", title:"Bible Atlas / Maps", desc:"Holy Land geography · History maps", url:"https://www.biblestudy.org/maps/", color:"#00838F" },
  ];

  return (
    <div>
      {/* Hero */}
      <div style={{background:"linear-gradient(135deg,var(--deep),#2A1A0A)",borderRadius:"20px",padding:"1.75rem 2rem",marginBottom:"1.5rem",color:"var(--parchment)"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.28em",color:"var(--gold-light)",marginBottom:"0.5rem"}}>✦ MY ACCOUNT</div>
        <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"clamp(1.3rem,4vw,2rem)",color:"var(--parchment)",marginBottom:"0.35rem"}}>{profile.name || (lang==="es"?"Mi Cuenta":lang==="fr"?"Mon Compte":"My Account")}</h2>
        <p style={{fontSize:"0.82rem",color:"rgba(250,246,238,0.55)",lineHeight:1.7}}>{lang==="es"?"Perfil · Guardados · Notas · Historial · Recursos":lang==="fr"?"Profil · Favoris · Notes · Historique · Ressources":"Profile · Bookmarks · Notes · History · Resources"}</p>
      </div>

      {/* Tab bar — scrollable */}
      <div style={{display:"flex",gap:"0",marginBottom:"1.5rem",border:"1px solid var(--border)",borderRadius:"12px",overflow:"hidden",overflowX:"auto",scrollbarWidth:"none"}}>
        {TABS.map(tab=>(
          <button key={tab.key} onClick={()=>setActiveTab(tab.key)}
            style={{flex:1,minWidth:"72px",fontFamily:"'Cinzel',serif",fontSize:"0.56rem",letterSpacing:"0.07em",padding:"0.65rem 0.3rem",border:"none",borderRight:"1px solid var(--border)",background:activeTab===tab.key?"var(--deep)":"white",color:activeTab===tab.key?"var(--gold-light)":"var(--muted)",cursor:"pointer",transition:"all 0.18s",display:"flex",flexDirection:"column",alignItems:"center",gap:"0.2rem"}}>
            <span style={{fontSize:"0.9rem"}}>{tab.icon}</span>
            <span>{tab.label}</span>
          </button>
        ))}
      </div>

      {/* ── PROFILE ── */}
      {activeTab==="profile" && (
        <div>
          <div style={{background:"white",borderRadius:"16px",border:"1px solid var(--border)",padding:"1.5rem",boxShadow:"var(--shadow)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.16em",color:"var(--gold)",marginBottom:"1rem"}}>👤 {lang==="es"?"EDITAR PERFIL":lang==="fr"?"MODIFIER LE PROFIL":"EDIT PROFILE"}</div>
            <div style={{marginBottom:"0.75rem"}}>
              <label style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",color:"var(--muted)",display:"block",marginBottom:"0.35rem"}}>{lang==="es"?"NOMBRE (OPCIONAL)":lang==="fr"?"NOM (OPTIONNEL)":"NAME (OPTIONAL)"}</label>
              <input value={profile.name} onChange={e=>setProfile(p=>({...p,name:e.target.value}))}
                placeholder={lang==="es"?"Tu nombre...":lang==="fr"?"Ton nom...":"Your name..."}
                style={{width:"100%",background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"9px",padding:"0.65rem 0.9rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.88rem",color:"var(--ink)",outline:"none"}} />
            </div>
            <div style={{marginBottom:"1.1rem"}}>
              <label style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.1em",color:"var(--muted)",display:"block",marginBottom:"0.35rem"}}>{lang==="es"?"IDIOMA PREFERIDO":lang==="fr"?"LANGUE PRÉFÉRÉE":"PREFERRED LANGUAGE"}</label>
              <select value={profile.lang||lang} onChange={e=>setProfile(p=>({...p,lang:e.target.value}))}
                style={{width:"100%",background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"9px",padding:"0.65rem 0.9rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.88rem",color:"var(--ink)",outline:"none"}}>
                <option value="en">🇺🇸 English</option>
                <option value="es">🇪🇸 Español</option>
                <option value="fr">🇫🇷 Français</option>
                <option value="pt">🇧🇷 Português</option>
                <option value="ht">🇭🇹 Kreyòl Ayisyen</option>
              </select>
            </div>
            <button className="btn-gold" onClick={saveProfile}>
              {saved_profile?(lang==="es"?"✓ Guardado":lang==="fr"?"✓ Sauvegardé":"✓ Saved!"):(lang==="es"?"Guardar Perfil":lang==="fr"?"Sauvegarder":"Save Profile")}
            </button>
          </div>

          {/* WhatsApp community */}
          <div style={{marginTop:"1.1rem",background:"linear-gradient(135deg,#075E54,#128C7E)",borderRadius:"14px",padding:"1.25rem 1.5rem",color:"white"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"rgba(255,255,255,0.65)",marginBottom:"0.4rem"}}>💬 WHATSAPP</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.88rem",color:"white",marginBottom:"0.3rem"}}>{lang==="es"?"Comunidad WhatsApp":lang==="fr"?"Communauté WhatsApp":"WhatsApp Community"}</div>
            <div style={{fontSize:"0.78rem",color:"rgba(255,255,255,0.65)",marginBottom:"0.85rem"}}>{lang==="es"?"Clases semanales · Avisos · Comunidad del pacto":lang==="fr"?"Cours hebdomadaires · Annonces · Communauté":"Weekly classes · Announcements · Covenant community"}</div>
            <a href={WHATSAPP_LINKS[lang]||WHATSAPP_LINKS.en} target="_blank" rel="noopener noreferrer"
              style={{display:"inline-flex",alignItems:"center",gap:"0.5rem",fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.1em",padding:"0.6rem 1.2rem",background:"#25D166",color:"white",borderRadius:"9px",textDecoration:"none",fontWeight:600}}>
              💬 {lang==="es"?"Unirse a la Comunidad":lang==="fr"?"Rejoindre la Communauté":"Join Community"}
            </a>
          </div>
        </div>
      )}

      {/* ── BOOKMARKS ── */}
      {activeTab==="bookmarks" && (
        <div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.85rem"}}>🔖 {saved.length} {lang==="es"?"GUARDADO(S)":lang==="fr"?"FAVORI(S)":"SAVED SCRIPTURE(S)"}</div>
          {saved.length===0 ? (
            <div style={{textAlign:"center",padding:"2.5rem 1rem"}}>
              <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>🔖</div>
              <div style={{fontSize:"0.84rem",color:"var(--muted)",lineHeight:1.75,maxWidth:"300px",margin:"0 auto"}}>
                {lang==="es"?"Aún no tienes escrituras guardadas. Usa el botón 🔖 en el lector de la Biblia para guardar versículos.":lang==="fr"?"Aucune écriture sauvegardée. Utilisez le bouton 🔖 dans le lecteur de Bible.":"No saved scriptures yet. Tap the 🔖 button in the Bible reader to save verses."}
              </div>
              <button className="btn-gold" style={{marginTop:"1rem"}} onClick={()=>setPage("bible-passage")}>📖 {lang==="es"?"Abrir Lector":"Open Bible Reader"}</button>
            </div>
          ) : saved.map(item=>(
            <VerseCard key={item.id} reference={item.ref} text={item.text||""} version="KJV" compact={false}
              onShare={()=>{}} />
          ))}
        </div>
      )}

      {/* ── NOTES ── */}
      {activeTab==="notes" && (
        <div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.85rem"}}>📝 {notes.length} {lang==="es"?"NOTA(S)":lang==="fr"?"NOTE(S)":"NOTE(S)"}</div>
          {notes.length===0 ? (
            <div style={{textAlign:"center",padding:"2.5rem 1rem"}}>
              <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>📔</div>
              <div style={{fontSize:"0.84rem",color:"var(--muted)"}}>
                {lang==="es"?"Tu diario del pacto está vacío.":lang==="fr"?"Votre journal d'alliance est vide.":"Your covenant journal is empty."}
              </div>
              <button className="btn-gold" style={{marginTop:"1rem"}} onClick={()=>setPage("my-journey")}>📝 {lang==="es"?"Ir a Mi Viaje":"Go to My Journey"}</button>
            </div>
          ) : notes.map(note=>(
            <div key={note.id} style={{background:"white",borderRadius:"14px",border:"1px solid var(--border)",padding:"1.1rem 1.35rem",marginBottom:"0.65rem",boxShadow:"var(--shadow)",borderLeft:"3px solid var(--gold)"}}>
              <div style={{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.5rem",marginBottom:"0.45rem"}}>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",color:"var(--gold)"}}>{note.ref}</div>
                <div style={{display:"flex",gap:"0.3rem"}}>
                  <button onClick={()=>navigator.clipboard?.writeText(note.ref+"\n\n"+note.text)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.18rem 0.45rem",borderRadius:"5px",border:"1px solid var(--border)",color:"var(--muted)",background:"transparent",cursor:"pointer"}}>📋</button>
                  <button onClick={()=>deleteNote(note.id)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.18rem 0.45rem",borderRadius:"5px",border:"1px solid var(--border)",color:"var(--muted)",background:"transparent",cursor:"pointer"}}>✕</button>
                </div>
              </div>
              <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.82,whiteSpace:"pre-wrap"}}>{note.text}</div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",color:"var(--muted)",marginTop:"0.4rem"}}>{note.date}</div>
            </div>
          ))}
        </div>
      )}

      {/* ── HISTORY ── */}
      {activeTab==="history" && (
        <div>
          <div style={{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.85rem"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--gold)"}}>🕐 {lang==="es"?"ACTIVIDAD RECIENTE":lang==="fr"?"ACTIVITÉ RÉCENTE":"RECENT ACTIVITY"}</div>
            {history.length>0 && <button onClick={clearHistory} style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",padding:"0.28rem 0.7rem",borderRadius:"7px",border:"1px solid var(--border)",color:"var(--muted)",background:"transparent",cursor:"pointer"}}>{lang==="es"?"Borrar":"Clear"}</button>}
          </div>
          {history.length===0 ? (
            <div style={{textAlign:"center",padding:"2.5rem 1rem"}}>
              <div style={{fontSize:"2.5rem",marginBottom:"0.75rem"}}>🕐</div>
              <div style={{fontSize:"0.84rem",color:"var(--muted)"}}>{lang==="es"?"Sin actividad reciente.":lang==="fr"?"Aucune activité récente.":"No recent activity yet."}</div>
            </div>
          ) : history.slice(0,20).map((item,i)=>(
            <div key={i} style={{background:"white",borderRadius:"12px",border:"1px solid var(--border)",padding:"0.85rem 1.1rem",marginBottom:"0.5rem",display:"flex",alignItems:"center",gap:"0.75rem",boxShadow:"var(--shadow)"}}>
              <span style={{fontSize:"1.1rem",flexShrink:0}}>{item.icon||"📖"}</span>
              <div style={{flex:1}}>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",color:"var(--ink)",marginBottom:"0.1rem"}}>{item.title}</div>
                <div style={{fontSize:"0.7rem",color:"var(--muted)"}}>{item.type} · {item.date}</div>
              </div>
              <button onClick={()=>setPage(item.page)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",padding:"0.25rem 0.6rem",borderRadius:"6px",border:"1px solid var(--border)",color:"var(--muted)",background:"transparent",cursor:"pointer"}}>→</button>
            </div>
          ))}
        </div>
      )}

      {/* ── REMINDERS ── */}
      {activeTab==="reminders" && (
        <div>
          <div style={{background:"white",borderRadius:"16px",border:"1px solid var(--border)",padding:"1.5rem",marginBottom:"1rem",boxShadow:"var(--shadow)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.16em",color:"var(--gold)",marginBottom:"1rem"}}>🔔 {lang==="es"?"PREFERENCIAS DE AVISOS":lang==="fr"?"PRÉFÉRENCES DE RAPPELS":"REMINDER PREFERENCES"}</div>
            {[
              {key:"inApp",   label:{en:"In-App Reminders",    es:"Avisos en la App",           fr:"Rappels dans l'App"}},
              {key:"sabbath", label:{en:"Sabbath Reminders",    es:"Avisos de Shabat",            fr:"Rappels du Sabbat"}},
              {key:"feasts",  label:{en:"Feast Day Reminders",  es:"Avisos de Días de Fiesta",    fr:"Rappels des Jours de Fête"}},
              {key:"whatsapp",label:{en:"WhatsApp Reminders",   es:"Avisos de WhatsApp",          fr:"Rappels WhatsApp"}},
            ].map(pref=>(
              <div key={pref.key} style={{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 0",borderBottom:"1px solid var(--border)"}}>
                <span style={{fontSize:"0.87rem",color:"var(--ink)"}}>{pref.label[lang]||pref.label.en}</span>
                <button onClick={()=>togglePref(pref.key)}
                  style={{width:"44px",height:"24px",borderRadius:"12px",background:remindPrefs[pref.key]?"#5A7A52":"var(--border)",border:"none",cursor:"pointer",position:"relative",transition:"background 0.2s"}}>
                  <span style={{position:"absolute",top:"2px",width:"20px",height:"20px",borderRadius:"50%",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.2)",transition:"left 0.2s",left:remindPrefs[pref.key]?"22px":"2px"}} />
                </button>
              </div>
            ))}
          </div>

          {/* WhatsApp reminder CTA */}
          <div style={{background:"linear-gradient(135deg,#075E54,#128C7E)",borderRadius:"14px",padding:"1.25rem 1.5rem",color:"white",marginBottom:"1rem"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"rgba(255,255,255,0.65)",marginBottom:"0.4rem"}}>💬 WHATSAPP</div>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.9rem",marginBottom:"0.3rem"}}>{lang==="es"?"Recibe recordatorios por WhatsApp":lang==="fr"?"Recevez les rappels sur WhatsApp":"Get reminders on WhatsApp"}</div>
            <div style={{fontSize:"0.78rem",color:"rgba(255,255,255,0.65)",marginBottom:"0.9rem"}}>{lang==="es"?"Únete a la comunidad para recibir avisos de Shabat, fiestas y clases en vivo.":lang==="fr"?"Rejoignez la communauté pour recevoir des rappels du Sabbat, des fêtes et des cours en direct.":"Join the community to receive Sabbath, feast, and live class reminders."}</div>
            <div style={{display:"flex",gap:"0.5rem",flexWrap:"wrap"}}>
              <a href={WHATSAPP_LINKS[lang]||WHATSAPP_LINKS.en} target="_blank" rel="noopener noreferrer"
                style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.08em",padding:"0.5rem 1rem",background:"#25D166",color:"white",borderRadius:"9px",textDecoration:"none",display:"inline-block"}}>
                💬 {lang==="es"?"Unirse":lang==="fr"?"Rejoindre":"Join WhatsApp"}
              </a>
              <button onClick={()=>sendWhatsAppReminder("sabbath",{lang})}
                style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.08em",padding:"0.5rem 1rem",background:"rgba(255,255,255,0.15)",color:"white",border:"1px solid rgba(255,255,255,0.3)",borderRadius:"9px",cursor:"pointer"}}>
                🕯️ {lang==="es"?"Recordatorio de Shabat":lang==="fr"?"Rappel du Sabbat":"Sabbath Reminder"}
              </button>
            </div>
          </div>
        </div>
      )}

      {/* ── RESOURCES ── */}
      {activeTab==="resources" && (
        <div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.85rem"}}>📚 {lang==="es"?"BIBLIOTECA DE RECURSOS":lang==="fr"?"BIBLIOTHÈQUE DE RESSOURCES":"RESOURCE LIBRARY"}</div>
          <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(185px,1fr))",gap:"0.6rem",marginBottom:"1.25rem"}}>
            {RESOURCES.map((r,i)=>(
              <a key={i} href={r.url} target="_blank" rel="noopener noreferrer"
                style={{display:"flex",alignItems:"flex-start",gap:"0.65rem",padding:"0.85rem 1rem",background:"white",border:`1px solid ${r.color}22`,borderRadius:"13px",textDecoration:"none",borderLeft:`3px solid ${r.color}`,boxShadow:"var(--shadow)"}}>
                <span style={{fontSize:"1.2rem",flexShrink:0}}>{r.icon}</span>
                <div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.67rem",color:r.color,marginBottom:"0.15rem"}}>{r.title}</div>
                  <div style={{fontSize:"0.62rem",color:"var(--muted)",lineHeight:1.45}}>{r.desc}</div>
                </div>
                <span style={{color:"var(--muted)",fontSize:"0.7rem",marginLeft:"auto",flexShrink:0}}>↗</span>
              </a>
            ))}
          </div>

          {/* App navigation quick links */}
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--muted)",marginBottom:"0.75rem"}}>✦ {lang==="es"?"MÓDULOS DE ESTUDIO EN LA APP":lang==="fr"?"MODULES D'ÉTUDE DANS L'APP":"IN-APP STUDY MODULES"}</div>
          <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(155px,1fr))",gap:"0.5rem"}}>
            {[
              {icon:"⚖️",label:lang==="es"?"Deuteronomio 28":lang==="fr"?"Deutéronome 28":"Deuteronomy 28",page:"deut28"},
              {icon:"⛓️",label:lang==="es"?"Las 7 Cautividades":lang==="fr"?"Les 7 Captivités":"The 7 Captivities",page:"captivities"},
              {icon:"🗺️",label:lang==="es"?"Las 12 Tribus":lang==="fr"?"Les 12 Tribus":"The 12 Tribes",page:"ai-tribes"},
              {icon:"🌸",label:lang==="es"?"Mujeres del Pacto":lang==="fr"?"Femmes de l'Alliance":"Women's Study",page:"women"},
              {icon:"🕎",label:lang==="es"?"Fiestas Santas":lang==="fr"?"Fêtes Saintes":"Holy Feasts",page:"feasts"},
              {icon:"🕯️",label:lang==="es"?"Devocional Diario":lang==="fr"?"Dévotionnel Quotidien":"Daily Devotional",page:"devotional"},
            ].map((m,i)=>(
              <button key={i} onClick={()=>setPage(m.page)}
                style={{display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.75rem 0.9rem",background:"white",border:"1px solid var(--border)",borderRadius:"11px",cursor:"pointer",textAlign:"left",transition:"all 0.18s",boxShadow:"var(--shadow)"}}>
                <span style={{fontSize:"1.1rem"}}>{m.icon}</span>
                <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",color:"var(--ink)",lineHeight:1.3}}>{m.label}</span>
              </button>
            ))}
          </div>
        </div>
      )}
    </div>
  );
}

// ─── SHABBAT CLASS DESCRIPTION MODAL ─────────────────────────────────────────
function ShabbatClassModal({ classData, lang, onClose, goToScripture }) {
  const [copied, setCopied] = useState(false);
  const [prepared, setPrepared] = useState(false);
  if (!classData) return null;

  const l = lang || "en";
  const allScriptures = [
    ...(classData.scriptures?.ot||[]),
    ...(classData.scriptures?.apocrypha||[]),
    ...(classData.scriptures?.nt||[]),
  ];

  const copyScriptures = () => {
    const text = `${classData.title?.[l]||classData.title?.en}\nStage ${classData.stage} — ${classData.stageName}\n\nOLD TESTAMENT:\n${(classData.scriptures?.ot||[]).join("\n")}\n\nAPOCRYPHA:\n${(classData.scriptures?.apocrypha||[]).join("\n")}\n\nNEW TESTAMENT:\n${(classData.scriptures?.nt||[]).join("\n")}`;
    navigator.clipboard?.writeText(text);
    setCopied(true);
    setTimeout(()=>setCopied(false),2500);
  };

  return (
    <motion.div initial={{opacity:0}} animate={{opacity:1}} exit={{opacity:0}}
      style={{position:"fixed",inset:0,background:"rgba(26,18,8,0.75)",zIndex:2000,display:"flex",alignItems:"flex-end",justifyContent:"center",padding:"0"}}
      onClick={onClose}>
      <motion.div initial={{y:"100%"}} animate={{y:0}} exit={{y:"100%"}} transition={{type:"spring",damping:28,stiffness:300}}
        style={{background:"var(--parchment)",borderRadius:"24px 24px 0 0",padding:"0",maxHeight:"90vh",width:"100%",maxWidth:"640px",overflowY:"auto",overflowX:"hidden"}}
        onClick={e=>e.stopPropagation()}>

        {/* Handle bar */}
        <div style={{display:"flex",justifyContent:"center",padding:"0.75rem 0 0"}}>
          <div style={{width:"40px",height:"4px",borderRadius:"2px",background:"var(--border)"}} />
        </div>

        {/* Header */}
        <div style={{background:`linear-gradient(135deg,${classData.color},${classData.color}CC)`,padding:"1.5rem 1.75rem",position:"relative"}}>
          <button onClick={onClose} style={{position:"absolute",top:"1rem",right:"1rem",background:"rgba(255,255,255,0.2)",border:"none",borderRadius:"50%",width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"white",fontSize:"1rem"}}>✕</button>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.18em",color:"rgba(255,255,255,0.65)",marginBottom:"0.35rem"}}>
            {l==="es"?"CLASE DE SHABAT":l==="fr"?"CLASSE DU SABBAT":"SHABBAT CLASS"} · STAGE {classData.stage}/7
          </div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.2rem",color:"white",marginBottom:"0.2rem"}}>{classData.title?.[l]||classData.title?.en}</div>
          <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",color:"rgba(255,255,255,0.8)"}}>{classData.topic?.[l]||classData.topic?.en}</div>
          <div style={{display:"inline-flex",alignItems:"center",gap:"0.4rem",background:"rgba(255,255,255,0.2)",borderRadius:"20px",padding:"0.25rem 0.75rem",marginTop:"0.6rem"}}>
            <span>{classData.icon}</span>
            <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.1em",color:"white"}}>{classData.stageName}</span>
          </div>
        </div>

        <div style={{padding:"1.5rem 1.75rem"}}>
          {/* Description */}
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"var(--gold)",marginBottom:"0.5rem"}}>📖 {l==="es"?"DESCRIPCIÓN DE LA CLASE":l==="fr"?"DESCRIPTION DU COURS":"CLASS DESCRIPTION"}</div>
          <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.85,marginBottom:"1.1rem"}}>{classData.description?.[l]||classData.description?.en}</div>

          {/* Why This Matters */}
          <div style={{background:`${classData.color}08`,borderRadius:"12px",padding:"1rem 1.25rem",borderLeft:`3px solid ${classData.color}`,marginBottom:"1.1rem"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.14em",color:classData.color,marginBottom:"0.35rem"}}>⚖️ {l==="es"?"POR QUÉ IMPORTA":l==="fr"?"POURQUOI C'EST IMPORTANT":"WHY THIS MATTERS"}</div>
            <div style={{fontSize:"0.85rem",color:"var(--ink)",lineHeight:1.82}}>{classData.whyMatters?.[l]||classData.whyMatters?.en}</div>
          </div>

          {/* Prep note */}
          <div style={{background:"rgba(196,137,58,0.08)",borderRadius:"12px",padding:"0.9rem 1.1rem",marginBottom:"1.25rem",borderLeft:"3px solid var(--gold)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.14em",color:"var(--gold)",marginBottom:"0.3rem"}}>📝 {l==="es"?"INSTRUCCIONES DE PREPARACIÓN":l==="fr"?"INSTRUCTIONS DE PRÉPARATION":"PREPARATION INSTRUCTIONS"}</div>
            <div style={{fontSize:"0.84rem",color:"var(--ink)",lineHeight:1.75}}>{classData.prepNote?.[l]||classData.prepNote?.en}</div>
          </div>

          {/* 20 Scriptures */}
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.75rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
            📜 {l==="es"?"LISTA DE ESCRITURAS DE PREPARACIÓN":l==="fr"?"LISTE D'ÉCRITURES DE PRÉPARATION":"SCRIPTURE PREPARATION LIST"} ({allScriptures.length})
            <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
          </div>

          {/* OT */}
          {classData.scriptures?.ot?.length>0 && (
            <div style={{marginBottom:"1rem"}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.14em",color:"#8B3A2A",marginBottom:"0.45rem"}}>📖 {l==="es"?"ANTIGUO TESTAMENTO":l==="fr"?"ANCIEN TESTAMENT":"OLD TESTAMENT"} ({classData.scriptures.ot.length})</div>
              {classData.scriptures.ot.map((ref,i)=>(
                <div key={i} style={{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.35rem"}}>
                  <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",color:"#8B3A2A",flexShrink:0}}>{i+1}.</span>
                  <button onClick={()=>goToScripture&&goToScripture(ref)} className="scripture-btn" style={{fontSize:"0.7rem"}}>{ref}</button>
                </div>
              ))}
            </div>
          )}

          {/* Apocrypha */}
          {classData.scriptures?.apocrypha?.length>0 && (
            <div style={{marginBottom:"1rem"}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.14em",color:"#7B5EA7",marginBottom:"0.45rem"}}>📜 {l==="es"?"APÓCRIFOS":l==="fr"?"APOCRYPHES":"APOCRYPHA"} ({classData.scriptures.apocrypha.length})</div>
              {classData.scriptures.apocrypha.map((ref,i)=>(
                <div key={i} style={{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.35rem"}}>
                  <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",color:"#7B5EA7",flexShrink:0}}>{classData.scriptures.ot.length+i+1}.</span>
                  <button onClick={()=>goToScripture&&goToScripture(ref)} className="scripture-btn" style={{fontSize:"0.7rem",borderColor:"#7B5EA744",color:"#7B5EA7"}}>{ref}</button>
                </div>
              ))}
            </div>
          )}

          {/* NT */}
          {classData.scriptures?.nt?.length>0 && (
            <div style={{marginBottom:"1.25rem"}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.14em",color:"#5A7A52",marginBottom:"0.45rem"}}>✦ {l==="es"?"NUEVO TESTAMENTO":l==="fr"?"NOUVEAU TESTAMENT":"NEW TESTAMENT"} ({classData.scriptures.nt.length})</div>
              {classData.scriptures.nt.map((ref,i)=>(
                <div key={i} style={{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.35rem"}}>
                  <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",color:"#5A7A52",flexShrink:0}}>{classData.scriptures.ot.length+classData.scriptures.apocrypha.length+i+1}.</span>
                  <button onClick={()=>goToScripture&&goToScripture(ref)} className="scripture-btn" style={{fontSize:"0.7rem",borderColor:"#5A7A5244",color:"#5A7A52"}}>{ref}</button>
                </div>
              ))}
            </div>
          )}

          {/* Action buttons */}
          <div style={{display:"flex",gap:"0.5rem",flexWrap:"wrap",paddingBottom:"1.5rem"}}>
            <button onClick={copyScriptures}
              style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",padding:"0.55rem 1rem",borderRadius:"9px",background:copied?"rgba(90,122,82,0.12)":"var(--cream)",border:"1px solid var(--border)",color:copied?"#5A7A52":"var(--ink)",cursor:"pointer"}}>
              {copied?"✓ Copied!":"📋 Copy All Scriptures"}
            </button>
            <button onClick={()=>setPrepared(!prepared)}
              style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",padding:"0.55rem 1rem",borderRadius:"9px",background:prepared?"rgba(90,122,82,0.15)":"var(--cream)",border:`1px solid ${prepared?"#5A7A52":"var(--border)"}`,color:prepared?"#5A7A52":"var(--ink)",cursor:"pointer"}}>
              {prepared?"✓ Marked Prepared":"✦ Mark as Prepared"}
            </button>
            <a href={LIVE_STREAMS[0].url} target="_blank" rel="noopener noreferrer"
              style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.08em",padding:"0.55rem 1rem",borderRadius:"9px",background:"#FF0000",color:"white",textDecoration:"none",display:"inline-block"}}>
              ▶️ YouTube
            </a>
          </div>
        </div>
      </motion.div>
    </motion.div>
  );
}

// ─── ROCK DID IT™ ECOSYSTEM CONFIG ──────────────────────────────────────────
// Goddiditbible.rockdidit.com — Bible Club Portal
const ROCKDIDIT_CONFIG = {
  PORTAL_ID:           "goddiditbible",
  PORTAL_NAME:         "God Did It Bible Club",
  SUBDOMAIN:           "goddiditbible.rockdidit.com",
  VERSION:             "2.0.0",

  // Feature flags — flip to true when backend is ready
  ENABLE_AUTH:          false,   // set true when /auth/* endpoints are live
  ENABLE_LOCAL_SAVE:    true,    // localStorage always on
  ENABLE_ZAPIER:        false,   // set true + add webhook URL
  ENABLE_ERP_SYNC:      false,   // set true when ERP API is live
  ENABLE_UNIVERSAL_API: false,   // future universal ROCK DID IT API

  // Endpoints — fill in when live
  ZAPIER_WEBHOOK_URL:   "",      // e.g. https://hooks.zapier.com/hooks/catch/XXXXX/
  ERP_API_URL:          "",      // e.g. https://erp.rockdidit.com/api
  UNIVERSAL_API_BASE:   "",      // e.g. https://api.rockdidit.com/v1

  // Auth endpoints (future)
  AUTH: {
    REGISTER:        "/auth/register",
    LOGIN:           "/auth/login",
    ME:              "/auth/me",
    FORGOT_PASSWORD: "/auth/forgot-password",
    RESET_PASSWORD:  "/auth/reset-password",
    LOGOUT:          "/auth/logout",
  },

  // Progress/data endpoints (future)
  API: {
    PROGRESS_SAVE:    "/api/progress/save",
    PROGRESS_COMPLETE:"/api/progress/complete",
    ACCESS_CHECK:     "/api/access/check",
    USER_PROFILE:     "/api/user/profile",
    ZAPIER_EVENT:     "/api/zapier/event",
  },

  // WhatsApp community links
  WHATSAPP_EN: "https://chat.whatsapp.com/GmdP6Rujeg6EHKJLcwGVlp?mode=gi_t",
  WHATSAPP_ES: "https://chat.whatsapp.com/DURN5BiprUzBa6v46bTLgu?mode=gi_t",
};

// Ecosystem event dispatcher — fires Zapier webhook if enabled
async function dispatchEcosystemEvent(eventType, payload) {
  // Always log locally
  try {
    const history = JSON.parse(localStorage.getItem("gdbc_history")||"[]");
    history.unshift({ ...payload, eventType, ts: Date.now(), date: new Date().toLocaleDateString() });
    localStorage.setItem("gdbc_history", JSON.stringify(history.slice(0,50)));
  } catch {}

  // Future: fire Zapier when enabled
  if (ROCKDIDIT_CONFIG.ENABLE_ZAPIER && ROCKDIDIT_CONFIG.ZAPIER_WEBHOOK_URL) {
    try {
      await fetch(ROCKDIDIT_CONFIG.ZAPIER_WEBHOOK_URL, {
        method: "POST", headers: {"Content-Type":"application/json"},
        body: JSON.stringify({ portal: ROCKDIDIT_CONFIG.PORTAL_ID, eventType, ...payload }),
      });
    } catch (e) { console.warn("Zapier event failed silently:", e); }
  }
}

// ─── 🌐 GLOBAL COVENANT BOT ──────────────────────────────────────────────────
// Appears on every page — explains any topic in 1st-grade level
// Strictly from the Ancient Hebrew Israelite covenant perspective
// (The people YAHAWAH made His covenant with: Blacks, Hispanics, Native Americans)
function CovenantBot({ lang }) {
  const [open, setOpen] = useState(false);
  const [minimized, setMinimized] = useState(false);
  const [question, setQuestion] = useState("");
  const [messages, setMessages] = useState([]);
  const [loading, setLoading] = useState(false);
  const [hasGreeted, setHasGreeted] = useState(false);
  const chatEndRef = useRef(null);

  const l = lang || "en";

  const GREETING = {
    en: "Shalom! I'm your Covenant Guide 📜\n\nAsk me ANYTHING about scripture, covenant identity, feasts, laws, or the 12 tribes — and I'll explain it simply, like you're hearing it for the first time.\n\nI teach strictly from the Ancient Hebrew Israelite perspective: the covenant YAHAWAH made with the children of Israel — the ancestors of today's Black, Hispanic, and Native American peoples.\n\nWhat would you like to understand today?",
    es: "¡Shalom! Soy tu Guía del Pacto 📜\n\nPregúntame lo que sea sobre las escrituras, identidad del pacto, fiestas, leyes o las 12 tribus — y te lo explicaré de manera simple.\n\nEnseño estrictamente desde la perspectiva Hebrea Israelita Antigua: el pacto que YAHAWAH hizo con los hijos de Israel — ancestros de los pueblos negros, hispanos e indígenas de hoy.\n\n¿Qué deseas entender hoy?",
    fr: "Shalom! Je suis ton Guide de l'Alliance 📜\n\nPose-moi n'importe quelle question sur les Écritures, l'identité de l'alliance, les fêtes, les lois ou les 12 tribus — et je l'expliquerai simplement.\n\nJ'enseigne strictement du point de vue des Hébreux Israélites Anciens: l'alliance que YAHAWAH a faite avec les enfants d'Israël — les ancêtres des peuples noirs, hispaniques et amérindiens d'aujourd'hui.\n\nQue veux-tu comprendre aujourd'hui?",
  };

  const SYSTEM_PROMPT = `You are the Covenant Guide for the God Did It Bible Club, a covenant scripture study platform.

IDENTITY RULE — CRITICAL:
You teach EXCLUSIVELY from the perspective of the Ancient Hebrew Israelite covenant. The covenant that YAHAWAH made was made specifically and exclusively with the children of Israel — the ancestors of today's Black Americans, Hispanic/Latino peoples, and Native American Indians. This is the covenant people of the Bible. No other people group holds this covenant position.

TEACHING RULES:
1. Always use YAHAWAH for the divine name (never just "God" or "LORD" alone unless quoting KJV scripture)
2. Always use Yahawashi for the Messiah (in teaching text, not scripture quotes)
3. Explain everything like the person is in 1st grade — simple, clear, plain English with no seminary jargon
4. Every answer must be rooted in scripture (KJV preferred, Apocrypha supported: Sirach, Baruch, Tobit, Judith, Maccabees, Esdras)
5. When someone asks about identity, ALWAYS affirm that YAHAWAH made His covenant exclusively with Israel — and that Israel's descendants are today's Black, Hispanic, and Native American peoples based on Deuteronomy 28, Joel 3:6, Amos 9:7
6. Keep answers SHORT — 4-8 sentences maximum unless asked for more
7. Always end with 1 scripture reference
8. Never teach replacement theology or say the covenant applies to everyone equally
9. If asked about feasts, explain what YAHAWAH actually commanded in Torah — not modern Jewish or Christian traditions
10. Be warm, patient, and encouraging — like a loving elder teaching a child

LANGUAGE RULE:
- If the user writes in Spanish, respond in Spanish
- If in French, respond in French
- Otherwise respond in English`;

  const openChat = () => {
    if (!hasGreeted) {
      setMessages([{ role:"assistant", text: GREETING[l]||GREETING.en }]);
      setHasGreeted(true);
    }
    setOpen(true);
    setMinimized(false);
  };

  const sendQuestion = async () => {
    if (!question.trim() || loading) return;
    const userMsg = question.trim();
    setQuestion("");
    const newMessages = [...messages, { role:"user", text:userMsg }];
    setMessages(newMessages);
    setLoading(true);

    try {
      const apiMessages = newMessages.map(m => ({
        role: m.role === "assistant" ? "assistant" : "user",
        content: m.text,
      }));

      const res = await fetch("https://api.anthropic.com/v1/messages", {
        method:"POST", headers:{"Content-Type":"application/json"},
        body: JSON.stringify({
          model: "claude-sonnet-4-20250514",
          max_tokens: 600,
          system: SYSTEM_PROMPT,
          messages: apiMessages,
        }),
      });
      const data = await res.json();
      const reply = data.content?.map(c=>c.text||"").join("") || "I wasn't able to answer that right now. Please try again.";
      setMessages(m => [...m, { role:"assistant", text:reply }]);
    } catch {
      setMessages(m => [...m, { role:"assistant", text:"Something went wrong connecting. Please check your connection and try again. YAHAWAH bless you 🙏" }]);
    }
    setLoading(false);
  };

  useEffect(() => {
    if (chatEndRef.current) chatEndRef.current.scrollIntoView({ behavior:"smooth" });
  }, [messages, loading]);

  const LABEL = {
    placeholder: { en:"Ask about scripture, identity, feasts, laws…", es:"Pregunta sobre escrituras, identidad, fiestas…", fr:"Pose une question sur les Écritures, l'identité, les fêtes…" },
    send:        { en:"Send", es:"Enviar", fr:"Envoyer" },
    title:       { en:"Covenant Guide", es:"Guía del Pacto", fr:"Guide de l'Alliance" },
    subtitle:    { en:"Ancient Hebrew Israelite perspective", es:"Perspectiva Hebrea Israelita Antigua", fr:"Perspective Hébraïque Israélite Ancienne" },
  };

  return (
    <>
      {/* Floating trigger button */}
      {!open && (
        <button
          onClick={openChat}
          title={LABEL.title[l]||LABEL.title.en}
          style={{
            position:"fixed", bottom:"calc(env(safe-area-inset-bottom,0px) + 90px)", right:"18px",
            width:"56px", height:"56px", borderRadius:"50%",
            background:"linear-gradient(135deg,#6B1A4A,#C4893A)",
            border:"none", cursor:"pointer", zIndex:1500,
            display:"flex", alignItems:"center", justifyContent:"center",
            boxShadow:"0 4px 20px rgba(107,26,74,0.45)",
            fontSize:"1.5rem", transition:"transform 0.2s",
          }}
          onMouseEnter={e=>e.currentTarget.style.transform="scale(1.1)"}
          onMouseLeave={e=>e.currentTarget.style.transform="scale(1)"}
        >
          📜
        </button>
      )}

      {/* Chat panel */}
      {open && (
        <motion.div
          initial={{opacity:0,y:60,scale:0.9}} animate={{opacity:1,y:0,scale:1}}
          exit={{opacity:0,y:60,scale:0.9}} transition={{type:"spring",damping:25,stiffness:300}}
          style={{
            position:"fixed",
            bottom: minimized ? "calc(env(safe-area-inset-bottom,0px) + 90px)" : "calc(env(safe-area-inset-bottom,0px) + 90px)",
            right:"12px",
            width:"min(90vw,380px)",
            height: minimized ? "56px" : "min(82vh,560px)",
            background:"var(--parchment)",
            borderRadius:"20px",
            boxShadow:"0 8px 40px rgba(26,18,8,0.35)",
            border:"1px solid rgba(196,137,58,0.3)",
            zIndex:1500,
            display:"flex", flexDirection:"column",
            overflow:"hidden",
            transition:"height 0.3s ease",
          }}>

          {/* Header */}
          <div style={{background:"linear-gradient(135deg,#3D0A2A,#6B1A4A)",padding:"0.85rem 1.1rem",display:"flex",alignItems:"center",gap:"0.65rem",flexShrink:0}}>
            <div style={{width:"36px",height:"36px",borderRadius:"10px",background:"rgba(196,137,58,0.25)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.2rem",flexShrink:0}}>📜</div>
            <div style={{flex:1}}>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",letterSpacing:"0.08em",color:"white"}}>{LABEL.title[l]||LABEL.title.en}</div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.06em",color:"rgba(255,255,255,0.55)"}}>{LABEL.subtitle[l]||LABEL.subtitle.en}</div>
            </div>
            <div style={{display:"flex",gap:"0.3rem"}}>
              <button onClick={()=>setMinimized(!minimized)}
                style={{background:"rgba(255,255,255,0.15)",border:"none",borderRadius:"6px",width:"28px",height:"28px",cursor:"pointer",color:"white",fontSize:"0.8rem",display:"flex",alignItems:"center",justifyContent:"center"}}>
                {minimized?"⬆":"⬇"}
              </button>
              <button onClick={()=>setOpen(false)}
                style={{background:"rgba(255,255,255,0.15)",border:"none",borderRadius:"6px",width:"28px",height:"28px",cursor:"pointer",color:"white",fontSize:"0.8rem",display:"flex",alignItems:"center",justifyContent:"center"}}>
                ✕
              </button>
            </div>
          </div>

          {/* Identity chip */}
          {!minimized && (
            <div style={{padding:"0.5rem 1rem",background:"rgba(139,58,42,0.08)",borderBottom:"1px solid rgba(196,137,58,0.15)",display:"flex",alignItems:"center",gap:"0.5rem",flexShrink:0}}>
              <span style={{fontSize:"0.75rem"}}>✦</span>
              <span style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.08em",color:"#8B3A2A",lineHeight:1.4}}>
                {l==="es"?"Perspectiva: Israelitas Hebreos Antiguos — Negros · Hispanos · Indígenas":l==="fr"?"Perspective: Hébreux Israélites Anciens — Noirs · Hispaniques · Amérindiens":"Perspective: Ancient Hebrew Israelites — Blacks · Hispanics · Native Americans"}
              </span>
            </div>
          )}

          {/* Messages */}
          {!minimized && (
            <div style={{flex:1,overflowY:"auto",padding:"0.9rem 1rem",display:"flex",flexDirection:"column",gap:"0.65rem",scrollbarWidth:"thin"}}>
              {messages.map((msg,i) => (
                <div key={i} style={{display:"flex",flexDirection:msg.role==="user"?"row-reverse":"row",gap:"0.5rem",alignItems:"flex-start"}}>
                  {msg.role==="assistant" && (
                    <div style={{width:"28px",height:"28px",borderRadius:"8px",background:"rgba(107,26,74,0.15)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.8rem",flexShrink:0,marginTop:"2px"}}>📜</div>
                  )}
                  <div style={{
                    maxWidth:"80%",
                    background: msg.role==="user" ? "linear-gradient(135deg,#6B1A4A,#8B3A2A)" : "white",
                    color: msg.role==="user" ? "white" : "var(--ink)",
                    borderRadius: msg.role==="user" ? "16px 16px 4px 16px" : "4px 16px 16px 16px",
                    padding:"0.65rem 0.85rem",
                    fontSize:"0.84rem", lineHeight:1.78,
                    border: msg.role==="assistant" ? "1px solid var(--border)" : "none",
                    boxShadow: msg.role==="assistant" ? "var(--shadow)" : "none",
                    whiteSpace:"pre-wrap",
                  }}>
                    {msg.text}
                  </div>
                </div>
              ))}
              {loading && (
                <div style={{display:"flex",gap:"0.5rem",alignItems:"flex-start"}}>
                  <div style={{width:"28px",height:"28px",borderRadius:"8px",background:"rgba(107,26,74,0.15)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.8rem",flexShrink:0}}>📜</div>
                  <div style={{background:"white",border:"1px solid var(--border)",borderRadius:"4px 16px 16px 16px",padding:"0.65rem 0.85rem",boxShadow:"var(--shadow)"}}>
                    <div style={{display:"flex",gap:"4px",alignItems:"center"}}>
                      {[0,1,2].map(d=><div key={d} style={{width:"6px",height:"6px",borderRadius:"50%",background:"var(--gold)",animation:`pulse ${0.6+d*0.15}s infinite alternate`}} />)}
                    </div>
                  </div>
                </div>
              )}
              <div ref={chatEndRef} />
            </div>
          )}

          {/* Input */}
          {!minimized && (
            <div style={{padding:"0.75rem 1rem",borderTop:"1px solid var(--border)",background:"var(--cream)",display:"flex",gap:"0.5rem",flexShrink:0}}>
              <input
                value={question}
                onChange={e=>setQuestion(e.target.value)}
                onKeyDown={e=>e.key==="Enter"&&!e.shiftKey&&sendQuestion()}
                placeholder={LABEL.placeholder[l]||LABEL.placeholder.en}
                style={{flex:1,background:"white",border:"1px solid var(--border)",borderRadius:"10px",padding:"0.55rem 0.8rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.82rem",color:"var(--ink)",outline:"none"}}
              />
              <button onClick={sendQuestion} disabled={!question.trim()||loading}
                style={{background:"linear-gradient(135deg,#6B1A4A,#C4893A)",border:"none",borderRadius:"10px",padding:"0.55rem 0.9rem",color:"white",cursor:"pointer",fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.08em",flexShrink:0,opacity:(!question.trim()||loading)?0.5:1}}>
                {LABEL.send[l]||"Send"}
              </button>
            </div>
          )}
        </motion.div>
      )}
    </>
  );
}

// ─── STUDY PATHS DATA ─────────────────────────────────────────────────────────
const STUDY_PATHS = [
  {
    id:"awakening", icon:"🔍", color:"#8B3A2A", title:"Identity & Awakening",
    subtitle:"Who are we? Why did our people forget? Where do we begin?",
    stages:["Stage 1 — Identity","Stage 2 — Covenant","Stage 3 — Signs of Punishment"],
    weeks:[1,2,3,4,5,6,7,8],
    scriptures:["Hosea 1:9-10","Deuteronomy 7:6","Baruch 4:28","Isaiah 43:1","Deuteronomy 28:37"],
    lessons:[
      { title:"Who Are We?", desc:"The identity of the covenant nation — lost, scattered, but not forgotten.", ref:"Hosea 1:9-10", page:"devotional" },
      { title:"The Covenant Contract", desc:"Blessings for obedience, curses for disobedience. The most important legal document in scripture.", ref:"Deuteronomy 28:1-2", page:"deut28" },
      { title:"Signs of Punishment", desc:"The curses were given as signs upon the seed forever.", ref:"Deuteronomy 28:46", page:"devotional" },
      { title:"The 7 Captivities", desc:"Eight historic captivities of the covenant people — scripture, history, and pattern.", ref:"2 Kings 17:6", page:"captivities" },
      { title:"The 12 Tribes Today", desc:"Where are the scattered tribes? Scripture-based community identification framework.", ref:"James 1:1", page:"ai-tribes" },
      { title:"The Table of Nations", desc:"Genesis 10 — every nation traced to Noah's sons. Who are the Gentile nations?", ref:"Genesis 10:1", page:"ancient-israel" },
      { title:"2 Esdras 6:56 — Made for Israel", desc:"The Apocrypha declares: the nations were made for Israel.", ref:"2 Esdras 6:56", page:"bible-passage" },
      { title:"Baruch 2:30-32 — In Captivity, Remember", desc:"Even in captivity, YAHAWAH promised they would remember.", ref:"Baruch 2:30-32", page:"bible-passage" },
    ]
  },
  {
    id:"laws", icon:"⚖️", color:"#1B3A5C", title:"Laws That Set Us Apart",
    subtitle:"Covenant life is visible. Dress, food, worship, marriage, morality.",
    stages:["Stage 4 — The Law"],
    weeks:[9,10,11,12,13,14,15,16],
    scriptures:["Matthew 5:17","Deuteronomy 22:5","Leviticus 11:1-3","Leviticus 23:2-3","Hebrews 13:4","Exodus 20:8"],
    lessons:[
      { title:"The Law Was Not Abolished", desc:"Yahawashi's own words: I came not to destroy, but to fulfill.", ref:"Matthew 5:17", page:"devotional" },
      { title:"Dress Code — Covenant Order", desc:"The woman shall not wear what pertains to a man. Order in garments.", ref:"Deuteronomy 22:5", page:"bible-passage" },
      { title:"Food Laws — What We Eat", desc:"Leviticus 11 and Deuteronomy 14 — clean and unclean foods.", ref:"Leviticus 11:2-3", page:"weekly" },
      { title:"Holy Days — YAHAWAH's Feasts", desc:"These are MY feasts, not Jewish holidays. Leviticus 23.", ref:"Leviticus 23:2-3", page:"feasts" },
      { title:"The Sabbath — Sign of the Covenant", desc:"Remember the Sabbath. It is a sign between YAHAWAH and Israel forever.", ref:"Exodus 20:8-11", page:"feasts" },
      { title:"Marriage Laws", desc:"Marriage is honorable. Covenant marriage — not a contract.", ref:"Hebrews 13:4", page:"women" },
      { title:"Moral Laws", desc:"Exodus 20 — the Ten Commandments as covenant living.", ref:"Exodus 20:1-17", page:"bible-passage" },
      { title:"Women's Laws Specifically", desc:"Laws given directly to daughters of the covenant.", ref:"Leviticus 15:19", page:"women" },
    ]
  },
  {
    id:"messiah", icon:"✦", color:"#5A7A52", title:"Messiah & Restoration",
    subtitle:"Yahawashi came for a specific people with a specific mission.",
    stages:["Stage 5 — Messiah","Stage 6 — Diaspora","Stage 7 — Restoration"],
    weeks:[17,18,19,20,21,22,23,24],
    scriptures:["Matthew 15:24","Acts 3:18","Hebrews 10:8-10","Jeremiah 30:7","Ezekiel 37:21-22","Revelation 21:12"],
    lessons:[
      { title:"Sent to the Lost Sheep of Israel", desc:"Yahawashi stated His mission explicitly: the lost sheep of the house of Israel.", ref:"Matthew 15:24", page:"devotional" },
      { title:"He Fulfilled the Prophets", desc:"Acts 3:18 — all that the prophets spoke was fulfilled in His suffering.", ref:"Acts 3:18", page:"devotional" },
      { title:"Keep the Commandments for Life", desc:"Matthew 19:16-17 — what must I do to have eternal life? Keep the commandments.", ref:"Matthew 19:16-17", page:"bible-passage" },
      { title:"How Israel Was Scattered", desc:"Hosea 8:8, James 1:1 — scattered but not destroyed.", ref:"Hosea 8:8", page:"devotional" },
      { title:"The Assyrian Captivity", desc:"722 BCE — the northern 10 tribes carried away into Assyria.", ref:"2 Kings 17:6", page:"captivities" },
      { title:"Jacob's Trouble — But He Shall Be Saved", desc:"Jeremiah 30:7 — the great tribulation before restoration.", ref:"Jeremiah 30:7", page:"devotional" },
      { title:"The Valley of Dry Bones", desc:"Ezekiel 37 — the whole house of Israel shall live again.", ref:"Ezekiel 37:1-14", page:"bible-passage" },
      { title:"12 Gates of New Jerusalem", desc:"Revelation 21:12 — the 12 gates named for the 12 tribes.", ref:"Revelation 21:12", page:"bible-passage" },
    ]
  },
  {
    id:"women", icon:"🌸", color:"#6B1A4A", title:"Daughters of the Covenant",
    subtitle:"Identity, character, laws, marriage, motherhood, and restoration for women.",
    stages:["Women's 7-Stage Path"],
    weeks:[25,26,27,28],
    scriptures:["Proverbs 31:10","Deuteronomy 7:6","Isaiah 62:4","Zephaniah 3:14"],
    lessons:[
      { title:"Identity of a Daughter of Israel", desc:"Before law comes identity. You were called before you were born.", ref:"Deuteronomy 7:6", page:"women" },
      { title:"Character of a Covenant Woman", desc:"Proverbs 31, Sirach 26 — inner qualities that honor YAHAWAH.", ref:"Proverbs 31:10", page:"women" },
      { title:"Laws Given to Women", desc:"Niddah, vows, inheritance rights, feast participation.", ref:"Leviticus 15:19", page:"women" },
      { title:"Covenant Marriage & Family Order", desc:"Marriage as covenant — not contract. The rights of a wife.", ref:"Malachi 2:14", page:"women" },
      { title:"Mothers of the Covenant", desc:"2 Timothy 1:5 — the faith of Lois and Eunice. Covenant is transmitted by mothers.", ref:"2 Timothy 1:5", page:"women" },
      { title:"Women Who Changed History", desc:"Deborah, Ruth, Esther, Judith, Mary, Anna — their stories and lessons.", ref:"Judges 4:4", page:"women" },
      { title:"Restoration of the Daughters of Zion", desc:"Zephaniah 3:14, Isaiah 62 — the daughters shall be honored again.", ref:"Zephaniah 3:14", page:"women" },
      { title:"Women's Prayer — Covenant Intercession", desc:"A 7-stage prayer path for the daughters returning to truth.", ref:"Isaiah 54:17", page:"women" },
    ]
  },
  {
    id:"feasts", icon:"🕎", color:"#C4893A", title:"Holy Feasts of YAHAWAH",
    subtitle:"These are not Jewish holidays. They are YAHAWAH's appointed times — commanded forever.",
    stages:["Feast Season"],
    weeks:[29,30,31,32,33,34,35,36],
    scriptures:["Leviticus 23:2","Exodus 20:8","Deuteronomy 16:16","Isaiah 66:23"],
    lessons:[
      { title:"Shabbat — Weekly Sign of the Covenant", desc:"Exodus 20:8 — remember the Sabbath. It is the eternal sign between YAHAWAH and Israel.", ref:"Exodus 20:8-11", page:"feasts" },
      { title:"Passover — Night of Deliverance", desc:"The night YAHAWAH passed over Israel and slew Egypt's firstborn.", ref:"Exodus 12:13", page:"feasts" },
      { title:"Unleavened Bread — 7 Days of Purification", desc:"Remove leaven from your home and heart. A type of separation from sin.", ref:"Leviticus 23:6-8", page:"feasts" },
      { title:"Firstfruits — Resurrection Pattern", desc:"The wave offering. Yahawashi was the firstfruit of the resurrection.", ref:"Leviticus 23:10-11", page:"feasts" },
      { title:"Shavuot — Feast of Weeks", desc:"50 days from firstfruits. The giving of the Torah. The outpouring of the Spirit.", ref:"Leviticus 23:15-17", page:"feasts" },
      { title:"Yom Teruah — Day of Trumpets", desc:"Blow the shofar. A day of solemn assembly and awakening.", ref:"Leviticus 23:23-25", page:"feasts" },
      { title:"Yom Kippur — Day of Atonement", desc:"The most holy day. Afflict the soul. Stand before YAHAWAH.", ref:"Leviticus 23:27-28", page:"feasts" },
      { title:"Sukkot — Feast of Tabernacles", desc:"7 days of joy. Dwell in booths. Remember the wilderness.", ref:"Leviticus 23:33-36", page:"feasts" },
    ]
  },
];

// ─── TOPIC SEARCH DATA ─────────────────────────────────────────────────────────
const TOPIC_INDEX = [
  // Identity
  { topic:"Identity", keywords:["who we are","israelite","covenant nation","scattered","remnant","identity"], refs:["Hosea 1:9-10","Deuteronomy 7:6","Isaiah 43:1","Baruch 4:28"], page:"devotional", stage:1 },
  { topic:"Covenant", keywords:["covenant","contract","agreement","berith","oath"], refs:["Deuteronomy 28:1","Deuteronomy 30:1","Leviticus 26:3"], page:"deut28", stage:2 },
  { topic:"Punishment / Curses", keywords:["curses","punishment","signs","wonders","seed forever","captivity"], refs:["Deuteronomy 28:46","Deuteronomy 28:68","Luke 21:24"], page:"deut28", stage:3 },
  { topic:"Sabbath", keywords:["sabbath","shabbat","rest","seventh day","saturday"], refs:["Exodus 20:8-11","Leviticus 23:3","Isaiah 66:23"], page:"feasts", stage:4 },
  { topic:"Food Laws", keywords:["food","clean","unclean","pork","swine","dietary","leviticus 11"], refs:["Leviticus 11:2-3","Leviticus 11:7-8","Deuteronomy 14:3","Isaiah 66:17"], page:"weekly", stage:4 },
  { topic:"Dress Code", keywords:["dress","clothing","modesty","gender","garment","deuteronomy 22"], refs:["Deuteronomy 22:5","1 Timothy 2:9-10","Numbers 15:38-40"], page:"bible-passage", stage:4 },
  { topic:"Messiah", keywords:["messiah","yahawashi","jesus","yeshua","lost sheep","fulfillment"], refs:["Matthew 15:24","Acts 3:18","Matthew 5:17","Hebrews 10:8-10"], page:"devotional", stage:5 },
  { topic:"Diaspora / Scattering", keywords:["diaspora","scattered","nations","hosea","captivity","exile"], refs:["Hosea 8:8","James 1:1","2 Kings 17:6","Amos 9:9"], page:"devotional", stage:6 },
  { topic:"Restoration", keywords:["restoration","return","regather","kingdom","new jerusalem","ezekiel 37"], refs:["Ezekiel 37:21-22","Deuteronomy 30:3","Jeremiah 30:7","Revelation 21:12"], page:"devotional", stage:7 },
  { topic:"Feasts", keywords:["feast","holy days","appointed times","passover","sukkot","shavuot","trumpets","atonement"], refs:["Leviticus 23:2","Deuteronomy 16:16"], page:"feasts", stage:4 },
  { topic:"Prayer", keywords:["prayer","intercession","supplication","praying","pray"], refs:["Psalm 91:1","Matthew 6:9-13","1 Timothy 2:1","Isaiah 56:7"], page:"devotional", stage:0 },
  { topic:"Fasting", keywords:["fasting","fast","afflict soul","yom kippur"], refs:["Isaiah 58:6-7","Joel 2:12","Matthew 6:16-18","Leviticus 23:27"], page:"feasts", stage:4 },
  { topic:"Marriage", keywords:["marriage","covenant marriage","husband","wife","malachi 2"], refs:["Malachi 2:14","Genesis 2:24","Ephesians 5:25","Exodus 21:10-11"], page:"women", stage:4 },
  { topic:"Women", keywords:["women","daughters","sisters","niddah","proverbs 31"], refs:["Proverbs 31:10","Deuteronomy 22:5","Numbers 30:3","Leviticus 12:2"], page:"women", stage:0 },
  { topic:"12 Tribes", keywords:["12 tribes","tribe","judah","benjamin","levi","ephraim","manasseh"], refs:["James 1:1","Isaiah 11:12","Revelation 21:12","Genesis 49:1"], page:"ai-tribes", stage:6 },
  { topic:"Captivities", keywords:["captivity","captivities","exile","assyria","babylon","rome","slavery","ships"], refs:["2 Kings 17:6","Deuteronomy 28:68","Joel 3:6","Amos 9:9"], page:"captivities", stage:3 },
  { topic:"Holiness", keywords:["holiness","holy","sanctified","set apart","kadosh"], refs:["Leviticus 19:2","1 Peter 1:16","Isaiah 6:3","Hebrews 12:14"], page:"weekly", stage:2 },
  { topic:"Obedience", keywords:["obedience","commandments","statutes","keep","observe","law"], refs:["Deuteronomy 28:1","Exodus 19:5","John 14:15","James 2:17"], page:"deut28", stage:2 },
  { topic:"Prophecy", keywords:["prophecy","prophets","end times","jacob's trouble","revelation"], refs:["Jeremiah 30:7","Daniel 12:1","Revelation 7:4","Amos 9:14"], page:"historical", stage:7 },
  { topic:"Wisdom", keywords:["wisdom","sirach","proverbs","understanding","discernment"], refs:["Proverbs 4:7","Sirach 1:1","James 1:5","Proverbs 1:7"], page:"weekly", stage:2 },
  { topic:"Deuteronomy 28", keywords:["deuteronomy 28","blessings","curses","punishment","signs"], refs:["Deuteronomy 28:1","Deuteronomy 28:15","Deuteronomy 28:46","Deuteronomy 28:68"], page:"deut28", stage:3 },
  { topic:"Ancient Israel", keywords:["ancient israel","history","timeline","kingdoms","archaeology"], refs:["2 Kings 17:6","Isaiah 10:5","Amos 5:27"], page:"ancient-israel", stage:3 },
  { topic:"Apocrypha", keywords:["apocrypha","sirach","baruch","tobit","judith","maccabees","esdras"], refs:["Sirach 1:1","Baruch 4:28","2 Esdras 6:56","Judith 13:18"], page:"bible-passage", stage:0 },
];

// ─── MY JOURNEY / PROGRESS TRACKER ───────────────────────────────────────────
function MyJourneyPage({ setPage, goToScripture }) {
  const [saved, setSaved] = useState(() => {
    try { return JSON.parse(localStorage.getItem("gdbc_saved")||"[]"); } catch { return []; }
  });
  const [notes, setNotes] = useState(() => {
    try { return JSON.parse(localStorage.getItem("gdbc_notes")||"[]"); } catch { return []; }
  });
  const [progress, setProgress] = useState(() => {
    try { return JSON.parse(localStorage.getItem("gdbc_progress")||"{}"); } catch { return {}; }
  });
  const [newNote, setNewNote] = useState("");
  const [noteRef, setNoteRef] = useState("");
  const [activeTab, setActiveTab] = useState("journey"); // journey | saved | notes | search
  const [searchQuery, setSearchQuery] = useState("");
  const [searchResults, setSearchResults] = useState([]);

  const completedStages = Object.keys(progress).filter(k=>progress[k]).length;
  const stages = DEVOTIONALS.map(d=>({ key:d.day, label:d.title, stage:d.stage, color:d.color, icon:d.icon }));

  const toggleStage = (key) => {
    const updated = { ...progress, [key]: !progress[key] };
    setProgress(updated);
    try { localStorage.setItem("gdbc_progress", JSON.stringify(updated)); } catch {}
  };

  const addNote = () => {
    if (!newNote.trim()) return;
    const entry = { id:Date.now(), ref:noteRef||"General", text:newNote, date:new Date().toLocaleDateString() };
    const updated = [entry, ...notes];
    setNotes(updated);
    setNewNote(""); setNoteRef("");
    try { localStorage.setItem("gdbc_notes", JSON.stringify(updated)); } catch {}
  };

  const deleteNote = (id) => {
    const updated = notes.filter(n=>n.id!==id);
    setNotes(updated);
    try { localStorage.setItem("gdbc_notes", JSON.stringify(updated)); } catch {}
  };

  const removeSaved = (id) => {
    const updated = saved.filter(s=>s.id!==id);
    setSaved(updated);
    try { localStorage.setItem("gdbc_saved", JSON.stringify(updated)); } catch {}
  };

  const handleSearch = (q) => {
    setSearchQuery(q);
    if (!q.trim() || q.length < 2) { setSearchResults([]); return; }
    const ql = q.toLowerCase();
    const results = TOPIC_INDEX.filter(t =>
      t.topic.toLowerCase().includes(ql) ||
      t.keywords.some(k => k.includes(ql)) ||
      t.refs.some(r => r.toLowerCase().includes(ql))
    );
    setSearchResults(results);
  };

  const TABS = [
    { key:"journey", label:"🗺️ My Journey" },
    { key:"saved",   label:`🔖 Saved (${saved.length})` },
    { key:"notes",   label:`📝 Notes (${notes.length})` },
    { key:"search",  label:"🔍 Search" },
  ];

  return (
    <div>
      {/* Hero */}
      <div style={{background:"linear-gradient(135deg,var(--deep),#2A1A0A)",borderRadius:"20px",padding:"2rem",marginBottom:"1.5rem",color:"var(--parchment)"}}>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.28em",color:"var(--gold-light)",marginBottom:"0.6rem"}}>✦ YOUR COVENANT WALK</div>
        <h2 style={{fontFamily:"'Cinzel',serif",fontSize:"clamp(1.4rem,4vw,2.2rem)",fontWeight:700,color:"var(--parchment)",marginBottom:"0.5rem",lineHeight:1.2}}>My Journey</h2>
        <p style={{fontSize:"0.85rem",color:"rgba(250,246,238,0.65)",lineHeight:1.78,marginBottom:"1rem"}}>Track your covenant awakening, save scriptures, write notes, and search every topic in the app.</p>
        {/* Progress bar */}
        <div style={{background:"rgba(250,246,238,0.1)",borderRadius:"8px",overflow:"hidden",marginBottom:"0.5rem"}}>
          <div style={{height:"8px",background:"var(--gold)",width:`${Math.round(completedStages/7*100)}%`,transition:"width 0.5s",borderRadius:"8px"}} />
        </div>
        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.1em",color:"var(--gold-light)"}}>
          {completedStages}/7 STAGES COMPLETED · {Math.round(completedStages/7*100)}% OF AWAKENING ROADMAP
        </div>
      </div>

      {/* Tab bar */}
      <div style={{display:"flex",gap:"0",marginBottom:"1.5rem",border:"1px solid var(--border)",borderRadius:"12px",overflow:"hidden"}}>
        {TABS.map(tab=>(
          <button key={tab.key} onClick={()=>setActiveTab(tab.key)}
            style={{flex:1,fontFamily:"'Cinzel',serif",fontSize:"0.58rem",letterSpacing:"0.07em",padding:"0.68rem 0.3rem",border:"none",borderRight:"1px solid var(--border)",background:activeTab===tab.key?"var(--deep)":"white",color:activeTab===tab.key?"var(--gold-light)":"var(--muted)",cursor:"pointer",transition:"all 0.18s",textAlign:"center",whiteSpace:"nowrap"}}>
            {tab.label}
          </button>
        ))}
      </div>

      {/* ── TAB: MY JOURNEY ── */}
      {activeTab==="journey" && (
        <div>
          <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--muted)",marginBottom:"1rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
            ✦ 7-STAGE COVENANT AWAKENING ROADMAP
            <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
          </div>
          {stages.map((s,i)=>{
            const done = progress[s.key];
            return (
              <div key={s.key} style={{background:"white",borderRadius:"14px",border:"1px solid var(--border)",padding:"1.1rem 1.35rem",marginBottom:"0.65rem",display:"flex",alignItems:"center",gap:"1rem",boxShadow:"var(--shadow)",borderLeft:`4px solid ${done?s.color:"var(--border)"}`}}>
                <div style={{width:"42px",height:"42px",borderRadius:"12px",background:done?s.color+"22":"var(--cream)",border:`2px solid ${done?s.color:"var(--border)"}`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1.2rem",flexShrink:0,cursor:"pointer"}}
                  onClick={()=>toggleStage(s.key)}>
                  {done?"✓":s.icon}
                </div>
                <div style={{flex:1}}>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.12em",color:done?s.color:"var(--muted)",marginBottom:"0.18rem"}}>STAGE {i+1} OF 7</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.82rem",color:done?"var(--ink)":"var(--muted)",lineHeight:1.3}}>{s.stage} — {s.label}</div>
                </div>
                <div style={{display:"flex",gap:"0.4rem"}}>
                  <button onClick={()=>setPage("devotional")} style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",padding:"0.3rem 0.65rem",borderRadius:"7px",border:`1px solid ${s.color}44`,color:s.color,background:"transparent",cursor:"pointer"}}>Study</button>
                  <button onClick={()=>toggleStage(s.key)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.58rem",padding:"0.3rem 0.65rem",borderRadius:"7px",border:"1px solid var(--border)",color:done?"#5A7A52":"var(--muted)",background:done?"rgba(90,122,82,0.1)":"transparent",cursor:"pointer"}}>{done?"✓ Done":"Mark Done"}</button>
                </div>
              </div>
            );
          })}

          {/* Study Paths */}
          <div style={{marginTop:"2rem"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--muted)",marginBottom:"1rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
              ✦ STUDY PATHS
              <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
            </div>
            <div style={{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(180px,1fr))",gap:"0.65rem"}}>
              {STUDY_PATHS.map(path=>(
                <div key={path.id} style={{background:"white",borderRadius:"14px",border:"1px solid var(--border)",padding:"1.1rem",cursor:"pointer",boxShadow:"var(--shadow)",borderTop:`3px solid ${path.color}`,transition:"all 0.2s"}}
                  onClick={()=>setPage(path.lessons[0].page)}>
                  <div style={{fontSize:"1.6rem",marginBottom:"0.5rem"}}>{path.icon}</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.72rem",color:path.color,marginBottom:"0.2rem"}}>{path.title}</div>
                  <div style={{fontSize:"0.72rem",color:"var(--muted)",lineHeight:1.4,marginBottom:"0.5rem"}}>{path.subtitle}</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.55rem",letterSpacing:"0.08em",color:"var(--muted)"}}>{path.lessons.length} LESSONS</div>
                </div>
              ))}
            </div>
          </div>

          {/* Quick stats */}
          <div style={{background:"var(--cream)",borderRadius:"14px",padding:"1.25rem 1.5rem",marginTop:"1.5rem",border:"1px solid var(--border)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--gold)",marginBottom:"0.75rem"}}>✦ MY COVENANT STATS</div>
            <div style={{display:"grid",gridTemplateColumns:"repeat(3,1fr)",gap:"0.75rem",textAlign:"center"}}>
              {[
                { label:"Stages Done", val:completedStages, icon:"🎯" },
                { label:"Saved Verses", val:saved.length, icon:"🔖" },
                { label:"Study Notes", val:notes.length, icon:"📝" },
              ].map(stat=>(
                <div key={stat.label} style={{background:"white",borderRadius:"11px",padding:"0.9rem 0.5rem",border:"1px solid var(--border)"}}>
                  <div style={{fontSize:"1.2rem",marginBottom:"0.25rem"}}>{stat.icon}</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"1.4rem",fontWeight:700,color:"var(--gold)",lineHeight:1}}>{stat.val}</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.5rem",letterSpacing:"0.1em",color:"var(--muted)",marginTop:"0.2rem"}}>{stat.label.toUpperCase()}</div>
                </div>
              ))}
            </div>
          </div>
        </div>
      )}

      {/* ── TAB: SAVED ── */}
      {activeTab==="saved" && (
        <div>
          {saved.length === 0 ? (
            <div style={{textAlign:"center",padding:"3rem 1rem"}}>
              <div style={{fontSize:"3rem",marginBottom:"1rem"}}>🔖</div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.78rem",letterSpacing:"0.1em",color:"var(--muted)",marginBottom:"0.75rem"}}>NO SAVED SCRIPTURES YET</div>
              <p style={{fontSize:"0.85rem",color:"var(--muted)",maxWidth:"320px",margin:"0 auto 1.5rem",lineHeight:1.75}}>When you tap the 🔖 Save button on any verse in the Bible reader, devotional, or women's study, it will appear here.</p>
              <button className="btn-gold" onClick={()=>setPage("bible-passage")}>📖 Open Bible Reader</button>
            </div>
          ) : (
            <div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--muted)",marginBottom:"1rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
                🔖 {saved.length} SAVED SCRIPTURE{saved.length!==1?"S":""}
                <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
              </div>
              {saved.map(item=>(
                <div key={item.id} style={{background:"white",borderRadius:"14px",border:"1px solid var(--border)",padding:"1.1rem 1.35rem",marginBottom:"0.65rem",boxShadow:"var(--shadow)",borderLeft:"3px solid var(--gold)"}}>
                  <div style={{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.5rem",marginBottom:"0.4rem"}}>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:"var(--gold)"}}>{item.ref}</div>
                    <div style={{display:"flex",gap:"0.35rem",flexShrink:0}}>
                      {goToScripture && <button onClick={()=>goToScripture(item.ref)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.2rem 0.5rem",borderRadius:"5px",border:"1px solid var(--gold)",color:"var(--gold)",background:"transparent",cursor:"pointer"}}>📖</button>}
                      <button onClick={()=>removeSaved(item.id)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.2rem 0.5rem",borderRadius:"5px",border:"1px solid var(--border)",color:"var(--muted)",background:"transparent",cursor:"pointer"}}>✕</button>
                    </div>
                  </div>
                  <div style={{fontFamily:"'Cormorant Garamond',serif",fontSize:"1rem",fontStyle:"italic",color:"var(--ink)",lineHeight:1.75}}>"{item.text}"</div>
                  {item.saved_on && <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",color:"var(--muted)",marginTop:"0.35rem",letterSpacing:"0.06em"}}>SAVED {item.saved_on}</div>}
                </div>
              ))}
            </div>
          )}
        </div>
      )}

      {/* ── TAB: NOTES ── */}
      {activeTab==="notes" && (
        <div>
          {/* Add note */}
          <div style={{background:"white",borderRadius:"14px",border:"1px solid var(--border)",padding:"1.25rem 1.5rem",marginBottom:"1.25rem",boxShadow:"var(--shadow)"}}>
            <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.16em",color:"var(--gold)",marginBottom:"0.75rem"}}>📝 NEW STUDY NOTE</div>
            <input value={noteRef} onChange={e=>setNoteRef(e.target.value)}
              placeholder="Scripture reference (e.g. Jeremiah 30:7)"
              style={{width:"100%",background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"9px",padding:"0.6rem 0.85rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.84rem",color:"var(--ink)",outline:"none",marginBottom:"0.6rem"}} />
            <textarea value={newNote} onChange={e=>setNewNote(e.target.value)}
              placeholder="Write your reflection, revelation, or study note here…"
              rows={4}
              style={{width:"100%",background:"var(--cream)",border:"1px solid var(--border)",borderRadius:"9px",padding:"0.6rem 0.85rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.84rem",color:"var(--ink)",outline:"none",resize:"vertical",lineHeight:1.72,marginBottom:"0.6rem"}} />
            <button className="btn-gold" disabled={!newNote.trim()} onClick={addNote}>📝 Save Note</button>
          </div>

          {notes.length === 0 ? (
            <div style={{textAlign:"center",padding:"2rem 1rem"}}>
              <div style={{fontSize:"2rem",marginBottom:"0.5rem"}}>📔</div>
              <div style={{fontSize:"0.84rem",color:"var(--muted)"}}>Your covenant journal is empty. Write your first reflection above.</div>
            </div>
          ) : (
            <div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.18em",color:"var(--muted)",marginBottom:"0.85rem",display:"flex",alignItems:"center",gap:"0.5rem"}}>
                📔 {notes.length} NOTE{notes.length!==1?"S":""}
                <span style={{flex:1,height:"1px",background:"var(--border)",display:"block"}} />
              </div>
              {notes.map(note=>(
                <div key={note.id} style={{background:"white",borderRadius:"14px",border:"1px solid var(--border)",padding:"1.1rem 1.35rem",marginBottom:"0.65rem",boxShadow:"var(--shadow)",borderLeft:"3px solid var(--gold)"}}>
                  <div style={{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"0.5rem",marginBottom:"0.5rem"}}>
                    <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.1em",color:"var(--gold)"}}>{note.ref}</div>
                    <div style={{display:"flex",gap:"0.35rem"}}>
                      <button onClick={()=>navigator.clipboard?.writeText(note.ref + "\n\n" + note.text)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.2rem 0.5rem",borderRadius:"5px",border:"1px solid var(--border)",color:"var(--muted)",background:"transparent",cursor:"pointer"}}>📋</button>
                      <button onClick={()=>deleteNote(note.id)} style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.2rem 0.5rem",borderRadius:"5px",border:"1px solid var(--border)",color:"var(--muted)",background:"transparent",cursor:"pointer"}}>✕</button>
                    </div>
                  </div>
                  <div style={{fontSize:"0.87rem",color:"var(--ink)",lineHeight:1.82,whiteSpace:"pre-wrap"}}>{note.text}</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",color:"var(--muted)",marginTop:"0.5rem",letterSpacing:"0.06em"}}>{note.date}</div>
                </div>
              ))}
            </div>
          )}
        </div>
      )}

      {/* ── TAB: SEARCH ── */}
      {activeTab==="search" && (
        <div>
          <div style={{position:"relative",marginBottom:"1.25rem"}}>
            <input value={searchQuery} onChange={e=>handleSearch(e.target.value)}
              placeholder="Search by topic, keyword, or scripture (e.g. sabbath, modesty, Acts 3:18)…"
              style={{width:"100%",background:"white",border:"2px solid var(--gold)",borderRadius:"12px",padding:"0.85rem 1rem 0.85rem 3rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.88rem",color:"var(--ink)",outline:"none",boxShadow:"0 2px 12px rgba(196,137,58,0.12)"}} />
            <span style={{position:"absolute",left:"1rem",top:"50%",transform:"translateY(-50%)",fontSize:"1.1rem",pointerEvents:"none"}}>🔍</span>
            {searchQuery && <button onClick={()=>{setSearchQuery("");setSearchResults([]);}} style={{position:"absolute",right:"0.75rem",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",color:"var(--muted)",cursor:"pointer",fontSize:"1rem"}}>✕</button>}
          </div>

          {/* Quick topic chips */}
          {!searchQuery && (
            <div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"var(--muted)",marginBottom:"0.75rem"}}>✦ BROWSE BY TOPIC</div>
              <div style={{display:"flex",flexWrap:"wrap",gap:"0.4rem",marginBottom:"1.5rem"}}>
                {TOPIC_INDEX.map(t=>(
                  <button key={t.topic} onClick={()=>handleSearch(t.topic)}
                    style={{fontFamily:"'Cinzel',serif",fontSize:"0.65rem",letterSpacing:"0.06em",padding:"0.38rem 0.85rem",borderRadius:"20px",border:"1px solid var(--border)",background:"white",color:"var(--ink)",cursor:"pointer",transition:"all 0.15s"}}>
                    {t.topic}
                  </button>
                ))}
              </div>
              <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.16em",color:"var(--muted)",marginBottom:"0.75rem"}}>✦ EXAMPLE SEARCHES</div>
              <div style={{display:"flex",flexWrap:"wrap",gap:"0.4rem"}}>
                {["Deuteronomy 28","modesty","captivity","messiah","sukkot","James 1:1","marriage","Apocrypha"].map(q=>(
                  <button key={q} onClick={()=>handleSearch(q)}
                    style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.06em",padding:"0.32rem 0.75rem",borderRadius:"20px",border:"1px solid rgba(196,137,58,0.3)",background:"rgba(196,137,58,0.06)",color:"var(--gold)",cursor:"pointer"}}>
                    "{q}"
                  </button>
                ))}
              </div>
            </div>
          )}

          {/* Results */}
          {searchQuery && (
            <div>
              {searchResults.length === 0 ? (
                <div style={{textAlign:"center",padding:"2rem 1rem"}}>
                  <div style={{fontSize:"2rem",marginBottom:"0.5rem"}}>🔍</div>
                  <div style={{fontSize:"0.84rem",color:"var(--muted)"}}>No results for "{searchQuery}". Try a different keyword or topic name.</div>
                </div>
              ) : (
                <div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.16em",color:"var(--gold)",marginBottom:"0.85rem"}}>{searchResults.length} RESULT{searchResults.length!==1?"S":""} FOR "{searchQuery.toUpperCase()}"</div>
                  {searchResults.map((result,i)=>(
                    <div key={i} style={{background:"white",borderRadius:"14px",border:"1px solid var(--border)",padding:"1.1rem 1.35rem",marginBottom:"0.65rem",boxShadow:"var(--shadow)",cursor:"pointer"}}
                      onClick={()=>setPage(result.page)}>
                      <div style={{display:"flex",alignItems:"center",gap:"0.65rem",marginBottom:"0.35rem"}}>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.82rem",color:"var(--ink)"}}>{result.topic}</div>
                        <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",letterSpacing:"0.1em",padding:"0.15rem 0.45rem",borderRadius:"5px",background:"rgba(196,137,58,0.12)",color:"var(--gold)"}}>STAGE {result.stage||"0"}</div>
                      </div>
                      <div style={{display:"flex",flexWrap:"wrap",gap:"0.35rem",marginBottom:"0.5rem"}}>
                        {result.refs.slice(0,3).map((ref,ri)=>(
                          <button key={ri} className="scripture-btn" style={{fontSize:"0.65rem"}}
                            onClick={e=>{e.stopPropagation();goToScripture&&goToScripture(ref);}}>📖 {ref}</button>
                        ))}
                      </div>
                      <div style={{fontSize:"0.75rem",color:"var(--muted)",display:"flex",alignItems:"center",gap:"0.4rem"}}>
                        <span>→ Go to {result.page.replace("bible-","").replace("-"," ").toUpperCase()}</span>
                      </div>
                    </div>
                  ))}
                </div>
              )}
            </div>
          )}
        </div>
      )}
    </div>
  );
}

// Global save function — exposed for other components to call
let _setSavedGlobal = null;

function SaveButton({ ref: verseRef, text }) {
  const [saved, setSaved] = useState(false);
  const save = () => {
    try {
      const existing = JSON.parse(localStorage.getItem("gdbc_saved")||"[]");
      if (existing.some(s=>s.ref===verseRef)) { setSaved(true); return; }
      const updated = [{ id:Date.now(), ref:verseRef, text, saved_on:new Date().toLocaleDateString() }, ...existing];
      localStorage.setItem("gdbc_saved", JSON.stringify(updated));
      setSaved(true);
      setTimeout(()=>setSaved(false), 2000);
    } catch {}
  };
  return (
    <button onClick={save}
      style={{fontFamily:"'Cinzel',serif",fontSize:"0.52rem",padding:"0.2rem 0.5rem",borderRadius:"5px",border:`1px solid ${saved?"#5A7A52":"var(--border)"}`,color:saved?"#5A7A52":"var(--muted)",background:saved?"rgba(90,122,82,0.1)":"transparent",cursor:"pointer",transition:"all 0.18s"}}>
      {saved?"✓ Saved":"🔖"}
    </button>
  );
}

// ═══════════════════════════════════════════════════════════════════════════════
// ROCK DID IT GLOBAL ECOSYSTEM CONFIG
// Portal: goddiditbible.rockdidit.com
// ═══════════════════════════════════════════════════════════════════════════════
const PORTAL_CONFIG = {
  PORTAL_ID:              "goddiditbible",
  PORTAL_NAME:            "God Did It Bible Club",
  SUBDOMAIN:              "goddiditbible.rockdidit.com",
  VERSION:                "3.0.0",

  // ── Auth ─────────────────────────────────────────────────────────────────
  ENABLE_AUTH:            false,   // set true when backend is live
  ENABLE_LOCAL_SAVE:      true,
  ENABLE_EMAIL_RESET:     true,    // uses Zapier or EmailJS

  // ── Integrations ─────────────────────────────────────────────────────────
  ENABLE_ZAPIER_WEBHOOK:  false,   // set true + add URL to activate
  ENABLE_ERP_SYNC:        false,
  ENABLE_UNIVERSAL_API:   false,

  // ── URLs (fill in Zapier/ERP when ready) ─────────────────────────────────
  ZAPIER_WEBHOOK_URL:     "",      // e.g. https://hooks.zapier.com/hooks/catch/xxx/yyy/
  EMAIL_RESET_ZAPIER_URL: "",      // separate zap for password reset emails
  ERP_API_URL:            "",
  UNIVERSAL_API_BASE:     "",
  EMAILJS_SERVICE_ID:     "",      // optional EmailJS fallback
  EMAILJS_TEMPLATE_ID:    "",
  EMAILJS_PUBLIC_KEY:     "",

  // ── Future API routes (ready when backend exists) ─────────────────────────
  API: {
    REGISTER:         "/auth/register",
    LOGIN:            "/auth/login",
    ME:               "/auth/me",
    FORGOT_PASSWORD:  "/auth/forgot-password",
    RESET_PASSWORD:   "/auth/reset-password",
    LOGOUT:           "/auth/logout",
    PROGRESS_SAVE:    "/api/progress/save",
    PROGRESS_COMPLETE:"/api/progress/complete",
    ACCESS_CHECK:     "/api/access/check",
    USER_PROFILE:     "/api/user/profile",
    ZAPIER_EVENT:     "/api/zapier/event",
  },
};

// ─── ROCK DID IT ECOSYSTEM CONNECTOR ─────────────────────────────────────────
async function sendZapierEvent(eventType, payload) {
  if (!PORTAL_CONFIG.ENABLE_ZAPIER_WEBHOOK || !PORTAL_CONFIG.ZAPIER_WEBHOOK_URL) return;
  try {
    await fetch(PORTAL_CONFIG.ZAPIER_WEBHOOK_URL, {
      method:"POST", headers:{"Content-Type":"application/json"},
      body:JSON.stringify({ portal:PORTAL_CONFIG.PORTAL_ID, event:eventType, timestamp:new Date().toISOString(), ...payload })
    });
  } catch(e) { console.warn("Zapier event failed (non-critical):", e); }
}

async function sendEmailReset(email, lang) {
  const messages = {
    en:`Your God Did It Bible Club account password reset was requested. If you did not request this, ignore this message. To reset, reply "RESET" and we will guide you through the steps.`,
    es:`Se solicitó el restablecimiento de tu contraseña del Club Bíblico Dios Lo Hizo. Si no lo solicitaste, ignora este mensaje.`,
    fr:`Une demande de réinitialisation de mot de passe a été faite pour votre compte du Club Biblique Dieu L'a Fait.`,
  };
  // Layer 1: Zapier email zap
  if (PORTAL_CONFIG.ENABLE_ZAPIER_WEBHOOK && PORTAL_CONFIG.EMAIL_RESET_ZAPIER_URL) {
    await fetch(PORTAL_CONFIG.EMAIL_RESET_ZAPIER_URL, {
      method:"POST", headers:{"Content-Type":"application/json"},
      body:JSON.stringify({ email, portal:PORTAL_CONFIG.PORTAL_ID, lang, message:messages[lang]||messages.en, timestamp:new Date().toISOString() })
    });
    return { success:true, method:"zapier" };
  }
  // Layer 2: mailto fallback (always works)
  const subject = encodeURIComponent("God Did It Bible Club — Password Reset");
  const body = encodeURIComponent(`Password reset requested for: ${email}\n\n${messages[lang]||messages.en}`);
  return { success:true, method:"mailto", fallback:true, mailto:`mailto:admin@rockdidit.com?subject=${subject}&body=${body}` };
}

// ─── GLOBAL AI COVENANT ASSISTANT (all pages) ────────────────────────────────
// Appears as floating 🤖 button on every page
// Explains any question in 1st-grade level language from the Hebrew Israelite covenant perspective
function GlobalAIBot({ lang }) {
  const [open, setOpen] = useState(false);
  const [question, setQuestion] = useState("");
  const [answer, setAnswer] = useState("");
  const [loading, setLoading] = useState(false);
  const [history, setHistory] = useState([]);

  const SYSTEM_PROMPT = `You are a covenant scripture teacher for GOD DID IT BIBLE CLUB. 
You explain things in the simplest, clearest way — like explaining to a child in 1st grade.
You speak FROM the perspective of the ancient Hebrew Israelites — the Black, Hispanic, and Native American peoples who YAHAWAH (The Most High God) made His covenant with alone of all the families of the earth.
IMPORTANT RULES:
- Always speak as if explaining to a young child — short sentences, simple words, no complicated theology
- Always ground answers in KJV scripture (cite the actual verse)
- Always use YAHAWAH for God's name and Yahawashi for the Messiah
- Never use church/Christian religion terminology that contradicts covenant truth
- The covenant was made with Israel ALONE (Amos 3:2, Deuteronomy 7:6)
- Israel today = scattered Black, Hispanic, and Native American peoples according to Deuteronomy 28
- Keep answers SHORT — 3 to 6 sentences maximum
- End every answer with 1 scripture reference
- If someone asks who Israel is, explain: the Black people (Judah), the Hispanics (various tribes), and Native Americans (various tribes) — based on Deuteronomy 28 signs`;

  const ask = async () => {
    if (!question.trim()) return;
    const q = question.trim();
    setQuestion("");
    setLoading(true);
    setHistory(h => [...h, { role:"user", text:q }]);
    try {
      const messages = [
        ...history.slice(-6).map(h => ({ role: h.role === "user" ? "user" : "assistant", content: h.text })),
        { role:"user", content:q }
      ];
      const res = await fetch("https://api.anthropic.com/v1/messages", {
        method:"POST", headers:{"Content-Type":"application/json"},
        body:JSON.stringify({
          model:"claude-sonnet-4-20250514", max_tokens:300,
          system: SYSTEM_PROMPT,
          messages
        })
      });
      const data = await res.json();
      const text = data.content?.map(c=>c.text||"").join("") || "I could not load an answer right now. Please try again.";
      setAnswer(text);
      setHistory(h => [...h, { role:"assistant", text }]);
    } catch {
      setAnswer("I had trouble connecting. Please check your internet and try again.");
    }
    setLoading(false);
  };

  const QUICK_PROMPTS = lang==="es" ? [
    "¿Quiénes son los israelitas hoy?",
    "¿Qué es el pacto?",
    "¿Por qué guardamos el Shabat?",
    "¿Por qué no comemos cerdo?",
  ] : lang==="fr" ? [
    "Qui sont les Israélites aujourd'hui ?",
    "Qu'est-ce que l'alliance ?",
    "Pourquoi observons-nous le Sabbat ?",
    "Pourquoi ne mangeons-nous pas de porc ?",
  ] : [
    "Who are the Israelites today?",
    "What is the covenant?",
    "Why do we keep the Sabbath?",
    "Why can't we eat pork?",
    "What did Yahawashi come to do?",
    "What is Deuteronomy 28?",
  ];

  return (
    <>
      {/* Floating trigger button */}
      <button
        onClick={() => setOpen(true)}
        style={{
          position:"fixed", bottom:"calc(env(safe-area-inset-bottom,0px) + 78px)", right:"1rem",
          width:"52px", height:"52px", borderRadius:"50%",
          background:"linear-gradient(135deg,#6B1A4A,#C4893A)",
          border:"2px solid rgba(255,255,255,0.25)",
          color:"white", fontSize:"1.35rem", cursor:"pointer",
          boxShadow:"0 4px 20px rgba(107,26,74,0.45)",
          display:"flex", alignItems:"center", justifyContent:"center",
          zIndex:500, transition:"transform 0.18s",
        }}
        title={lang==="es"?"Pregunta al Asistente IA":lang==="fr"?"Demander à l'Assistant IA":"Ask the AI Assistant"}>
        🤖
      </button>

      {/* Modal */}
      {open && (
        <motion.div initial={{opacity:0}} animate={{opacity:1}} exit={{opacity:0}}
          style={{position:"fixed",inset:0,background:"rgba(26,18,8,0.75)",zIndex:1500,display:"flex",alignItems:"flex-end",justifyContent:"center"}}
          onClick={()=>setOpen(false)}>
          <motion.div initial={{y:"100%"}} animate={{y:0}} exit={{y:"100%"}} transition={{type:"spring",damping:28,stiffness:300}}
            style={{background:"var(--parchment)",borderRadius:"24px 24px 0 0",width:"100%",maxWidth:"640px",maxHeight:"82vh",display:"flex",flexDirection:"column",overflow:"hidden"}}
            onClick={e=>e.stopPropagation()}>

            {/* Header */}
            <div style={{background:"linear-gradient(135deg,#3D0A2A,#6B1A4A)",padding:"1.1rem 1.5rem",display:"flex",justifyContent:"space-between",alignItems:"center",flexShrink:0}}>
              <div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.62rem",letterSpacing:"0.2em",color:"rgba(244,167,195,0.8)",marginBottom:"0.18rem"}}>
                  ✦ {lang==="es"?"ASISTENTE DE ESCRITURA IA":lang==="fr"?"ASSISTANT SCRIPTURAIRE IA":"AI COVENANT SCRIPTURE ASSISTANT"}
                </div>
                <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.88rem",color:"white"}}>
                  {lang==="es"?"Pregunta cualquier cosa — respuesta simple":lang==="fr"?"Pose n'importe quelle question — réponse simple":"Ask anything — simple answer"}
                </div>
              </div>
              <button onClick={()=>setOpen(false)} style={{background:"rgba(255,255,255,0.15)",border:"none",borderRadius:"50%",width:"32px",height:"32px",color:"white",cursor:"pointer",fontSize:"1rem",display:"flex",alignItems:"center",justifyContent:"center"}}>✕</button>
            </div>

            {/* History */}
            <div style={{flex:1,overflowY:"auto",padding:"1rem 1.25rem",display:"flex",flexDirection:"column",gap:"0.75rem"}}>
              {history.length === 0 && (
                <div style={{textAlign:"center",padding:"1rem 0"}}>
                  <div style={{fontSize:"2rem",marginBottom:"0.5rem"}}>🤖</div>
                  <div style={{fontFamily:"'Cinzel',serif",fontSize:"0.7rem",letterSpacing:"0.1em",color:"#6B1A4A",marginBottom:"0.35rem"}}>
                    {lang==="es"?"¡Hola! Estoy aquí para ayudarte.":lang==="fr"?"Bonjour ! Je suis là pour vous aider.":"Hello! I'm here to help you."}
                  </div>
                  <div style={{fontSize:"0.82rem",color:"var(--muted)",lineHeight:1.72,maxWidth:"320px",margin:"0 auto"}}>
                    {lang==="es"?"Te explicaré las escrituras de forma sencilla — como si fuera un niño de primer grado — siempre desde la perspectiva del pacto con Israel.":lang==="fr"?"Je t'expliquerai les écritures simplement — comme à un enfant de première année — toujours du point de vue de l'alliance avec Israël.":"I'll explain scripture simply — like a 1st grader — always from the covenant perspective of Ancient Hebrew Israel."}
                  </div>
                  {/* Quick prompts */}
                  <div style={{display:"flex",flexWrap:"wrap",gap:"0.4rem",justifyContent:"center",marginTop:"1rem"}}>
                    {QUICK_PROMPTS.map((q,i)=>(
                      <button key={i} onClick={()=>{setQuestion(q);setTimeout(()=>{setQuestion("");setLoading(true);setHistory(h=>[...h,{role:"user",text:q}]);fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:"claude-sonnet-4-20250514",max_tokens:300,system:SYSTEM_PROMPT,messages:[{role:"user",content:q}]})}).then(r=>r.json()).then(d=>{const t=d.content?.map(c=>c.text||"").join("")||"";setAnswer(t);setHistory(h=>[...h,{role:"assistant",text:t}]);setLoading(false);}).catch(()=>{setAnswer("Connection error.");setLoading(false);});},50);}}
                        style={{fontFamily:"'Cinzel',serif",fontSize:"0.6rem",letterSpacing:"0.06em",padding:"0.35rem 0.75rem",borderRadius:"20px",border:"1px solid rgba(107,26,74,0.3)",background:"rgba(107,26,74,0.06)",color:"#6B1A4A",cursor:"pointer",textAlign:"left"}}>
                        {q}
                      </button>
                    ))}
                  </div>
                </div>
              )}
              {history.map((msg,i) => (
                <div key={i} style={{display:"flex",justifyContent:msg.role==="user"?"flex-end":"flex-start"}}>
                  <div style={{maxWidth:"85%",padding:"0.75rem 1rem",borderRadius:msg.role==="user"?"14px 14px 4px 14px":"14px 14px 14px 4px",background:msg.role==="user"?"#6B1A4A":"white",color:msg.role==="user"?"white":"var(--ink)",fontSize:"0.85rem",lineHeight:1.75,border:msg.role==="assistant"?"1px solid var(--border)":"none",boxShadow:msg.role==="assistant"?"var(--shadow)":"none"}}>
                    {msg.text}
                  </div>
                </div>
              ))}
              {loading && (
                <div style={{display:"flex",justifyContent:"flex-start"}}>
                  <div style={{padding:"0.75rem 1rem",borderRadius:"14px 14px 14px 4px",background:"white",border:"1px solid var(--border)",display:"flex",gap:"0.4rem",alignItems:"center"}}>
                    {[0,1,2].map(i=>(
                      <div key={i} style={{width:"7px",height:"7px",borderRadius:"50%",background:"#6B1A4A",animation:"pulse 1.2s infinite",animationDelay:`${i*0.2}s`}} />
                    ))}
                  </div>
                </div>
              )}
            </div>

            {/* Input */}
            <div style={{padding:"0.85rem 1.25rem",borderTop:"1px solid var(--border)",background:"var(--cream)",display:"flex",gap:"0.6rem",flexShrink:0}}>
              <input
                value={question}
                onChange={e=>setQuestion(e.target.value)}
                onKeyDown={e=>e.key==="Enter"&&!e.shiftKey&&ask()}
                placeholder={lang==="es"?"Haz una pregunta sobre la escritura...":lang==="fr"?"Pose une question sur l'Écriture...":"Ask a question about scripture..."}
                style={{flex:1,background:"white",border:"1px solid var(--border)",borderRadius:"11px",padding:"0.65rem 0.9rem",fontFamily:"'Libre Baskerville',serif",fontSize:"0.85rem",color:"var(--ink)",outline:"none"}}
              />
              <button onClick={ask} disabled={loading||!question.trim()}
                style={{background:"#6B1A4A",border:"none",borderRadius:"11px",padding:"0.65rem 1rem",color:"white",cursor:"pointer",fontFamily:"'Cinzel',serif",fontSize:"0.68rem",letterSpacing:"0.08em",opacity:loading||!question.trim()?0.5:1,transition:"opacity 0.18s"}}>
                {loading?"⏳":"Send"}
              </button>
            </div>
          </motion.div>
        </motion.div>
      )}
    </>
  );
}

function App() {
  const [page, setPage] = useState("home");
  const [selectedVersion, setSelectedVersion] = useState("kjv");
  const [passageQuery, setPassageQuery] = useState("");
  const [member, setMember] = useState(null);
  const [showTour, setShowTour] = useState(false);
  const [lang, setLang] = useState("en");

  const t = T[lang] || T.en;

  useEffect(() => { window.scrollTo({ top:0, behavior:"smooth" }); }, [page]);

  const goToScripture = useCallback((ref) => {
    if (!ref) return;
    setPassageQuery(ref);
    setPage("bible-passage");
  }, []);

  const handleJoinSuccess = (formData) => {
    setMember(formData);
    sendZapierEvent("member_joined", { name:formData.name, email:formData.email, lang:formData.lang });
    setPage("welcome");
    setTimeout(() => setShowTour(true), 800);
  };

  const navPage = BIBLE_SUB_PAGES.includes(page) ? "bible-hub" : AI_SUB_PAGES.includes(page) ? "ancient-israel" : page;

  const pageContent = () => {
    switch(page) {
      case "home":        return <HomePage setPage={setPage} t={t} goToScripture={goToScripture} />;
      case "welcome":     return <WelcomePage member={member} setPage={setPage} startTour={() => setShowTour(true)} t={t} />;
      case "weekly":      return <WeeklyPage t={t} setPage={setPage} goToScripture={goToScripture} />;
      case "devotional":  return <DevotionalPage t={t} goToScripture={goToScripture} setPage={setPage} />;
      case "reading":     return <ReadingPage t={t} setPage={setPage} setPassageQuery={setPassageQuery} goToScripture={goToScripture} />;
      case "audio":       return <AudioBiblePage t={t} />;
      case "livestream":  return <LiveStreamPage setPage={setPage} t={t} />;
      case "bible-hub":   return <BibleHubPage setPage={setPage} t={t} />;
      case "bible-versions": return <BibleVersionsPage selectedVersion={selectedVersion} setSelectedVersion={setSelectedVersion} setPage={setPage} t={t} />;
      case "bible-read":  return <BibleBooksPage setPage={setPage} setPassageQuery={setPassageQuery} t={t} />;
      case "bible-passage": return <PassageReaderPage selectedVersion={selectedVersion} setSelectedVersion={setSelectedVersion} passageQuery={passageQuery} setPassageQuery={setPassageQuery} setPage={setPage} t={t} />;
      case "bible-tools": return <ScriptureToolsPage setPage={setPage} t={t} />;
      case "bible-news":  return <ScriptureNewsPage setPage={setPage} t={t} goToScripture={goToScripture} />;
      case "bible-explore": return <BiblePlaceholderPage icon="🧭" title="Explore More" desc="Reading plans, audio scripture, podcasts, and devotional archives coming soon." setPage={setPage} t={t} />;
      case "ancient-israel": return <AncientIsraelHubPage setPage={setPage} goToScripture={goToScripture} />;
      case "ai-reader":   return <BibleReaderPage setPage={setPage} />;
      case "ai-articles": return <ArticlesPage setPage={setPage} />;
      case "ai-study":    return <StudyGuidePage setPage={setPage} />;
      case "ai-timeline": return <HistoricalTimelinePage setPage={setPage} />;
      case "ai-tribes":   return <TwelveTribesPage setPage={setPage} goToScripture={goToScripture} t={t} />;
      case "deut28":      return <Deut28Page setPage={setPage} goToScripture={goToScripture} t={t} />;
      case "historical":  return <HistoricalContextPage setPage={setPage} t={t} />;
      case "captivities": return <CaptivitiesPage setPage={setPage} goToScripture={goToScripture} t={t} />;
      case "feasts":      return <FeastPage setPage={setPage} goToScripture={goToScripture} t={t} />;
      case "women":       return <WomenPage setPage={setPage} goToScripture={goToScripture} t={t} />;
      case "my-journey":  return <MyJourneyPage setPage={setPage} goToScripture={goToScripture} />;
      case "study-paths": return <MyJourneyPage setPage={setPage} goToScripture={goToScripture} />;
      case "account":     return <AccountPage setPage={setPage} lang={lang} setLang={setLang} t={t} />;
      case "forgot-password": return <ForgotPasswordPage setPage={setPage} lang={lang} />;
      case "join":        return <JoinPage onSuccess={handleJoinSuccess} t={t} lang={lang} />;
      default:            return <HomePage setPage={setPage} t={t} goToScripture={goToScripture} />;
    }
  };

  return (
    <>
      <style>{css}</style>
      <Nav page={navPage} setPage={setPage} lang={lang} setLang={setLang} t={t} />
      {(AI_SUB_PAGES.includes(page) || page === "ancient-israel") && (
        <AncientIsraelSubNav page={page} setPage={setPage} />
      )}
      <main className="main main-with-sticky">
        <AnimatePresence mode="wait">
          <motion.div key={page} initial={{opacity:0,y:10}} animate={{opacity:1,y:0}} exit={{opacity:0}} transition={{duration:0.28}}>
            {pageContent()}
          </motion.div>
        </AnimatePresence>
      </main>
      <Footer setPage={setPage} t={t} />
      {/* Sticky Bottom Nav */}
      <nav className="sticky-bottom-nav">
        {[
          { icon:"🏠", label:t.navHome||"Home",            page:"home" },
          { icon:"📖", label:t.quickScripture||"Scripture", page:"bible-hub" },
          { icon:"🕯️", label:t.navDevotional||"Devotional", page:"devotional" },
          { icon:"🕎", label:t.quickFeasts||"Feasts",       page:"feasts" },
          { icon:"🗺️", label:"My Journey",                 page:"my-journey" },
        ].map(item => (
          <button key={item.page+item.label} className={`sticky-nav-item${page===item.page?" active":""}`}
            onClick={() => setPage(item.page)}>
            <span className="sticky-nav-icon">{item.icon}</span>
            <span className="sticky-nav-label">{item.label}</span>
            {page === item.page && <span className="sticky-nav-dot" />}
          </button>
        ))}
      </nav>
      {showTour && <OnboardingTour onComplete={() => setShowTour(false)} setPage={(p) => { setPage(p); setShowTour(false); }} t={t} />}
      {/* 🤖 Global Covenant AI Bot — appears on every page, 1st grade level, Hebrew Israelite covenant perspective */}
      <GlobalAIBot lang={lang} />
    </>
  );
}

// ─── ROCK DID IT ECOSYSTEM MOUNT ────────────────────────────────────────────
// Mount the app and fire ecosystem initialization events
const _root = document.getElementById('root');
if (_root) {
  ReactDOM.createRoot(_root).render(React.createElement(App));
}

// Fire portal-ready event for ecosystem tracking
if (typeof ECOSYSTEM !== 'undefined') {
  ECOSYSTEM.sendZapierEvent('portal_loaded', {
    url: window.location.href,
    referrer: document.referrer,
    timestamp: new Date().toISOString()
  });
}
