/** Free-tier buff activations per rolling 24h window (spec daily task "Use 3 Buffs") */
export const FREE_BUFF_ACTIVATIONS_PER_PERIOD = 2;

/** Server tick rate in Hz */
export const TICK_RATE = 10;

/** Fixed timestep for game logic in seconds */
export const FIXED_DT = 1 / TICK_RATE;

/** Fixed timestep in milliseconds */
export const FIXED_DT_MS = 1000 / TICK_RATE;

/** Isometric tile width in pixels */
export const TILE_WIDTH = 96;

/** Isometric tile height in pixels (typically half of width for 2:1 iso) */
export const TILE_HEIGHT = 48;

/** Camera follow lerp factor (0 = no follow, 1 = instant snap) */
export const CAMERA_FOLLOW_LERP = 0.08;

/** Reference frame duration for dt-scaled camera smoothing (~60 Hz) */
export const CAMERA_LERP_REFERENCE_MS = 1000 / 60;

/** Map zoom level (<1 = zoomed out to show more tiles, 1 = default) */
export const MAP_ZOOM = 1.0;

/** Screen shake magnitude in pixels */
export const SHAKE_MAGNITUDE = 6;

/** Screen shake duration in milliseconds */
export const SHAKE_DURATION_MS = 200;

/** WebSocket reconnect base delay in milliseconds */
export const WS_RECONNECT_BASE_MS = 1000;

/** WebSocket reconnect max delay in milliseconds */
export const WS_RECONNECT_MAX_MS = 30000;

/** WebSocket heartbeat interval in milliseconds */
export const WS_HEARTBEAT_INTERVAL_MS = 15000;

/** WebSocket heartbeat timeout in milliseconds */
export const WS_HEARTBEAT_TIMEOUT_MS = 5000;

/** Max accumulated time before we drop frames (prevents spiral of death) */
export const MAX_ACCUMULATED_MS = 250;

/** Floating damage number duration in milliseconds */
export const DAMAGE_NUMBER_DURATION_MS = 1200;

/** Floating damage rise distance in pixels */
export const DAMAGE_NUMBER_RISE_PX = 60;

/** Buff cooldown overlay animation fps */
export const BUFF_OVERLAY_FPS = 30;

/** Death screen auto-revive countdown (seconds); manual "Revive now" is always available when server allows. */
export const REVIVE_TIMER_SECONDS = 300;

/** Client combat tuning: longer fights vs server-authoritative preview (matches backend pace intent). */
export const COMBAT_HIT_INTERVAL_MULT = 5;
/** Multiplier applied to outgoing/incoming hit damage (before minimum 1). */
export const COMBAT_DAMAGE_SCALE = 0.35;

/** API base path */
export const API_BASE = '/api/v1';

/** WebSocket path */
export const WS_PATH = '/ws';

// ---- Rarity Colors (WoW-style) ----

export const RARITY_COLORS: Record<string, string> = {
  common: '#9d9d9d',
  uncommon: '#1eff00',
  rare: '#0070dd',
  epic: '#a335ee',
  legendary: '#ffd700',
};

export const RARITY_GLOW: Record<string, string> = {
  common: 'none',
  uncommon: '0 0 8px #1eff0066',
  rare: '0 0 10px #0070dd88, 0 0 20px #0070dd44',
  epic: '0 0 12px #a335ee99, 0 0 24px #a335ee55',
  legendary: '0 0 16px #ffd700cc, 0 0 32px #ffd70066, 0 0 48px #ffd70033',
};

// ---- Debuff Colors ----

export const DEBUFF_COLORS: Record<string, string> = {
  poison: '#44cc44',
  freeze: '#44ddff',
  burn: '#ff8833',
  stun: '#ffdd44',
  slow: '#4488ff',
  weaken: '#aa44dd',
};

// ---- Debuff Default Durations (ms) ----

export const DEBUFF_DURATION_DEFAULTS: Record<string, number> = {
  poison: 5000,
  freeze: 3000,
  burn: 4000,
  stun: 2000,
  slow: 4000,
  weaken: 5000,
};

/** Loot popup display duration in milliseconds */
export const LOOT_POPUP_DURATION_MS = 5000;
