EbonholdHub.SynergyData = {}

-- ── Manual echo tags ─────────────────────────────────────────────────────────
-- Key: canonical echo name (as returned by GetSpellInfo, quality suffix stripped)
-- tags:         what this echo does / what school/mechanic it belongs to
-- synergiesWith: tags on OTHER echoes that make this echo more valuable
--
-- Expand this table as you discover echoes in-game.
-- Echoes NOT listed here get auto-tags from description parsing (EchoAnalyzer).

EbonholdHub.SynergyData.EchoTags = {

    -- ══════════════════════════════════════════════════════════════════════════
    -- FIRE
    -- ══════════════════════════════════════════════════════════════════════════
    -- Scorched Sky: after 3 Fire spells → Rain of Fire AOE
    ["Scorched Sky"] = {
        tags         = { "fire", "aoe", "proc" },
        synergiesWith = { "fire", "aoe" },
    },
    -- Cinders of the Sanctum: Fire dmg → stacks → Fire Cyclone AOE
    ["Cinders of the Sanctum"] = {
        tags         = { "fire", "stack", "aoe", "proc" },
        synergiesWith = { "fire", "stack" },
    },
    -- Brittle Forging: Fire builds Heat → Brittle → next Fire crit Shatters AOE
    ["Brittle Forging"] = {
        tags         = { "fire", "stack", "crit", "aoe" },
        synergiesWith = { "fire", "crit", "stack" },
    },
    -- Burning Touch: direct spells → 10% of damage as fire dot
    ["Burning Touch"] = {
        tags         = { "fire", "dot", "proc" },
        synergiesWith = { "fire", "dot", "crit" },
    },
    -- Scorching Wounds: direct spells burn target fire dot
    ["Scorching Wounds"] = {
        tags         = { "fire", "dot" },
        synergiesWith = { "fire", "dot", "crit" },
    },
    -- Burning Cataclysm: Fire over-time effects can crit
    ["Burning Cataclysm"] = {
        tags         = { "fire", "dot", "crit" },
        synergiesWith = { "fire", "dot", "crit" },
    },
    -- Immolation Aura: fire aura damages nearby enemies while in combat
    ["Immolation Aura"] = {
        tags         = { "fire", "aoe", "melee" },
        synergiesWith = { "fire", "aoe" },
    },
    -- Scorched Path: movement leaves fire trail
    ["Scorched Path"] = {
        tags         = { "fire", "aoe" },
        synergiesWith = { "fire", "aoe" },
    },
    -- Burning Flames (Healer): periodic healing erupts in flames on nearby enemies
    ["Burning Flames"] = {
        tags         = { "fire", "dot", "healing", "aoe" },
        synergiesWith = { "fire", "healing", "dot" },
    },
    -- Frostfire Paradox: Frost builds Biting Cold → direct Fire Shatters stacks
    ["Frostfire Paradox"] = {
        tags         = { "fire", "frost", "stack", "crit" },
        synergiesWith = { "fire", "frost", "stack", "crit" },
    },
    -- Emberlord's Gift: Fire dmg → 100 stacks → Fire eruption
    ["Emberlord's Gift"] = {
        tags         = { "fire", "stack", "aoe" },
        synergiesWith = { "fire", "stack" },
    },
    -- Ember Spark (class-specific): resource spend → fire proc
    ["Ember Spark"] = {
        tags         = { "fire", "proc", "resource" },
        synergiesWith = { "fire" },
    },
    -- Broodmother's Fury: chance to apply Searing Cinders fire dot → Deep Breath
    ["Broodmother's Fury"] = {
        tags         = { "fire", "dot", "aoe", "proc" },
        synergiesWith = { "fire", "dot", "stack" },
    },
    -- Rocket Strike: 5% chance on auto-attack to fire rocket (scales with pets)
    -- "scales with pets" means pet Attack Power amplifies the rocket damage.
    ["Rocket Strike"] = {
        tags         = { "fire", "ranged", "melee", "proc", "pet" },
        synergiesWith = { "fire", "ranged", "pet" },
    },
    -- Flame Vents: dodge/parry → stack → fire vent (tank) + damage reduction
    ["Flame Vents"] = {
        tags         = { "fire", "defensive", "stack", "aoe" },
        synergiesWith = { "fire", "defensive" },
    },
    -- Nether Lord's Command: dmg procs Nether Portal → Fel Lightning + Fire
    ["Nether Lord's Command"] = {
        tags         = { "shadow", "fire", "aoe", "proc" },
        synergiesWith = { "shadow", "fire" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- FROST
    -- ══════════════════════════════════════════════════════════════════════════
    -- Shattered Sky: after 3 Frost spells → Blizzard AOE + slow
    ["Shattered Sky"] = {
        tags         = { "frost", "aoe", "slow", "proc" },
        synergiesWith = { "frost", "aoe" },
    },
    -- Chill of the Bone Wyrm: Frost dmg → Rime stacks → Frost Breath + Brittle
    ["Chill of the Bone Wyrm"] = {
        tags         = { "frost", "stack", "aoe", "proc" },
        synergiesWith = { "frost", "stack", "crit" },
    },
    -- Killing Chill: Frost over-time effects can crit
    ["Killing Chill"] = {
        tags         = { "frost", "dot", "crit" },
        synergiesWith = { "frost", "dot", "crit" },
    },
    -- Permafrost Aura: frost aura damages nearby enemies + attack speed debuff
    -- Note: spell name has trailing space as returned by GetSpellInfo
    ["Permafrost Aura "] = {
        tags         = { "frost", "aoe", "melee" },
        synergiesWith = { "frost", "aoe", "melee" },
    },
    -- Spiteful Shard: chance on being hit → Glacial Spike frost/knockup
    ["Spiteful Shard"] = {
        tags         = { "frost", "defensive", "proc" },
        synergiesWith = { "frost", "defensive" },
    },
    -- Frost Bite: 10% chance on being struck → freeze attacker
    ["Frost Bite"] = {
        tags         = { "frost", "defensive", "proc" },
        synergiesWith = { "frost", "defensive" },
    },
    -- Fire Brand: Fire direct hits stack damage amp on target
    -- Available to: Hunter, Shaman, Mage, Warlock (classMask 452)
    ["Fire Brand"] = {
        tags         = { "fire", "stack", "damage" },
        synergiesWith = { "fire", "stack" },
    },
    -- Frost Brand: Frost direct hits stack damage amp on target
    ["Frost Brand"] = {
        tags         = { "frost", "stack", "damage" },
        synergiesWith = { "frost", "stack" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- SHADOW
    -- ══════════════════════════════════════════════════════════════════════════
    -- Blighted Sky: after 3 Shadow spells → Shadowfury AOE + stun
    ["Blighted Sky"] = {
        tags         = { "shadow", "aoe", "proc" },
        synergiesWith = { "shadow", "aoe" },
    },
    -- Curse of the Plaguebringer: Shadow dmg stacks → spreading shadow dot
    ["Curse of the Plaguebringer"] = {
        tags         = { "shadow", "dot", "stack", "aoe" },
        synergiesWith = { "shadow", "dot", "stack" },
    },
    -- Reaper's Verdict: +20% damage below 35% hp; extra shadow dmg below 15%
    ["Reaper's Verdict"] = {
        tags         = { "shadow", "damage", "proc" },
        synergiesWith = { "shadow", "damage" },
    },
    -- Reaper's Doom: shadow dot explodes on death or expiry
    ["Reaper's Doom"] = {
        tags         = { "shadow", "dot", "aoe", "proc" },
        synergiesWith = { "shadow", "dot", "aoe" },
    },
    -- Shadow Crash: shadow DOT ticks → 3% chance to launch Shadow Crash AOE
    ["Shadow Crash"] = {
        tags         = { "shadow", "dot", "aoe", "proc" },
        synergiesWith = { "shadow", "dot" },
    },
    -- Idol of Yogg-Saron: kill stacks → summon Thing from Beyond (shadow spikes)
    ["Idol of Yogg-Saron"] = {
        tags         = { "shadow", "aoe", "proc" },
        synergiesWith = { "shadow", "aoe" },
    },
    -- Shadow Malice: Shadow over-time effects can crit
    ["Shadow Malice"] = {
        tags         = { "shadow", "dot", "crit" },
        synergiesWith = { "shadow", "dot", "crit" },
    },
    -- Shadow Brand: Shadow direct hits stack damage amp on target
    ["Shadow Brand"] = {
        tags         = { "shadow", "stack", "damage" },
        synergiesWith = { "shadow", "stack" },
    },
    -- The Unclean's Fever: melee hits apply shadow dot + 10% damage reduction
    ["The Unclean's Fever"] = {
        tags         = { "shadow", "dot", "defensive", "melee" },
        synergiesWith = { "shadow", "dot", "defensive" },
    },
    -- Reap the Weak: crit strikes → shadow damage (x3 below 35%)
    ["Reap the Weak"] = {
        tags         = { "shadow", "crit", "proc", "direct" },
        synergiesWith = { "shadow", "crit" },
    },
    -- Crimson Reprisal (Blood Mirror): heals received → shadow damage to enemy
    ["Crimson Reprisal"] = {
        tags         = { "shadow", "healing", "defensive", "proc" },
        synergiesWith = { "shadow", "healing", "defensive" },
    },
    -- The Unclean's Fever: already listed above
    -- Shadow Hazard: Fan of Knives +20% vs 4+ enemies
    ["Shadow Hazard"] = {
        tags         = { "shadow", "aoe", "melee" },
        synergiesWith = { "shadow", "aoe" },
    },
    -- Fel Hazard: Rain of Fire / Hellfire / Shadowfury +20% vs 4+ enemies
    ["Fel Hazard"] = {
        tags         = { "shadow", "fire", "aoe" },
        synergiesWith = { "shadow", "fire", "aoe" },
    },
    -- Battlefield Hazard: Thunder Clap/Shockwave/Whirlwind/Bladestorm +20% vs 4+ enemies (Warrior-only)
    ["Battlefield Hazard"] = {
        tags         = { "physical", "melee", "aoe" },
        synergiesWith = { "physical", "melee", "aoe" },
    },
    -- Blighted Hazard: Death and Decay/Blood Boil/Howling Blast/Corpse Explosion +20% vs 4+ enemies (DK-only)
    ["Blighted Hazard"] = {
        tags         = { "shadow", "frost", "aoe" },
        synergiesWith = { "shadow", "frost", "aoe" },
    },
    -- Sanctified Hazard: Consecration/Divine Storm/Hammer of Righteous +20% vs 4+ enemies (Paladin-only)
    ["Sanctified Hazard"] = {
        tags         = { "holy", "aoe", "melee" },
        synergiesWith = { "holy", "aoe" },
    },
    -- Hunting Hazard: Volley/Multi-Shot +20% vs 4+ enemies (Hunter-only)
    ["Hunting Hazard"] = {
        tags         = { "ranged", "aoe", "physical" },
        synergiesWith = { "ranged", "aoe" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- HOLY
    -- ══════════════════════════════════════════════════════════════════════════
    -- Sanctified Sky: after 3 Holy spells → Consecration dmg + healing
    ["Sanctified Sky"] = {
        tags         = { "holy", "aoe", "healing", "proc" },
        synergiesWith = { "holy", "healing", "aoe" },
    },
    -- Holy Revelation: Holy over-time effects can crit
    ["Holy Revelation"] = {
        tags         = { "holy", "dot", "crit" },
        synergiesWith = { "holy", "dot", "crit" },
    },
    -- Holy Brand: Holy direct hits stack damage amp on target
    ["Holy Brand"] = {
        tags         = { "holy", "stack", "damage" },
        synergiesWith = { "holy", "stack" },
    },
    -- Divine Resonance: direct heal → holy burst damages nearby enemies
    ["Divine Resonance"] = {
        tags         = { "holy", "healing", "aoe", "proc" },
        synergiesWith = { "holy", "healing" },
    },
    -- Holy Hazard: Holy Nova +20% vs 4+ enemies
    ["Holy Hazard"] = {
        tags         = { "holy", "aoe" },
        synergiesWith = { "holy", "aoe" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- NATURE / LIGHTNING
    -- ══════════════════════════════════════════════════════════════════════════
    -- Stormtorn Sky: after 3 Nature spells → Hurricane AOE + attack slow
    ["Stormtorn Sky"] = {
        tags         = { "nature", "lightning", "aoe", "proc" },
        synergiesWith = { "nature", "lightning", "aoe" },
    },
    -- Storm Conductor: 10 offensive abilities → Chain Lightning (99 targets!)
    ["Storm Conductor"] = {
        tags         = { "nature", "lightning", "aoe", "proc" },
        synergiesWith = { "nature", "lightning", "aoe" },
    },
    -- Widow's Venom: Nature dmg → Venomous stacks → Poison Bolt Volley AOE
    ["Widow's Venom"] = {
        tags         = { "nature", "poison", "stack", "aoe" },
        synergiesWith = { "nature", "poison", "stack" },
    },
    -- Nature's Reprisal: Nature over-time effects can crit
    ["Nature's Reprisal"] = {
        tags         = { "nature", "dot", "crit" },
        synergiesWith = { "nature", "dot", "crit" },
    },
    -- Nature Brand: Nature direct hits stack damage amp on target
    ["Nature Brand"] = {
        tags         = { "nature", "stack", "damage" },
        synergiesWith = { "nature", "stack" },
    },
    -- Lightning Charged: every 8s stacks (max 5) → auto-attacks deal nature → Chain Lightning at 5
    ["Lightning Charged"] = {
        tags         = { "nature", "lightning", "melee", "ranged", "stack", "haste" },
        synergiesWith = { "nature", "lightning", "melee", "ranged" },
    },
    -- Tempest Vortex: pulls nearby enemies + lightning damage every 5s (tank)
    ["Tempest Vortex"] = {
        tags         = { "nature", "lightning", "aoe" },
        synergiesWith = { "nature", "lightning", "aoe" },
    },
    -- Static Overflow: every 3s next ability also hits 3 random enemies nature
    ["Static Overflow"] = {
        tags         = { "nature", "lightning", "aoe", "proc" },
        synergiesWith = { "nature", "lightning" },
    },
    -- Storm Hazard: Chain Lightning + Thunderstorm +20% vs 4+ enemies
    ["Storm Hazard"] = {
        tags         = { "nature", "lightning", "aoe" },
        synergiesWith = { "nature", "lightning", "aoe" },
    },
    -- Mutagenic Fumes: kill → Poison Cloud AOE nature damage
    ["Mutagenic Fumes"] = {
        tags         = { "nature", "poison", "aoe", "proc" },
        synergiesWith = { "nature", "poison", "aoe" },
    },
    -- Wild Hazard: Hurricane / Starfall / Swipe +20% vs 4+ enemies
    ["Wild Hazard"] = {
        tags         = { "nature", "aoe" },
        synergiesWith = { "nature", "aoe" },
    },
    -- Crypt Lord's Swarm: Locust Swarm in combat — nature aoe + 20% damage reduction
    ["Crypt Lord's Swarm"] = {
        tags         = { "nature", "aoe", "defensive" },
        synergiesWith = { "nature", "defensive" },
    },
    -- Broodmother's Webbing: below 50% hp → web AOE + stun (tank)
    ["Broodmother's Webbing"] = {
        tags         = { "nature", "defensive", "aoe", "proc" },
        synergiesWith = { "nature", "defensive" },
    },
    -- Spiteful Thorns: being hit → nature damage scales with Armor
    ["Spiteful Thorns"] = {
        tags         = { "nature", "defensive", "armor", "proc" },
        synergiesWith = { "nature", "armor", "defensive" },
    },
    -- Slimebound Husk: being hit stacks → shed skin → Poison Slime + move speed
    ["Slimebound Husk"] = {
        tags         = { "nature", "defensive", "poison", "stack" },
        synergiesWith = { "nature", "defensive" },
    },
    -- Leeching Swarm: below 50% hp → Leeching Swarm nature dot + heal
    ["Leeching Swarm"] = {
        tags         = { "nature", "dot", "healing", "defensive" },
        synergiesWith = { "nature", "healing", "defensive" },
    },
    -- Corrosive Breath (class-specific): specific ability → Acid Breath nature dot
    ["Corrosive Breath"] = {
        tags         = { "nature", "dot", "aoe", "proc" },
        synergiesWith = { "nature", "dot" },
    },
    -- Nature's Surge (class-specific): chance to make next nature/heal spell instant
    ["Nature's Surge"] = {
        tags         = { "nature", "healing", "proc" },
        synergiesWith = { "nature", "healing" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- ARCANE
    -- ══════════════════════════════════════════════════════════════════════════
    -- Riven Sky: after 3 Arcane spells → Arcane Explosion AOE + restore 5% mana
    ["Riven Sky"] = {
        tags         = { "arcane", "aoe", "proc" },
        synergiesWith = { "arcane", "aoe" },
    },
    -- Storm of the Spellweaver: Arcane dmg → stacks → Magic Missile salvo (3 targets)
    ["Storm of the Spellweaver"] = {
        tags         = { "arcane", "stack", "aoe", "proc" },
        synergiesWith = { "arcane", "stack" },
    },
    -- Constellations: crits → Falling Stars → Big Bang AOE Arcane
    ["Constellations"] = {
        tags         = { "arcane", "crit", "aoe", "proc" },
        synergiesWith = { "arcane", "crit" },
    },
    -- Arcane Rupture: Arcane over-time effects can crit
    ["Arcane Rupture"] = {
        tags         = { "arcane", "dot", "crit" },
        synergiesWith = { "arcane", "dot", "crit" },
    },
    -- Arcane Brand: Arcane direct hits stack damage amp on target
    ["Arcane Brand"] = {
        tags         = { "arcane", "stack", "damage" },
        synergiesWith = { "arcane", "stack" },
    },
    -- Arcane Weapon: above 15% mana → auto-attacks deal 20% Arcane (melee/ranged).
    -- Requires mana resource → best for mana-using melee/ranged (Ret Paladin, Enhancement Shaman,
    -- Hunter). Zero value for rage/energy/RP users (Warriors, Rogues, Feral Druids, DKs).
    ["Arcane Weapon"] = {
        tags         = { "arcane", "melee", "ranged", "proc", "mana" },
        synergiesWith = { "arcane", "melee", "mana" },
    },
    -- Third Time's the Charm: every 3rd direct spell +20% Arcane damage
    ["Third Time's the Charm"] = {
        tags         = { "arcane", "direct", "proc" },
        synergiesWith = { "arcane", "direct" },
    },
    -- Arcane Density: Spell Power = 5% of Armor (great for plate/mail casters)
    ["Arcane Density"] = {
        tags         = { "arcane", "armor", "spellpower" },
        synergiesWith = { "arcane", "armor", "spellpower" },
    },
    -- Arcane Burn: +15% spell damage but +50% resource costs
    ["Arcane Burn"] = {
        tags         = { "arcane", "spellpower", "damage" },
        synergiesWith = { "arcane", "spellpower" },
    },
    -- Arcane Hazard: Arcane Explosion / Blizzard / Flamestrike +20% vs 4+ enemies
    ["Arcane Hazard"] = {
        tags         = { "arcane", "aoe" },
        synergiesWith = { "arcane", "aoe" },
    },
    -- Arcane Surge: chance to make next arcane/fire/frost spell instant
    ["Arcane Surge"] = {
        tags         = { "arcane", "fire", "frost", "proc" },
        synergiesWith = { "arcane", "fire", "frost" },
    },
    -- Arcane Cadence: each unique offensive spell/ability stacks +3% damage (max stack)
    ["Arcane Cadence"] = {
        tags         = { "arcane", "stack", "damage" },
        synergiesWith = { "arcane", "stack", "damage" },
    },
    -- Archmage's Mark: dealing Fire+Frost+Arcane within 6s → +10% damage 12s
    ["Archmage's Mark"] = {
        tags         = { "fire", "frost", "arcane", "damage" },
        synergiesWith = { "fire", "frost", "arcane" },
    },
    -- Arcane Snare: direct spells → slow target 30% (Caster only: 1488)
    ["Arcane Snare"] = {
        tags         = { "arcane", "slow" },
        synergiesWith = { "arcane" },
    },
    -- Arcane Bombardment (class-specific): class ability → missile AOE Arcane
    ["Arcane Bombardment"] = {
        tags         = { "arcane", "aoe", "proc" },
        synergiesWith = { "arcane", "aoe" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- MULTI-SCHOOL
    -- ══════════════════════════════════════════════════════════════════════════
    -- Twilight Equilibrium: alternate Light/Dark essence — dual school cycle
    ["Twilight Equilibrium"] = {
        tags         = { "fire", "holy", "nature", "shadow", "frost", "arcane", "stack" },
        synergiesWith = { "fire", "holy", "nature", "shadow", "frost", "arcane" },
    },
    -- Entropic Fusion: Fire + Shadow within 3s → +10% damage 6s
    ["Entropic Fusion"] = {
        tags         = { "fire", "shadow", "damage", "proc" },
        synergiesWith = { "fire", "shadow", "damage" },
    },
    -- Edict of the Four: 10 dmg abilities → Meteor/VoidZone/Shadow/HolyWrath cycle
    ["Edict of the Four"] = {
        tags         = { "fire", "shadow", "holy", "nature", "aoe", "stack" },
        synergiesWith = { "fire", "shadow", "holy", "nature", "aoe" },
    },
    -- Edict of the Iron Council: 10 dmg abilities → Rune/Overload/Fusion cycle
    ["Edict of the Iron Council"] = {
        tags         = { "shadow", "nature", "lightning", "aoe", "stack" },
        synergiesWith = { "shadow", "nature", "lightning", "aoe" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- DOT / PERIODIC MECHANICS
    -- ══════════════════════════════════════════════════════════════════════════
    -- Harbringer of Doom: +1% damage per active DOT on target + sp/ap bonus
    ["Harbringer of Doom"] = {
        tags         = { "dot", "damage", "stack" },
        synergiesWith = { "dot", "damage" },
    },
    -- Echoing Afflictions: DOTs/HoTs hit additional target + 25% more frequent
    ["Echoing Afflictions"] = {
        tags         = { "dot", "hot", "aoe", "healing" },
        synergiesWith = { "dot", "hot", "healing" },
    },
    -- Overtime Conversion: on kill — remaining DOTs detonate 30% to nearby enemies
    ["Overtime Conversion"] = {
        tags         = { "dot", "aoe", "proc" },
        synergiesWith = { "dot", "aoe" },
    },
    -- Contagion: DOT ticks → chance to apply a random class DOT to target
    ["Contagion"] = {
        tags         = { "dot", "proc" },
        synergiesWith = { "dot" },
    },
    -- Pandemic: target with your DOT dies → DOT spreads to all nearby enemies
    ["Pandemic"] = {
        tags         = { "dot", "aoe", "proc" },
        synergiesWith = { "dot", "aoe" },
    },
    -- Accelerated Decay: your DOTs now benefit from Haste
    ["Accelerated Decay"] = {
        tags         = { "dot", "haste" },
        synergiesWith = { "dot", "haste" },
    },
    -- Echoing Tides: periodic effects have 30% chance to tick once more
    ["Echoing Tides"] = {
        tags         = { "dot", "hot", "proc" },
        synergiesWith = { "dot", "hot" },
    },
    -- Unstable Infusion (class-specific): dmg applies class-specific DOT to target
    ["Unstable Infusion"] = {
        tags         = { "dot", "dot_damage", "proc", "disease" },
        synergiesWith = { "dot", "dot_damage", "disease" },
    },
    -- Creeping Decay: your DOTs slow target's attack/cast speed
    ["Creeping Decay"] = {
        tags         = { "dot", "slow" },
        synergiesWith = { "dot" },
    },
    -- Blood Frenzy: Bleed effects can now critically strike
    ["Blood Frenzy"] = {
        tags         = { "bleed", "dot", "crit" },
        synergiesWith = { "bleed", "dot", "crit" },
    },
    -- Essence Tap: DOT ticks → chance to give ally 1% mana/energy/rage/RP
    ["Essence Tap"] = {
        tags         = { "dot", "resource" },
        synergiesWith = { "dot" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- CRIT-CENTRIC
    -- ══════════════════════════════════════════════════════════════════════════
    -- Precision Strike: every 10s next auto-attack has 100% crit chance for 3s
    ["Precision Strike"] = {
        tags         = { "crit", "damage" },
        synergiesWith = { "crit", "damage" },
    },
    -- Perfect Timing: stand still 6s → crit hits deal 25% extra damage
    ["Perfect Timing"] = {
        tags         = { "crit", "damage_bonus" },
        synergiesWith = { "crit", "damage_bonus" },
    },
    -- Lethal Precision: -50% crit chance but +30% crit damage
    ["Lethal Precision"] = {
        tags         = { "crit", "damage" },
        synergiesWith = { "crit", "damage" },
    },
    -- Battle Rhythm: +1% crit damage per 150 crit rating
    ["Battle Rhythm"] = {
        tags         = { "crit", "damage" },
        synergiesWith = { "crit", "damage" },
    },
    -- Sudden Insight: crit → 1% haste for 2s stacking up to 5
    ["Sudden Insight"] = {
        tags         = { "crit", "haste", "stack" },
        synergiesWith = { "crit", "haste" },
    },
    -- Polarity Shift: takes melee dmg → Negative Charge (defense); else Positive (crit+dmg)
    ["Polarity Shift"] = {
        tags         = { "crit", "defensive", "damage", "proc" },
        synergiesWith = { "crit", "defensive" },
    },
    -- Rage of the Colossus: crits → Momentum stacks → Massive Crash AOE physical
    ["Rage of the Colossus"] = {
        tags         = { "crit", "physical", "aoe", "stack" },
        synergiesWith = { "crit", "physical", "aoe" },
    },
    -- The Sporelord's Gift: periodic buff to nearby allies → +10% crit damage
    ["The Sporelord's Gift"] = {
        tags         = { "crit", "nature", "aoe" },
        synergiesWith = { "crit", "nature" },
    },
    -- Rend the Weak: crits → 20% chance physical proc (x3 below 35%)
    ["Rend the Weak"] = {
        tags         = { "physical", "crit", "proc" },
        synergiesWith = { "physical", "crit" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- HASTE / COOLDOWN
    -- ══════════════════════════════════════════════════════════════════════════
    -- Quickening Aura: +10% Haste + 30 haste rating (no conditions)
    ["Quickening Aura"] = {
        tags         = { "haste", "damage" },
        synergiesWith = { "haste" },
    },
    -- Chronoboost: +2% Haste per ability on CD + 20 haste rating
    ["Chronoboost"] = {
        tags         = { "haste", "stack" },
        synergiesWith = { "haste" },
    },
    -- Temporal Flow: using CD ability reduces all other CDs by 1.5s
    ["Temporal Flow"] = {
        tags         = { "haste", "cooldown_reduction" },
        synergiesWith = { "haste" },
    },
    -- Temporal Pressure (class-specific): your cooldowns scale with Haste
    ["Temporal Pressure"] = {
        tags         = { "haste", "cooldown_reduction" },
        synergiesWith = { "haste" },
    },
    -- Quickened Tempo: global cooldown now reduced by Haste
    ["Quickened Tempo"] = {
        tags         = { "haste", "cooldown_reduction" },
        synergiesWith = { "haste" },
    },
    -- Battle Tempo: killing an enemy reduces all CDs by 1s
    ["Battle Tempo"] = {
        tags         = { "cooldown_reduction", "cooldown", "proc" },
        synergiesWith = { "cooldown_reduction", "cooldown" },
    },
    -- Relentless Rhythm: melee attacks reduce random CD by 1.5s
    ["Relentless Rhythm"] = {
        tags         = { "melee", "cooldown_reduction", "physical", "proc" },
        synergiesWith = { "melee", "cooldown_reduction" },
    },
    -- Rapid Recalibration: auto-shots reduce random CD by 2s
    ["Rapid Recalibration"] = {
        tags         = { "ranged", "cooldown_reduction", "proc" },
        synergiesWith = { "ranged", "cooldown_reduction" },
    },
    -- Class CD-reduction echoes (1% CDR on class abilities)
    ["Rite of Quickening"]     = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },
    ["Echoes of Celerity"]     = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },
    ["Flow of Battle"]         = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },
    ["Pulse of Renewal"]       = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },
    ["Momentum Chant"]         = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },
    ["Accelerated Spirit"]     = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },
    ["Tempo Weave"]            = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },
    ["Rhythm of Power"]        = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },
    ["Nature Quickness"]       = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },
    -- Note: spell name has trailing space as returned by GetSpellInfo
    ["Cyclebreaker's Sigil "]  = { tags = { "cooldown_reduction" }, synergiesWith = { "cooldown_reduction" } },

    -- ══════════════════════════════════════════════════════════════════════════
    -- PHYSICAL / MELEE EPICS
    -- ══════════════════════════════════════════════════════════════════════════
    -- Backstabber's Edge: behind target → extra 5% strike + crit rating
    ["Backstabber's Edge"] = {
        tags         = { "physical", "melee", "crit", "proc" },
        synergiesWith = { "physical", "melee", "crit" },
    },
    -- Second Edge: melee attacks strike additional nearby enemy + AP bonus
    ["Second Edge"] = {
        tags         = { "physical", "melee", "aoe" },
        synergiesWith = { "melee", "physical", "aoe" },
    },
    -- Sweeping Blows: melee auto-attacks cleave 20% to nearby enemies
    ["Sweeping Blows"] = {
        tags         = { "physical", "melee", "aoe" },
        synergiesWith = { "melee", "physical", "aoe" },
    },
    -- Double Strike: melee attacks → 10% chance to strike again
    ["Double Strike"] = {
        tags         = { "physical", "melee", "proc" },
        synergiesWith = { "physical", "melee" },
    },
    -- Battle Momentum: every 5 melee hits → +1% attack speed (stacks 5)
    ["Battle Momentum"] = {
        tags         = { "melee", "haste", "stack" },
        synergiesWith = { "melee", "haste" },
    },
    -- Drillmaster's Rebuke: melee attacks → Unbalancing Strike 350% weapon + 10% dmg debuff
    ["Drillmaster's Rebuke"] = {
        tags         = { "physical", "melee", "proc", "damage" },
        synergiesWith = { "physical", "melee", "damage" },
    },
    -- Exposed Heart: auto-attack stacks → expose heart 20% dmg + 40% cleave AOE
    ["Exposed Heart"] = {
        tags         = { "physical", "melee", "ranged", "aoe", "stack" },
        synergiesWith = { "physical", "melee", "aoe" },
    },
    -- Impaler's Tribute: dmg builds Impale stacks → Skewer dot + splinter on auto
    ["Impaler's Tribute"] = {
        tags         = { "physical", "melee", "ranged", "dot", "stack", "aoe" },
        synergiesWith = { "physical", "melee", "dot" },
    },
    -- Stitched Fury: below 15% hp → Frenzy +30% attack speed +25% physical dmg
    ["Stitched Fury"] = {
        tags         = { "physical", "melee", "haste" },
        synergiesWith = { "melee", "physical" },
    },
    -- Ravenous Bellow: killing blow → Terrifying Roar AOE + 15% dmg taken debuff
    ["Ravenous Bellow"] = {
        tags         = { "physical", "melee", "aoe", "proc" },
        synergiesWith = { "physical", "aoe" },
    },
    -- Open Wounds: melee/ranged attacks apply physical bleeding dot
    ["Open Wounds"] = {
        tags         = { "physical", "bleed", "dot", "melee", "ranged" },
        synergiesWith = { "physical", "bleed", "dot" },
    },
    -- Steel Brand: Physical direct hits stack damage amp on target
    ["Steel Brand"] = {
        tags         = { "physical", "melee", "ranged", "stack" },
        synergiesWith = { "physical", "stack" },
    },
    -- Heavy Blows: +15% physical damage but -30% attack speed
    ["Heavy Blows"] = {
        tags         = { "physical", "melee" },
        synergiesWith = { "physical", "melee" },
    },
    -- Crushing Finish: hit enemy below 30% → Execute for massive physical + expertise scaling
    ["Crushing Finish"] = {
        tags         = { "physical", "melee", "ranged", "expertise" },
        synergiesWith = { "physical", "expertise" },
    },
    -- Stonefist Barrage (class-specific): specific ability → boulder AOE physical
    ["Stonefist Barrage"] = {
        tags         = { "physical", "aoe", "proc" },
        synergiesWith = { "physical", "aoe" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- RESOURCE MANAGEMENT
    -- ══════════════════════════════════════════════════════════════════════════
    -- Energy Overflow: every 10s next ability free + restores resource
    ["Energy Overflow"] = {
        tags         = { "resource", "haste" },
        synergiesWith = { "resource" },
    },
    -- Relentless Energy: below 80% Energy → more regen; above 80% → +10% dmg
    ["Relentless Energy"] = {
        tags         = { "resource", "melee", "damage" },
        synergiesWith = { "melee", "damage" },
    },
    -- Raging Momentum: below 80% Rage → more Rage gen; above 80% → +10% dmg
    ["Raging Momentum"] = {
        tags         = { "resource", "melee", "damage", "physical" },
        synergiesWith = { "melee", "physical", "damage" },
    },
    -- Runic Momentum: below 80% RP → more RP gen; above 80% → +10% dmg
    ["Runic Momentum"] = {
        tags         = { "resource", "melee", "damage", "physical" },
        synergiesWith = { "melee", "physical", "damage" },
    },
    -- Anger Management: +1 Rage every 3s (Warrior)
    ["Anger Management"] = {
        tags         = { "resource", "melee" },
        synergiesWith = { "melee" },
    },
    -- Dirge: DK attacks (Obliterate, Death Strike, Plague Strike etc.) generate +2.5 Runic Power.
    -- Only DKs have these abilities → tags must NOT include generic "melee" (would falsely score for Paladins etc.)
    ["Dirge"] = {
        tags         = { "resource", "runicpower", "disease" },
        synergiesWith = { "disease", "frost" },
    },
    -- Vitality: +x% Energy regeneration (Rogue/Druid)
    ["Vitality"] = {
        tags         = { "resource", "melee" },
        synergiesWith = { "melee" },
    },
    -- Unbridled Fury: +x% Rage generation (Warrior/Feral Druid)
    ["Unbridled Fury"] = {
        tags         = { "resource", "melee", "physical" },
        synergiesWith = { "melee", "physical" },
    },
    -- Runic Empowerment: +x% Runic Power generation (DK)
    ["Runic Empowerment"] = {
        tags         = { "resource", "melee" },
        synergiesWith = { "melee" },
    },
    -- Meditative Flow: +x% mana regeneration
    ["Meditative Flow"] = {
        tags         = { "resource", "mp5" },
        synergiesWith = { "mp5", "healing" },
    },
    -- Stored Momentum: resources spent stored → next ability deals bonus damage
    ["Stored Momentum"] = {
        tags         = { "resource", "damage", "proc" },
        synergiesWith = { "resource", "damage" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- UNIVERSAL DAMAGE MECHANICS
    -- ══════════════════════════════════════════════════════════════════════════
    -- First Strike: out of combat → 100% dmg/heal, persists 3s in combat
    ["First Strike"] = {
        tags         = { "damage", "healing" },
        synergiesWith = { "damage", "crit" },
    },
    -- Focused Assault: 4 hits in 5s → 15% dmg increase for 8s per target
    ["Focused Assault"] = {
        tags         = { "damage", "stack" },
        synergiesWith = { "damage", "stack" },
    },
    -- Chaotic Convergence: chance to unleash random class offensive spell
    ["Chaotic Convergence"] = {
        tags         = { "damage", "proc" },
        synergiesWith = { "damage", "proc" },
    },
    -- The Harvester's Tithe: harvest nearby souls → +1% dmg per stack (max 10%) + heal on kill
    ["The Harvester's Tithe"] = {
        tags         = { "damage", "stack", "healing", "proc" },
        synergiesWith = { "damage", "healing" },
    },
    -- Stone Shatter: first hit on enemy → Fracture; dies while fractured → AOE physical
    ["Stone Shatter"] = {
        tags         = { "physical", "aoe", "proc" },
        synergiesWith = { "physical", "aoe" },
    },
    -- Sanctum Sentries: two guards mark enemies for +10% damage
    ["Sanctum Sentries"] = {
        tags         = { "damage", "proc" },
        synergiesWith = { "damage" },
    },
    -- Grim Resolve: damage scales with missing health (up to +20% at 20% hp)
    ["Grim Resolve"] = {
        tags         = { "damage_bonus", "stamina" },
        synergiesWith = { "damage_bonus", "stamina" },
    },
    -- Peak Condition: above 75% hp → +10% damage
    ["Peak Condition"] = {
        tags         = { "damage" },
        synergiesWith = { "damage" },
    },
    -- Tunnel Vision: same target 6s → +8% damage to that target
    ["Tunnel Vision"] = {
        tags         = { "damage_bonus" },
        synergiesWith = { "damage_bonus" },
    },
    -- Ruthless Exploiter: +20% damage to CC'd enemies
    ["Ruthless Exploiter"] = {
        tags         = { "damage", "proc" },
        synergiesWith = { "damage" },
    },
    -- Rolling Momentum: moving → +2% damage per stack (max 5)
    ["Rolling Momentum"] = {
        tags         = { "damage_bonus", "stack" },
        synergiesWith = { "damage_bonus", "stack" },
    },
    -- Unbroken Focus: no damage taken in 5s → +10% damage
    ["Unbroken Focus"] = {
        tags         = { "damage" },
        synergiesWith = { "damage" },
    },
    -- Glass Canon: +15% damage but -30% max hp
    ["Glass Canon"] = {
        tags         = { "damage" },
        synergiesWith = { "damage" },
    },
    -- Overcharged: +15% damage but +30% damage taken
    ["Overcharged"] = {
        tags         = { "damage" },
        synergiesWith = { "damage" },
    },
    -- Brittle Armor: +10% crit but -30% armor — never for tanks/healers
    ["Brittle Armor"] = {
        tags         = { "crit", "tradeoff_negative" },
        synergiesWith = {},
    },
    -- Drained Reserves: +15% spell damage but -30% max mana
    ["Drained Reserves"] = {
        tags         = { "spellpower", "damage", "damage_bonus" },
        synergiesWith = { "spellpower", "damage_bonus" },
    },
    -- Leadfoot: +10% spell haste but -30% movement speed
    ["Leadfoot"] = {
        tags         = { "haste", "spellpower" },
        synergiesWith = { "haste", "spellpower" },
    },
    -- Grim Resolve duplicate already above
    -- Opening Split: every 20s (and after leaving combat) next ability hits extra enemy
    ["Opening Split"] = {
        tags         = { "aoe", "damage", "proc" },
        synergiesWith = { "aoe", "damage" },
    },
    -- Twin Casting: 35% chance to cast same ability twice
    ["Twin Casting"] = {
        tags         = { "direct", "proc", "damage", "healing" },
        synergiesWith = { "direct", "proc" },
    },
    -- Spellweave: heals → +10% dmg 4s; dmg spells → +10% heal 4s
    -- Requires ACTIVE healing rotation to gain the spell-damage buff.
    -- Useless for any pure DPS spec (goes in ALL_DPS_F below).
    ["Spellweave"] = {
        tags         = { "healing", "damage_bonus" },
        synergiesWith = { "healing", "damage_bonus" },
    },
    -- Heavy Incantations: casts with >2.5s cast time deal +30% damage.
    -- Great for slow-cast specs: Destruction (Chaos Bolt 3s), Fire Mage (Fireball 3s),
    -- Balance Druid (Starfire 3.5s), Affliction/Demo (Shadow Bolt 3s).
    -- "channeled" tag included because channeled spells (Mind Flay 3s, Hurricane 10s) qualify.
    ["Heavy Incantations"] = {
        tags         = { "spellpower", "direct", "damage", "channeled" },
        synergiesWith = { "spellpower", "direct", "channeled" },
    },
    -- Adaptive Power: +1% damage per unique Echo active in build (diversity)
    ["Adaptive Power"] = {
        tags         = { "damage" },
        synergiesWith = { "damage" },
    },
    -- Resonant Build: 3+ different base stat echoes (STR/AGI/INT/SPI/STA) → +15% dmg
    ["Resonant Build"] = {
        tags         = { "strength", "agility", "intellect", "stamina", "spirit" },
        synergiesWith = { "strength", "agility", "intellect", "stamina" },
    },
    -- Call of the Lich King: kills → Soul Fragments → summon Lich King Servants
    ["Call of the Lich King"] = {
        tags         = { "shadow", "proc", "aoe" },
        synergiesWith = { "shadow", "proc" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- PRIMARY STAT BOOSTERS (name-driven; used by Advisor + auto-pick C picks)
    -- ══════════════════════════════════════════════════════════════════════════
    ["Strength Training"] = {
        tags         = { "strength" },
        synergiesWith = { "strength" },
    },
    ["Agility Boost"] = {
        tags         = { "agility" },
        synergiesWith = { "agility" },
    },
    ["Intellect Boost"] = {
        tags         = { "intellect" },
        synergiesWith = { "intellect" },
    },
    ["Stamina Boost"] = {
        tags         = { "stamina" },
        synergiesWith = { "stamina" },
    },
    ["Spirit Boost"] = {
        tags         = { "spirit" },
        synergiesWith = { "spirit" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- DEFENSIVE / TANK
    -- ══════════════════════════════════════════════════════════════════════════
    -- Warded Aegis: every 30s absorb shield
    ["Warded Aegis"] = {
        tags         = { "absorb", "defensive" },
        synergiesWith = { "defensive", "absorb" },
    },
    -- Sanguine Bulwark: absorbs up to 50% incoming damage (reduces healing done -25%)
    ["Sanguine Bulwark"] = {
        tags         = { "absorb", "defensive" },
        synergiesWith = { "defensive", "absorb" },
    },
    -- Fortress Soul: -35% damage taken but -70% damage done (+200% threat)
    ["Fortress Soul"] = {
        tags         = { "defensive" },
        synergiesWith = { "defensive" },
    },
    -- The Last Wall: +50% max hp but -60% healing received
    ["The Last Wall"] = {
        tags         = { "defensive", "stamina" },
        synergiesWith = { "defensive", "stamina" },
    },
    -- Earthen Spike: being hit → earthen spike AOE + armor scaling damage + high threat
    ["Earthen Spike"] = {
        tags         = { "physical", "defensive", "armor", "aoe", "proc" },
        synergiesWith = { "armor", "physical", "defensive" },
    },
    -- Reactive Retaliation: dodge/parry → physical AOE scales with Stamina
    ["Reactive Retaliation"] = {
        tags         = { "physical", "defensive", "stamina", "dodge", "parry", "proc", "aoe" },
        synergiesWith = { "defensive", "physical", "stamina", "dodge", "parry" },
    },
    -- Hardened Skin: flat armor increase
    ["Hardened Skin"] = {
        tags         = { "armor", "defensive" },
        synergiesWith = { "armor", "defensive" },
    },
    -- Hardened Resolve: flat damage reduction
    ["Hardened Resolve"] = {
        tags         = { "defense", "defensive" },
        synergiesWith = { "defense", "defensive" },
    },
    -- Earthen Stability: stand still → armor buff
    ["Earthen Stability"] = {
        tags         = { "armor", "defensive" },
        synergiesWith = { "armor", "defensive" },
    },
    -- Reinforced Shielding: block value
    ["Reinforced Shielding"] = {
        tags         = { "block_stat", "defensive" },
        synergiesWith = { "block_stat", "defensive" },
    },
    -- (Tempest Vortex, Spiteful Thorns, Frost Bite defined earlier in Nature section)
    -- Forged in Combat: combat → armor + block
    ["Forged in Combat"] = {
        tags         = { "armor", "block_stat", "defensive" },
        synergiesWith = { "armor", "block_stat", "defensive" },
    },
    -- Safeguarded Gear: stamina + armor
    ["Safeguarded Gear"] = {
        tags         = { "stamina", "armor", "defensive" },
        synergiesWith = { "stamina", "armor" },
    },
    -- Stoneskin Threads: armor + damage reduction
    ["Stoneskin Threads"] = {
        tags         = { "armor", "defense", "defensive" },
        synergiesWith = { "armor", "defense" },
    },
    -- (Crypt Lord's Swarm, Broodmother's Webbing defined earlier in Nature section)
    -- Harpoon Barrage: every 8s pulls up to 5 far enemies → pinned + 15% dmg taken
    ["Harpoon Barrage"] = {
        tags         = { "defensive", "aoe" },
        synergiesWith = { "defensive", "aoe" },
    },
    -- Demonic Awakening: below 35% hp → 8s demon form 30% dmg, 15% leech, cleave
    ["Demonic Awakening"] = {
        tags         = { "melee", "defensive", "healing", "damage" },
        synergiesWith = { "melee", "defensive" },
    },
    -- Reaper's Reprieve: fatal damage → survive at 1 hp + 3s immunity + 35% hp heal
    ["Reaper's Reprieve"] = {
        tags         = { "defensive", "healing", "proc" },
        synergiesWith = { "defensive" },
    },
    -- Frostguard Carapace: below 50% hp → -15% damage taken 6s (45s ICD)
    ["Frostguard Carapace"] = {
        tags         = { "frost", "defensive", "absorb" },
        synergiesWith = { "defensive", "absorb" },
    },
    -- Pain Drive: being struck → +20% movement speed 5s
    ["Pain Drive"] = {
        tags         = { "defensive" },
        synergiesWith = { "defensive" },
    },
    -- Earthen Snap: first hit entering combat → root for 1.5s
    ["Earthen Snap"] = {
        tags         = { "defensive", "proc" },
        synergiesWith = { "defensive" },
    },
    -- Spell Harmony: drop below 30% hp → random HoT from another class (30s ICD)
    ["Spell Harmony"] = {
        tags         = { "defensive", "healing", "proc" },
        synergiesWith = { "defensive", "healing" },
    },
    -- Bolstered Vitality: flat max health increase
    ["Bolstered Vitality"] = {
        tags         = { "stamina", "defensive" },
        synergiesWith = { "defensive", "stamina" },
    },
    -- Desperate Escape: below 25% hp → greatly increased movement speed (2min ICD)
    ["Desperate Escape"] = {
        tags         = { "defensive", "proc" },
        synergiesWith = { "defensive" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- HEALING EPICS / RARES
    -- ══════════════════════════════════════════════════════════════════════════
    -- Healing Echo: direct heals → 5% chance to leave HoT for 3s
    ["Healing Echo"] = {
        tags         = { "healing", "hot", "proc" },
        synergiesWith = { "healing", "hot" },
    },
    -- Purifying Touch: direct heals also dispel one magic debuff
    ["Purifying Touch"] = {
        tags         = { "healing", "proc" },
        synergiesWith = { "healing" },
    },
    -- Eonar's Seed: overheal → stored as seed → blooms when target <50% hp
    ["Eonar's Seed"] = {
        tags         = { "healing", "absorb", "hot", "proc" },
        synergiesWith = { "healing" },
    },
    -- Inspiring Mending: direct heals → 10% chance to grant ally 3% all attributes 15s
    ["Inspiring Mending"] = {
        tags         = { "healing", "proc" },
        synergiesWith = { "healing" },
    },
    -- Lingering Inspiration: periodic heals → 5% chance to grant ally 1% all attributes 15s
    ["Lingering Inspiration"] = {
        tags         = { "healing", "hot", "proc" },
        synergiesWith = { "healing", "hot" },
    },
    -- Champion's Rally: direct heals → Rally stacks → big heal + Rallying Cry defensive
    ["Champion's Rally"] = {
        tags         = { "healing", "defensive", "stack", "proc" },
        synergiesWith = { "healing", "defensive" },
    },
    -- Overwhelming Restoration: +30% healing but spells cost 500% more mana
    ["Overwhelming Restoration"] = {
        tags         = { "healing" },
        synergiesWith = { "healing" },
    },
    -- Healing Cadence: each different healing spell stacks +3% healing
    ["Healing Cadence"] = {
        tags         = { "healing", "stack" },
        synergiesWith = { "healing", "stack" },
    },
    -- Mana Infusion: above 80% mana → mana restore also restores health 50%
    -- Passive self-sustain for casters via MP5/spirit ticks; does NOT require casting heals.
    -- Useful for Caster DPS and Healer (any mana-based spec). NOT useful for melee/tank/ranged.
    ["Mana Infusion"] = {
        tags         = { "mana", "mp5", "healing" },
        synergiesWith = { "mana", "mp5" },
    },
    -- Crusader's Surge: chance to make next Holy Paladin healing spell instant
    ["Crusader's Surge"] = {
        tags         = { "holy", "healing", "proc" },
        synergiesWith = { "holy", "healing" },
    },
    -- Divine Surge: chance to make next Priest healing/dmg spell instant
    ["Divine Surge"] = {
        tags         = { "holy", "healing", "proc" },
        synergiesWith = { "holy", "healing" },
    },
    -- Storm Surge: chance to make next Shaman heal/lightning spell instant
    ["Storm Surge"] = {
        tags         = { "nature", "lightning", "healing", "proc" },
        synergiesWith = { "nature", "lightning", "healing" },
    },
    -- Fel Surge: chance to make next Warlock spell instant
    ["Fel Surge"] = {
        tags         = { "shadow", "fire", "proc" },
        synergiesWith = { "shadow", "fire" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- PET SYNERGY
    -- ══════════════════════════════════════════════════════════════════════════
    -- Vital Bond: increases pets' Stamina based on your Stamina
    ["Vital Bond"] = {
        tags         = { "pet", "stamina" },
        synergiesWith = { "pet", "stamina" },
    },
    -- Ferocious Bond: increases pets' Attack Power based on your AP
    ["Ferocious Bond"] = {
        tags         = { "pet", "attackpower", "physical" },
        synergiesWith = { "pet", "attackpower" },
    },
    -- Arcane Bond: increases pets' Spell Power by % of caster's SP.
    -- Available to: PRIEST, SHAMAN, MAGE, WARLOCK (classMask 464).
    -- Useful only for specs with a SPELL-CASTING pet (SP-scaling):
    --   Warlock (all specs: Imp/Voidwalker/Felguard/etc.) ✓
    --   Frost Mage (Water Elemental: Waterbolt scales with Mage SP) ✓
    --   Shadow Priest (Shadowfiend scales with SP) ✓
    --   Elemental Shaman (Fire Elemental scales with SP) ✓
    -- Useless: Fire/Arcane Mage (no persistent SP pet), Disc/Holy Priest,
    --           Enhancement Shaman (Feral Spirits scale with AP), Resto Shaman.
    ["Arcane Bond"] = {
        tags         = { "pet", "spellpower" },
        synergiesWith = { "pet", "spellpower" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- UNIQUE UTILITY / SPECIAL
    -- ══════════════════════════════════════════════════════════════════════════
    -- Weapon Mastery: equip all weapon types
    ["Weapon Mastery"] = {
        tags         = { "physical", "melee", "ranged" },
        synergiesWith = { "physical", "melee" },
    },
    -- Armor Mastery: equip all armor types
    ["Armor Mastery"] = {
        tags         = { "armor", "defensive" },
        synergiesWith = { "armor", "defensive" },
    },
    -- Ambidexterity: enables dual wielding
    ["Ambidexterity"] = {
        tags         = { "physical", "melee" },
        synergiesWith = { "physical", "melee" },
    },
    -- Titan's Grip: two-handed weapon in one hand
    ["Titan's Grip"] = {
        tags         = { "physical", "melee", "strength" },
        synergiesWith = { "physical", "melee", "strength" },
    },
    -- Double Tap: Auto Shot has % chance to fire additional shot (Hunter-only)
    ["Double Tap"] = {
        tags         = { "ranged", "physical", "proc" },
        synergiesWith = { "ranged", "physical" },
    },
    -- Bola Shot: Auto Shot slows target 30% for 3s (Hunter utility)
    ["Bola Shot"] = {
        tags         = { "ranged", "physical", "slow" },
        synergiesWith = { "ranged", "physical" },
    },
    -- Crippling Strikes: melee attacks slow enemies 30% for 3s (melee utility)
    ["Crippling Strikes"] = {
        tags         = { "melee", "physical", "slow" },
        synergiesWith = { "melee", "physical" },
    },
    -- Efficient Casting: reduces mana cost of all spells by %
    ["Efficient Casting"] = {
        tags         = { "mana", "spellpower" },
        synergiesWith = { "mana" },
    },
    -- Steady Casting: reduces spell pushback while taking damage (caster/healer utility)
    ["Steady Casting"] = {
        tags         = { "spellpower", "channeled" },
        synergiesWith = { "spellpower", "channeled" },
    },
    -- Steady Channeling: mana regen continues while casting (caster/healer utility)
    ["Steady Channeling"] = {
        tags         = { "mana", "spellpower" },
        synergiesWith = { "mana", "spellpower" },
    },
    -- Spellweave: defined above in FIRE/SCHOOL section with correct hybrid tags
    -- Mana Infusion: defined in the Caster section above with correct mana/mp5 tags
    -- Blood Mirror: when you receive a direct heal, deal 15% shadow dmg to nearby enemy (Tank)
    ["Blood Mirror"] = {
        tags         = { "shadow", "defensive", "healing" },
        synergiesWith = { "shadow", "defensive" },
    },
    -- (Entropic Fusion, Shattered Sky, Shadow Malice, Reap the Weak, Unstable Missiles,
    --  Drained Reserves, Ferocious Bond, Call of the Lich King, Edict of the Iron Council,
    --  Perfect Timing, Grim Resolve, Rolling Momentum, Tunnel Vision, Battle Tempo,
    --  Essence Tap, Creeping Decay, Mutagenic Fumes, Immolation Aura, Static Overflow
    --  are all defined earlier in the file)
    -- Toxic Phials: every 3s hurls poison pool AOE
    ["Toxic Phials"] = {
        tags         = { "poison", "aoe", "dot" },
        synergiesWith = { "poison", "dot" },
    },
    -- Hungering Curse: every 2s afflicts nearby enemy with shadow siphon dot + heal on kill
    ["Hungering Curse"] = {
        tags         = { "shadow", "dot", "healing", "proc", "aoe" },
        synergiesWith = { "shadow", "dot", "healing" },
    },
    -- Unstable Missiles: direct spells → chance arcane missile proc
    ["Unstable Missiles"] = {
        tags         = { "arcane", "direct", "proc" },
        synergiesWith = { "arcane", "direct" },
    },

    -- ══════════════════════════════════════════════════════════════════════════
    -- CREATURE-TYPE CONDITIONAL (Bane / Slayer)
    --
    -- These echoes give a STAT BONUS that is ONLY active while fighting a
    -- specific creature type (Undead, Elemental, Beast, etc.).
    -- The "conditional_vs_type" tag triggers a 0.6x score penalty in
    -- EchoAnalyzer to reflect their situational nature (~50-60% uptime
    -- in mixed content).  In specific content they can be top-tier:
    --   Undead Bane/Slayer → excellent in ICC (heavy Undead)
    --   Elemental Bane/Slayer → excellent in Ulduar (heavy Elemental/Mechanical)
    --   Beast Bane/Slayer → excellent in ToC (heavy Beasts first half)
    -- ══════════════════════════════════════════════════════════════════════════

    -- Bane: "+X spell power when fighting [creature type]"  (Caster DPS only)
    ["Beast Bane"]       = { tags = { "spellpower", "damage", "conditional_vs_type" }, synergiesWith = { "spellpower" } },
    ["Dragonkin Bane"]   = { tags = { "spellpower", "damage", "conditional_vs_type" }, synergiesWith = { "spellpower" } },
    ["Demon Bane"]       = { tags = { "spellpower", "damage", "conditional_vs_type" }, synergiesWith = { "spellpower" } },
    ["Elemental Bane"]   = { tags = { "spellpower", "damage", "conditional_vs_type" }, synergiesWith = { "spellpower" } },
    ["Giant Bane"]       = { tags = { "spellpower", "damage", "conditional_vs_type" }, synergiesWith = { "spellpower" } },
    ["Undead Bane"]      = { tags = { "spellpower", "damage", "conditional_vs_type" }, synergiesWith = { "spellpower" } },
    ["Mechanical Bane"]  = { tags = { "spellpower", "damage", "conditional_vs_type" }, synergiesWith = { "spellpower" } },

    -- Slayer: "+X attack power when fighting [creature type]"  (Melee/Ranged DPS)
    ["Beast Slayer"]     = { tags = { "attackpower", "physical", "damage", "conditional_vs_type" }, synergiesWith = { "attackpower" } },
    ["Dragon Slayer"]    = { tags = { "attackpower", "physical", "damage", "conditional_vs_type" }, synergiesWith = { "attackpower" } },
    ["Demon Slayer"]     = { tags = { "attackpower", "physical", "damage", "conditional_vs_type" }, synergiesWith = { "attackpower" } },
    ["Elemental Slayer"] = { tags = { "attackpower", "physical", "damage", "conditional_vs_type" }, synergiesWith = { "attackpower" } },
    ["Giant Slayer"]     = { tags = { "attackpower", "physical", "damage", "conditional_vs_type" }, synergiesWith = { "attackpower" } },
    ["Undead Slayer"]    = { tags = { "attackpower", "physical", "damage", "conditional_vs_type" }, synergiesWith = { "attackpower" } },
    ["Machine Slayer"]   = { tags = { "attackpower", "physical", "damage", "conditional_vs_type" }, synergiesWith = { "attackpower" } },

    -- ── NEW / BRAND-NEW ECHOES (not in original dump — best-guess tags from names) ──
    -- These will be refined once descriptions are available from the game client.

    -- Blade Tempest: likely melee/ranged AoE (whirlwind variant)
    ["Blade Tempest"]   = { tags = { "physical", "melee", "aoe" }, synergiesWith = { "physical", "melee", "aoe" } },
    -- Conjured Flame: fire-based conjured effect (likely Mage)
    ["Conjured Flame"]  = { tags = { "fire", "proc" }, synergiesWith = { "fire" } },
    -- Cyclone of Cold Bones: frost + undead theme (likely DK AoE)
    ["Cyclone of Cold Bones"] = { tags = { "frost", "aoe", "shadow" }, synergiesWith = { "frost", "aoe" } },
    -- Dark Nucleus: shadow orbital/proc effect
    ["Dark Nucleus"]    = { tags = { "shadow", "proc" }, synergiesWith = { "shadow" } },
    -- Defile: DK ability — spreading necrotic zone, shadow/death
    ["Defile"]          = { tags = { "shadow", "aoe", "stack", "dot" }, synergiesWith = { "shadow", "stack", "aoe" } },
    -- Deathwhisper's Barrier: defensive shield (Healer or Tank)
    ["Deathwhisper's Barrier"] = { tags = { "shadow", "defensive", "absorb" }, synergiesWith = { "shadow", "defensive" } },
    -- Emerald Vigor: nature healing vigor (likely Druid / Healer)
    ["Emerald Vigor"]   = { tags = { "nature", "healing", "hot" }, synergiesWith = { "nature", "healing", "hot" } },
    -- Flame Beacon: fire AoE marker / beacon
    ["Flame Beacon"]    = { tags = { "fire", "aoe", "proc" }, synergiesWith = { "fire", "aoe" } },
    -- Frostmourne Hungers: DK — Frostmourne empowerment (frost + shadow)
    ["Frostmourne Hungers"] = { tags = { "frost", "shadow", "melee", "damage_bonus" }, synergiesWith = { "frost", "shadow", "melee" } },
    -- Gunship Barrage: ranged AoE cannonball volley
    ["Gunship Barrage"] = { tags = { "ranged", "aoe", "fire" }, synergiesWith = { "ranged", "aoe" } },
    -- Inhaled Blight: nature/poison inhale — proc/dot effect
    ["Inhaled Blight"]  = { tags = { "nature", "poison", "dot", "proc" }, synergiesWith = { "nature", "poison", "dot" } },
    -- Malleable Goo: slowing nature/ooze effect (AoE)
    ["Malleable Goo"]   = { tags = { "nature", "slow", "aoe" }, synergiesWith = { "nature", "slow" } },
    -- Necrotic Plague: shadow/disease stacking DoT
    ["Necrotic Plague"] = { tags = { "shadow", "disease", "dot", "stack" }, synergiesWith = { "shadow", "disease", "dot" } },
    -- Permeating Chill: frost slowing aura / frost dot
    ["Permeating Chill"] = { tags = { "frost", "slow", "dot" }, synergiesWith = { "frost", "slow" } },
    -- Scent of Blood: physical/bleed proc (likely DK/Warrior)
    ["Scent of Blood"]  = { tags = { "physical", "bleed", "proc", "resource" }, synergiesWith = { "physical", "bleed" } },
    -- Shock Vortex: lightning/nature AoE vortex
    ["Shock Vortex"]    = { tags = { "nature", "lightning", "aoe" }, synergiesWith = { "nature", "lightning", "aoe" } },
    -- Slime Spray: nature/poison cone AoE
    ["Slime Spray"]     = { tags = { "nature", "poison", "aoe" }, synergiesWith = { "nature", "poison", "aoe" } },
    -- Sundered Formation: physical armor debuff / AoE sunder
    ["Sundered Formation"] = { tags = { "physical", "melee", "aoe", "debuff" }, synergiesWith = { "physical", "melee" } },
    -- Sundered Will: fear/CC duration reduction (Tank utility)
    ["Sundered Will"]   = { tags = { "defensive" }, synergiesWith = { "defensive" } },
    -- Twilight Combustion: fire + shadow hybrid detonation
    ["Twilight Combustion"] = { tags = { "fire", "shadow", "aoe", "proc" }, synergiesWith = { "fire", "shadow", "aoe" } },
    -- Emerald Vigor, Flame Beacon, etc. covered above
    -- (Frostguard Carapace defined earlier in Tank section)
    -- Warded Aegis: every 30s gain absorb shield — Survivability
    ["Warded Aegis"]    = { tags = { "defensive", "absorb" }, synergiesWith = { "defensive", "absorb" } },
    -- Warm-Blooded: health regen every 3s — Survivability
    ["Warm-Blooded"]    = { tags = { "healing" }, synergiesWith = {} },
}

-- ── Spec profiles ────────────────────────────────────────────────────────────
-- Indexed by class token → array[specIndex] matching SpecData.lua order.
-- specIndex 1/2/3 = first/second/third talent tree.
--
-- preferredFamilies: PerkDatabase family tags this spec values
-- preferredTags:     mechanic/school tags this spec values
-- preferredStats:    character stats this spec scales with
--
-- Stat tokens (matched via KEYWORD_ENTRIES in EchoAnalyzer.lua):
--   Primary:      strength  agility  intellect  stamina  spirit
--   Offensive:    spellpower  attackpower  haste  crit  arpen  hit  expertise  spellpen
--   Bonuses:      damage_bonus  healing_bonus  absorb  dot_damage  aoe_damage  cooldown
--   Resources:    mana  mp5  energy  rage  runicpower
--   Pet:          pet
--   Proc/Stack:   proc  stack
--   Defensive:    dodge  parry  defense  block_stat  armor
--   Utility:      movespeed  resilience
--   Schools:      physical  holy  fire  frost  nature  shadow  arcane  lightning
--   Mechanics:    bleed  poison  disease

EbonholdHub.SynergyData.SpecProfiles = {

    -- ════════════════════════════════════════════════════════════════════════
    -- preferredStats: dict { statId = weight } where weight is 1-10.
    -- 10 = essential primary stat, 1 = minimal benefit.
    -- Weights feed the EchoAnalyzer scorer; higher weight → echo scores more.
    -- ════════════════════════════════════════════════════════════════════════

    WARRIOR = {
        [1] = { -- Arms
            specName          = "Arms",
            preferredFamilies = { "Melee" },
            preferredTags     = { "physical", "melee", "bleed", "crit", "damage", "direct", "cooldown_reduction" },
            preferredStats    = { strength=10, crit=9, arpen=8, hit=7, expertise=6, haste=4, damage_bonus=7, dot_damage=5, rage=3, proc=4, cooldown=3 },
        },
        [2] = { -- Fury
            specName          = "Fury",
            preferredFamilies = { "Melee" },
            preferredTags     = { "physical", "melee", "crit", "proc", "damage", "direct", "haste" },
            preferredStats    = { strength=10, crit=9, haste=8, arpen=7, hit=6, expertise=5, damage_bonus=7, proc=6, rage=4, aoe_damage=3 },
        },
        [3] = { -- Protection
            specName          = "Protection",
            preferredFamilies = { "Tank" },
            preferredTags     = { "physical", "defensive", "absorb", "aoe", "damage", "cooldown_reduction" },
            preferredStats    = { stamina=10, defense=10, armor=9, expertise=8, dodge=7, parry=6, block_stat=5, strength=4, absorb=8, cooldown=6, rage=4 },
        },
    },

    -- ════════════════════════════════════════════════════════════════════════
    PALADIN = {
        [1] = { -- Holy
            specName          = "Holy",
            preferredFamilies = { "Healer" },
            preferredTags     = { "holy", "healing", "hot", "absorb", "direct", "proc" },
            preferredStats    = { intellect=10, haste=8, spellpower=7, crit=6, spirit=4, mp5=2, healing_bonus=9, absorb=5, mana=6, cooldown=4 },
        },
        [2] = { -- Protection
            specName          = "Protection",
            preferredFamilies = { "Tank" },
            preferredTags     = { "holy", "physical", "defensive", "absorb", "aoe" },
            preferredStats    = { stamina=10, defense=10, armor=9, expertise=8, dodge=7, parry=6, block_stat=5, strength=4, spellpower=3, absorb=9, cooldown=7 },
        },
        [3] = { -- Retribution
            specName          = "Retribution",
            preferredFamilies = { "Melee" },
            preferredTags     = { "holy", "physical", "melee", "crit", "damage", "proc", "aoe", "direct" },
            preferredStats    = { strength=10, crit=8, haste=7, expertise=7, hit=6, arpen=4, damage_bonus=8, proc=6, aoe_damage=4, cooldown=4 },
        },
    },

    -- ════════════════════════════════════════════════════════════════════════
    HUNTER = {
        [1] = { -- Beast Mastery
            specName          = "Beast Mastery",
            preferredFamilies = { "Ranged" },
            preferredTags     = { "physical", "ranged", "beast", "proc", "crit", "nature", "damage" },
            preferredStats    = { agility=10, crit=8, hit=7, haste=6, attackpower=5, pet=10, damage_bonus=6, proc=5, cooldown=5 },
        },
        [2] = { -- Marksmanship
            specName          = "Marksmanship",
            preferredFamilies = { "Ranged" },
            preferredTags     = { "physical", "ranged", "crit", "damage", "direct", "proc" },
            preferredStats    = { agility=10, crit=9, arpen=8, hit=7, haste=5, attackpower=4, damage_bonus=7, proc=4, cooldown=5 },
        },
        [3] = { -- Survival
            specName          = "Survival",
            preferredFamilies = { "Ranged" },
            preferredTags     = { "physical", "ranged", "nature", "fire", "trap", "dot", "proc", "poison" },
            preferredStats    = { agility=10, crit=9, haste=7, hit=7, attackpower=5, dot_damage=8, damage_bonus=6, proc=7 },
        },
    },

    -- ════════════════════════════════════════════════════════════════════════
    ROGUE = {
        [1] = { -- Assassination
            specName          = "Assassination",
            preferredFamilies = { "Melee" },
            preferredTags     = { "physical", "melee", "poison", "dot", "crit", "proc", "damage" },
            preferredStats    = { agility=10, crit=9, haste=7, hit=7, expertise=6, energy=8, dot_damage=8, damage_bonus=6, proc=6, cooldown=4 },
        },
        [2] = { -- Combat
            specName          = "Combat",
            preferredFamilies = { "Melee" },
            preferredTags     = { "physical", "melee", "crit", "damage", "proc", "direct" },
            preferredStats    = { agility=10, arpen=9, crit=8, hit=7, expertise=6, haste=5, energy=7, damage_bonus=6, proc=5 },
        },
        [3] = { -- Subtlety
            specName          = "Subtlety",
            preferredFamilies = { "Melee" },
            preferredTags     = { "physical", "melee", "shadow", "crit", "bleed", "proc", "direct", "cooldown_reduction" },
            preferredStats    = { agility=10, crit=9, hit=7, expertise=7, haste=5, energy=8, dot_damage=6, damage_bonus=6, proc=5, cooldown=5 },
        },
    },

    -- ════════════════════════════════════════════════════════════════════════
    PRIEST = {
        [1] = { -- Discipline
            specName          = "Discipline",
            preferredFamilies = { "Healer" },
            preferredTags     = { "holy", "healing", "absorb", "shield", "proc", "direct" },
            preferredStats    = { spellpower=10, intellect=9, crit=8, haste=7, spirit=6, mp5=2, absorb=10, healing_bonus=8, mana=5, cooldown=5 },
        },
        [2] = { -- Holy
            specName          = "Holy",
            preferredFamilies = { "Healer" },
            preferredTags     = { "holy", "healing", "hot", "direct", "proc", "aoe" },
            preferredStats    = { spellpower=10, spirit=9, intellect=8, haste=7, crit=5, mp5=2, healing_bonus=9, mana=5, aoe_damage=3, cooldown=4 },
        },
        [3] = { -- Shadow
            specName          = "Shadow",
            preferredFamilies = { "Caster" },
            -- shadow: SW:Pain, Mind Blast, VT, DP; dot: all DoTs; aoe: Mind Sear;
            -- stack: Shadow Weaving / Misery debuff stacking; channeled: Mind Flay / Mind Sear
            preferredTags     = { "shadow", "dot", "damage", "proc", "crit", "channeled", "aoe", "stack" },
            preferredStats    = { spellpower=10, hit=9, crit=8, haste=7, intellect=4, dot_damage=8, damage_bonus=6, proc=5, cooldown=4, aoe_damage=3 },
        },
    },

    -- ════════════════════════════════════════════════════════════════════════
    DEATHKNIGHT = {
        [1] = { -- Blood (Tank)
            specName          = "Blood",
            preferredFamilies = { "Melee", "Tank" },
            preferredTags     = { "shadow", "physical", "melee", "bleed", "disease", "healing", "damage", "defensive" },
            preferredStats    = { stamina=10, defense=9, armor=8, expertise=8, parry=7, dodge=5, strength=6, absorb=7, runicpower=6, healing_bonus=5, cooldown=5 },
        },
        [2] = { -- Frost DPS
            specName          = "Frost",
            preferredFamilies = { "Melee" },
            preferredTags     = { "frost", "physical", "melee", "crit", "proc", "damage", "disease", "cooldown_reduction" },
            preferredStats    = { strength=10, crit=9, haste=7, arpen=7, hit=6, expertise=6, runicpower=7, damage_bonus=6, proc=6, dot_damage=5, cooldown=4 },
        },
        [3] = { -- Unholy
            specName          = "Unholy",
            preferredFamilies = { "Melee" },
            preferredTags     = { "shadow", "disease", "dot", "physical", "melee", "proc", "damage", "aoe", "cooldown_reduction" },
            preferredStats    = { strength=10, haste=9, crit=7, hit=6, expertise=6, arpen=4, runicpower=7, pet=7, dot_damage=8, damage_bonus=5, aoe_damage=5, cooldown=4 },
        },
    },

    -- ════════════════════════════════════════════════════════════════════════
    SHAMAN = {
        [1] = { -- Elemental
            specName          = "Elemental",
            preferredFamilies = { "Caster" },
            preferredTags     = { "nature", "lightning", "fire", "crit", "damage", "proc", "aoe", "direct" },
            preferredStats    = { spellpower=10, hit=9, haste=8, crit=7, intellect=5, damage_bonus=7, aoe_damage=6, proc=5, cooldown=4 },
        },
        [2] = { -- Enhancement
            specName          = "Enhancement",
            preferredFamilies = { "Melee" },
            preferredTags     = { "nature", "lightning", "physical", "melee", "proc", "crit", "damage", "direct" },
            preferredStats    = { agility=10, haste=8, crit=8, hit=7, expertise=7, strength=5, damage_bonus=6, proc=7, stack=5, cooldown=4 },
        },
        [3] = { -- Restoration
            specName          = "Restoration",
            preferredFamilies = { "Healer" },
            preferredTags     = { "nature", "healing", "hot", "proc", "aoe", "direct" },
            preferredStats    = { spellpower=10, intellect=9, haste=8, crit=7, spirit=6, mp5=3, healing_bonus=9, mana=5, aoe_damage=3, cooldown=4 },
        },
    },

    -- ════════════════════════════════════════════════════════════════════════
    MAGE = {
        [1] = { -- Arcane
            specName          = "Arcane",
            preferredFamilies = { "Caster" },
            preferredTags     = { "arcane", "damage", "stack", "crit", "proc", "direct", "channeled", "cooldown_reduction" },
            preferredStats    = { spellpower=10, hit=9, haste=8, crit=6, intellect=6, damage_bonus=7, mana=7, stack=6, cooldown=5, proc=4 },
        },
        [2] = { -- Fire
            specName          = "Fire",
            preferredFamilies = { "Caster" },
            preferredTags     = { "fire", "crit", "damage", "dot", "proc", "aoe", "direct", "cooldown_reduction" },
            preferredStats    = { spellpower=10, crit=9, hit=8, haste=6, intellect=4, damage_bonus=8, dot_damage=7, aoe_damage=6, proc=7, cooldown=5 },
        },
        [3] = { -- Frost
            specName          = "Frost",
            preferredFamilies = { "Caster" },
            preferredTags     = { "frost", "damage", "slow", "proc", "crit", "direct", "aoe", "cooldown_reduction" },
            preferredStats    = { spellpower=10, haste=9, hit=8, crit=6, intellect=4, damage_bonus=7, proc=7, aoe_damage=5, cooldown=5 },
        },
    },

    -- ════════════════════════════════════════════════════════════════════════
    WARLOCK = {
        [1] = { -- Affliction
            specName          = "Affliction",
            preferredFamilies = { "Caster" },
            -- Removed "hot" — Affliction never casts healing spells; "hot" tag caused
            -- healing echoes (Healing Echo, Burning Flames, etc.) to score higher than intended.
            preferredTags     = { "shadow", "dot", "damage", "proc", "drain", "stack", "cooldown_reduction" },
            preferredStats    = { spellpower=10, hit=9, haste=8, spirit=7, crit=5, intellect=4, dot_damage=10, damage_bonus=6, stack=7, mana=4, cooldown=4 },
        },
        [2] = { -- Demonology
            specName          = "Demonology",
            -- Demon form (Metamorphosis): melee-style attacks scaling with SP; permanent pet (Felguard)
            preferredFamilies = { "Caster", "Pet" },
            -- physical: Meta melee attacks; pet: Felguard AP/SP scaling; stack: Demonic Pact stacks
            preferredTags     = { "shadow", "fire", "damage", "proc", "crit", "physical", "pet", "stack" },
            preferredStats    = { spellpower=10, hit=9, haste=8, crit=6, intellect=5, pet=9, damage_bonus=7, proc=5, mana=4, stack=4 },
        },
        [3] = { -- Destruction
            specName          = "Destruction",
            preferredFamilies = { "Caster" },
            preferredTags     = { "fire", "shadow", "crit", "damage", "direct", "proc", "dot" },
            preferredStats    = { spellpower=10, crit=9, hit=8, haste=6, intellect=4, damage_bonus=8, dot_damage=5, proc=6, cooldown=5 },
        },
    },

    -- ════════════════════════════════════════════════════════════════════════
    DRUID = {
        [1] = { -- Balance: Moonkin, Wrath/Starfire, Eclipse procs
            specName          = "Balance",
            preferredFamilies = { "Caster" },
            -- nature: Wrath, Starfall, Moonfire; arcane: Starfire; dot: Moonfire DoT, Insect Swarm;
            -- aoe: Starfall, Hurricane; stack: Eclipse cycling; channeled: Hurricane
            preferredTags     = { "nature", "arcane", "damage", "crit", "proc", "dot", "aoe", "direct", "stack", "channeled" },
            -- SpellPower scales everything; Hit cap; Haste more casts + Moonfire ticks;
            -- Crit for Eclipse procs; Intellect secondary (large mana pool useful);
            -- dot_damage: Moonfire + Insect Swarm are significant; aoe_damage: Starfall/Hurricane
            preferredStats    = { spellpower=10, hit=9, haste=8, crit=7, intellect=5, dot_damage=7, damage_bonus=6, aoe_damage=5, proc=4, cooldown=3 },
        },
        [2] = { -- Feral
            specName          = "Feral",
            preferredFamilies = { "Melee", "Tank" },
            preferredTags     = { "physical", "melee", "bleed", "crit", "damage", "proc", "defensive" },
            preferredStats    = { agility=10, crit=9, arpen=7, hit=6, expertise=6, stamina=5, energy=8, dot_damage=7, damage_bonus=5, absorb=4, cooldown=4 },
        },
        [3] = { -- Restoration
            specName          = "Restoration",
            preferredFamilies = { "Healer" },
            preferredTags     = { "nature", "healing", "hot", "proc", "aoe", "direct" },
            preferredStats    = { spellpower=10, spirit=9, intellect=8, haste=7, crit=5, mp5=2, healing_bonus=9, dot_damage=6, mana=5, aoe_damage=4, cooldown=4 },
        },
    },
}

-- ── Class/spec blacklists (used by ApplyAdvisorTiers) ───────────────────────
--
-- EchoAnalyzer also enforces role/family compatibility for ALL classes:
--   TANK        → Tank, Melee, Survivability families
--   HEAL        → Healer, Caster, Survivability
--   MELEE_DPS   → Melee, Survivability
--   RANGED_DPS  → Ranged, Melee, Survivability  (passive Melee-tagged procs work at range)
--   CASTER_DPS  → Caster, Survivability
-- Echoes whose families don't match the spec archetype are forced to F before scoring.
-- The lists below are additional manual overrides (heal-on-DPS, wrong resource, etc.).
--
-- Echoes listed here are FORCED to F-tier for the matching class/spec,
-- regardless of the analyzer's computed score.
--
-- This is the "AI-curated" tier override: each entry is based on game knowledge:
--   - class armor restrictions (Paladin already wears plate → Armor Mastery = F)
--   - role mechanics (Eonar's Seed only works from overhealing → F for DPS)
--   - class-exclusive spells (Crusader's Surge only procs on Paladin spells)
--   - native dual-wield (Rogues already DW → Ambidexterity = F)
--
-- Keys used in AdvisorView.lua::BuildForcedFSet():
--   ALL_DPS_F          → applied when role == "DPS"
--   ALL_TANK_F         → applied when role == "TANK"
--   ALL_HEAL_F         → applied when role == "HEAL"
--   CASTER_DPS_F       → applied for pure-caster DPS specs (see CASTER_SPECS table)
--   CLASS_EXCLUSIVE    → echo → { "CLASS1", "CLASS2" } only those classes can benefit
--   <CLASS>_ALL_F      → F for every spec of that class
--   <CLASS>_<N>_F      → F for spec N of that class (1/2/3)

EbonholdHub.SynergyData.ClassBlacklists = {

    -- ── Healer-only: F for any DPS or TANK spec ───────────────────────────────
    -- These echoes ONLY trigger when casting healing spells.
    -- A Ret Paladin, Shadow Priest, Arms Warrior, etc. never cast heals in rotation.
    ALL_DPS_F = {
        "Healing Echo",           -- 5% chance on direct heal → HoT (no heals = no procs)
        "Purifying Touch",        -- direct heals dispel magic (no heals = useless)
        "Eonar's Seed",           -- overheal → stored → blooms (DPS never overheal)
        "Inspiring Mending",      -- direct heals → ally attribute buff (no heals)
        "Lingering Inspiration",  -- periodic heals → ally attribute buff (no heals)
        "Champion's Rally",       -- healing stacks → Rallying Cry (no heals to stack)
        "Overwhelming Restoration",-- +30% healing, 500% mana cost (DPS dont heal)
        "Healing Cadence",        -- stack bonus per unique healing spell cast (no heals)
        -- Mana Infusion is NOT in ALL_DPS_F — it passively heals via MP5/spirit ticks
        -- and is useful self-sustain for Caster DPS specs (no active heal casts required)
        "Divine Resonance",       -- direct heal → holy nova burst (no heals = no procs)
        -- Requires active healing rotation to proc — DPS never cast heals
        "Burning Flames",         -- periodic healing erupts fire on nearby enemies (DPS have no HoTs)
        "Spellweave",             -- heal → +10% dmg; dmg → +10% heal (requires healing rotation — DPS never cast heals)
        -- DPS-crippling trade-offs
        "Fortress Soul",          -- -70% damage dealt, +200% threat (kills DPS output)
        "Provoking Presence",     -- generates extra threat (DPS pulling aggro = wipe)
    },

    ALL_TANK_F = {
        "Glass Canon",            -- -30% max HP (tanks get one-shot; lethal)
        "Overcharged",            -- +30% damage taken (tanks get one-shot; lethal)
        "Brittle Armor",          -- -30% armor (tanks lose massive mitigation; lethal)
        "Subtle Presence",        -- reduced threat generation (tanks NEED threat)
    },

    ALL_HEAL_F = {
        "Fortress Soul",          -- -70% damage (healers don't dps)
        "Glass Canon",            -- -30% max HP (healers can't afford to die)
        "Overcharged",            -- +30% damage taken (same)
        "Brittle Armor",          -- -30% armor (same)
        "Subtle Presence",        -- reduced threat (irrelevant for healers)
        "Provoking Presence",     -- increased threat (irrelevant for healers)
        "Sanguine Bulwark",       -- -25% healing done penalty makes this unusable for healers
        "Drained Reserves",       -- -30% max mana devastates healer longevity
    },

    -- ── Melee-only echoes: F for pure caster / ranged specs ──────────────────
    -- These echoes require melee auto-attacks or melee-range physical abilities.
    -- Mage, Warlock, Shadow Priest, Balance Druid, Elemental Shaman never melee.
    CASTER_DPS_F = {
        "Backstabber's Edge",     -- bonus damage from behind/flank (casters don't melee)
        "Sweeping Blows",         -- cleave behind melee swings (casters don't melee)
        "Heavy Blows",            -- +30% weapon damage (physical melee; casters don't melee)
        "Impaler's Tribute",      -- stack melee crits for burst (casters don't melee)
        "Drillmaster's Rebuke",   -- melee crit proc (casters don't melee)
        "Second Edge",            -- secondary melee strike proc (casters don't melee)
        "Exposed Heart",          -- target vulnerability from melee attacks (casters don't melee)
        "Ambidexterity",          -- enables dual-wield (pointless for non-melee)
        "Titan's Grip",           -- equip 2H as 1H (pointless for non-melee casters)
    },

    -- ── Class-exclusive echoes: only the listed classes have the spells to proc them ──
    -- These surges and pet-bond echoes hard-require specific class spells.
    -- A Warrior with "Crusader's Surge" equipped gains zero benefit — it only procs
    -- on Holy Paladin spells (Exorcism, Flash of Light, Holy Light).
    CLASS_EXCLUSIVE = {
        -- Surge echoes: each procs ONLY on that class's specific spells
        ["Crusader's Surge"] = { "PALADIN" },           -- Exorcism / FoL / HL
        ["Divine Surge"]     = { "PRIEST" },            -- Smite / Holy Fire / Mind Blast / heals
        ["Storm Surge"]      = { "SHAMAN" },            -- LB / CL / LvB / Healing Wave / Chain Heal
        ["Arcane Surge"]     = { "MAGE" },              -- Arcane Blast / Fireball / Frostbolt / etc.
        ["Fel Surge"]        = { "WARLOCK" },           -- Shadow Bolt / Chaos Bolt / Haunt / UA / etc.
        ["Nature's Surge"]   = { "DRUID" },             -- Wrath / Starfire / Healing Touch / Regrowth

        -- AP-based pet-bond echoes: scale Attack Power to a permanent pet.
        -- Hunters (beast), Warlocks (Felguard/Voidwalker AP), Unholy DKs (Ghoul AP) benefit.
        ["Ferocious Bond"]         = { "HUNTER", "WARLOCK", "DEATHKNIGHT" },
        ["Vital Bond"]             = { "HUNTER", "WARLOCK", "DEATHKNIGHT" },
        -- Arcane Bond scales PET SPELL POWER based on CASTER SP — NOT AP-based.
        -- Available classes: PRIEST, SHAMAN, MAGE, WARLOCK (classMask 464).
        -- Per-spec exclusions (Fire/Arcane Mage, Disc/Holy Priest, Enh/Resto Shaman)
        -- are handled via spec _F lists below.
        -- Warlock demon-specific echoes
        ["Nether Lord's Command"]  = { "WARLOCK" },
        -- Note: "Edict of the Four" is universal (classMask=1535, all roles) — NOT Warlock-only
    },

    -- ── Hazard/class-ability echoes: only listed classes have the spells they boost ───
    -- These echoes hard-require specific class spells (Fan of Knives, Holy Nova, etc.).
    -- Classes NOT listed get these forced to F-tier by BuildForcedFSet.
    ABILITY_ECHO_CLASSES = {
        -- Hazard echoes: each boosts a named AOE spell unique to one class
        ["Shadow Hazard"] = { "ROGUE" },           -- Fan of Knives (Rogue-only)
        ["Holy Hazard"]   = { "PRIEST" },           -- Holy Nova (Priest-only)
        ["Fel Hazard"]    = { "WARLOCK" },          -- Rain of Fire / Hellfire / Shadowfury
        ["Wild Hazard"]   = { "DRUID" },            -- Hurricane / Starfall / Swipe
        ["Storm Hazard"]  = { "SHAMAN" },           -- Chain Lightning / Thunderstorm
        ["Arcane Hazard"] = { "MAGE" },             -- Arcane Explosion / Blizzard / Flamestrike
        -- Healer-proc echoes requiring active healing rotation
        ["Burning Flames"] = { "PRIEST", "PALADIN", "SHAMAN", "DRUID" }, -- periodic healing → fire (non-healers never cast HoTs in rotation)
    },

    -- Brand echoes amplify direct hits of one damage school only.
    -- Classes not listed cannot proc them (Rogue has no Nature spells → Nature Brand = F).
    -- Per-spec exclusions (e.g. Frost Mage has Frost Brand but Fire Mage does not)
    -- are handled via per-spec _F tables below.
    SCHOOL_BRAND_CLASSES = {
        ["Steel Brand"]  = { "WARRIOR", "ROGUE", "HUNTER", "DEATHKNIGHT", "SHAMAN", "DRUID" },
        ["Nature Brand"] = { "SHAMAN", "DRUID", "HUNTER" },
        ["Frost Brand"]  = { "MAGE", "DEATHKNIGHT" },
        -- Fire Brand: Hunter(Explosive Shot/fire aspects), Shaman(Lava Burst/Fire Nova/Flame Shock),
        -- Mage(Fireball/Flame/Scorch), Warlock(Immolate/Incinerate/Chaos Bolt)
        ["Fire Brand"]   = { "HUNTER", "SHAMAN", "MAGE", "WARLOCK" },
        -- Shadow Brand: Warlocks (all specs shadow/fire), Shadow Priest, Unholy/Blood DK (Death Coil)
        ["Shadow Brand"] = { "WARLOCK", "PRIEST", "DEATHKNIGHT" },
        ["Holy Brand"]   = { "PALADIN", "PRIEST" },
        -- Arcane Brand: Arcane Mage + Balance Druid (Starfire = Arcane school)
        ["Arcane Brand"] = { "MAGE", "DRUID" },
    },

    -- ── WARRIOR ──────────────────────────────────────────────────────────────
    WARRIOR_ALL_F = {
        "Armor Mastery",
        "Nature's Surge", "Storm Surge", "Arcane Surge", "Fel Surge",
        "Crusader's Surge", "Divine Surge",
        -- Wrong resource: Warriors use Rage, not Energy or Runic Power
        "Relentless Energy",  -- requires Energy bar (Rogue/Feral only)
        "Runic Momentum",     -- requires Runic Power (DK only)
        -- Arcane Weapon requires mana resource to stay active; Warriors use Rage → always 0
        "Arcane Weapon",
    },
    WARRIOR_1_F = {  -- Arms: fights with one 2H weapon, no dual-wield
        "Ambidexterity",   -- Arms Warrior does not dual-wield
    },
    WARRIOR_2_F = {  -- Fury: spec already dual-wields two 1H or 2H weapons
        "Ambidexterity",   -- Fury already dual-wields
        "Titan's Grip",    -- WotLK Fury Warriors have Titan's Grip as a talent
    },

    -- ── PALADIN ──────────────────────────────────────────────────────────────
    PALADIN_ALL_F = {
        "Armor Mastery",
        -- Non-Paladin Surge echoes
        "Nature's Surge", "Storm Surge", "Arcane Surge", "Fel Surge", "Divine Surge",
        -- Wrong resource: Paladins use Mana, not Energy/Rage/Runic Power
        "Relentless Energy",  -- requires Energy bar (Rogue/Feral only)
        "Raging Momentum",    -- requires Rage bar (Warrior/Feral Bear only)
        "Runic Momentum",     -- requires Runic Power (DK only)
    },
    PALADIN_1_F = {  -- Holy: dedicated healer, never uses melee abilities
        "Titan's Grip", "Ambidexterity", "Heavy Blows",
        "Backstabber's Edge", "Sweeping Blows", "Second Edge",
        "Exposed Heart", "Impaler's Tribute", "Drillmaster's Rebuke",
    },
    PALADIN_2_F = {  -- Protection tank: same melee blacklist as healer for pure-melee DPS echoes
        "Backstabber's Edge",  -- these are positional DPS echoes, not tank-relevant
        "Exposed Heart",
        "Impaler's Tribute",
        "Titan's Grip",
    },
    PALADIN_3_F = {  -- Retribution DPS: has holy spells but NEVER casts healing spells in DPS rotation
        -- These are NOT covered by ALL_DPS_F because they reference holy tags that score high for Pally
        "Eonar's Seed",           -- overheal only; Ret never intentionally overheals
        "Inspiring Mending",      -- direct-heal proc; Ret doesn't heal
        "Lingering Inspiration",  -- periodic-heal proc; Ret doesn't heal
        "Champion's Rally",       -- healing-stack; Ret doesn't stack heals
        "Overwhelming Restoration",
        "Healing Cadence",
        "Mana Infusion",
        "Divine Resonance",
    },

    -- ── HUNTER ───────────────────────────────────────────────────────────────
    HUNTER_ALL_F = {
        "Ambidexterity",          -- Hunters are ranged; DW melee provides zero benefit
        "Titan's Grip",
        "Backstabber's Edge",
        "Sweeping Blows",
        "Heavy Blows",
        "Impaler's Tribute",
        "Drillmaster's Rebuke",
        "Second Edge",
        "Exposed Heart",
        "Nature's Surge", "Storm Surge", "Arcane Surge", "Fel Surge",
        "Crusader's Surge", "Divine Surge",
        -- Wrong resource: Hunters use Mana in WotLK
        "Relentless Energy", "Raging Momentum", "Runic Momentum",
    },

    -- ── ROGUE ────────────────────────────────────────────────────────────────
    ROGUE_ALL_F = {
        "Ambidexterity", "Titan's Grip", "Armor Mastery",
        "Nature's Surge", "Storm Surge", "Arcane Surge", "Fel Surge",
        "Crusader's Surge", "Divine Surge",
        -- Wrong resource: Rogues use Energy, not Rage or Runic Power
        "Raging Momentum", "Runic Momentum",
        -- Arcane Weapon requires mana to stay active; Rogues use Energy → always 0
        "Arcane Weapon",
    },

    -- ── PRIEST ───────────────────────────────────────────────────────────────
    PRIEST_ALL_F = {
        "Ambidexterity", "Titan's Grip", "Heavy Blows",
        "Backstabber's Edge", "Sweeping Blows", "Second Edge",
        "Exposed Heart", "Impaler's Tribute", "Drillmaster's Rebuke",
        "Nature's Surge", "Storm Surge", "Arcane Surge", "Fel Surge",
        "Crusader's Surge",
        -- Wrong resource: Priests use Mana
        "Relentless Energy", "Raging Momentum", "Runic Momentum",
    },
    PRIEST_1_F = {  -- Discipline: absorb-healer, does not cast shadow damage in rotation
        -- Shadow Brand stacks require regular shadow direct hits; Disc never uses
        -- shadow spells as core rotation (occasional Mind Blast ≠ meaningful stacking).
        "Shadow Brand",
        "Shadow Hazard",  -- Fan of Knives variant; Priests have no FoK
        "Arcane Bond",    -- no combat pet in Disc rotation (Shadowfiend is CD, not permanent pet)
    },
    PRIEST_2_F = {  -- Holy: pure healer, same shadow-damage logic as Discipline
        "Shadow Brand",
        "Shadow Hazard",
        "Arcane Bond",    -- no combat pet in Holy rotation
    },
    PRIEST_3_F = {  -- Shadow: Shadowform restricts Holy casts; Shadow → Shadow damage only
        -- Holy Brand procs ONLY on Holy direct hits. Shadow Priests deal Shadow damage.
        -- Leaving Shadowform to cast Smite/Holy Fire is never part of the Shadow rotation.
        "Holy Brand",
        -- Holy Hazard boosts Holy Nova damage. Shadow Priests cannot cast Holy Nova while
        -- in Shadowform without first dropping the form — never done in a DPS rotation.
        "Holy Hazard",
    },

    -- ── DEATH KNIGHT ─────────────────────────────────────────────────────────
    DEATHKNIGHT_ALL_F = {
        "Armor Mastery",
        "Nature's Surge", "Storm Surge", "Arcane Surge", "Fel Surge",
        "Crusader's Surge", "Divine Surge",
        -- Wrong resource: DKs use Runic Power, not Energy or Rage
        "Relentless Energy", "Raging Momentum",
        -- Arcane Weapon requires mana to stay active; DKs use Runic Power → always 0
        "Arcane Weapon",
    },
    DEATHKNIGHT_2_F = {  -- Frost: WotLK Frost DK primarily dual-wields (two 1H)
        "Ambidexterity",   -- Frost DK with DW build already dual-wields
        -- Frost DK deals Frost damage (Howling Blast, Frost Strike, Obliterate frost portion).
        -- Shadow Brand requires Shadow direct hits — Frost DK has none in rotation.
        "Shadow Brand",
    },

    -- ── SHAMAN ───────────────────────────────────────────────────────────────
    SHAMAN_ALL_F = {
        "Nature's Surge", "Arcane Surge", "Fel Surge",
        "Crusader's Surge", "Divine Surge",
        -- Wrong resource: Shamans use Mana
        "Relentless Energy", "Raging Momentum", "Runic Momentum",
    },
    SHAMAN_1_F = {  -- Elemental: caster DPS, casts Lightning Bolt / Chain Lightning / Lava Burst
        -- Steel Brand requires physical melee hits to stack. Elemental Shaman is a caster
        -- and never melees — Steel Brand cannot proc in this spec.
        "Steel Brand",
    },
    SHAMAN_2_F = {  -- Enhancement: melee with Windfury — no Fire spells in standard rotation
        "Ambidexterity",   -- Enhancement Shaman already dual-wields
        -- Fire Brand requires Fire direct hits. Enhancement uses Flame Shock but its damage
        -- is Physical/Lightning (Windfury, Stormstrike, Lava Lash) — Fire proc share is minimal.
        "Fire Brand",
        -- Arcane Bond scales pet SP. Enhancement's Feral Spirits scale with AP, not SP.
        "Arcane Bond",
    },
    SHAMAN_3_F = {  -- Restoration: healer — no persistent SP-scaling pet in Resto rotation
        "Fire Brand",
        "Arcane Bond",
    },

    -- ── DRUID ────────────────────────────────────────────────────────────────
    DRUID_2_F = {  -- Feral: Bear (Rage) and Cat (Energy) form — never cast from mana bar
        -- Feral Druids in Bear form get ~370% armor bonus from Dire Bear Form applied
        -- to base item armor. This multiplier applies to ALL equipped items.
        -- However, Plate armor lacks Agility — which is Feral's primary stat
        -- (Agility → AP + Crit + Dodge). Leather with Agility + armor multiplier
        -- outperforms plate even with the higher base armor.
        -- Net result: Armor Mastery is a stat downgrade for Feral.
        "Armor Mastery",
        -- Cat/Bear forms use natural attacks; these melee-weapon echoes don't apply
        "Ambidexterity",
        "Titan's Grip",
        -- Feral deals physical/bleed, not spell schools
        "Nature Brand", "Frost Brand", "Shadow Brand", "Holy Brand", "Arcane Brand",
        -- Arcane Weapon requires mana; Feral forms use Energy (Cat) or Rage (Bear)
        "Arcane Weapon",
    },
    DRUID_ALL_F = {
        "Storm Surge", "Arcane Surge", "Fel Surge",
        "Crusader's Surge", "Divine Surge",
        -- All Druid specs: Runic Power is Death Knight only
        "Runic Momentum",
    },
    DRUID_1_F = {  -- Balance: uses Mana, not Energy or Rage
        "Relentless Energy", "Raging Momentum",
    },
    DRUID_3_F = {  -- Restoration: uses Mana, not Energy or Rage
        "Titan's Grip", "Ambidexterity", "Heavy Blows",
        "Backstabber's Edge", "Sweeping Blows", "Second Edge",
        "Exposed Heart", "Impaler's Tribute", "Drillmaster's Rebuke",
        "Relentless Energy", "Raging Momentum",
        -- Nature Brand procs on Nature *direct damage* hits. Restoration Druid's Nature spells
        -- are healing (Healing Touch, Regrowth, Wild Growth). Occasional Wrath for mana regen
        -- is not a meaningful source of stacks.
        "Nature Brand",
        -- Arcane Brand procs on Arcane direct hits. Restoration Druid has no Arcane spells.
        "Arcane Brand",
    },

    -- ── MAGE ─────────────────────────────────────────────────────────────────
    MAGE_ALL_F = {
        "Nature's Surge", "Storm Surge", "Fel Surge",
        "Crusader's Surge", "Divine Surge",
        "Armor Mastery",
        -- Wrong resource: Mages use Mana
        "Relentless Energy", "Raging Momentum", "Runic Momentum",
    },
    MAGE_1_F = {  -- Arcane: deals Arcane school damage only
        -- Frost Brand requires Frost direct hits. Arcane Mage has no Frost spells.
        "Frost Brand",
        -- Fire Brand requires Fire direct hits. Arcane Mage has no Fire spells in rotation.
        "Fire Brand",
        -- Arcane Bond scales pet SP: Arcane Mage has no persistent SP-scaling pet (Mirror Images
        -- share Mage stats but don't scale from Arcane Bond's formula).
        "Arcane Bond",
    },
    MAGE_2_F = {  -- Fire: deals Fire school damage primarily (some Arcane via Scorch/FFB offspec)
        -- Frost Brand requires Frost direct hits — Fire Mage has none in standard rotation.
        "Frost Brand",
        -- Arcane Brand requires Arcane direct hits. Fire Mage's main spells are Fireball,
        -- Fire Blast, Living Bomb, Scorch — all Fire school. Not worth stacking Arcane Brand.
        "Arcane Brand",
        -- Arcane Bond scales pet SP: Fire Mage has no persistent SP-scaling pet.
        "Arcane Bond",
    },
    MAGE_3_F = {  -- Frost: deals Frost school damage; Frostbolt, Ice Lance, Frozen Orb
        -- Arcane Brand requires Arcane direct hits. Frost Mage has no Arcane spells in rotation.
        "Arcane Brand",
        -- Fire Brand requires Fire direct hits. Frost Mage has no Fire spells in rotation.
        "Fire Brand",
    },

    -- ── WARLOCK ──────────────────────────────────────────────────────────────
    WARLOCK_ALL_F = {
        "Nature's Surge", "Storm Surge", "Arcane Surge",
        "Crusader's Surge", "Divine Surge",
        "Armor Mastery",
        -- Wrong resource: Warlocks use Mana
        "Relentless Energy", "Raging Momentum", "Runic Momentum",
    },
    -- Affliction: Shadow/Drain rotation — no Fire spells in standard rotation
    WARLOCK_1_F = { "Fire Brand" },
}

-- ── Role tables for forced-F blacklist ───────────────────────────────────────
EbonholdHub.SynergyData.SpecRole = {
    WARRIOR     = { [1]="DPS",  [2]="DPS",  [3]="TANK" },
    PALADIN     = { [1]="HEAL", [2]="TANK", [3]="DPS"  },
    HUNTER      = { [1]="DPS",  [2]="DPS",  [3]="DPS"  },
    ROGUE       = { [1]="DPS",  [2]="DPS",  [3]="DPS"  },
    PRIEST      = { [1]="HEAL", [2]="HEAL", [3]="DPS"  },
    DEATHKNIGHT = { [1]="TANK", [2]="DPS",  [3]="DPS"  },
    SHAMAN      = { [1]="DPS",  [2]="DPS",  [3]="HEAL" },
    MAGE        = { [1]="DPS",  [2]="DPS",  [3]="DPS"  },
    WARLOCK     = { [1]="DPS",  [2]="DPS",  [3]="DPS"  },
    DRUID       = { [1]="DPS",  [2]="DPS",  [3]="HEAL" },
}

EbonholdHub.SynergyData.CasterDpsSpec = {
    MAGE    = { [1]=true, [2]=true, [3]=true },
    WARLOCK = { [1]=true, [2]=true, [3]=true },
    PRIEST  = { [3]=true },
    DRUID   = { [1]=true },
    SHAMAN  = { [1]=true },
}

-- Returns { echoName = true } — echoes forced to F for this class/spec.
function EbonholdHub.SynergyData.BuildForcedFSet(cls, spc)
    local forced = {}
    local bl = EbonholdHub.SynergyData.ClassBlacklists
    if not bl then return forced end

    local function addList(key)
        local lst = bl[key]
        if not lst then return end
        for _, name in ipairs(lst) do
            forced[name] = true
        end
    end

    local roles = EbonholdHub.SynergyData.SpecRole
    local role = (roles[cls] and roles[cls][spc]) or "DPS"
    if role == "DPS"  then addList("ALL_DPS_F")  end
    if role == "TANK" then addList("ALL_TANK_F") end
    if role == "HEAL" then addList("ALL_HEAL_F") end

    local casterSpecs = EbonholdHub.SynergyData.CasterDpsSpec
    if casterSpecs[cls] and casterSpecs[cls][spc] then
        addList("CASTER_DPS_F")
    end

    if bl.CLASS_EXCLUSIVE then
        for echoName, allowedClasses in pairs(bl.CLASS_EXCLUSIVE) do
            local allowed = false
            for _, c in ipairs(allowedClasses) do
                if c == cls then allowed = true; break end
            end
            if not allowed then forced[echoName] = true end
        end
    end

    if bl.ABILITY_ECHO_CLASSES then
        for echoName, allowedClasses in pairs(bl.ABILITY_ECHO_CLASSES) do
            local allowed = false
            for _, c in ipairs(allowedClasses) do
                if c == cls then allowed = true; break end
            end
            if not allowed then forced[echoName] = true end
        end
    end

    if bl.SCHOOL_BRAND_CLASSES then
        for echoName, allowedClasses in pairs(bl.SCHOOL_BRAND_CLASSES) do
            local allowed = false
            for _, c in ipairs(allowedClasses) do
                if c == cls then allowed = true; break end
            end
            if not allowed then forced[echoName] = true end
        end
    end

    local excl = EbonholdHub.SynergyData.ClassExclusiveEchoes
    if excl then
        for echoName, ownerClass in pairs(excl) do
            if ownerClass ~= cls then forced[echoName] = true end
        end
    end

    addList(cls .. "_ALL_F")
    addList(cls .. "_" .. tostring(spc) .. "_F")

    return forced
end

-- ── Default stat tier lists (from spec preferredStats) ─────────────────────────

local function WeightToStatTier(w)
    if not w or w == 0 then return nil end
    if w >= 8 then return "S" end
    if w >= 5 then return "A" end
    if w >= 3 then return "B" end
    return "C"
end

local function GetProfileForStatTiers(class, specIdx)
    local sp = EbonholdHub.SynergyData.SpecProfiles
    if sp and class and sp[class] then
        local p = sp[class][specIdx or 1]
        if p then return p end
    end
    local cp = EbonholdHub.SynergyData.ClassProfiles
    return cp and class and cp[class]
end

-- Build default advisor stat tiers + within-tier order for a class/spec.
-- Derived from SpecProfiles.preferredStats (same thresholds as Advisor UI).
function EbonholdHub.SynergyData.GetDefaultStatTiers(class, specIdx)
    local emptyOrder = { S = {}, A = {}, B = {}, C = {}, pool = {} }
    local profile = GetProfileForStatTiers(class, specIdx)
    if not profile or not profile.preferredStats then
        return {}, emptyOrder
    end

    local ps = profile.preferredStats
    local firstK, firstV = next(ps)
    local tiers = {}
    local byTier = { S = {}, A = {}, B = {}, C = {} }

    if type(firstK) == "string" and type(firstV) == "number" then
        for statId, w in pairs(ps) do
            local tier = WeightToStatTier(w)
            if tier then
                tiers[statId] = tier
                byTier[tier][#byTier[tier] + 1] = { id = statId, w = w }
            end
        end
    else
        local fallbackWeights = { 10, 8, 7, 6, 5, 4, 3 }
        for i, statId in ipairs(ps) do
            local w = fallbackWeights[i] or 3
            local tier = WeightToStatTier(w)
            if tier then
                tiers[statId] = tier
                byTier[tier][#byTier[tier] + 1] = { id = statId, w = w }
            end
        end
    end

    local order = { S = {}, A = {}, B = {}, C = {}, pool = {} }
    for _, sec in ipairs({ "S", "A", "B", "C" }) do
        table.sort(byTier[sec], function(a, b) return a.w > b.w end)
        for _, entry in ipairs(byTier[sec]) do
            order[sec][#order[sec] + 1] = entry.id
        end
    end
    return tiers, order
end

-- ── Class fallback profiles ───────────────────────────────────────────────────
-- Used when spec cannot be detected. Covers all tags/stats any spec could value.

EbonholdHub.SynergyData.ClassProfiles = {
    WARRIOR     = { preferredFamilies = { "Melee", "Tank" },
                    preferredTags  = { "physical", "melee", "bleed", "defensive", "crit", "damage", "aoe" },
                    preferredStats = { "strength", "stamina", "armor", "crit", "arpen", "expertise" } },
    PALADIN     = { preferredFamilies = { "Melee", "Tank", "Healer" },
                    preferredTags  = { "holy", "physical", "defensive", "healing", "absorb", "crit", "aoe" },
                    preferredStats = { "strength", "spellpower", "stamina", "armor", "crit", "haste" } },
    HUNTER      = { preferredFamilies = { "Ranged" },
                    preferredTags  = { "physical", "ranged", "nature", "crit", "proc", "dot", "trap" },
                    preferredStats = { "agility", "crit", "hit", "haste", "attackpower" } },
    ROGUE       = { preferredFamilies = { "Melee" },
                    preferredTags  = { "physical", "melee", "bleed", "poison", "shadow", "crit", "proc" },
                    preferredStats = { "agility", "crit", "hit", "expertise", "arpen" } },
    PRIEST      = { preferredFamilies = { "Healer", "Caster" },
                    preferredTags  = { "holy", "shadow", "healing", "hot", "absorb", "proc", "dot" },
                    preferredStats = { "spellpower", "intellect", "spirit", "haste", "crit" } },
    SHAMAN      = { preferredFamilies = { "Caster", "Healer", "Melee" },
                    preferredTags  = { "nature", "lightning", "healing", "physical", "proc", "aoe" },
                    preferredStats = { "spellpower", "agility", "intellect", "haste", "crit" } },
    MAGE        = { preferredFamilies = { "Caster" },
                    preferredTags  = { "fire", "frost", "arcane", "damage", "crit", "proc", "aoe", "direct" },
                    preferredStats = { "spellpower", "hit", "haste", "crit", "intellect" } },
    WARLOCK     = { preferredFamilies = { "Caster" },
                    preferredTags  = { "shadow", "fire", "dot", "damage", "proc", "crit", "drain" },
                    preferredStats = { "spellpower", "hit", "haste", "crit", "intellect" } },
    DRUID       = { preferredFamilies = { "Healer", "Tank", "Melee", "Caster" },
                    preferredTags  = { "nature", "arcane", "healing", "hot", "bleed", "proc", "aoe" },
                    preferredStats = { "agility", "spellpower", "intellect", "crit", "haste" } },
    DEATHKNIGHT = { preferredFamilies = { "Melee", "Tank" },
                    preferredTags  = { "shadow", "frost", "physical", "bleed", "disease", "melee", "defensive", "dot" },
                    preferredStats = { "strength", "stamina", "armor", "crit", "haste", "expertise" } },
}

-- ── Class-exclusive echoes ────────────────────────────────────────────────────
-- Echoes that name specific class abilities in their description.
-- Although their classMask may be 1535 (all classes), they are meaningless
-- for any class other than the listed owner.
-- Used by AdvisorView.BuildForcedFSet to force F-tier for wrong classes.
--
-- Key:   exact echo base name (quality suffix stripped)
-- Value: WoW class token that exclusively benefits from this echo
EbonholdHub.SynergyData.ClassExclusiveEchoes = {
    -- ── Hazard echoes (AoE +20% for class-specific abilities) ─────────────────
    ["Battlefield Hazard"]  = "WARRIOR",      -- Thunder Clap, Shockwave, Whirlwind, Bladestorm
    ["Sanctified Hazard"]   = "PALADIN",       -- Consecration, Divine Storm, Hammer of the Righteous
    ["Blighted Hazard"]     = "DEATHKNIGHT",   -- Death and Decay, Blood Boil, Howling Blast, Corpse Explosion
    ["Hunting Hazard"]      = "HUNTER",        -- Volley, Multi-Shot
    ["Storm Hazard"]        = "SHAMAN",        -- Chain Lightning, Thunderstorm
    ["Wild Hazard"]         = "DRUID",         -- Hurricane, Starfall, Swipe
    ["Shadow Hazard"]       = "ROGUE",         -- Fan of Knives
    ["Arcane Hazard"]       = "MAGE",          -- Arcane Explosion, Blizzard, Flamestrike, Blast Wave
    ["Holy Hazard"]         = "PRIEST",        -- Holy Nova
    ["Fel Hazard"]          = "WARLOCK",       -- Rain of Fire, Hellfire, Shadowflame, Shadowfury

    -- ── Surge echoes (instant-cast proc for class-specific spell list) ────────
    ["Crusader's Surge"]    = "PALADIN",       -- Exorcism, Flash of Light, Holy Light
    ["Divine Surge"]        = "PRIEST",        -- Smite, Holy Fire, Mind Blast, Flash Heal, Greater Heal…
    ["Storm Surge"]         = "SHAMAN",        -- Lightning Bolt, Chain Lightning, Lava Burst, Healing Wave, Chain Heal
    ["Arcane Surge"]        = "MAGE",          -- Arcane Blast, Fireball, Frostbolt, Frostfire Bolt, Pyroblast, Flamestrike
    ["Fel Surge"]           = "WARLOCK",       -- Shadow Bolt, Incinerate, Soul Fire, Chaos Bolt, Haunt…
    ["Nature's Surge"]      = "DRUID",         -- Wrath, Starfire, Healing Touch, Nourish, Regrowth
}
