const RARITIES = {
  normal: { id: 'normal', name: 'Normal', color: 'text-white', border: 'border-white' },
  rare: { id: 'rare', name: 'Rare', color: 'text-blue-400', border: 'border-blue-500' },
  epic: { id: 'epic', name: 'Epic', color: 'text-purple-400', border: 'border-purple-500' },
  legend: { id: 'legend', name: 'Legend', color: 'text-yellow-400', border: 'border-yellow-500' },
  unique: { id: 'unique', name: 'Unique', color: 'text-cyan-300', border: 'border-cyan-400' }
};

const PREFIXES = {
  'none': { id: 'none', name: '', atkMult: 1.0, spdMult: 1.0, hpMult: 1.0 },
  'rusty': { id: 'rusty', name: '錆びた', atkMult: 0.5, spdMult: 0.8, hpMult: 1.0 },
  'sharp': { id: 'sharp', name: '鋭利な', atkMult: 1.5, spdMult: 1.0, hpMult: 1.0 },
  'heavy': { id: 'heavy', name: '重厚な', atkMult: 2.0, spdMult: 0.5, hpMult: 1.5 },
  'sonic': { id: 'sonic', name: '音速の', atkMult: 0.8, spdMult: 2.5, hpMult: 1.0 },
  'legendary': { id: 'legendary', name: '伝説の', atkMult: 3.0, spdMult: 1.2, hpMult: 2.0 },
  'cursed': { id: 'cursed', name: '呪われた', atkMult: 5.0, spdMult: 1.0, hpMult: 0.1 },
};

const PARTS = {
  'fire': { id: 'fire', name: '火炎コア', icon: <Flame size={16}/>, color: 'text-red-500', desc: '基本攻撃力+5', minFloor: 1, rarity: 'normal', apply: (s) => { s.atk += 5; } },
  'spread': { id: 'spread', name: '拡散レンズ', icon: <Target size={16}/>, color: 'text-yellow-500', desc: 'シナジー用', minFloor: 1, rarity: 'normal' },
  'gravity': { id: 'gravity', name: '重力発生器', icon: <Package size={16}/>, color: 'text-purple-500', desc: '基本攻撃力+10', minFloor: 1, rarity: 'normal', apply: (s) => { s.atk += 10; } },
  'motor': { id: 'motor', name: '高速モーター', icon: <Zap size={16}/>, color: 'text-blue-500', desc: '攻撃速度UP', minFloor: 1, rarity: 'normal', apply: (s) => { s.spd += 0.5; } },
  'poison': { id: 'poison', name: '猛毒フラスコ', icon: <Skull size={16}/>, color: 'text-green-500', desc: 'シナジー用', minFloor: 1, rarity: 'normal' },
  'ice': { id: 'ice', name: '絶対零度コア', icon: <Snowflake size={16}/>, color: 'text-cyan-300', desc: '基本攻撃力+3', minFloor: 1, rarity: 'normal', apply: (s) => { s.atk += 3; } },
  'battery': { id: 'battery', name: '超電導バッテリー', icon: <Battery size={16}/>, color: 'text-yellow-400', desc: '攻撃速度+0.3', minFloor: 1, rarity: 'normal', apply: (s) => { s.spd += 0.3; } },
  'laser': { id: 'laser', name: '収束プリズム', icon: <Crosshair size={16}/>, color: 'text-fuchsia-500', desc: '攻撃力大UP,速度低下', minFloor: 1, rarity: 'rare', apply: (s) => { s.atk += 15; s.spd -= 0.2; } },
  'spring': { id: 'spring', name: '反発スプリング', icon: <Activity size={16}/>, color: 'text-green-300', desc: '攻撃速度UP,攻撃力低下', minFloor: 1, rarity: 'rare', apply: (s) => { s.spd += 0.5; s.atk -= 3; } },
  'core': { id: 'core', name: 'ブラックボックス', icon: <Hexagon size={16}/>, color: 'text-gray-400', desc: '謎のシナジー用コア', minFloor: 1, rarity: 'rare' },
  'plasma': { id: 'plasma', name: 'プラズマセル', icon: <Zap size={16}/>, color: 'text-blue-300', desc: '基本攻撃力+30', minFloor: 15, rarity: 'epic', apply: (s) => { s.atk += 30; } },
  'antimatter': { id: 'antimatter', name: '反物質カプセル', icon: <Hexagon size={16}/>, color: 'text-purple-600', desc: '基本攻撃力+100', minFloor: 30, rarity: 'legend', apply: (s) => { s.atk += 100; } },
  'tachyon': { id: 'tachyon', name: 'タキオンドライブ', icon: <Activity size={16}/>, color: 'text-cyan-400', desc: '攻撃速度+1.5', minFloor: 40, rarity: 'legend', apply: (s) => { s.spd += 1.5; } },
  'singularity': { id: 'singularity', name: '特異点エンジン', icon: <Target size={16}/>, color: 'text-gray-900', desc: '攻撃力大幅UP、速度大幅UP', minFloor: 50, rarity: 'unique', apply: (s) => { s.atk += 200; s.spd += 2.0; } },
};

const WEAPON_TYPES = [
  { id: 'w_pipe', name: '鉄パイプ', baseAtk: 5, maxSockets: 2, minFloor: 1, rarity: 'normal' },
  { id: 'w_blade', name: 'ジャンクブレード', baseAtk: 10, maxSockets: 2, minFloor: 1, rarity: 'normal' },
  { id: 'w_plasma', name: 'プラズマカッター', baseAtk: 25, maxSockets: 3, minFloor: 1, rarity: 'rare' },
  { id: 'w_pile', name: 'パイルバンカー', baseAtk: 50, maxSockets: 1, minFloor: 1, rarity: 'rare' },
  { id: 'w_nano', name: 'ナノマシンロッド', baseAtk: 15, maxSockets: 4, minFloor: 1, rarity: 'rare' },
  { id: 'w_chain', name: 'チェーンソード', baseAtk: 30, maxSockets: 3, minFloor: 10, rarity: 'epic' },
  { id: 'w_railgun', name: 'レールガン', baseAtk: 80, maxSockets: 4, minFloor: 20, rarity: 'epic' },
  { id: 'w_photon', name: 'フォトンランチャー', baseAtk: 150, maxSockets: 5, minFloor: 30, rarity: 'legend' },
  { id: 'w_dimension', name: '次元断層刀', baseAtk: 300, maxSockets: 6, minFloor: 45, rarity: 'unique' },
];

const SYNERGIES = [
  { req: ['fire', 'spread'], name: '【火炎放射】', effectText: '攻撃力が2.5倍になる', apply: (s) => { s.atk *= 2.5; } },
  { req: ['gravity', 'spread'], name: '【メテオストライク】', effectText: '攻撃力が4.0倍、攻撃速度が半減する', apply: (s) => { s.atk *= 4.0; s.spd *= 0.5; } },
  { req: ['poison', 'motor'], name: '【猛毒の雨】', effectText: '攻撃力が+50される', apply: (s) => { s.atk += 50; } },
  { req: ['ice', 'laser'], name: '【絶対零度ビーム】', effectText: '攻撃力が3.0倍、速度がUPする', apply: (s) => { s.atk *= 3.0; s.spd += 0.5; } },
  { req: ['core', 'battery'], name: '【オーバードライブ】', effectText: '攻撃力と速度が2.0倍になる', apply: (s) => { s.atk *= 2.0; s.spd *= 2.0; } },
  { req: ['fire', 'ice'], name: '【熱膨張崩壊】', effectText: '攻撃力が5.0倍になるが、速度が激減する', apply: (s) => { s.atk *= 5.0; s.spd *= 0.2; } },
  { req: ['fire', 'spread', 'motor'], name: '【フレイムストーム】', effectText: '攻撃力3倍、速度+1.0', apply: (s) => { s.atk *= 3.0; s.spd += 1.0; } },
  { req: ['ice', 'laser', 'battery'], name: '【絶対零度コライダー】', effectText: '攻撃力5倍、速度2倍', apply: (s) => { s.atk *= 5.0; s.spd *= 2.0; } },
  { req: ['gravity', 'plasma', 'antimatter'], name: '【ブラックホール生成】', effectText: '攻撃力15倍、速度激減', apply: (s) => { s.atk *= 15.0; s.spd *= 0.1; } },
  { req: ['fire', 'ice', 'laser', 'core'], name: '【アルティメット・カオス】', effectText: '攻撃力50倍、速度3倍', apply: (s) => { s.atk *= 50.0; s.spd *= 3.0; } },
];

const INITIAL_PLAYER = {
  level: 1,
  maxHp: 100,
  hp: 100,
  baseSpd: 1.0,
  scrap: 0
};

const INITIAL_WEAPON = {
  id: 'w_init',
  typeId: 'w_pipe',
  name: '鉄パイプ',
  prefix: 'none',
  baseAtk: 5,
  sockets: [null, null],
  rarity: 'normal'
};
