// ====================== INÍCIO DO SCRIPT ======================
import { world, system, EquipmentSlot, MinecraftEffectTypes } from "@minecraft/server";

// Mapeamento de efeitos para a API Bedrock
// SUBSTITUA por:
const EFFECTS = {
  strength: MinecraftEffectTypes.get(MinecraftEffectTypes.strength.id),
  speed: MinecraftEffectTypes.get(MinecraftEffectTypes.speed.id),
  jumpBoost: MinecraftEffectTypes.get(MinecraftEffectTypes.jumpBoost.id),  // ← camelCase!
  resistance: MinecraftEffectTypes.get(MinecraftEffectTypes.resistance.id),
  regeneration: MinecraftEffectTypes.get(MinecraftEffectTypes.regeneration.id),
  nightVision: MinecraftEffectTypes.get(MinecraftEffectTypes.nightVision.id),
  saturation: MinecraftEffectTypes.get(MinecraftEffectTypes.saturation.id),
  hunger: MinecraftEffectTypes.get(MinecraftEffectTypes.hunger.id),
  wither: MinecraftEffectTypes.get(MinecraftEffectTypes.wither.id),
};

// Estado por jogador
const playerStates = new Map();

function getPlayerState(player) {
  let state = playerStates.get(player.id);
  if (!state) {
    state = {
      activeModes: new Map(),
      baseMaxHealth: 20,
    };
    playerStates.set(player.id, state);
  }
  return state;
}

// Funções auxiliares de efeitos
function applyEffect(player, effectName, level) {
  if (!level || level <= 0) return;
  const effType = EFFECTS[effectName];
  if (!effType) return;
  try {
    player.addEffect(effType, 200, { amplifier: level - 1, showParticles: false });
  } catch (err) {
    console.error(`Erro ao aplicar efeito ${effectName} no jogador ${player.name}:`, err);
  }
}

function clearEffect(player, effectName) {
  const effType = EFFECTS[effectName];
  if (!effType) return;
  try {
    const eff = player.getEffect(effType);
    if (eff) player.removeEffect(effType);
  } catch (err) {
    console.error(`Erro ao remover efeito ${effectName} do jogador ${player.name}:`, err);
  }
}

function roman(n) {
  const map = [
    [10, "X"], [9, "IX"], [8, "VIII"], [7, "VII"], [6, "VI"],
    [5, "V"], [4, "IV"], [3, "III"], [2, "II"], [1, "I"],
  ];
  let x = n || 1, out = "";
  for (const [v, r] of map) {
    while (x >= v) { out += r; x -= v; }
  }
  return out || "I";
}

// Aplicar e remover efeitos de modos
function aplicarEfeitos(player, efeitos, nome, healthBoost, negativos) {
  const safe = {
    ...efeitos,
    resistance: efeitos.resistance ? Math.min(efeitos.resistance, 4) : undefined,
    regeneration: efeitos.regeneration ? Math.min(efeitos.regeneration, 4) : undefined,
  };

  applyEffect(player, "strength", safe.strength);
  applyEffect(player, "speed", safe.speed);
  applyEffect(player, "jump_boost", safe.jump_boost);
  applyEffect(player, "resistance", safe.resistance);
  applyEffect(player, "regeneration", safe.regeneration);
  applyEffect(player, "night_vision", safe.night_vision ?? 1);
  applyEffect(player, "saturation", safe.saturation ?? 1);

  if (negativos) {
    applyEffect(player, "hunger", negativos.hunger);
    applyEffect(player, "wither", negativos.wither);
  }

  sendTabelaChat(player, nome, healthBoost, safe, negativos);
}

function desativarEfeitos(player, efeitos, negativos) {
  clearEffect(player, "strength");
  clearEffect(player, "speed");
  clearEffect(player, "jump_boost");
  clearEffect(player, "resistance");
  clearEffect(player, "regeneration");
  clearEffect(player, "night_vision");
  clearEffect(player, "saturation");

  if (negativos) {
    clearEffect(player, "hunger");
    clearEffect(player, "wither");
  }
}

// Health Boost
function recalcHealthBoostFromActive(player) {
  try {
    const state = getPlayerState(player);
    const totalBoost = [...state.activeModes.values()].reduce((sum, modo) => sum + (modo.healthBoost || 0), 0);
    const clamped = Math.max(0, Math.min(totalBoost, 40));
    const base = state.baseMaxHealth ?? 20;
    const newMax = base + clamped;
    player.setDynamicProperty("naruto_max_health", newMax);
  } catch (err) {
    console.error(`Erro ao recalcular health boost do jogador ${player.name}:`, err);
  }
}

// Mensagem no chat
function sendTabelaChat(player, nome, healthBoost, efeitos, negativos) {
  const lines = [];
  lines.push("---------------------------------");
  lines.push(`[MODO EQUIPADO: ${nome}]`);
  lines.push(`Vida extra: +${healthBoost}`);
  const list = [];

  if (efeitos.strength) list.push(`Strength ${roman(efeitos.strength)}`);
  if (efeitos.speed) list.push(`Speed ${roman(efeitos.speed)}`);
  if (efeitos.jump_boost) list.push(`Jump Boost ${roman(efeitos.jump_boost)}`);
  if (efeitos.resistance) list.push(`Resistência ${roman(efeitos.resistance)}`);
  if (efeitos.regeneration) list.push(`Regeneração ${roman(efeitos.regeneration)}`);
  if (efeitos.night_vision) list.push(`Night Vision ${roman(efeitos.night_vision)}`);
  if (efeitos.saturation) list.push(`Saturação ${roman(efeitos.saturation)}`);

  if (negativos?.hunger) list.push(`Fome ${roman(negativos.hunger)}`);
  if (negativos?.wither) list.push(`Wither ${roman(negativos.wither)}`);

  lines.push(`Efeitos: ${list.join(", ") || "Nenhum"}`);
  lines.push("---------------------------------");

  try {
    player.sendMessage(lines.join("
"));
  } catch (err) {
    console.error(`Erro ao enviar mensagem ao jogador ${player.name}:`, err);
  }
}

// Slots suportados
const CHECK_SLOTS = [EquipmentSlot.Head, EquipmentSlot.Chest, EquipmentSlot.Feet];

function getEquippedItemId(player, slotEnum) {
  try {
    const eq = player.getComponent("minecraft:equippable");
    if (!eq) return null;
    const item = eq.getEquipment(slotEnum);
    return item?.typeId ?? null;
  } catch {
    return null;
  }
}

const MODOS = [];

// ====================== CLÃ HYUGA ======================
MODOS.push(
  {
    id: "nz:byakugan",
    slot: "head",
    nome: "Byakugan",
    efeitos: { strength: 1, speed: 1, jump_boost: 1, resistance: 1, regeneration: 1, night_vision: 1, saturation: 1 },
    healthBoost: 4,
    negativos: null,
  },
  {
    id: "nz:bk_ativado",
    slot: "head",
    nome: "Byakugan Ativado",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 6,
    negativos: null,
  },
  {
    id: "nz:byakugan_otsutsuki",
    slot: "head",
    nome: "Byakugan Otsutsuki",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 2, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 8,
    negativos: null,
  },
  {
    id: "nz:bk_otsutsuki_ativado",
    slot: "head",
    nome: "Byakugan Otsutsuki Ativado",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 10,
    negativos: null,
  },
  {
    id: "nz:tenseigan_olho",
    slot: "head",
    nome: "Tenseigan",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null,
  },
  {
    id: "nz:tenseigan_manto",
    slot: "head", // regra: manto vai no peitoral
    nome: "Manto Tenseigan",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null,
  },
  {
    id: "nz:jougan",
    slot: "head",
    nome: "Jougan",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null,
  },
  {
    id: "nz:karma_boruto_v1",
    slot: "head", // Karma é transformação, então peitoral
    nome: "Karma Boruto V1",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: { hunger: 1, wither: 1 }, // desgaste leve
  }
);
// ====================== FIM CLÃ HYUGA ======================

// ====================== CLÃ UCHIHA - SHARINGAN BÁSICOS ======================
MODOS.push(
  {
    id: "nz:sharingan",
    slot: "head",
    nome: "Sharingan 1 Tomoe",
    efeitos: { strength: 1, speed: 1, jump_boost: 1, resistance: 1, regeneration: 1, night_vision: 1, saturation: 1 },
    healthBoost: 4,
    negativos: null
  },
  {
    id: "nz:sharingan2",
    slot: "head",
    nome: "Sharingan 2 Tomoe",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 8,
    negativos: null
  },
  {
    id: "nz:sharingan3",
    slot: "head",
    nome: "Sharingan 3 Tomoe",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:sha3_obito",
    slot: "head",
    nome: "Sharingan 3 Tomoe (Obito)",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:sha3_kakashi",
    slot: "head",
    nome: "Sharingan 3 Tomoe (Kakashi)",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  }
);
// ====================== FIM SHARINGAN BÁSICOS ======================

// ====================== CLÃ UCHIHA - MANGEKYOU SHARINGAN ======================
MODOS.push(
  {
    id: "nz:mangekyou_izuna",
    slot: "head",
    nome: "Mangekyou Izuna",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:mangekyou_rai",
    slot: "head",
    nome: "Mangekyou Rai",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:mangekyou_naori",
    slot: "head",
    nome: "Mangekyou Naori",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:mangekyou_naka",
    slot: "head",
    nome: "Mangekyou Naka",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:mangekyou_shin",
    slot: "head",
    nome: "Mangekyou Shin",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:mangekyou_fugaku",
    slot: "head",
    nome: "Mangekyou Fugaku",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:mangekyou_sarada",
    slot: "head",
    nome: "Mangekyou Sarada",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:mangekyou_baru",
    slot: "head",
    nome: "Mangekyou Baru",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:mangekyou_sasuke",
    slot: "head",
    nome: "Mangekyou Sasuke",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:mangekyou_itachi",
    slot: "head",
    nome: "Mangekyou Itachi",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:mangekyou_madara",
    slot: "head",
    nome: "Mangekyou Madara",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:mangekyou_shisui",
    slot: "head",
    nome: "Mangekyou Shisui",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:mangekyou_kakashi",
    slot: "head",
    nome: "Mangekyou Kakashi",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:mangekyou_obito",
    slot: "head",
    nome: "Mangekyou Obito",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:mangekyou_lp",
    slot: "head",
    nome: "Mangekyou LP",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  },
  {
    id: "nz:mangekyou_kaiser",
    slot: "head",
    nome: "Mangekyou Kaiser",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  }
);
// ====================== FIM MANGEKYOU SHARINGAN ======================

// ====================== CLÃ UCHIHA - MANGEKYOU ETERNOS ======================
MODOS.push(
  {
    id: "nz:mg_eterno_sasuke",
    slot: "head",
    nome: "Mangekyou Eterno Sasuke",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 26,
    negativos: null
  },
  {
    id: "nz:mg_eterno_madara",
    slot: "head",
    nome: "Mangekyou Eterno Madara",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 28,
    negativos: null
  },
  {
    id: "nz:mangekyou_duplo",
    slot: "head",
    nome: "Mangekyou Duplo",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 26,
    negativos: null
  },
  {
    id: "nz:mg_eterno_lp",
    slot: "head",
    nome: "Mangekyou Eterno LP",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 28,
    negativos: null
  },
  {
    id: "nz:mg_eterno_kaiser",
    slot: "head",
    nome: "Mangekyou Eterno Kaiser",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 28,
    negativos: null
  }
);
// ====================== FIM MANGEKYOU ETERNOS ======================



// ====================== CLÃ UCHIHA - RINNEGAN ======================
MODOS.push(
  {
    id: "nz:rinnegan",
    slot: "head",
    nome: "Rinnegan",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 28,
    negativos: null
  },
  {
    id: "nz:rinne_mangekyou_obito",
    slot: "head",
    nome: "Rinnegan Mangekyou Obito",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 30,
    negativos: null
  },
  {
    id: "nz:rinnegan_supremo_sasuke",
    slot: "head",
    nome: "Rinnegan Supremo Sasuke",
    efeitos: { strength: 6, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 32,
    negativos: null
  }
);
// ====================== FIM RINNEGAN ======================


// ====================== CLÃ UCHIHA - SUSANOO ======================
MODOS.push(
  // Itachi
  {
    id: "nz:susanoo_itachi",
    slot: "chest",
    nome: "Susanoo Itachi - Fase 1",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:susanoo_itachi2",
    slot: "chest",
    nome: "Susanoo Itachi - Fase 2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:susanoo_itachi3",
    slot: "chest",
    nome: "Susanoo Itachi - Fase 3",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:susanoo_itachi4",
    slot: "chest",
    nome: "Susanoo Itachi - Fase 4",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:susanoo_itachi5",
    slot: "chest",
    nome: "Susanoo Itachi - Fase 5",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },

  // Sasuke
  {
    id: "nz:susanoo_sasuke",
    slot: "chest",
    nome: "Susanoo Sasuke - Fase 1",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:susanoo_sasuke2",
    slot: "chest",
    nome: "Susanoo Sasuke - Fase 2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:susanoo_sasuke3",
    slot: "chest",
    nome: "Susanoo Sasuke - Fase 3",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:susanoo_sasuke4",
    slot: "chest",
    nome: "Susanoo Sasuke - Fase 4",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:susanoo_sasuke5",
    slot: "chest",
    nome: "Susanoo Sasuke - Fase 5",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },

  // Sarada
  {
    id: "nz:susanoo_sarada",
    slot: "chest",
    nome: "Susanoo Sarada - Fase 1",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:susanoo_sarada2",
    slot: "chest",
    nome: "Susanoo Sarada - Fase 2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:susanoo_sarada3",
    slot: "chest",
    nome: "Susanoo Sarada - Fase 3",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:susanoo_sarada4",
    slot: "chest",
    nome: "Susanoo Sarada - Fase 4",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:susanoo_sarada5",
    slot: "chest",
    nome: "Susanoo Sarada - Fase 5",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },

  // Madara
  {
    id: "nz:susanoo_madara",
    slot: "chest",
    nome: "Susanoo Madara - Fase 1",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:susanoo_madara2",
    slot: "chest",
    nome: "Susanoo Madara - Fase 2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:susanoo_madara3",
    slot: "chest",
    nome: "Susanoo Madara - Fase 3",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:susanoo_madara4",
    slot: "chest",
    nome: "Susanoo Madara - Fase 4",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:susanoo_madara5",
    slot: "chest",
    nome: "Susanoo Madara - Fase 5",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },

  // Shisui
  {
    id: "nz:susanoo_shisui",
    slot: "chest",
    nome: "Susanoo Shisui - Fase 1",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:susanoo_shisui2",
    slot: "chest",
    nome: "Susanoo Shisui - Fase 2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:susanoo_shisui3",
    slot: "chest",
    nome: "Susanoo Shisui - Fase 3",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:susanoo_shisui4",
    slot: "chest",
    nome: "Susanoo Shisui - Fase 4",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:susanoo_shisui5",
    slot: "chest",
    nome: "Susanoo Shisui - Fase 5",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },

  // Kakashi
  {
    id: "nz:susanoo_kakashi",
    slot: "chest",
    nome: "Susanoo Kakashi - Fase 1",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:susanoo_kakashi2",
    slot: "chest",
    nome: "Susanoo Kakashi - Fase 2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:susanoo_kakashi3",
    slot: "chest",
    nome: "Susanoo Kakashi - Fase 3",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:susanoo_kakashi4",
    slot: "chest",
    nome: "Susanoo Kakashi - Fase 4",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:susanoo_kakashi5",
    slot: "chest",
    nome: "Susanoo Kakashi - Fase 5",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  }
);
// ====================== FIM SUSANOO ======================


// ====================== CLÃ AKIMICHI ======================
MODOS.push(
  {
    id: "nz:expansao_lvl1",
    slot: "head",
    nome: "Expansão Akimichi Lv1",
    efeitos: { strength: 2, speed: 1, jump_boost: 1, resistance: 2, regeneration: 1, night_vision: 1, saturation: 1 },
    healthBoost: 8,
    negativos: null
  }
);
// ====================== FIM AKIMICHI ======================


// ====================== CLÃ SENJU ======================
MODOS.push(
  {
    id: "nz:olho_senju",
    slot: "head",
    nome: "Olho Senju",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  }
);
// ====================== FIM SENJU ======================


// ====================== CLÃ UZUMAKI ======================
MODOS.push(
  {
    id: "nz:olho_uzumaki",
    slot: "head",
    nome: "Olho Uzumaki",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:corrente_uzumaki",
    slot: "head",
    nome: "Correntes Uzumaki",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  }
);
// ====================== FIM UZUMAKI ======================


// ====================== CLÃ CHINOIKE ======================
MODOS.push(
  {
    id: "nz:ketsuryugan",
    slot: "head",
    nome: "Ketsuryugan",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:ketsuryugan_8dragoes",
    slot: "head",
    nome: "Ketsuryugan - 8 Dragões",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  }
);
// ====================== FIM CHINOIKE ======================

// ====================== EXTRAS ======================
MODOS.push(
  {
    id: "nz:modo_samehada",
    slot: "head",
    nome: "Samehada",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:braco_danzou_selado",
    slot: "head",
    nome: "Braço Danzou Selado",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:braco_danzou_liberado",
    slot: "head",
    nome: "Braço Danzou Liberado",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:jutsu_modo_trovao",
    slot: "chest",
    nome: "Modo Trovão",
    efeitos: { strength: 4, speed: 5, jump_boost: 3, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  }
);
// ====================== FIM EXTRAS ======================


// ====================== PORTÕES INTERNOS ======================
MODOS.push(
  {
    id: "nz:portao1_kaimon",
    slot: "chest",
    nome: "1º Portão - Kaimon (Abertura)",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 1, night_vision: 1, saturation: 1 },
    healthBoost: 6,
    negativos: null
  },
  {
    id: "nz:portao2_kyumon",
    slot: "chest",
    nome: "2º Portão - Kyūmon (Cura)",
    efeitos: { strength: 2, speed: 2, jump_boost: 2, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 8,
    negativos: null
  },
  {
    id: "nz:portao3_seimon",
    slot: "chest",
    nome: "3º Portão - Seimon (Vida)",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:portao4_shoumon",
    slot: "chest",
    nome: "4º Portão - Shōmon (Dor)",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:portao5_tomon",
    slot: "chest",
    nome: "5º Portão - Tomon (Força)",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2 },
    healthBoost: 14,
    negativos: { hunger: 1 }
  },
  {
    id: "nz:portao6_keimon",
    slot: "chest",
    nome: "6º Portão - Keimon (Visão)",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2 },
    healthBoost: 16,
    negativos: { hunger: 1 }
  },
  {
    id: "nz:portao7_kyoumon",
    slot: "chest",
    nome: "7º Portão - Kyōmon (Choque)",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 18,
    negativos: { hunger: 2, wither: 1 }
  },
  {
    id: "nz:portao8_shimon",
    slot: "chest",
    nome: "8º Portão - Shimon (Morte)",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 22,
    negativos: { hunger: 2, wither: 2 }
  }
);
// ====================== FIM PORTÕES INTERNOS ======================

// ====================== SENNINS ======================
MODOS.push(
  {
    id: "nz:sennin_jiraya",
    slot: "feet",
    nome: "Sennin Jiraiya",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:sennin_naruto",
    slot: "feet",
    nome: "Sennin Naruto",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:sennin_hashirama",
    slot: "feet",
    nome: "Sennin Hashirama",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:sennin_kabuto",
    slot: "feet",
    nome: "Sennin Kabuto",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:sennin_orochimaru",
    slot: "feet",
    nome: "Sennin Orochimaru",
    efeitos: { strength: 4, speed: 3, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:sennin_mitsuki",
    slot: "feet",
    nome: "Sennin Mitsuki",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:byakugou",
    slot: "chest", // único sennin que fica no peitoral
    nome: "Byakugou",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  }
);
// ====================== FIM SENNINS ======================


// ====================== MARCAS DA MALDIÇÃO ======================
MODOS.push(
  // Tayuya
  {
    id: "nz:maldicao_tayuya1",
    slot: "feet",
    nome: "Maldição Tayuya Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 8,
    negativos: null
  },
  {
    id: "nz:maldicao_tayuya2",
    slot: "feet",
    nome: "Maldição Tayuya Lv2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:maldicao_tayuya3",
    slot: "feet",
    nome: "Maldição Tayuya Lv3",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },

  // Kidomaru
  {
    id: "nz:maldicao_kindomaru1",
    slot: "feet",
    nome: "Maldição Kidomaru Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 8,
    negativos: null
  },
  {
    id: "nz:maldicao_kindomaru2",
    slot: "feet",
    nome: "Maldição Kidomaru Lv2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:maldicao_kindomaro3",
    slot: "feet",
    nome: "Maldição Kidomaru Lv3",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },

  // Kimimaro
  {
    id: "nz:maldicao_kimimaro1",
    slot: "feet",
    nome: "Maldição Kimimaro Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 8,
    negativos: null
  },
  {
    id: "nz:maldicao_kimimaro2_v1",
    slot: "feet",
    nome: "Maldição Kimimaro Lv2 (Forma 1)",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:maldicao_kimimaro2_v2",
    slot: "feet",
    nome: "Maldição Kimimaro Lv2 (Forma 2)",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:maldicao_kimimaro3",
    slot: "feet",
    nome: "Maldição Kimimaro Lv3",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },

  // Sasuke
  {
    id: "nz:maldicao_sasuke1",
    slot: "feet",
    nome: "Maldição Sasuke Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 8,
    negativos: null
  },
  {
    id: "nz:maldicao_sasuke2",
    slot: "feet",
    nome: "Maldição Sasuke Lv2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:maldicao_sasuke3",
    slot: "feet",
    nome: "Maldição Sasuke Lv3",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },

  // Jirobo
  {
    id: "nz:maldicao_jirobo1",
    slot: "feet",
    nome: "Maldição Jirobo Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 8,
    negativos: null
  },
  {
    id: "nz:maldicao_jirobo2",
    slot: "feet",
    nome: "Maldição Jirobo Lv2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:maldicao_jirobo3",
    slot: "feet",
    nome: "Maldição Jirobo Lv3",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },

  // Sakon & Ukon
  {
    id: "nz:maldicao_sakon_ukon1",
    slot: "feet",
    nome: "Maldição Sakon & Ukon Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 8,
    negativos: null
  },
  {
    id: "nz:maldicao_sakon_ukon2",
    slot: "feet",
    nome: "Maldição Sakon & Ukon Lv2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:maldicao_sakon_ukon3",
    slot: "feet",
    nome: "Maldição Sakon & Ukon Lv3",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  }
);
// ====================== FIM MARCAS DA MALDIÇÃO ======================

// ====================== KARMAS ======================
MODOS.push(
  {
    id: "nz:karma_boruto_v1_",
    slot: "chest",
    nome: "Karma Boruto V1",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:karma_boruto_v2_",
    slot: "chest",
    nome: "Karma Boruto V2",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:karma_kawaki_v1_",
    slot: "chest",
    nome: "Karma Kawaki V1",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:karma_kawaki_v2_",
    slot: "chest",
    nome: "Karma Kawaki V2",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  }
);
// ====================== FIM KARMAS ======================


// ====================== BIJUU - SHUKAKU ======================
MODOS.push(
  {
    id: "nz:manto_shukaku1",
    slot: "head",
    nome: "Manto Shukaku Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:manto_shukaku1_v",
    slot: "head",
    nome: "Manto Shukaku Lv1 (Versão V)",
    efeitos: { strength: 3, speed: 2, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:manto_shukakumk1",
    slot: "head",
    nome: "Manto Shukaku MK1",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:manto_shukakumk2",
    slot: "head",
    nome: "Manto Shukaku MK2",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:manto_shukakurikudou",
    slot: "head",
    nome: "Manto Shukaku Rikudou",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:modo_barion_shukaku",
    slot: "head",
    nome: "Modo Barion Shukaku",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 28,
    negativos: { hunger: 2, wither: 2 }
  },
  {
    id: "nz:modo_bijuu_shukaku",
    slot: "head",
    nome: "Modo Bijuu Shukaku",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  }
);
// ====================== FIM SHUKAKU ======================


// (Aqui seguem os outros modos, omitidos por questão de comprimento [copiar original completo está ok])

// ====================== BIJUU - MATATABI ======================
// SUBSTITUA o bloco cortado por:
MODOS.push(
  {id:"nz:manto_matatabi", slot:"head", nome:"Manto Matatabi Lv1", efeitos:{strength:2,speed:2,jumpBoost:1,resistance:2,regeneration:2,nightVision:1,saturation:1},healthBoost:10,negativos:null},
  {id:"nz:manto_matatabi2", slot:"head", nome:"Manto Matatabi Lv2", efeitos:{strength:3,speed:3,jumpBoost:2,resistance:3,regeneration:2,nightVision:2,saturation:1},healthBoost:12,negativos:null},
  {id:"nz:manto_matatabimk1", slot:"head", nome:"Manto Matatabi MK1", efeitos:{strength:4,speed:3,jumpBoost:2,resistance:3,regeneration:3,nightVision:2,saturation:1},healthBoost:16,negativos:null},
  {id:"nz:manto_matatabimk2", slot:"head", nome:"Manto Matatabi MK2", efeitos:{strength:5,speed:4,jumpBoost:3,resistance:4,regeneration:4,nightVision:2,saturation:1},healthBoost:20,negativos:null},
  {id:"nz:manto_matatabirikudou", slot:"head", nome:"Manto Matatabi Rikudou", efeitos:{strength:5,speed:4,jumpBoost:3,resistance:4,regeneration:4,nightVision:2,saturation:1},healthBoost:22,negativos:null},
  {id:"nz:modo_barion_matatabi", slot:"head", nome:"Modo Barion Matatabi", efeitos:{strength:6,speed:6,jumpBoost:4,resistance:4,regeneration:4,nightVision:2},healthBoost:28,negativos:{hunger:2,wither:2}},
  {id:"nz:modo_bijuu_matatabi", slot:"head", nome:"Modo Bijuu Matatabi", efeitos:{strength:5,speed:5,jumpBoost:3,resistance:4,regeneration:4,nightVision:2,saturation:1},healthBoost:24,negativos:null}
);
// ====================== FIM MATATABI ======================

// ====================== BIJUU - ISOBU ======================
MODOS.push(
  {
    id: "nz:manto_isobu1",
    slot: "head",
    nome: "Manto Isobu Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:manto_isobu2",
    slot: "head",
    nome: "Manto Isobu Lv2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:manto_isobu3",
    slot: "head",
    nome: "Manto Isobu Lv3",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:manto_isobumk1",
    slot: "head",
    nome: "Manto Isobu MK1",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:manto_isobumk2",
    slot: "head",
    nome: "Manto Isobu MK2",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:manto_isoburikudou",
    slot: "head",
    nome: "Manto Isobu Rikudou",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:modo_barion_isobu",
    slot: "head",
    nome: "Modo Barion Isobu",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 28,
    negativos: { hunger: 2, wither: 2 }
  },
  {
    id: "nz:modo_bijuu_isobu",
    slot: "head",
    nome: "Modo Bijuu Isobu",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  }
);
// ====================== FIM ISOBU ======================

// ====================== BIJUU - SON GOKU ======================
MODOS.push(
  {
    id: "nz:manto_songoku",
    slot: "head",
    nome: "Manto Son Gokū Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:manto_songoku2",
    slot: "head",
    nome: "Manto Son Gokū Lv2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:manto_songoku4",
    slot: "head",
    nome: "Manto Son Gokū Lv4",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:manto_songokumk1",
    slot: "head",
    nome: "Manto Son Gokū MK1",
    efeitos: { strength: 4, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:manto_songokumk2",
    slot: "head",
    nome: "Manto Son Gokū MK2",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:manto_songokurikudou",
    slot: "head",
    nome: "Manto Son Gokū Rikudou",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:modo_barion_songoku",
    slot: "head",
    nome: "Modo Barion Son Gokū",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 28,
    negativos: { hunger: 2, wither: 2 }
  },
  {
    id: "nz:modo_bijuu_songoku",
    slot: "head",
    nome: "Modo Bijuu Son Gokū",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  }
);
// ====================== FIM SON GOKU ======================


// ====================== BIJUU - KOKUŌ ======================
MODOS.push(
  {
    id: "nz:manto_kokuo1",
    slot: "head",
    nome: "Manto Kokuō Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:manto_kokuo4",
    slot: "head",
    nome: "Manto Kokuō Lv4",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:manto_kokuo5",
    slot: "head",
    nome: "Manto Kokuō Lv5",
    efeitos: { strength: 4, speed: 4, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:manto_kokuomk1",
    slot: "head",
    nome: "Manto Kokuō MK1",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:manto_kokuomk2",
    slot: "head",
    nome: "Manto Kokuō MK2",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:manto_kokuorikudou",
    slot: "head",
    nome: "Manto Kokuō Rikudou",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:modo_barion_kokuo",
    slot: "head",
    nome: "Modo Barion Kokuō",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 28,
    negativos: { hunger: 2, wither: 2 }
  },
  {
    id: "nz:modo_bijuu_kokuo",
    slot: "head",
    nome: "Modo Bijuu Kokuō",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  }
);
// ====================== FIM KOKUŌ ======================

// ====================== BIJUU - SAIKEN ======================
MODOS.push(
  {
    id: "nz:manto_saiken1",
    slot: "head",
    nome: "Manto Saiken Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:manto_saiken3",
    slot: "head",
    nome: "Manto Saiken Lv3",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:manto_saiken6",
    slot: "head",
    nome: "Manto Saiken Lv6",
    efeitos: { strength: 4, speed: 4, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:manto_saiken6_escorregadio",
    slot: "head",
    nome: "Manto Saiken Lv6 (Escorregadio)",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:manto_saikenmk1",
    slot: "head",
    nome: "Manto Saiken MK1",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:manto_saikenmk2",
    slot: "head",
    nome: "Manto Saiken MK2",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:manto_saikenrikudou",
    slot: "head",
    nome: "Manto Saiken Rikudou",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:modo_barion_saiken",
    slot: "head",
    nome: "Modo Barion Saiken",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 28,
    negativos: { hunger: 2, wither: 2 }
  },
  {
    id: "nz:modo_bijuu_saiken",
    slot: "head",
    nome: "Modo Bijuu Saiken",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  }
);
// ====================== FIM SAIKEN ======================

// ====================== BIJUU - CHŌMEI ======================
MODOS.push(
  {
    id: "nz:manto_chomei1",
    slot: "head",
    nome: "Manto Chōmei Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:manto_chomei3",
    slot: "head",
    nome: "Manto Chōmei Lv3",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:manto_chomei5",
    slot: "head",
    nome: "Manto Chōmei Lv5",
    efeitos: { strength: 4, speed: 4, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:manto_chomemk1",
    slot: "head",
    nome: "Manto Chōmei MK1",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:manto_chomeimk2",
    slot: "head",
    nome: "Manto Chōmei MK2",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:manto_chomeirikudou",
    slot: "head",
    nome: "Manto Chōmei Rikudou",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:modo_barion_chomei",
    slot: "head",
    nome: "Modo Barion Chōmei",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 28,
    negativos: { hunger: 2, wither: 2 }
  },
  {
    id: "nz:modo_bijuu_chomei",
    slot: "head",
    nome: "Modo Bijuu Chōmei",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  }
);
// ====================== FIM CHŌMEI ======================

// ====================== BIJUU - GYŪKI ======================
MODOS.push(
  {
    id: "nz:manto_gyuki1",
    slot: "head",
    nome: "Manto Gyūki Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:manto_gyuki6",
    slot: "head",
    nome: "Manto Gyūki Lv6",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:manto_gyuki7",
    slot: "head",
    nome: "Manto Gyūki Lv7",
    efeitos: { strength: 4, speed: 4, jump_boost: 2, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:manto_gyukimk1",
    slot: "head",
    nome: "Manto Gyūki MK1",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:manto_gyukimk2",
    slot: "head",
    nome: "Manto Gyūki MK2",
    efeitos: { strength: 5, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:manto_gyukirikudou",
    slot: "head",
    nome: "Manto Gyūki Rikudou",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:modo_barion_gyuki",
    slot: "head",
    nome: "Modo Barion Gyūki",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 28,
    negativos: { hunger: 2, wither: 2 }
  },
  {
    id: "nz:modo_bijuu_gyuki",
    slot: "head",
    nome: "Modo Bijuu Gyūki",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  }
);
// ====================== FIM GYŪKI ======================


// ====================== BIJUU - KURAMA ======================
MODOS.push(
  {
    id: "nz:manto_kurama1",
    slot: "head",
    nome: "Manto Kurama Lv1",
    efeitos: { strength: 2, speed: 2, jump_boost: 1, resistance: 2, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 10,
    negativos: null
  },
  {
    id: "nz:manto_kurama2",
    slot: "head",
    nome: "Manto Kurama Lv2",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 2, saturation: 1 },
    healthBoost: 12,
    negativos: null
  },
  {
    id: "nz:manto_kurama3",
    slot: "head",
    nome: "Manto Kurama Lv3",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:manto_kurama4",
    slot: "head",
    nome: "Manto Kurama Lv4",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 16,
    negativos: null
  },
  {
    id: "nz:manto_kurama6",
    slot: "head",
    nome: "Manto Kurama Lv6",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:manto_kurama8",
    slot: "head",
    nome: "Manto Kurama Lv8",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 20,
    negativos: null
  },
  {
    id: "nz:manto_kuramamk1",
    slot: "head",
    nome: "Manto Kurama MK1",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:manto_kuramamk2",
    slot: "head",
    nome: "Manto Kurama MK2",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  },
  {
    id: "nz:manto_kuramarikudou",
    slot: "head",
    nome: "Manto Kurama Rikudou",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 26,
    negativos: null
  },
  {
    id: "nz:modo_barion_kurama",
    slot: "head",
    nome: "Modo Barion Kurama",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 30,
    negativos: { hunger: 2, wither: 2 }
  },
  {
    id: "nz:modo_bijuu_kurama",
    slot: "head",
    nome: "Modo Bijuu Kurama",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 26,
    negativos: null
  },
  {
    id: "nz:modo_bijuu_kurama_ashura",
    slot: "head",
    nome: "Modo Bijuu Kurama Ashura",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 32,
    negativos: null
  }
);
// ====================== FIM KURAMA ======================


// ====================== BIJUU - JŪBI ======================
MODOS.push(
  {
    id: "nz:manto_juubi1",
    slot: "head",
    nome: "Manto Jūbi Lv1",
    efeitos: { strength: 3, speed: 3, jump_boost: 2, resistance: 3, regeneration: 2, night_vision: 1, saturation: 1 },
    healthBoost: 14,
    negativos: null
  },
  {
    id: "nz:manto_juubi8",
    slot: "head",
    nome: "Manto Jūbi Lv8",
    efeitos: { strength: 4, speed: 4, jump_boost: 3, resistance: 4, regeneration: 3, night_vision: 2, saturation: 1 },
    healthBoost: 18,
    negativos: null
  },
  {
    id: "nz:manto_juubi9",
    slot: "head",
    nome: "Manto Jūbi Lv9",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 22,
    negativos: null
  },
  {
    id: "nz:manto_juubiobito",
    slot: "head",
    nome: "Manto Jūbi Obito",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 24,
    negativos: null
  },
  {
    id: "nz:manto_juubimadara",
    slot: "head",
    nome: "Manto Jūbi Madara",
    efeitos: { strength: 5, speed: 5, jump_boost: 3, resistance: 4, regeneration: 4, night_vision: 2, saturation: 1 },
    healthBoost: 26,
    negativos: null
  },
  {
    id: "nz:modo_barion_juubi",
    slot: "head",
    nome: "Modo Barion Jūbi",
    efeitos: { strength: 6, speed: 6, jump_boost: 4, resistance: 4, regeneration: 4, night_vision: 2 },
    healthBoost: 32,
    negativos: { hunger: 2, wither: 2 }
  }
);
// ====================== FIM JŪBI ======================

// Função para buscar modo pelo item e slot
function getModoByItemIdAndSlot(itemId, slotEnum) {
  if (!itemId) return null;
  const slotStr = slotEnum === EquipmentSlot.Head ? "head"
                : slotEnum === EquipmentSlot.Chest ? "chest"
                : slotEnum === EquipmentSlot.Feet ? "feet"
                : null;
  if (!slotStr) return null;
  return MODOS.find(m => m.id === itemId && m.slot === slotStr) || null;
}

// Loop principal: detecta itens equipados e aplica/remove efeitos
system.runInterval(() => {
  for (const player of world.getPlayers()) {
    const state = getPlayerState(player);

    for (const slotEnum of CHECK_SLOTS) {
      const itemId = getEquippedItemId(player, slotEnum);
      const equippedModo = getModoByItemIdAndSlot(itemId, slotEnum);
      const currentlyActive = state.activeModes.get(slotEnum);

      // Ativação de novo modo
      if (equippedModo && (!currentlyActive || currentlyActive.id !== equippedModo.id)) {
        if (currentlyActive) {
          desativarEfeitos(player, currentlyActive.efeitos, currentlyActive.negativos);
        }
        aplicarEfeitos(player, equippedModo.efeitos, equippedModo.nome, equippedModo.healthBoost, equippedModo.negativos);
        state.activeModes.set(slotEnum, equippedModo);
      }

      // Remoção de modo ao tirar item
      if (!equippedModo && currentlyActive) {
        desativarEfeitos(player, currentlyActive.efeitos, currentlyActive.negativos);
        state.activeModes.delete(slotEnum);
      }
    }

    // Recalcula health boost total
    recalcHealthBoostFromActive(player);

// SISTEMA DE EVENTOS (adicione ANTES do fim)
const CHECK_SLOTS = { head: EquipmentSlot.Head, chest: EquipmentSlot.Chest, feet: EquipmentSlot.Feet };

world.afterEvents.playerEquipItem.subscribe((ev) => {
  const {player, itemStack, slot} = ev;
  const itemId = itemStack?.typeId;
  const slotName = slot === EquipmentSlot.Head ? "head" : slot === EquipmentSlot.Chest ? "chest" : "feet";
  
  system.runTimeout(() => {
    // Desativa modo anterior se equipar novo
    const modoAtual = MODOS.find(m => m.id === itemId && m.slot === slotName);
    if (modoAtual) {
      aplicarEfeitos(player, modoAtual.efeitos, modoAtual.nome, modoAtual.healthBoost, modoAtual.negativos);
    }
  }, 1);
});

console.log(`§a[Modos Naruto] ${MODOS.length} modos carregados!`);
  }
}, 40);


// ====================== FIM DO SCRIPT ======================
