<?php
// Wiki pública de ElementalArms: docs + compra (premium) + reseñas.
require_once __DIR__ . '/../includes/init.php';
require_once __DIR__ . '/../includes/plugins.php';
$slug = 'elementalarms';
$loggedIn = is_logged_in();
$revTotal = 0; $revAvg = 0.0; $revList = []; $myRev = null; $revMsg = ''; $replies = [];

function wiki_pdo() {
    return new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8mb4', DB_USER, DB_PASS,
        [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC]);
}
function rw_stars($n) { $n = max(0, min(5, (int)$n)); return str_repeat('★', $n) . '<span class="off">' . str_repeat('★', 5 - $n) . '</span>'; }

if ($_SERVER['REQUEST_METHOD'] === 'POST' && ($_POST['do'] ?? '') === 'review' && $loggedIn) {
    csrf_check();
    $rating = (int)($_POST['rating'] ?? 0); $comment = trim($_POST['comment'] ?? '');
    if ($rating >= 1 && $rating <= 5 && $comment !== '') {
        try {
            $pdo = wiki_pdo();
            $o = $pdo->prepare("SELECT 1 FROM licenses WHERE user_id=? AND plugin_slug=? AND status='active' LIMIT 1");
            $o->execute([$_SESSION['uid'], $slug]); $owns = $o->fetchColumn() ? 1 : 0;
            $pdo->prepare("INSERT INTO reviews (user_id, plugin_slug, rating, comment, verified_buyer) VALUES (?,?,?,?,?)
                ON DUPLICATE KEY UPDATE rating=VALUES(rating), comment=VALUES(comment), verified_buyer=VALUES(verified_buyer), created_at=NOW()")
                ->execute([$_SESSION['uid'], $slug, $rating, $comment, $owns]);
            header('Location: ./?saved=1'); exit;
        } catch (Throwable $e) { $revMsg = 'No se pudo guardar tu reseña.'; }
    } else { $revMsg = 'Elige estrellas y escribe un comentario.'; }
}
try {
    $pdo = wiki_pdo();
    $s = $pdo->prepare("SELECT COUNT(*) c, COALESCE(AVG(rating),0) a FROM reviews WHERE plugin_slug=? AND status='visible'");
    $s->execute([$slug]); $sm = $s->fetch();
    $revTotal = (int)$sm['c']; $revAvg = round((float)$sm['a'], 1);
    $s = $pdo->prepare("SELECT r.id, r.rating, r.comment, r.created_at, us.username, us.role,
        (SELECT GROUP_CONCAT(l.plugin_slug) FROM licenses l WHERE l.user_id=r.user_id AND l.status='active') owned
        FROM reviews r JOIN users us ON us.id=r.user_id
        WHERE r.plugin_slug=? AND r.status='visible' ORDER BY r.created_at DESC LIMIT 100");
    $s->execute([$slug]); $revList = $s->fetchAll();
    try {
        $rp = $pdo->prepare("SELECT id, admin_reply, admin_reply_at FROM reviews WHERE plugin_slug=? AND admin_reply IS NOT NULL AND admin_reply<>''");
        $rp->execute([$slug]);
        foreach ($rp->fetchAll() as $x) { $replies[(int)$x['id']] = $x; }
    } catch (Throwable $e) {}
    if ($loggedIn) {
        $m = $pdo->prepare("SELECT rating, comment FROM reviews WHERE user_id=? AND plugin_slug=?");
        $m->execute([$_SESSION['uid'], $slug]); $myRev = $m->fetch() ?: null;
    }
} catch (Throwable $e) {}
$DL = e(BASE) . '/panel/buy.php?plugin=' . $slug;  // premium: compra directa (buy.php genérico lee el precio del manifiesto)
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ElementalArms — RPG Items, Elemental Damage & Abilities for Minecraft | infinity3113</title>
<meta name="description" content="ElementalArms: a complete RPG item suite for Minecraft — elemental weapons, item abilities, tiers with rolls, gems, sets and a full equipment menu. Native MythicMobs integration. No required dependencies.">
<meta property="og:title" content="ElementalArms — RPG Items, Elemental & Abilities">
<meta property="og:description" content="Elemental RPG weapons, 19 item abilities, tiers, gems, sets and a full equipment menu. Runs standalone.">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>%F0%9F%92%A7</text></svg>">
<link rel="stylesheet" href="../assets/app.css">
</head>
<body>
<style>
  #crhub{
    --bg:#081016; --bg2:#0a1620; --panel:#0f1e2a; --panel2:#132635;
    --line:rgba(255,255,255,.09); --line2:rgba(255,255,255,.14);
    --gold:#f6c453; --gold-deep:#e0a92e; --green:#34d2f2; --teal:#7fe0ff; --purple:#6ec6ff;
    --text:#eaf6fb; --muted:#9fb8c4; --muted2:#6f8895; --maxw:1200px;
    --sans:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
    --mono:ui-monospace,"SF Mono","Cascadia Code",Consolas,monospace;
    background:
      radial-gradient(1100px 600px at 82% -10%, rgba(52,210,242,.16), transparent 60%),
      radial-gradient(900px 520px at 4% 2%, rgba(110,198,255,.10), transparent 55%),
      linear-gradient(180deg,var(--bg2),var(--bg) 42%);
    color:var(--text);font-family:var(--sans);font-size:16px;line-height:1.62;min-height:100vh;overflow-x:hidden;
  }
  #crhub *{box-sizing:border-box}
  #crhub a{color:inherit;text-decoration:none}
  #crhub h1,#crhub h2,#crhub h3{line-height:1.12;margin:0;letter-spacing:-.02em}
  #crhub .eyebrow{font:600 12px/1 var(--mono);letter-spacing:.22em;text-transform:uppercase;color:var(--green)}
  #crhub .top{position:sticky;top:0;z-index:50;backdrop-filter:blur(14px);background:rgba(8,16,22,.8);border-bottom:1px solid var(--line)}
  #crhub .top .in{max-width:var(--maxw);margin:0 auto;padding:0 22px;display:flex;align-items:center;gap:14px;height:62px;flex-wrap:wrap}
  #crhub .brand{display:flex;align-items:center;gap:11px;margin-right:auto}
  #crhub .brand .logo{width:38px;height:38px;border-radius:10px;flex:none;background:linear-gradient(145deg,var(--green),#1f8fc0);display:grid;place-items:center;font-size:20px;box-shadow:0 6px 20px rgba(52,210,242,.35)}
  #crhub .brand b{font-size:15px;font-weight:800;display:block}
  #crhub .brand span{font:600 11px/1.3 var(--mono);color:var(--muted);letter-spacing:.06em}
  #crhub .navlink{font-size:13.5px;font-weight:700;color:var(--muted);padding:8px 10px;border-radius:9px}
  #crhub .navlink:hover{color:var(--text);background:var(--panel)}
  #crhub .langsw{display:flex;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:3px}
  #crhub .langsw button{border:0;background:transparent;color:var(--muted);font-family:var(--mono);font-size:12px;font-weight:600;padding:6px 9px;border-radius:7px;cursor:pointer}
  #crhub .langsw button:hover{color:var(--text)}
  #crhub .langsw button.on{background:linear-gradient(145deg,var(--green),#1f8fc0);color:#03151d}
  #crhub .layout{max-width:var(--maxw);margin:0 auto;padding:24px 22px 0;display:grid;grid-template-columns:246px minmax(0,1fr);gap:34px;align-items:start}
  #crhub .side{position:sticky;top:86px}
  #crhub .plugsel{display:flex;align-items:center;gap:10px;padding:12px 13px;border-radius:13px;margin-bottom:8px;border:1px solid var(--green);background:linear-gradient(180deg,rgba(52,210,242,.1),var(--panel))}
  #crhub .plugsel .ic{font-size:20px}
  #crhub .plugsel b{font-size:14.5px;font-weight:800;display:block}
  #crhub .plugsel small{font:600 10px/1.3 var(--mono);color:var(--muted2);letter-spacing:.08em}
  #crhub .sidelabel{font:600 10px/1 var(--mono);letter-spacing:.18em;text-transform:uppercase;color:var(--muted2);padding:14px 12px 8px}
  #crhub .sidenav{display:flex;flex-direction:column;gap:2px}
  #crhub .sidenav a{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:9px;font-size:14px;font-weight:600;color:var(--muted);cursor:pointer;border-left:2px solid transparent}
  #crhub .sidenav a .n{width:19px;text-align:center;opacity:.85}
  #crhub .sidenav a:hover{color:var(--text);background:var(--panel)}
  #crhub .sidenav a.on{color:var(--text);background:var(--panel);border-left-color:var(--green)}
  #crhub .content{min-width:0;padding-bottom:40px}
  #crhub .page{display:none}
  #crhub .page.active{display:block;animation:crfade .25s ease}
  @keyframes crfade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
  #crhub .crumb{font:600 12px/1 var(--mono);letter-spacing:.05em;color:var(--muted2);margin-bottom:14px}
  #crhub .crumb b{color:var(--green)}
  #crhub .ptitle{font-size:clamp(26px,4vw,36px);font-weight:800;margin-bottom:10px}
  #crhub .plead{color:var(--muted);font-size:16.5px;max-width:64ch;margin-bottom:24px}
  #crhub h3.sub{font-size:19px;font-weight:800;margin:32px 0 14px}
  #crhub .hero{display:grid;grid-template-columns:1.05fr .95fr;gap:34px;align-items:center;margin-bottom:14px}
  #crhub .badge{display:inline-flex;align-items:center;gap:8px;padding:7px 13px;border-radius:999px;background:var(--panel);border:1px solid var(--line2);font:600 12.5px/1 var(--sans);color:var(--muted);margin-bottom:20px}
  #crhub .badge .dot{width:7px;height:7px;border-radius:50%;background:var(--green);box-shadow:0 0 10px var(--green)}
  #crhub .hero h1{font-size:clamp(40px,6vw,66px);font-weight:900}
  #crhub .hero h1 .grad{background:linear-gradient(120deg,#fff 8%,var(--green) 52%,var(--teal));-webkit-background-clip:text;background-clip:text;color:transparent}
  #crhub .lede{color:var(--muted);font-size:clamp(15px,2vw,18px);margin:18px 0 26px;max-width:42ch}
  #crhub .cta{display:flex;gap:12px;flex-wrap:wrap}
  #crhub .btn{display:inline-flex;align-items:center;gap:9px;padding:12px 20px;border-radius:12px;font-weight:700;font-size:15px;cursor:pointer;border:1px solid transparent;transition:.18s}
  #crhub .btn.primary{background:linear-gradient(145deg,var(--green),#1f8fc0);color:#03151d;box-shadow:0 10px 26px rgba(52,210,242,.32)}
  #crhub .btn.primary:hover{transform:translateY(-2px)}
  #crhub .btn.ghost{background:var(--panel);border-color:var(--line2);color:var(--text)}
  #crhub .btn.ghost:hover{border-color:var(--green);color:var(--green)}
  #crhub .stats{display:flex;gap:24px;margin-top:30px;flex-wrap:wrap}
  #crhub .stats .s b{font-size:18px;font-weight:800;display:block}
  #crhub .stats .s span{font:600 10px/1 var(--mono);letter-spacing:.14em;text-transform:uppercase;color:var(--muted2)}
  #crhub .scroll{position:relative;justify-self:center;width:min(100%,380px);background:linear-gradient(180deg,var(--panel2),var(--panel));border:1px solid var(--line2);border-radius:22px;padding:22px}
  #crhub .scroll .mrow{display:flex;align-items:center;gap:10px;padding:11px 12px;border-radius:12px;background:#0a1620;border:1px solid var(--line);margin-bottom:9px}
  #crhub .scroll .mrow .e{font-size:20px}
  #crhub .scroll .mrow b{font-size:13.5px;font-weight:800;display:block}
  #crhub .scroll .mrow small{font:600 11px/1.2 var(--mono);color:var(--muted2)}
  #crhub .scroll .mrow .rr{margin-left:auto;font:800 11px/1 var(--mono);color:var(--gold)}
  #crhub .cards{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:20px}
  #crhub .card{background:linear-gradient(180deg,var(--panel),rgba(15,30,42,.55));border:1px solid var(--line);border-radius:16px;padding:18px;transition:.2s}
  #crhub .card:hover{border-color:var(--line2);transform:translateY(-3px)}
  #crhub .card .ico{width:42px;height:42px;border-radius:11px;display:grid;place-items:center;font-size:21px;margin-bottom:12px;background:var(--panel2);border:1px solid var(--line2)}
  #crhub .card h3{font-size:16px;font-weight:800}
  #crhub .card p{color:var(--muted);font-size:13.5px;margin:7px 0 0}
  #crhub .tablewrap{overflow-x:auto;border:1px solid var(--line);border-radius:14px;background:var(--panel);margin-top:8px}
  #crhub table{width:100%;border-collapse:collapse;min-width:480px}
  #crhub th,#crhub td{text-align:left;padding:12px 15px;border-bottom:1px solid var(--line);font-size:14px;vertical-align:top}
  #crhub th{font:600 11px/1 var(--mono);letter-spacing:.13em;text-transform:uppercase;color:var(--muted2)}
  #crhub tr:last-child td{border-bottom:0}
  #crhub code{font-family:var(--mono);font-size:12.5px;background:rgba(52,210,242,.12);color:var(--green);padding:3px 7px;border-radius:6px;white-space:nowrap}
  #crhub .perm{font-family:var(--mono);font-size:12px;color:var(--teal);white-space:nowrap}
  #crhub pre{background:#06121a;border:1px solid var(--line);border-radius:12px;padding:16px 18px;overflow-x:auto;margin:14px 0}
  #crhub pre code{background:none;color:#cfeefb;padding:0;white-space:pre;font-size:13px;line-height:1.7}
  #crhub .cmt{color:#5f7f8c}
  #crhub .note{margin-top:18px;padding:15px 17px;border-radius:12px;background:rgba(52,210,242,.08);border:1px solid rgba(52,210,242,.25);color:var(--muted);font-size:14px;display:flex;gap:11px}
  #crhub .note b{color:var(--text)}
  #crhub ol.steps{counter-reset:s;list-style:none;padding:0;margin:8px 0 0}
  #crhub ol.steps li{position:relative;padding:12px 0 12px 44px;border-bottom:1px solid var(--line);color:var(--muted);font-size:14.5px}
  #crhub ol.steps li:last-child{border-bottom:0}
  #crhub ol.steps li::before{counter-increment:s;content:counter(s);position:absolute;left:0;top:10px;width:30px;height:30px;border-radius:9px;background:var(--panel2);border:1px solid var(--line2);color:var(--green);font:800 13px/30px var(--mono);text-align:center}
  #crhub ol.steps b{color:var(--text)}
  #crhub .rev-head{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:18px}
  #crhub .rev-avg{font-size:40px;font-weight:900}
  #crhub .rev-st{color:var(--gold);letter-spacing:2px} #crhub .off{color:#39505c}
  #crhub .rev-form{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:18px;margin-bottom:16px}
  #crhub .starpick{display:flex;gap:6px;font-size:28px;color:#39505c;cursor:pointer}
  #crhub .starpick span.hot{color:var(--gold)}
  #crhub .rev-ta{width:100%;margin-top:12px;background:#0a1620;border:1px solid var(--line2);border-radius:10px;color:var(--text);padding:11px 13px;font-family:inherit;font-size:14px;min-height:80px;resize:vertical}
  #crhub .rev-cta{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:16px;display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px;color:var(--muted)}
  #crhub .rev-item{display:flex;gap:13px;padding:15px 0;border-bottom:1px solid var(--line)}
  #crhub .rev-item:last-child{border-bottom:0}
  #crhub .ra{width:40px;height:40px;border-radius:11px;flex:none;background:var(--panel2);border:1px solid var(--line2);display:grid;place-items:center;font-weight:800;color:var(--green)}
  #crhub .rev-top{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
  #crhub .who{font-weight:800} #crhub .when{font:600 11px/1 var(--mono);color:var(--muted2);margin-left:auto}
  #crhub .rev-body p{margin:6px 0 0;color:var(--muted);font-size:14px}
  #crhub .rev-empty{color:var(--muted2)}
  #crhub .pbadge{display:inline-flex;align-items:center;gap:4px;font:700 10px/1 var(--mono);text-transform:uppercase;letter-spacing:.05em;padding:3px 7px;border-radius:6px;background:linear-gradient(145deg,var(--gold),var(--gold-deep));color:#241a06}
  #crhub footer{border-top:1px solid var(--line);margin-top:30px}
  #crhub footer .in{max-width:var(--maxw);margin:0 auto;padding:22px;display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;color:var(--muted2);font-size:13px}
  #crhub footer .dom{font-family:var(--mono)}
  @media(max-width:860px){#crhub .layout{grid-template-columns:1fr}#crhub .side{position:static}#crhub .sidenav{flex-direction:row;flex-wrap:wrap}#crhub .hero{grid-template-columns:1fr}#crhub .cards{grid-template-columns:1fr 1fr}}
  @media(max-width:520px){#crhub .cards{grid-template-columns:1fr}}
</style>

<div id="crhub">
  <div class="top"><div class="in">
    <a class="brand" href="<?= e(BASE) ?>/">
      <div class="logo">💧</div>
      <div><b>ElementalArms</b><span data-i18n="brandSub">Minecraft Plugins</span></div>
    </a>
    <a class="navlink" href="<?= e(BASE) ?>/" data-i18n="navHubPlugins">Plugins</a>
    <?php if ($loggedIn): ?>
      <a class="navlink" href="<?= e(BASE) ?>/panel/" data-i18n="navMyPanel">My panel</a>
      <a class="navlink" href="<?= e(BASE) ?>/logout.php" data-i18n="navLogout">Log out</a>
    <?php else: ?>
      <a class="navlink" href="<?= e(BASE) ?>/login.php" data-i18n="navLogin">Log in</a>
      <a class="navlink" href="<?= e(BASE) ?>/register.php" data-i18n="navRegister">Sign up</a>
    <?php endif; ?>
    <div class="langsw">
      <button data-lang="en">EN</button><button data-lang="es">ES</button>
    </div>
  </div></div>

  <div class="layout">
    <aside class="side">
      <div class="plugsel"><span class="ic">💧</span><div><b>ElementalArms</b><small>v1.0 · FREE</small></div></div>
      <div class="sidelabel" data-i18n="sideDocs">Documentation</div>
      <nav class="sidenav">
        <a class="on" data-page="overview"><span class="n">◆</span><span data-i18n="navOverview">Overview</span></a>
        <a data-page="install"><span class="n">▸</span><span data-i18n="navInstall">Installation</span></a>
        <a data-page="items"><span class="n">▸</span><span data-i18n="navItems">Items &amp; tiers</span></a>
        <a data-page="elemental"><span class="n">▸</span><span data-i18n="navElemental">Elemental damage</span></a>
        <a data-page="abilities"><span class="n">▸</span><span data-i18n="navAbilities">Abilities</span></a>
        <a data-page="equipment"><span class="n">▸</span><span data-i18n="navEquipment">Equipment &amp; accessories</span></a>
        <a data-page="progression"><span class="n">▸</span><span data-i18n="navProgress">Upgrade &amp; gems</span></a>
        <a data-page="commands"><span class="n">▸</span><span data-i18n="navCommands">Commands</span></a>
        <a data-page="perms"><span class="n">▸</span><span data-i18n="navPerms">Permissions</span></a>
        <a data-page="placeholders"><span class="n">▸</span><span data-i18n="navPlaceholders">Placeholders</span></a>
        <a data-page="config"><span class="n">▸</span><span data-i18n="navConfig">Configuration</span></a>
        <a data-page="reviews"><span class="n">★</span><span data-i18n="navReviews">Reviews</span></a>
      </nav>
    </aside>

    <main class="content">

      <!-- OVERVIEW -->
      <section class="page active" data-p="overview">
        <div class="hero">
          <div>
            <span class="badge"><span class="dot"></span><span data-i18n="heroBadge">RPG items for Minecraft · 1.21+</span></span>
            <h1>Elemental<span class="grad">Arms</span></h1>
            <p class="lede" data-i18n="heroTagline">The complete RPG gear suite: elemental weapons, item abilities, tiers with random rolls, gems, sets and a full equipment menu — all with a visual in-game editor.</p>
            <div class="cta">
              <a class="btn primary" href="<?= $DL ?>">🛒 <span data-i18n="btnBuy">Get it · $8.99</span></a>
              <a class="btn ghost" data-page="install" onclick="return false"><span data-i18n="btnInstall">Installation</span></a>
            </div>
            <div class="stats">
              <div class="s"><b>1.0.0</b><span data-i18n="statVersion">Version</span></div>
              <div class="s"><b>1.21+</b><span data-i18n="statMc">Minecraft</span></div>
              <div class="s"><b data-i18n="statNoneVal">None</b><span data-i18n="statDeps">Required deps</span></div>
              <div class="s"><b>ES · EN</b><span data-i18n="statLangs">Languages</span></div>
            </div>
          </div>
          <div class="scroll">
            <div class="mrow"><span class="e">⚔️</span><div><b data-i18n="ovItems">Custom items</b><small data-i18n="ovItemsEx">Stats, rarities, lore</small></div></div>
            <div class="mrow"><span class="e">🔥</span><div><b data-i18n="ovElem">Elemental damage</b><small data-i18n="ovElemEx">Weakness &amp; resistance</small></div><span class="rr">12</span></div>
            <div class="mrow"><span class="e">✨</span><div><b data-i18n="ovAbil">Item abilities</b><small data-i18n="ovAbilEx">Bind to any item</small></div><span class="rr">19</span></div>
            <div class="mrow"><span class="e">💎</span><div><b data-i18n="ovGems">Tiers &amp; gems</b><small data-i18n="ovGemsEx">Rolls, sockets, reforge</small></div></div>
            <div class="mrow"><span class="e">🎒</span><div><b data-i18n="ovEquip">Equipment menu</b><small data-i18n="ovEquipEx">Rings, amulets, talismans</small></div></div>
          </div>
        </div>

        <h3 class="sub" data-i18n="featuresTitle">A full RPG item system</h3>
        <div class="cards">
          <div class="card"><div class="ico">⚔️</div><h3 data-i18n="f1t">Custom items</h3><p data-i18n="f1d">Weapons, armor, bows, wands, rings, amulets, talismans, gems and consumables — with stats, rarities and dynamic lore.</p></div>
          <div class="card"><div class="ico">🔥</div><h3 data-i18n="f2t">12 elements</h3><p data-i18n="f2d">Fire, ice, lightning, poison, arcane and more. Mobs can be weak or resistant, shown live with ▲ / ▼.</p></div>
          <div class="card"><div class="ico">✦</div><h3 data-i18n="f3t">Floating damage</h3><p data-i18n="f3d">Native damage numbers — weapon, critical, elemental and ability each pop as their own colored number. No dependency.</p></div>
          <div class="card"><div class="ico">💠</div><h3 data-i18n="f4t">Tiers with rolls</h3><p data-i18n="f4d">Common to Mythic. Each item rolls its stats within its tier — two of the same weapon are never identical.</p></div>
          <div class="card"><div class="ico">✨</div><h3 data-i18n="f5t">19 item abilities</h3><p data-i18n="f5d">Fireball, lightning, lifesteal, heal, shield, teleport… bound to any item with triggers (click, on-hit, on-kill…).</p></div>
          <div class="card"><div class="ico">💎</div><h3 data-i18n="f6t">Upgrade · Reforge · Gems</h3><p data-i18n="f6d">Level items to +N, re-roll their stats and socket gems — all by dragging the stone/gem onto the item.</p></div>
          <div class="card"><div class="ico">🎒</div><h3 data-i18n="f7t">Equipment menu</h3><p data-i18n="f7d">Real armor, two hands, shield, elytra, plus slots for 2 rings, amulet, pendant and talisman, with a character sheet.</p></div>
          <div class="card"><div class="ico">🛠️</div><h3 data-i18n="f8t">Visual editor</h3><p data-i18n="f8d">Create items, abilities, tiers, sets and crafting stations from an in-game GUI — no YAML needed.</p></div>
          <div class="card"><div class="ico">🧩</div><h3 data-i18n="f9t">Integrations</h3><p data-i18n="f9d">Native MythicMobs (weaknesses + drops + skills), PlaceholderAPI and MMOCore. All optional.</p></div>
        </div>
        <div class="note">✅ <div><b data-i18n="noReqT">No required dependencies.</b> <span data-i18n="noReqD">ElementalArms runs on its own. MythicMobs, PlaceholderAPI and MMOCore are optional and activate automatically.</span></div></div>
      </section>

      <!-- INSTALL -->
      <section class="page" data-p="install">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navInstall">Installation</span></div>
        <h2 class="ptitle" data-i18n="navInstall">Installation</h2>
        <p class="plead" data-i18n="instLead">Get ElementalArms running in a minute — it needs no other plugin.</p>
        <ol class="steps">
          <li data-i18n="ist1">Buy and download <b>ElementalArms.jar</b>, then drop it into your server's <b>plugins/</b> folder.</li>
          <li data-i18n="ist2"><b>Restart</b> the server (Java 21 required for 1.21+).</li>
          <li data-i18n="ist3">(Optional) Install MythicMobs, PlaceholderAPI or MMOCore — they hook in automatically.</li>
          <li data-i18n="ist4">Edit anything from <code>/ea editor</code> or the config files, then run <code>/ea reload</code>.</li>
        </ol>
        <div class="note">ℹ️ <div><span data-i18n="instNote">Example items, tiers, sets, abilities and stations are generated on first start so you have a working setup to build on.</span></div></div>
      </section>

      <!-- ITEMS -->
      <section class="page" data-p="items">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navItems">Items &amp; tiers</span></div>
        <h2 class="ptitle" data-i18n="navItems">Items &amp; tiers</h2>
        <p class="plead" data-i18n="itLead">Every item is defined in YAML or from the editor, with stats, a rarity, a tier and dynamic lore.</p>
        <div class="tablewrap"><table>
          <tr><th data-i18n="itColA">Concept</th><th data-i18n="itColB">What it does</th></tr>
          <tr><td data-i18n="it1a">Types</td><td data-i18n="it1b">Sword, axe, bow, crossbow, spear, shield, armor, wand, ring, amulet, talisman, gem, consumable.</td></tr>
          <tr><td data-i18n="it2a">Stats</td><td data-i18n="it2b">Damage, attack speed, crit chance/damage, max health, armor, defense, toughness, knockback resist, movement speed.</td></tr>
          <tr><td data-i18n="it3a">Tiers</td><td data-i18n="it3b">Common → Mythic. Each tier rolls stats in a range, so items of the same kind vary. <code>tier: RANDOM</code> picks one by weight.</td></tr>
          <tr><td data-i18n="it4a">Soulbound</td><td data-i18n="it4b">Binds an item to the player who picks it up; others can't use it and it can't be dropped.</td></tr>
          <tr><td data-i18n="it5a">Requirements</td><td data-i18n="it5b">Gate an item behind a level, permission or class (uses MMOCore level/class if present).</td></tr>
          <tr><td data-i18n="it6a">Durability</td><td data-i18n="it6b">Optional custom durability that warns and breaks on its own.</td></tr>
        </table></div>
        <div class="note">🛠️ <div><span data-i18n="itEditor">Create and edit all of this from <code>/ea editor</code> — pick a category, an item, and click each property.</span></div></div>
      </section>

      <!-- ELEMENTAL -->
      <section class="page" data-p="elemental">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navElemental">Elemental damage</span></div>
        <h2 class="ptitle" data-i18n="navElemental">Elemental damage</h2>
        <p class="plead" data-i18n="elLead">Weapons deal elemental damage on top of physical. Mobs can be weak (more damage) or resistant (less) to each element.</p>
        <div class="tablewrap"><table>
          <tr><th>Element</th><th>Element</th><th>Element</th></tr>
          <tr><td>🔥 Fire</td><td>❄ Ice</td><td>💧 Water</td></tr>
          <tr><td>🪨 Earth</td><td>🌪 Wind</td><td>⚡ Lightning</td></tr>
          <tr><td>☠ Poison</td><td>✨ Light</td><td>🌑 Dark</td></tr>
          <tr><td>🕊 Holy</td><td>🌿 Nature</td><td>🔮 Arcane</td></tr>
        </table></div>
        <p class="plead" data-i18n="elWeak">Weakness and resistance show live as ▲ / ▼ on the floating damage number. Set them per mob, or per MythicMobs mob with the native mechanic.</p>
        <div class="note">🔥 <div><span data-i18n="elNote">The floating numbers are native — weapon, crit, elemental and ability damage each appear as their own colored, staggered number.</span></div></div>
      </section>

      <!-- ABILITIES -->
      <section class="page" data-p="abilities">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navAbilities">Abilities</span></div>
        <h2 class="ptitle" data-i18n="navAbilities">Item abilities</h2>
        <p class="plead" data-i18n="abLead">Bind any of the 19 built-in abilities to an item, with a trigger, cooldown, chance and its own parameters. Configure it all from the editor.</p>
        <div class="tablewrap"><table>
          <tr><th data-i18n="abColA">Trigger</th><th data-i18n="abColB">When it fires</th></tr>
          <tr><td><code>RIGHT_CLICK</code> / <code>LEFT_CLICK</code></td><td data-i18n="ab1b">On right/left click — aims where you look.</td></tr>
          <tr><td><code>ON_HIT</code></td><td data-i18n="ab2b">When you hit an entity with the item.</td></tr>
          <tr><td><code>WHEN_DAMAGED</code></td><td data-i18n="ab3b">When something damages you.</td></tr>
          <tr><td><code>ON_KILL</code></td><td data-i18n="ab4b">When you kill an entity.</td></tr>
        </table></div>
        <p class="plead" data-i18n="abList"><b>Abilities:</b> fireball, lightning, aoe_damage, explosion, heal, lifesteal, shield, speed, strength, regeneration, resistance, poison, wither, blind, freeze, ignite, knockback, pull, leap, teleport. Plus <code>mythic:YourSkill</code> to run a MythicMobs skill.</p>
      </section>

      <!-- EQUIPMENT -->
      <section class="page" data-p="equipment">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navEquipment">Equipment &amp; accessories</span></div>
        <h2 class="ptitle" data-i18n="navEquipment">Equipment &amp; accessories</h2>
        <p class="plead" data-i18n="eqLead">Open <code>/ea inventory</code> for a full equipment menu: armor, two hands, shield and elytra, plus dedicated accessory slots.</p>
        <div class="tablewrap"><table>
          <tr><th data-i18n="eqColA">Slot</th><th data-i18n="eqColB">Accepts</th></tr>
          <tr><td data-i18n="eq1a">2 Rings</td><td><code>RING</code></td></tr>
          <tr><td data-i18n="eq2a">Amulet</td><td><code>AMULET</code></td></tr>
          <tr><td data-i18n="eq3a">Pendant</td><td><code>NECKLACE</code></td></tr>
          <tr><td data-i18n="eq4a">Talisman</td><td><code>TALISMAN</code></td></tr>
        </table></div>
        <p class="plead" data-i18n="eqSheet"><code>/ea stats</code> opens a character sheet grouped by offense / defense / mobility, with all elemental damage folded into a single icon so it never clutters — no matter how many elements you carry.</p>
      </section>

      <!-- PROGRESSION -->
      <section class="page" data-p="progression">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navProgress">Upgrade &amp; gems</span></div>
        <h2 class="ptitle" data-i18n="navProgress">Upgrade · Reforge · Gems</h2>
        <p class="plead" data-i18n="prLead">The progression loop, all with one natural gesture — grab the stone or gem and click the item.</p>
        <div class="tablewrap"><table>
          <tr><th data-i18n="prColA">Action</th><th data-i18n="prColB">What it does</th></tr>
          <tr><td data-i18n="pr1a">Upgrade (+N)</td><td data-i18n="pr1b">An upgrade stone raises all stats a % per level, up to a max. Optional success chance.</td></tr>
          <tr><td data-i18n="pr2a">Reforge</td><td data-i18n="pr2b">A reforge stone re-rolls the item's stats within its tier — it can come out better or worse.</td></tr>
          <tr><td data-i18n="pr3a">Gems / sockets</td><td data-i18n="pr3b">Items can have sockets; drag a gem in to add its stats. Slots shown as ◆ / ◇.</td></tr>
          <tr><td data-i18n="pr4a">Sets</td><td data-i18n="pr4b">Cumulative bonuses for wearing 2 / 3 / 4 pieces of the same set.</td></tr>
        </table></div>
        <div class="note">🔨 <div><span data-i18n="prStation">Craft the stones and gems at your own <b>crafting stations</b> (<code>/ea station</code>), or drop them from mobs and blocks with drop tables.</span></div></div>
      </section>

      <!-- COMMANDS -->
      <section class="page" data-p="commands">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navCommands">Commands</span></div>
        <h2 class="ptitle" data-i18n="navCommands">Commands</h2>
        <p class="plead" data-i18n="cmdLead">Base: <code>/elementalarms</code> · aliases <code>/ea</code>, <code>/earms</code></p>
        <div class="tablewrap"><table>
          <tr><th data-i18n="cmdColA">Command</th><th data-i18n="cmdColB">What it does</th></tr>
          <tr><td><code>/ea inventory</code></td><td data-i18n="cmd1">Open your equipment menu</td></tr>
          <tr><td><code>/ea stats</code></td><td data-i18n="cmd2">Your character sheet</td></tr>
          <tr><td><code>/ea editor</code></td><td data-i18n="cmd3">The visual item / ability editor</td></tr>
          <tr><td><code>/ea station &lt;id&gt;</code></td><td data-i18n="cmd4">Open a crafting station</td></tr>
          <tr><td><code>/ea give &lt;player&gt; &lt;item&gt; [n]</code></td><td data-i18n="cmd5">Give a custom item</td></tr>
          <tr><td><code>/ea list</code> · <code>/ea reload</code></td><td data-i18n="cmd6">List items · reload config</td></tr>
        </table></div>
      </section>

      <!-- PERMS -->
      <section class="page" data-p="perms">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navPerms">Permissions</span></div>
        <h2 class="ptitle" data-i18n="navPerms">Permissions</h2>
        <div class="tablewrap"><table>
          <tr><th data-i18n="pmColA">Permission</th><th data-i18n="pmColB">Grants</th><th>Default</th></tr>
          <tr><td><code>elementalarms.admin</code></td><td data-i18n="pm1">Editor, give, reload and admin tools</td><td>op</td></tr>
        </table></div>
        <p class="plead" data-i18n="pmNote">Players use the menus (<code>/ea inventory</code>, <code>/ea stats</code>) without any permission.</p>
      </section>

      <!-- PLACEHOLDERS -->
      <section class="page" data-p="placeholders">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navPlaceholders">Placeholders</span></div>
        <h2 class="ptitle" data-i18n="navPlaceholders">Placeholders</h2>
        <p class="plead" data-i18n="phLead">With PlaceholderAPI installed:</p>
        <div class="tablewrap"><table>
          <tr><th>Placeholder</th><th data-i18n="phColB">Returns</th></tr>
          <tr><td><code>%elementalarms_stat_damage%</code></td><td data-i18n="ph1">Total of any stat (damage, defense…)</td></tr>
          <tr><td><code>%elementalarms_set%</code></td><td data-i18n="ph2">Active set name</td></tr>
          <tr><td><code>%elementalarms_tier%</code></td><td data-i18n="ph3">Tier of the item in hand</td></tr>
          <tr><td><code>%elementalarms_upgrade%</code></td><td data-i18n="ph4">Upgrade level of the item in hand</td></tr>
          <tr><td><code>%elementalarms_durability%</code></td><td data-i18n="ph5">Custom durability of the item in hand</td></tr>
        </table></div>
      </section>

      <!-- CONFIG -->
      <section class="page" data-p="config">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navConfig">Configuration</span></div>
        <h2 class="ptitle" data-i18n="navConfig">Configuration</h2>
        <p class="plead" data-i18n="cfgLead">Everything is configurable. The main files, all reloadable with <code>/ea reload</code>:</p>
        <div class="tablewrap"><table>
          <tr><th data-i18n="cfgColA">File</th><th data-i18n="cfgColB">What it holds</th></tr>
          <tr><td><code>config.yml</code></td><td data-i18n="cfg1">Damage indicators, recipes, upgrade/reforge/gems, requirements, drops, stations, accessories.</td></tr>
          <tr><td><code>items/</code></td><td data-i18n="cfg2">Your custom items, one file per category.</td></tr>
          <tr><td><code>items/configurations/</code></td><td data-i18n="cfg3">Tiers, sets, rarities, elements, stats, lore formats, drop tables.</td></tr>
          <tr><td><code>stations.yml</code></td><td data-i18n="cfg4">Crafting stations and their recipes.</td></tr>
        </table></div>
        <div class="note">🛠️ <div><span data-i18n="cfgNote">Prefer clicking to typing? <code>/ea editor</code> writes all of these files for you.</span></div></div>
      </section>
            <section class="page" data-p="reviews">
        <div class="crumb"><b>ElementalArms</b> / <span data-i18n="navReviews">Reviews</span></div>
        <h2 class="ptitle" data-i18n="reviewsTitle">Player reviews</h2>
        <p class="plead" data-i18n="reviewsSub">What server owners think of ElementalArms.</p>
        <div class="rev-head">
          <div class="rev-avg"><?= $revTotal ? number_format($revAvg,1) : '—' ?></div>
          <div>
            <div class="rev-st"><?= $revTotal ? rw_stars((int)round($revAvg)) : '<span class="off">★★★★★</span>' ?></div>
            <div style="font:600 12px/1 var(--mono);color:var(--muted2);margin-top:5px"><?= $revTotal ?> <span data-i18n="reviewsWord">reviews</span></div>
          </div>
        </div>

        <?php if ($revMsg): ?><div class="note" style="border-color:rgba(246,196,83,.4)"><?= e($revMsg) ?></div><?php endif; ?>

        <?php if ($loggedIn): ?>
          <div class="rev-form">
            <div style="font-weight:800;margin-bottom:10px"><?= $myRev ? '<span data-i18n="reviewEditT">Edit your review</span>' : '<span data-i18n="reviewWriteT">Write a review</span>' ?></div>
            <form method="post">
              <?= csrf_field() ?>
              <input type="hidden" name="do" value="review">
              <input type="hidden" name="rating" id="rating" value="<?= $myRev ? (int)$myRev['rating'] : 0 ?>">
              <div class="starpick" id="starpick">
                <span data-v="1">★</span><span data-v="2">★</span><span data-v="3">★</span><span data-v="4">★</span><span data-v="5">★</span>
              </div>
              <textarea class="rev-ta" name="comment" maxlength="1000" data-i18n-ph="reviewPh" placeholder="Share your experience…"><?= htmlspecialchars($myRev['comment'] ?? '', ENT_QUOTES) ?></textarea>
              <div style="margin-top:12px"><button class="btn primary" type="submit"><?= $myRev ? '<span data-i18n="reviewUpdate">Update review</span>' : '<span data-i18n="reviewPublish">Publish review</span>' ?></button></div>
            </form>
          </div>
        <?php else: ?>
          <div class="rev-cta">
            <span data-i18n="reviewsLoginPrompt">Log in to leave a review.</span>
            <a class="btn ghost" href="<?= e(BASE) ?>/login.php" data-i18n="navLogin">Log in</a>
          </div>
        <?php endif; ?>

        <div class="rev-list">
          <?php if ($revList): foreach ($revList as $r):
            $ini = strtoupper(mb_substr($r['username'], 0, 2));
            $cmt = nl2br(htmlspecialchars($r['comment'], ENT_QUOTES, 'UTF-8')); ?>
            <div class="rev-item">
              <span class="ra"><?= htmlspecialchars($ini, ENT_QUOTES) ?></span>
              <div class="rev-body">
                <div class="rev-top">
                  <span class="who"><?= htmlspecialchars($r['username'], ENT_QUOTES) ?></span>
                  <?= review_badges(($r['role'] ?? '')==='admin', $r['owned']) ?>
                  <span class="when"><?= date('d M Y', strtotime($r['created_at'])) ?></span>
                </div>
                <div class="rev-st"><?= rw_stars((int)$r['rating']) ?></div>
                <p><?= $cmt ?></p>
                <?php if (!empty($replies[(int)$r['id']])): $rep = $replies[(int)$r['id']]; ?>
                  <div class="adminreply">
                    <div class="arhead"><?= role_badge(true) ?><span class="lbl">infinity3113</span><span class="when"><?= date('d M Y', strtotime($rep['admin_reply_at'])) ?></span></div>
                    <p><?= nl2br(htmlspecialchars($rep['admin_reply'], ENT_QUOTES, 'UTF-8')) ?></p>
                  </div>
                <?php endif; ?>
              </div>
            </div>
          <?php endforeach; else: ?>
            <p class="rev-empty" data-i18n="reviewsNone">No reviews yet — be the first!</p>
          <?php endif; ?>
        </div>
      </section>

    </main>
  </div>

  <footer><div class="in">
    <span data-i18n="footMade">Made by infinity3113 · ElementalArms</span>
    <span class="dom">infinity3113.mc-paradise.com/plugins/elementalarms</span>
  </div></footer>
</div>

<script>
(function(){
  var I18N={
    es:{
      brandSub:"Plugins de Minecraft",sideDocs:"Documentación",navHubPlugins:"Plugins",navMyPanel:"Mi panel",navLogout:"Salir",navLogin:"Entrar",navRegister:"Crear cuenta",
      navOverview:"Resumen",navInstall:"Instalación",navItems:"Ítems y tiers",navElemental:"Daño elemental",navAbilities:"Habilidades",navEquipment:"Equipo y accesorios",navProgress:"Mejora y gemas",navCommands:"Comandos",navPerms:"Permisos",navPlaceholders:"Placeholders",navConfig:"Configuración",navReviews:"Reseñas",
      heroBadge:"Ítems RPG para Minecraft · 1.21+",heroTagline:"La suite de equipo RPG completa: armas elementales, habilidades por ítem, tiers con tiradas, gemas, sets y un menú de equipo completo — todo con editor visual in-game.",
      btnBuy:"Conseguir · 8,99 $",btnInstall:"Instalación",statVersion:"Versión",statMc:"Minecraft",statNoneVal:"Ninguna",statDeps:"Dependencias",statLangs:"Idiomas",
      ovItems:"Ítems custom",ovItemsEx:"Stats, rarezas, lore",ovElem:"Daño elemental",ovElemEx:"Debilidad y resistencia",ovAbil:"Habilidades",ovAbilEx:"En cualquier ítem",ovGems:"Tiers y gemas",ovGemsEx:"Tiradas, sockets, reforja",ovEquip:"Menú de equipo",ovEquipEx:"Anillos, amuletos, talismanes",
      featuresTitle:"Un sistema de ítems RPG completo",
      f1t:"Ítems custom",f1d:"Armas, armaduras, arcos, varitas, anillos, amuletos, talismanes, gemas y consumibles — con stats, rarezas y lore dinámico.",
      f2t:"12 elementos",f2d:"Fuego, hielo, rayo, veneno, arcano y más. Los mobs pueden ser débiles o resistentes, mostrado en vivo con ▲ / ▼.",
      f3t:"Daño flotante",f3d:"Números de daño nativos — arma, crítico, elemental y habilidad, cada uno con su color. Sin dependencias.",
      f4t:"Tiers con tiradas",f4d:"De Común a Mítico. Cada ítem tira sus stats dentro de su tier — dos armas iguales nunca son idénticas.",
      f5t:"19 habilidades",f5d:"Bola de fuego, rayo, robo de vida, curación, escudo, teletransporte… enlazadas a cualquier ítem con triggers (click, al golpear, al matar…).",
      f6t:"Mejora · Reforja · Gemas",f6d:"Sube ítems a +N, vuelve a tirar sus stats y engarza gemas — todo arrastrando la piedra/gema sobre el ítem.",
      f7t:"Menú de equipo",f7d:"Armadura real, dos manos, escudo, elytra, y slots para 2 anillos, amuleto, colgante y talismán, con hoja de personaje.",
      f8t:"Editor visual",f8d:"Crea ítems, habilidades, tiers, sets y estaciones desde una GUI in-game — sin tocar YAML.",
      f9t:"Integraciones",f9d:"MythicMobs nativo (debilidades + drops + skills), PlaceholderAPI y MMOCore. Todas opcionales.",
      noReqT:"Sin dependencias obligatorias.",noReqD:"ElementalArms funciona solo. MythicMobs, PlaceholderAPI y MMOCore son opcionales y se activan solos.",
      instLead:"Pon ElementalArms en marcha en un minuto — no necesita ningún otro plugin.",
      ist1:"Compra y descarga <b>ElementalArms.jar</b> y ponlo en la carpeta <b>plugins/</b> de tu servidor.",ist2:"<b>Reinicia</b> el servidor (se requiere Java 21 para 1.21+).",ist3:"(Opcional) Instala MythicMobs, PlaceholderAPI o MMOCore — se enganchan solos.",ist4:"Edita todo desde <code>/ea editor</code> o los archivos, y ejecuta <code>/ea reload</code>.",
      instNote:"Al arrancar por primera vez se generan ítems, tiers, sets, habilidades y estaciones de ejemplo, para que tengas una base funcional sobre la que construir.",
      itLead:"Cada ítem se define en YAML o desde el editor, con stats, una rareza, un tier y lore dinámico.",itColA:"Concepto",itColB:"Qué hace",
      it1a:"Tipos",it1b:"Espada, hacha, arco, ballesta, lanza, escudo, armadura, varita, anillo, amuleto, talismán, gema, consumible.",
      it2a:"Stats",it2b:"Daño, velocidad de ataque, prob./daño crítico, vida máx, armadura, defensa, dureza, resistencia a empuje, velocidad.",
      it3a:"Tiers",it3b:"De Común a Mítico. Cada tier tira los stats en un rango, así los ítems del mismo tipo varían. <code>tier: RANDOM</code> elige uno por peso.",
      it4a:"Soulbound",it4b:"Vincula el ítem al jugador que lo recoge; otros no pueden usarlo ni se puede tirar.",
      it5a:"Requisitos",it5b:"Bloquea un ítem tras un nivel, permiso o clase (usa el nivel/clase de MMOCore si está).",
      it6a:"Durabilidad",it6b:"Durabilidad custom opcional que avisa y se rompe sola.",
      itEditor:"Crea y edita todo esto desde <code>/ea editor</code> — elige una categoría, un ítem, y haz click en cada propiedad.",
      elLead:"Las armas hacen daño elemental además del físico. Los mobs pueden ser débiles (más daño) o resistentes (menos) a cada elemento.",
      elWeak:"La debilidad y la resistencia salen en vivo como ▲ / ▼ en el número de daño flotante. Configúralas por mob, o por mob de MythicMobs con el mechanic nativo.",
      elNote:"Los números flotantes son nativos — daño de arma, crítico, elemental y de habilidad, cada uno como su propio número de color, escalonado.",
      abLead:"Enlaza cualquiera de las 19 habilidades integradas a un ítem, con trigger, cooldown, probabilidad y sus propios parámetros. Todo desde el editor.",abColA:"Trigger",abColB:"Cuándo se lanza",
      ab1b:"Con click derecho/izquierdo — apunta a donde miras.",ab2b:"Al golpear a una entidad con el ítem.",ab3b:"Cuando algo te hace daño.",ab4b:"Al matar a una entidad.",
      abList:"<b>Habilidades:</b> fireball, lightning, aoe_damage, explosion, heal, lifesteal, shield, speed, strength, regeneration, resistance, poison, wither, blind, freeze, ignite, knockback, pull, leap, teleport. Y <code>mythic:TuSkill</code> para lanzar una skill de MythicMobs.",
      eqLead:"Abre <code>/ea inventory</code> para un menú de equipo completo: armadura, dos manos, escudo y elytra, más slots de accesorio dedicados.",eqColA:"Slot",eqColB:"Acepta",
      eq1a:"2 anillos",eq2a:"Amuleto",eq3a:"Colgante",eq4a:"Talismán",
      eqSheet:"<code>/ea stats</code> abre una hoja de personaje por categorías (ofensiva / defensiva / movilidad), con todo el daño elemental agrupado en un icono para que nunca sature — tengas los elementos que tengas.",
      prLead:"El bucle de progresión, todo con un gesto natural — coge la piedra o gema y haz click en el ítem.",prColA:"Acción",prColB:"Qué hace",
      pr1a:"Mejora (+N)",pr1b:"Una piedra de mejora sube todos los stats un % por nivel, hasta un máximo. Probabilidad de éxito opcional.",
      pr2a:"Reforja",pr2b:"Una piedra de reforja vuelve a tirar los stats del ítem dentro de su tier — puede salir mejor o peor.",
      pr3a:"Gemas / sockets",pr3b:"Los ítems pueden tener sockets; arrastra una gema para sumar sus stats. Se ven como ◆ / ◇.",
      pr4a:"Sets",pr4b:"Bonus acumulativos por llevar 2 / 3 / 4 piezas del mismo set.",
      prStation:"Craftea las piedras y gemas en tus <b>estaciones de crafteo</b> (<code>/ea station</code>), o suéltalas de mobs y bloques con drop tables.",
      cmdLead:"Base: <code>/elementalarms</code> · alias <code>/ea</code>, <code>/earms</code>",cmdColA:"Comando",cmdColB:"Qué hace",
      cmd1:"Abre tu menú de equipo",cmd2:"Tu hoja de personaje",cmd3:"El editor visual de ítems / habilidades",cmd4:"Abre una estación de crafteo",cmd5:"Da un ítem custom",cmd6:"Lista ítems · recarga la config",
      pmColA:"Permiso",pmColB:"Otorga",pm1:"Editor, give, reload y herramientas de admin",pmNote:"Los jugadores usan los menús (<code>/ea inventory</code>, <code>/ea stats</code>) sin ningún permiso.",
      phLead:"Con PlaceholderAPI instalado:",phColB:"Devuelve",
      ph1:"Total de cualquier stat (daño, defensa…)",ph2:"Nombre del set activo",ph3:"Tier del ítem en la mano",ph4:"Nivel de mejora del ítem en la mano",ph5:"Durabilidad custom del ítem en la mano",
      cfgLead:"Todo es configurable. Los archivos principales, todos recargables con <code>/ea reload</code>:",cfgColA:"Archivo",cfgColB:"Qué contiene",
      cfg1:"Indicadores de daño, recetas, mejora/reforja/gemas, requisitos, drops, estaciones, accesorios.",cfg2:"Tus ítems custom, un archivo por categoría.",cfg3:"Tiers, sets, rarezas, elementos, stats, formatos de lore, drop tables.",cfg4:"Estaciones de crafteo y sus recetas.",
      cfgNote:"¿Prefieres hacer click a escribir? <code>/ea editor</code> escribe todos estos archivos por ti.",
      reviewsTitle:"Reseñas de jugadores",reviewsSub:"Lo que opinan los dueños de servidores sobre ElementalArms.",reviewsWord:"reseñas",
      reviewWriteT:"Escribe una reseña",reviewEditT:"Edita tu reseña",reviewPublish:"Publicar reseña",reviewUpdate:"Actualizar reseña",
      reviewsLoginPrompt:"Inicia sesión para dejar una reseña.",reviewsNone:"Aún no hay reseñas — ¡sé el primero!",
      footMade:"Hecho por infinity3113 · ElementalArms"
    }
  };
  var htmlKeys={ist1:1,ist2:1,ist3:1,ist4:1,instNote:1,cmdLead:1,phLead:1,cfgLead:1,thTip:1,waTip:1,waPurD:1,paTip:1,cuTip:1,th5b:1,wa3c:1,cfgNote:1};
  var saved=<?= isset($_GET['saved']) ? 'true':'false' ?>;

  // Instantánea del inglés inline: sirve de idioma EN y de respaldo para claves no traducidas.
  var EN={};
  document.querySelectorAll('[data-i18n]').forEach(function(el){var k=el.getAttribute('data-i18n');EN[k]=htmlKeys[k]?el.innerHTML:el.textContent;});
  document.querySelectorAll('[data-i18n-ph]').forEach(function(el){EN[el.getAttribute('data-i18n-ph')]=el.getAttribute('placeholder')||'';});

  function setLang(l){
    var d=(l==='en')?EN:(I18N[l]||{});
    document.querySelectorAll('[data-i18n]').forEach(function(el){
      var k=el.getAttribute('data-i18n'); var v=(d[k]!=null)?d[k]:EN[k]; if(v==null) return;
      if(htmlKeys[k]) el.innerHTML=v; else el.textContent=v;
    });
    document.querySelectorAll('[data-i18n-ph]').forEach(function(el){
      var k=el.getAttribute('data-i18n-ph'); var v=(d[k]!=null)?d[k]:EN[k]; if(v!=null) el.setAttribute('placeholder',v);
    });
    document.querySelectorAll('.langsw button').forEach(function(b){b.classList.toggle('on',b.getAttribute('data-lang')===l);});
    try{document.documentElement.lang=l;localStorage.setItem('lang',l);}catch(e){}
    document.cookie='lang='+l+';path=/;max-age=31536000';
  }
  document.querySelectorAll('.langsw button').forEach(function(b){
    b.addEventListener('click',function(){setLang(b.getAttribute('data-lang'));});
  });
  (function(){var s='en';try{s=localStorage.getItem('lang')||(document.cookie.match(/lang=(\w+)/)||[])[1]||'en';}catch(e){}
    if(s!=='en'&&!I18N[s])s='en';setLang(s);})();

  document.querySelectorAll('.sidenav a, [data-page]').forEach(function(a){
    a.addEventListener('click',function(e){
      var pg=a.getAttribute('data-page'); if(!pg)return; e.preventDefault();
      document.querySelectorAll('.sidenav a').forEach(function(x){x.classList.toggle('on',x.getAttribute('data-page')===pg);});
      document.querySelectorAll('.page').forEach(function(s){s.classList.toggle('active',s.getAttribute('data-p')===pg);});
      window.scrollTo({top:0,behavior:'smooth'});
    });
  });

  var sp=document.getElementById('starpick');
  if(sp){var ri=document.getElementById('rating');
    function paint(n){sp.querySelectorAll('span').forEach(function(s){s.classList.toggle('hot',parseInt(s.getAttribute('data-v'))<=n);});}
    paint(parseInt(ri.value)||0);
    sp.querySelectorAll('span').forEach(function(s){
      s.addEventListener('mouseenter',function(){paint(parseInt(s.getAttribute('data-v')));});
      s.addEventListener('click',function(){ri.value=s.getAttribute('data-v');paint(parseInt(ri.value));});
    });
    sp.addEventListener('mouseleave',function(){paint(parseInt(ri.value)||0);});
  }
  if(saved){document.querySelectorAll('.sidenav a').forEach(function(x){x.classList.toggle('on',x.getAttribute('data-page')==='reviews');});
    document.querySelectorAll('.page').forEach(function(s){s.classList.toggle('active',s.getAttribute('data-p')==='reviews');});}
})();
</script>
</body>
</html>
