{
  quest_book: {
    name: "All Good Things — Main Questline",
    description: "Guided progression split into chapters: Survival, Exploration, Combat, Magic, Endgame.",
    chapters: [
      {
        id: "ch1_survival",
        name: "Chapter I — Survival",
        description: "Establish a base and basic food systems.",
        icon: "minecraft:campfire",
        quests: [
          {
            id: "start_basic",
            name: "A Hard Night",
            description: "Survive your first night and make a small base.",
            icon: "minecraft:campfire",
            tasks: [
              { type: "item", item: "minecraft:campfire", amount: 1 },
              { type: "item", item: "minecraft:bed", amount: 1 },
              { type: "item", item: "supplementaries:jar", amount: 1 }
            ],
            reward: { xp: 50, items: [ { item: "minecraft:bread", amount: 8 } ] }
          },
          {
            id: "fd_stove",
            name: "Farmer's Delight Start",
            description: "Make a stove and cook a meal.",
            icon: "farmerdelight:stove",
            parent_id: "start_basic",
            tasks: [
              { type: "craft", item: "farmerdelight:stove", amount: 1 },
              { type: "use", item: "farmerdelight:stove", amount: 1 }
            ],
            reward: { xp: 100, items: [ { item: "farmerdelight:cooked_porkchop", amount: 4 } ] }
          },
          {
            id: "seasonal_prepared",
            name: "Prepare For Seasons",
            description: "Make basic gear to prepare for weather (if Serene Seasons enabled).",
            icon: "sereneseasons:season_clock",
            parent_id: "fd_stove",
            tasks: [
              { type: "item", item: "minecraft:leather_boots", amount: 1 },
              { type: "item", item: "minecraft:leather_chestplate", amount: 1 }
            ],
            reward: { xp: 75, items: [ { item: "minecraft:torch", amount: 32 } ] }
          }
        ]
      },

      {
        id: "ch2_explore",
        name: "Chapter II — Exploration",
        description: "Find structures, loot your first ruins, and gather spell fragments.",
        icon: "minecraft:map",
        quests: [
          {
            id: "ruins_one",
            name: "First Ruin",
            description: "Loot your first YUNG's / Moog's / DnT structure.",
            icon: "minecraft:map",
            parent_id: "fd_stove",
            tasks: [
              { type: "discover", id: "yung:ancient_tower" }, // discovery requires structure to register; may be optional
              { type: "item", item: "kubejs:spell_fragment_apprentice", amount: 1, hidden: true }
            ],
            reward: { xp: 150, items: [ { item: "minecraft:emerald", amount: 3 } ] }
          },
          {
            id: "village_goods",
            name: "Trade & Tools",
            description: "Find a village and complete a trade to start economy progression.",
            icon: "minecraft:emerald",
            parent_id: "ruins_one",
            tasks: [
              { type: "item", item: "minecraft:emerald", amount: 1 },
              { type: "item", item: "morevillagerstrades:trade_marker", amount: 1, optional: true }
            ],
            reward: { xp: 100, items: [ { item: "minecraft:bread", amount: 16 } ] }
          }
        ]
      },

      {
        id: "ch3_combat",
        name: "Chapter III — Combat",
        description: "Train against champions, prepare for bosses, and collect boss fragments.",
        icon: "minecraft:iron_sword",
        quests: [
          {
            id: "champion_slayer",
            name: "Champion Slayer",
            description: "Defeat one elite mob (B.O.M.D / Blue / Cataclysm elite).",
            icon: "bluebetter:elite_sword", // approximate icon; JEI can confirm
            parent_id: "ruins_one",
            tasks: [
              { type: "kill_entity", entity: "bluebetter:elite_zombie", amount: 1 },
              { type: "kill_entity", entity: "mowziesmobs:barakoa", amount: 1, optional: true }
            ],
            reward: { xp: 300, items: [ { item: "kubejs:boss_ignis_fragment", amount: 1 } ] }
          },
          {
            id: "boss_fragment_offer",
            name: "Offer the Fragment",
            description: "Offer the Ignis Core Fragment to claim Adventurer stage.",
            icon: "kubejs:boss_ignis_fragment",
            parent_id: "champion_slayer",
            tasks: [
              { type: "consume", item: "kubejs:boss_ignis_fragment", amount: 1 }
            ],
            reward: {
              xp: 250,
              commands: [
                "kubejs agt_unlockstage adventurer",
                "kubejs agt_unlockstage initiated_magic"
              ],
              items: [ { item: "minecraft:iron_ingot", amount: 4 } ]
            }
          }
        ]
      },

      {
        id: "ch4_magic",
        name: "Chapter IV — Magic (Iron's Spells)",
        description: "Find spellbooks, assemble fragments, and unlock spell crafting.",
        icon: "irons_spellbooks:novice_spellbook",
        quests: [
          {
            id: "find_novice_book",
            name: "Find a Novice Spellbook",
            description: "Find or craft a novice spellbook. If recipes are gated, finish the Initiate quest to get the recipe.",
            icon: "irons_spellbooks:novice_spellbook",
            parent_id: "boss_fragment_offer",
            tasks: [
              { type: "item", item: "irons_spellbooks:novice_spellbook", amount: 1 }
            ],
            reward: {
              xp: 400,
              items: [ { item: "irons_spellbooks:scroll_firebolt", amount: 1 } ],
              commands: [ "kubejs agt_unlockstage initiated_magic" ]
            }
          },
          {
            id: "apprentice_assembly",
            name: "Assemble Apprentice Fragments",
            description: "Bring 4 Apprentice Spell Fragments to assemble an Apprentice Spellbook.",
            icon: "kubejs:spell_fragment_apprentice",
            parent_id: "find_novice_book",
            tasks: [
              { type: "item", item: "kubejs:spell_fragment_apprentice", amount: 4 }
            ],
            reward: {
              xp: 500,
              commands: [
                // unlock apprentice recipes & stage
                "kubejs agt_unlockstage apprentice_magic",
                "recipe give @s irons_spellbooks:apprentice_spellbook"
              ],
              items: [ { item: "minecraft:emerald", amount: 6 } ]
            }
          },
          {
            id: "apprentice_crafting",
            name: "Apprentice Spellbook Crafting",
            description: "If crafting was unlocked by the previous quest, craft an apprentice spellbook.",
            icon: "irons_spellbooks:apprentice_spellbook",
            parent_id: "apprentice_assembly",
            tasks: [
              { type: "craft", item: "irons_spellbooks:apprentice_spellbook", amount: 1 }
            ],
            reward: { xp: 350, items: [ { item: "minecraft:gold_ingot", amount: 8 } ] }
          }
        ]
      },

      {
        id: "ch5_endgame",
        name: "Chapter V — Endgame",
        description: "Tackle nether/end bosses and claim Master Magic.",
        icon: "minecraft:dragon_head",
        quests: [
          {
            id: "nether_prepare",
            name: "Nether Preparation",
            description: "Collect nether materials and defeat a Cataclysm nether boss (or acquire its fragment).",
            icon: "minecraft:netherite_scrap",
            parent_id: "apprentice_crafting",
            tasks: [
              { type: "item", item: "minecraft:blaze_powder", amount: 8 },
              { type: "item", item: "kubejs:boss_ignis_fragment", amount: 1 }
            ],
            reward: {
              xp: 700,
              commands: [ "kubejs agt_unlockstage nether_unlocked" ],
              items: [ { item: "minecraft:nether_brick", amount: 16 } ]
            }
          },
          {
            id: "mastery_final",
            name: "Mastery Challenge",
            description: "Defeat the Ender Dragon AND a major mod boss (Cataclysm / BOMD).",
            icon: "minecraft:dragon_head",
            parent_id: "nether_prepare",
            tasks: [
              { type: "kill_entity", entity: "minecraft:ender_dragon", amount: 1 },
              { type: "item", item: "kubejs:spell_fragment_master", amount: 1 }
            ],
            reward: {
              xp: 1500,
              items: [ { item: "irons_spellbooks:spell_mastery", amount: 1 } ],
              commands: [ "kubejs agt_unlockstage master_magic", "kubejs agt_unlockstage end_unlocked" ]
            }
          }
        ]
      }
    ]
  }
}