/* ══════════════════════════════════════════════
   world.css — RPG Live: World Map
   Original zone layout (village/training/forest/arena) — not a
   copy of any existing game's map or art, built from CSS shapes
   and emoji placeholders so real sprites can be dropped in later.
══════════════════════════════════════════════ */

.world-page { max-width: 1100px; margin: 0 auto; padding: 0 16px 60px; }

.world-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  margin: 16px 0;
}
.world-controls-hint {
  font-family: 'Share Tech Mono', monospace; font-size: 13px; color: var(--text-dim);
  background: var(--card-bg2); border: 1px solid var(--border-soft); padding: 8px 12px; border-radius: var(--radius);
}
.world-controls-hint b { color: var(--gold-bright); }

/* ---------- Map stage ---------- */
.world-stage-wrap {
  position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 640px;
  border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: #14100d; box-shadow: 0 0 40px rgba(0,0,0,0.5) inset;
}
.world-map {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.world-zone {
  position: absolute; border: 1px dashed rgba(255,255,255,0.08);
}
.world-zone-label {
  position: absolute; top: 8px; left: 10px; font-family: 'Cinzel', serif; font-size: 12px;
  letter-spacing: 1px; text-transform: uppercase; color: rgba(255,255,255,0.35);
  pointer-events: none;
}

/* ---------- NPC markers ---------- */
.world-npc {
  position: absolute; transform: translate(-50%, -50%); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  z-index: 3; transition: transform 0.15s ease;
}
.world-npc:hover { transform: translate(-50%, -50%) scale(1.15); }
.world-npc-emoji {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: var(--card-bg); border: 2px solid var(--gold-dim);
  box-shadow: 0 0 10px rgba(255,90,31,0.35);
}
.world-npc-label {
  font-family: 'Rajdhani', sans-serif; font-size: 10px; color: var(--text-dim);
  background: rgba(0,0,0,0.55); padding: 1px 5px; border-radius: 2px; white-space: nowrap;
}
.world-npc.in-range .world-npc-emoji { border-color: var(--green); box-shadow: 0 0 14px rgba(54,201,126,0.6); }

/* ---------- Players ---------- */
.world-player {
  position: absolute; transform: translate(-50%, -50%); z-index: 4;
  display: flex; flex-direction: column; align-items: center; pointer-events: none;
  transition: left 0.08s linear, top 0.08s linear;
}
.world-player-tag {
  font-family: 'Rajdhani', sans-serif; font-size: 10px; font-weight: 700; color: var(--gold-bright);
  background: rgba(0,0,0,0.6); padding: 1px 6px; border-radius: 2px; margin-bottom: 2px; white-space: nowrap;
}
.world-player.is-me .world-player-tag { color: var(--cyan); }

/* Layered character rig — same equip slots as the "Build Your Ninja"
   preview (weapon/armor/boots/aura). Each slot is currently a blank,
   labeled placeholder box: drop a sprite/PNG/spine animation into the
   matching slot's background-image later and these divs are already
   positioned + state-driven. */
.world-avatar-rig {
  position: relative; width: 46px; height: 46px;
}
.world-avatar-slot {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.world-avatar-body {
  font-size: 26px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6));
}
/* Empty equip-slot outlines — purely structural placeholders */
.world-avatar-slot.slot-weapon,
.world-avatar-slot.slot-armor,
.world-avatar-slot.slot-boots,
.world-avatar-slot.slot-aura {
  border-radius: 4px;
  opacity: 0.9;
}
.world-avatar-slot.slot-weapon { transform: translate(14px, -4px); }
.world-avatar-slot.slot-boots  { transform: translate(0, 16px); font-size: 12px; }
.world-avatar-slot.slot-aura   {
  border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,90,31,0.25) inset;
}

/* ── Placeholder animation state machine ──────────────────────────
   These classes are the ONLY thing that changes between states right
   now (a CSS transform/opacity pulse). Swap in a real sprite-sheet
   or Spine/Rive animation per state later — the state names + timing
   below (idle/run/attack/skill/hurt) are already wired end-to-end
   from keyboard input through the socket and back down to this class
   toggle, so only the *visual* needs to change, not the logic. */
.world-avatar-rig[data-state="idle"]   .world-avatar-body { animation: world-idle-bob 1.6s ease-in-out infinite; }
.world-avatar-rig[data-state="run"]    .world-avatar-body { animation: world-run-bob 0.35s ease-in-out infinite; }
.world-avatar-rig[data-state="attack"] .world-avatar-body { animation: world-attack-pulse 0.35s ease-out 1; }
.world-avatar-rig[data-state="skill"]  .world-avatar-body { animation: world-skill-flash 0.5s ease-out 1; }
.world-avatar-rig[data-state="hurt"]   .world-avatar-body { animation: world-hurt-shake 0.3s ease-in-out 1; }

@keyframes world-idle-bob   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes world-run-bob    { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-4px) rotate(-4deg); } }
@keyframes world-attack-pulse { 0% { transform: scale(1) rotate(0); } 40% { transform: scale(1.35) rotate(-18deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes world-skill-flash  { 0% { filter: drop-shadow(0 0 0 var(--purple)); } 50% { filter: drop-shadow(0 0 10px var(--purple-bright)); transform: scale(1.2); } 100% { filter: drop-shadow(0 0 0 var(--purple)); } }
@keyframes world-hurt-shake   { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* ---------- Nearby players / challenge UI ---------- */
.world-side-panel {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px;
}
@media (max-width: 720px) { .world-side-panel { grid-template-columns: 1fr; } }

.world-panel-card {
  background: var(--card-bg); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px 16px;
}
.world-panel-card h3 { font-family: 'Cinzel', serif; font-size: 15px; margin: 0 0 10px; color: var(--gold-bright); }

.world-nearby-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px;
}
.world-nearby-row:last-child { border-bottom: none; }
.world-nearby-name { color: var(--text); font-weight: 600; }
.world-nearby-lvl { color: var(--text-dim); font-size: 11px; }
.world-btn-challenge {
  font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 12px; padding: 4px 10px;
  background: var(--gold-dim); color: var(--text); border: 1px solid var(--gold); border-radius: 2px; cursor: pointer;
}
.world-btn-challenge:hover { background: var(--gold); }
.world-btn-challenge:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Modal (challenge / mission / duel) ---------- */
.world-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.world-modal {
  width: min(460px, 100%); background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.world-modal h3 { font-family: 'Cinzel', serif; margin: 0 0 8px; color: var(--gold-bright); }
.world-modal p { color: var(--text-dim); font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
.world-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.world-duel-bars { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.world-duel-fighter { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text); }
.world-hp-bar { height: 8px; border-radius: 4px; background: var(--dark3); overflow: hidden; margin-top: 3px; }
.world-hp-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width 0.3s ease; }
.world-duel-log { max-height: 140px; overflow-y: auto; font-family: 'Share Tech Mono', monospace; font-size: 12px; color: var(--text-dim); }
.world-duel-log div { padding: 2px 0; border-bottom: 1px dashed var(--border-soft); }

.world-status-badge {
  display: inline-block; font-family: 'Share Tech Mono', monospace; font-size: 12px; padding: 4px 10px;
  border-radius: 12px; border: 1px solid var(--border-soft); color: var(--text-dim); margin-bottom: 10px;
}
.world-status-badge.on  { color: var(--green); border-color: var(--green); }
.world-status-badge.off { color: var(--red); border-color: var(--red); }
