/* ============================================================
   ENCHANTING PAGE  (/plugins/enchanting.html)
   Codex GUI: every perk card is rendered by enchanting.js from
   /data/enchanting.json, which the API publishes from the live
   ItemPerks.json config (uploaded by a Lead Admin in the terminal).
   Layered on rank-pages.css + plugin-pages.css. Prefix: ec-
   ============================================================ */
.rankpage.ec-page {
  --ec: #b48cff;                       /* arcane violet: the page identity */
  --ec-bright: #d9c4ff;
  --ec-dim: rgba(180, 140, 255, 0.14);
  --ec-line: rgba(180, 140, 255, 0.35);
  --ec-gold: #ffd964;                  /* legendary-only perks */
  --ec-gold-dim: rgba(255, 217, 100, 0.14);
  --ec-gold-line: rgba(255, 217, 100, 0.5);
  --rk-accent: var(--ec);
  --rk-accent-bright: var(--ec-bright);
  --rk-accent-dim: var(--ec-dim);
  --rk-accent-line: var(--ec-line);
  --rk-glow: rgba(180, 140, 255, 0.22);
  /* category colours */
  --ec-gathering: #7ee66b;
  --ec-fishing: #5ad1e6;
  --ec-combat: #ff6b5c;
  --ec-defense: #74a8ff;
  --ec-luck: #ffd05a;
  --ec-crafting: #f2a44a;
  --ec-survival: #ff8fd0;
  --ec-other: #c3c9d6;
}
.ec-page .rk-title { background: linear-gradient(175deg, #f3ecff 15%, var(--ec) 55%, #6b4bb8 95%); -webkit-background-clip: text; background-clip: text; text-shadow: 0 0 55px rgba(180, 140, 255, 0.25); }
.ec-page .rk-hero { background: radial-gradient(ellipse 900px 420px at 78% 10%, rgba(180, 140, 255, 0.12), transparent 65%), radial-gradient(ellipse 700px 380px at 15% 110%, rgba(255, 217, 100, 0.06), transparent 60%), linear-gradient(180deg, #0a0d14 0%, #05070d 100%); }
.ec-page .rk-tagline a { color: var(--ec-bright); }

/* ---------- Hero art: the kit, floating ---------- */
.ec-hero-art {
  position: relative;
  flex: 0 0 auto;
  width: clamp(200px, 26vw, 320px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.ec-hero-art::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 140, 255, 0.35) 0%, rgba(180, 140, 255, 0.08) 45%, transparent 68%);
  animation: rk-glow 4.5s ease-in-out infinite;
}
.ec-hero-art .ec-ring {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1px dashed var(--ec-line);
  animation: ec-spin 40s linear infinite;
}
.ec-hero-art .ec-ring.is-2 { inset: 0; border-style: solid; border-color: rgba(180, 140, 255, 0.14); animation-direction: reverse; animation-duration: 70s; }
.ec-hero-art .ec-ring i { position: absolute; top: -4px; left: 50%; width: 7px; height: 7px; margin-left: -3px; border-radius: 50%; background: var(--ec-bright); box-shadow: 0 0 10px var(--ec); }
.ec-hero-art img {
  position: relative;
  width: 78%;
  height: auto;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 22px rgba(180, 140, 255, 0.35));
  animation: ec-float 6s ease-in-out infinite;
}
@keyframes ec-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-12px) rotate(2deg); } }
@keyframes ec-spin { to { transform: rotate(360deg); } }

/* ---------- Live stat strip under the hero ---------- */
.ec-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
  margin: -1.6rem 0 2.6rem;
}
.ec-stat {
  --c: var(--ec);
  position: relative;
  padding: 1rem 0.8rem 0.85rem;
  text-align: center;
  background: linear-gradient(180deg, var(--rk-panel-2), var(--rk-panel));
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.ec-stat::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--c), transparent); }
.ec-stat-value { display: block; font-family: "Cinzel", serif; font-weight: 800; font-size: 1.7rem; line-height: 1.1; color: var(--c); text-shadow: 0 0 20px color-mix(in srgb, var(--c) 35%, transparent); }
.ec-stat-value small { font-size: 0.85rem; letter-spacing: 0.04em; }
.ec-stat-label { display: block; margin-top: 0.25rem; font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ec-stat.is-gold { --c: var(--ec-gold); }
.ec-stat.is-green { --c: var(--ec-gathering); }
.ec-stat.is-cyan { --c: var(--ec-fishing); }

/* ---------- Build Planner launch CTA (links to /plugins/enchanting-planner.html) ---------- */
.ec-planner-cta {
  display: flex; align-items: center; gap: 1rem;
  margin: 0 0 2.4rem; padding: 1rem 1.15rem; text-decoration: none;
  border: 1px solid var(--ec-line); border-radius: 14px;
  background: linear-gradient(120deg, rgba(180, 140, 255, 0.16), rgba(180, 140, 255, 0.05) 60%, transparent);
  position: relative; overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
}
.ec-planner-cta::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(240px 120px at 90% -20%, rgba(180, 140, 255, 0.25), transparent 70%);
}
.ec-planner-cta:hover { transform: translateY(-2px); border-color: var(--ec); box-shadow: 0 12px 34px rgba(180, 140, 255, 0.25); }
.ec-planner-cta-ico { flex: 0 0 auto; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--ec-dim); border: 1px solid var(--ec-line); color: var(--ec-bright); }
.ec-planner-cta-ico svg { width: 26px; height: 26px; }
.ec-planner-cta-text { flex: 1; min-width: 0; }
.ec-planner-cta-text b { display: block; font-family: "Cinzel", serif; font-size: 1.15rem; color: #fff; letter-spacing: 0.01em; }
.ec-planner-cta-text small { display: block; margin-top: 0.15rem; font-size: 0.86rem; color: var(--muted); line-height: 1.45; }
.ec-planner-cta-go { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.9rem; color: var(--ec-bright); padding: 0.5rem 0.85rem; border-radius: 999px; background: rgba(180, 140, 255, 0.16); border: 1px solid var(--ec-line); }
.ec-planner-cta-go svg { width: 16px; height: 16px; transition: transform 0.15s ease; }
.ec-planner-cta:hover .ec-planner-cta-go svg { transform: translateX(3px); }
@media (max-width: 560px) {
  .ec-planner-cta { flex-wrap: wrap; }
  .ec-planner-cta-go { width: 100%; justify-content: center; }
}

/* ---------- How it works: four steps ---------- */
.ec-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.9rem; counter-reset: ec-step; }
.ec-step {
  position: relative;
  padding: 1.15rem 1.15rem 1.1rem 1.15rem;
  background: linear-gradient(180deg, var(--rk-panel-2), var(--rk-panel));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.ec-step::before {
  counter-increment: ec-step;
  content: "0" counter(ec-step);
  position: absolute;
  right: 0.8rem; top: 0.4rem;
  font-family: "Cinzel", serif;
  font-weight: 800;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--ec-dim);
}
.ec-step-ico { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-bottom: 0.7rem; border-radius: 10px; background: var(--ec-dim); border: 1px solid var(--ec-line); color: var(--ec-bright); }
.ec-step-ico svg { width: 20px; height: 20px; }
.ec-step h3 { margin: 0 0 0.35rem; font-family: "Cinzel", serif; font-size: 1.02rem; letter-spacing: 0.03em; color: var(--text); }
.ec-step p { margin: 0; font-size: 0.93rem; line-height: 1.55; color: var(--muted); }
.ec-step p strong { color: var(--text); }
.ec-step p a { color: var(--ec-bright); }

/* ---------- Sources: cards with live numbers ---------- */
.ec-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.9rem; align-items: start; } /* top-aligned: each card is only as tall as its content, no dead space */
.ec-source {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.15rem 1.2rem 1.1rem;
  background: linear-gradient(180deg, var(--rk-panel-2), var(--rk-panel));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ec-source-head { display: flex; align-items: center; gap: 0.6rem; }
.ec-source-head svg { width: 20px; height: 20px; color: var(--ec-bright); flex: 0 0 auto; }
.ec-source-head h3 { margin: 0; font-family: "Cinzel", serif; font-size: 1.02rem; letter-spacing: 0.03em; color: var(--text); }
.ec-source p { margin: 0; font-size: 0.93rem; line-height: 1.55; color: var(--muted); }
.ec-source p strong, .ec-source li strong { color: var(--text); }
.ec-source ul { margin: 0; padding-left: 1.1rem; font-size: 0.92rem; line-height: 1.55; color: var(--muted); }
.ec-source li { margin-bottom: 0.3rem; }
.ec-source a { color: var(--ec-bright); }
.ec-source .cmd { color: var(--ec-bright); }
/* the label sits on its own line under the title so it can never run off the card edge */
.ec-source-tag { align-self: flex-start; max-width: 100%; margin-top: -0.2rem; padding: 0.22rem 0.6rem; border-radius: 999px; border: 1px solid var(--ec-line); background: var(--ec-dim); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.04em; line-height: 1.35; color: var(--ec-bright); }
.ec-bars-wrap { position: relative; height: 236px; overflow-y: auto; padding-right: 0.4rem; margin: 0.1rem -0.2rem 0.1rem 0; border-top: 1px solid rgba(255, 255, 255, 0.06); border-bottom: 1px solid rgba(255, 255, 255, 0.06); scrollbar-width: thin; scrollbar-color: var(--ec-line) transparent; }
.ec-bars-wrap::after { content: ""; position: sticky; bottom: 0; display: block; height: 22px; margin-top: -22px; background: linear-gradient(180deg, transparent, var(--rk-panel)); pointer-events: none; }
.ec-bars { display: grid; gap: 0.35rem; padding: 0.5rem 0 0.6rem; }
.ec-split { display: grid; gap: 0.5rem; }
.ec-split-item { padding: 0.65rem 0.8rem; border-radius: 10px; border: 1px solid var(--ec-line); background: var(--ec-dim); }
.ec-split-item.is-gold { border-color: var(--ec-gold-line); background: var(--ec-gold-dim); }
.ec-split-item h4 { margin: 0 0 0.25rem; font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ec-bright); }
.ec-split-item.is-gold h4 { color: var(--ec-gold); }
.ec-split-item.is-gold a { color: var(--ec-gold); }
.ec-split-item p { font-size: 0.9rem; }
.ec-source-list li { margin-bottom: 0.45rem; }
.ec-bar { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.6rem; align-items: center; font-size: 0.82rem; color: var(--muted); }
.ec-bar-track { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.ec-bar-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--ec), var(--ec-bright)); transition: width 0.9s cubic-bezier(0.2, 0.9, 0.2, 1); }
.ec-bar b { color: var(--text); font-weight: 600; }

/* ---------- Codex: toolbar ---------- */
.ec-codex-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem 1rem; margin: 0 0 1rem; }
.ec-updated { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; letter-spacing: 0.04em; color: var(--muted); }
.ec-updated i { width: 8px; height: 8px; border-radius: 50%; background: var(--ec-gathering); box-shadow: 0 0 8px var(--ec-gathering); animation: ec-pulse 2s ease-in-out infinite; }
@keyframes ec-pulse { 50% { opacity: 0.35; } }
.ec-toolbar {
  position: sticky;
  top: 66px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.1rem;
  padding: 0.7rem 0.8rem;
  background: rgba(10, 12, 18, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.ec-search { position: relative; flex: 1 1 220px; min-width: 180px; }
.ec-search svg { position: absolute; left: 0.7rem; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.ec-search input {
  width: 100%;
  padding: 0.55rem 0.8rem 0.55rem 2.2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
  font-size: 0.93rem;
}
.ec-search input:focus { outline: none; border-color: var(--ec); box-shadow: 0 0 0 3px var(--ec-dim); }
.ec-cats { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ec-cat {
  --c: var(--ec);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--muted);
  font: 600 0.8rem/1 "Inter", sans-serif;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.18s;
}
.ec-cat i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 60%, transparent); }
.ec-cat:hover { color: var(--text); border-color: var(--c); transform: translateY(-1px); }
.ec-cat.is-active { color: #0b0d12; background: var(--c); border-color: var(--c); }
.ec-cat.is-active i { background: #0b0d12; box-shadow: none; }
.ec-cat small { opacity: 0.7; font-weight: 500; }
.ec-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: rgba(0, 0, 0, 0.3); }
.ec-seg button { padding: 0.4rem 0.75rem; border: 0; background: transparent; color: var(--muted); font: 600 0.8rem/1 "Inter", sans-serif; letter-spacing: 0.03em; cursor: pointer; transition: background 0.18s, color 0.18s; }
.ec-seg button + button { border-left: 1px solid var(--line); }
.ec-seg button:hover { color: var(--text); }
.ec-seg button.is-active { background: var(--ec-dim); color: var(--ec-bright); }
.ec-seg button.is-gold.is-active { background: var(--ec-gold-dim); color: var(--ec-gold); }
.ec-sort { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.ec-sort select { padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); color: var(--text); font: inherit; font-size: 0.85rem; }
.ec-count { margin-left: auto; font-size: 0.8rem; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.ec-count b { color: var(--text); }

/* ---------- Codex: legend ---------- */
.ec-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; margin: 0 0 1.1rem; padding: 0.7rem 1rem; border: 1px dashed var(--line); border-radius: 10px; font-size: 0.82rem; color: var(--muted); }
.ec-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.ec-legend b { color: var(--text); font-weight: 600; }
.ec-legend .ec-swatch { width: 26px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--ec), var(--ec-bright)); }
.ec-legend .ec-swatch.is-cap { width: 3px; height: 14px; background: #fff; }
.ec-legend .ec-swatch.is-gold { background: linear-gradient(90deg, #a8871f, var(--ec-gold)); }

/* ---------- Codex: grid + cards ---------- */
.ec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 0.9rem; }
.ec-card {
  --c: var(--ec);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.1rem 1.15rem 1.05rem;
  background: linear-gradient(180deg, var(--rk-panel-2), var(--rk-panel));
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: left;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  animation: ec-card-in 0.45s ease both;
}
@keyframes ec-card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ec-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--c), transparent 90%); }
.ec-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 18%, transparent), transparent 65%); pointer-events: none; z-index: -1; transition: transform 0.3s ease; }
.ec-card:hover, .ec-card:focus-visible { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 55%, var(--line)); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--c) 25%, transparent); outline: none; }
.ec-card:hover::after { transform: scale(1.35); }
.ec-card.is-gathering { --c: var(--ec-gathering); }
.ec-card.is-fishing { --c: var(--ec-fishing); }
.ec-card.is-combat { --c: var(--ec-combat); }
.ec-card.is-defense { --c: var(--ec-defense); }
.ec-card.is-luck { --c: var(--ec-luck); }
.ec-card.is-crafting { --c: var(--ec-crafting); }
.ec-card.is-survival { --c: var(--ec-survival); }
.ec-card.is-other { --c: var(--ec-other); }
.ec-card.is-legendary {
  border-color: var(--ec-gold-line);
  background:
    linear-gradient(180deg, rgba(255, 217, 100, 0.06), transparent 40%),
    repeating-linear-gradient(-45deg, rgba(255, 217, 100, 0.025) 0 10px, transparent 10px 20px),
    linear-gradient(180deg, var(--rk-panel-2), var(--rk-panel));
}
.ec-card.is-legendary::before { background: linear-gradient(180deg, var(--ec-gold), var(--c) 60%, transparent); }
/* Corner sash. The strip is 220px wide and centred 52px in from the top-right corner, so the whole label
   (about 120px of text) sits inside the card's clipped area with room to spare on both ends. */
.ec-ribbon {
  position: absolute;
  top: 42px; right: -162px;
  width: 220px;
  padding: 0.28rem 0;
  text-align: center;
  transform: rotate(45deg);
  background: linear-gradient(90deg, #a8871f, var(--ec-gold), #fdf6d8);
  color: #2a1e00;
  font: 800 0.62rem/1 "Inter", sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.ec-card-top { display: flex; align-items: flex-start; gap: 0.85rem; }
.ec-ico {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  color: var(--c);
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--c) 12%, transparent);
}
.ec-ico svg { width: 26px; height: 26px; }
.ec-card.is-legendary .ec-ico { background: linear-gradient(180deg, rgba(255, 217, 100, 0.18), rgba(255, 217, 100, 0.05)); border-color: var(--ec-gold-line); color: var(--ec-gold); }
.ec-card-title { min-width: 0; flex: 1; }
.ec-card h3 { margin: 0 0 0.25rem; font-family: "Cinzel", serif; font-weight: 700; font-size: 1.16rem; letter-spacing: 0.02em; line-height: 1.2; color: var(--text); }
.ec-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.ec-tag { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.18rem 0.5rem; border-radius: 999px; font: 600 0.68rem/1 "Inter", sans-serif; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); }
.ec-tag.is-rarity { --c: var(--muted); }
.ec-tag.is-rarity.r-common { --c: #9fb0c8; }
.ec-tag.is-rarity.r-uncommon { --c: #7ee66b; }
.ec-tag.is-rarity.r-rare { --c: #74a8ff; }
.ec-tag.is-rarity.r-veryrare { --c: #b48cff; }
.ec-tag.is-rarity.r-legendary { --c: var(--ec-gold); }
.ec-desc { margin: 0; font-size: 0.93rem; line-height: 1.5; color: var(--muted); }

/* Roll gauge: min..max window on a track that ends at the global cap */
.ec-gauge { position: relative; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: visible; margin: 0.15rem 0 0.2rem; }
.ec-gauge-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, transparent), var(--c)); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 55%, transparent); }
.ec-gauge-cap { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; border-radius: 2px; background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, 0.6); }
.ec-gauge-cap.is-none { display: none; }
/* cap beyond the end of the bar: pinned at 100% and drawn as an arrow pointing past it */
.ec-gauge-cap.is-over { width: 0; height: 0; top: -3px; bottom: auto; margin-left: -2px; border-radius: 0; background: none; box-shadow: none; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 10px solid #fff; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.7)); }
.ec-gauge-fill { min-width: 2px; }
.ec-card.is-legendary .ec-gauge-fill { background: linear-gradient(90deg, #a8871f, var(--ec-gold)); box-shadow: 0 0 12px rgba(255, 217, 100, 0.5); }
.ec-vals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.ec-val { padding: 0.5rem 0.55rem 0.45rem; border-radius: 9px; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.06); text-align: center; }
.ec-val b { display: block; font-family: "Cinzel", serif; font-weight: 700; font-size: 1.08rem; line-height: 1.1; color: var(--text); white-space: nowrap; }
.ec-val.is-max b { color: var(--c); }
.ec-val.is-cap b { color: #fff; }
.ec-val span { display: block; margin-top: 0.2rem; font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ec-val small { font-size: 0.72em; font-weight: 600; }

.ec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; font-size: 0.78rem; color: var(--muted); }
.ec-pips { display: inline-flex; gap: 3px; }
.ec-pips i { width: 9px; height: 9px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); transform: rotate(45deg) scale(0.8); }
.ec-pips i.on { background: var(--c); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 60%, transparent); }
.ec-card.is-legendary .ec-pips i.on { background: var(--ec-gold); box-shadow: 0 0 6px rgba(255, 217, 100, 0.6); }
.ec-cost { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.55rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); color: var(--text); font-weight: 600; }
.ec-cost svg { width: 12px; height: 12px; color: var(--ec-gold); }
.ec-odds b { color: var(--text); }
.ec-odds a { color: var(--ec-gold); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(255, 217, 100, 0.4); }
.ec-odds a:hover { text-decoration-color: var(--ec-gold); }

.ec-items { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; padding-top: 0.6rem; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.ec-items-label { flex-basis: 100%; font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.1rem; }
.ec-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.22rem 0.55rem; border-radius: 7px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.76rem; color: var(--text); white-space: nowrap; }
.ec-chip small { color: var(--muted); font-size: 0.68rem; }
.ec-chip.is-any { border-color: color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); font-weight: 600; }
.ec-chip.is-more { color: var(--muted); }
.ec-chip.is-legend { border-color: var(--ec-gold-line); background: var(--ec-gold-dim); color: var(--ec-gold); font-weight: 600; }
.ec-card-more { position: absolute; right: 0.9rem; bottom: 0.8rem; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); opacity: 0; transform: translateX(6px); transition: opacity 0.2s, transform 0.2s; }
.ec-card:hover .ec-card-more { opacity: 1; transform: none; }
.ec-empty { grid-column: 1 / -1; padding: 2.4rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
.ec-empty b { color: var(--text); }
.ec-loading { grid-column: 1 / -1; padding: 2.4rem 1rem; text-align: center; color: var(--muted); }
.ec-loading::after { content: ""; display: block; width: min(320px, 70%); height: 3px; margin: 1rem auto 0; background: linear-gradient(90deg, transparent, var(--ec), transparent); background-size: 50% 100%; animation: ec-load 1.4s linear infinite; }
@keyframes ec-load { from { background-position: -100% 0; } to { background-position: 300% 0; } }

/* ---------- Detail modal ---------- */
.ec-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 1rem; }
.ec-modal[hidden] { display: none; }
.ec-modal-backdrop { position: absolute; inset: 0; background: rgba(3, 5, 10, 0.78); backdrop-filter: blur(6px); animation: ec-fade 0.25s ease both; }
@keyframes ec-fade { from { opacity: 0; } }
.ec-modal-panel {
  --c: var(--ec);
  position: relative;
  width: min(880px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1c1f28, #13161d);
  border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line));
  border-radius: 18px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7), 0 0 60px color-mix(in srgb, var(--c) 18%, transparent);
  overflow: hidden;
  animation: ec-pop 0.3s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
@keyframes ec-pop { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
.ec-modal-panel.is-gathering { --c: var(--ec-gathering); } .ec-modal-panel.is-fishing { --c: var(--ec-fishing); } .ec-modal-panel.is-combat { --c: var(--ec-combat); } .ec-modal-panel.is-defense { --c: var(--ec-defense); } .ec-modal-panel.is-luck { --c: var(--ec-luck); } .ec-modal-panel.is-crafting { --c: var(--ec-crafting); } .ec-modal-panel.is-survival { --c: var(--ec-survival); } .ec-modal-panel.is-other { --c: var(--ec-other); }
.ec-modal-panel.is-legendary { border-color: var(--ec-gold-line); box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7), 0 0 60px rgba(255, 217, 100, 0.18); }
.ec-modal-head { position: relative; display: flex; align-items: center; gap: 1rem; padding: 1.3rem 1.5rem 1.1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.07); background: radial-gradient(600px 160px at 20% 0%, color-mix(in srgb, var(--c) 16%, transparent), transparent 70%); }
.ec-modal-head .ec-ico { width: 64px; height: 64px; border-radius: 18px; }
.ec-modal-head .ec-ico svg { width: 32px; height: 32px; }
.ec-modal-panel.is-legendary .ec-modal-head .ec-ico { background: linear-gradient(180deg, rgba(255, 217, 100, 0.2), rgba(255, 217, 100, 0.05)); border-color: var(--ec-gold-line); color: var(--ec-gold); }
.ec-modal-head h2 { margin: 0 0 0.35rem; font-family: "Cinzel", serif; font-weight: 700; font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: 0.03em; line-height: 1.15; color: var(--text); }
.ec-modal-close { position: absolute; top: 0.9rem; right: 0.9rem; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); color: var(--text); font-size: 1.3rem; line-height: 1; cursor: pointer; transition: background 0.18s, border-color 0.18s; }
.ec-modal-close:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--c); }
.ec-modal-body { padding: 1.2rem 1.5rem 1.5rem; overflow-y: auto; display: grid; gap: 1.1rem; }
.ec-modal-body .ec-desc { font-size: 1.02rem; color: var(--text); }
.ec-modal-body .ec-gauge { height: 12px; }
.ec-modal-body .ec-vals { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.ec-modal-body .ec-val b { font-size: 1.25rem; }
.ec-note-gold { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.85rem 1rem; border-radius: 10px; border: 1px solid var(--ec-gold-line); background: var(--ec-gold-dim); font-size: 0.92rem; line-height: 1.5; color: var(--muted); }
.ec-note-gold svg { flex: 0 0 auto; width: 18px; height: 18px; color: var(--ec-gold); margin-top: 0.1rem; }
.ec-note-gold strong { color: var(--ec-gold); }
.ec-note-gold a { color: var(--ec-gold); }
.ec-h { margin: 0 0 0.5rem; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 0.6rem; }
.ec-h::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.ec-h b { color: var(--c); }
.ec-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.6rem; }
.ec-group { padding: 0.6rem 0.75rem; border-radius: 10px; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.06); }
.ec-group h4 { margin: 0 0 0.35rem; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c); }
.ec-group h4 small { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 500; }
.ec-group ul { margin: 0; padding: 0; list-style: none; columns: 1; font-size: 0.86rem; color: var(--text); line-height: 1.5; }
.ec-group li { break-inside: avoid; }
.ec-any { padding: 0.8rem 1rem; border-radius: 10px; border: 1px dashed color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 8%, transparent); font-size: 0.92rem; color: var(--muted); }
.ec-any strong { color: var(--c); }
.ec-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.5rem; }
.ec-fact { padding: 0.6rem 0.75rem; border-radius: 10px; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.06); font-size: 0.84rem; color: var(--muted); line-height: 1.45; }
.ec-fact b { display: block; color: var(--text); font-size: 0.95rem; margin-bottom: 0.15rem; }
.ec-fact .ec-chip { margin: 0.15rem 0.2rem 0 0; }
.ec-drops { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.ec-drops .ec-chip small { margin-left: 0.15rem; }
.ec-modal-foot { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; padding-top: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.ec-modal-foot code { padding: 0.12em 0.45em; border-radius: 5px; background: rgba(255, 255, 255, 0.07); font-size: 0.9em; color: var(--text); }
.ec-modal-foot a { color: var(--c); }
.ec-share { margin-left: auto; padding: 0.35rem 0.7rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); color: var(--text); font: 600 0.78rem/1 "Inter", sans-serif; cursor: pointer; }
.ec-share:hover { border-color: var(--c); }
.ec-share.is-copied { border-color: var(--ec-gathering); color: var(--ec-gathering); }
body.ec-modal-open { overflow: hidden; }

/* ---------- Good to know ---------- */
.ec-facts-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.7rem; margin: 0; padding: 0; list-style: none; }
.ec-facts-list li { display: flex; gap: 0.7rem; padding: 0.85rem 1rem; background: linear-gradient(180deg, var(--rk-panel-2), var(--rk-panel)); border: 1px solid var(--line); border-radius: 10px; font-size: 0.92rem; line-height: 1.5; color: var(--muted); }
.ec-facts-list li svg { flex: 0 0 auto; width: 18px; height: 18px; color: var(--ec-bright); margin-top: 0.15rem; }
.ec-facts-list strong { color: var(--text); }
.ec-facts-list .cmd { color: var(--ec-bright); }
.ec-facts-list a { color: var(--ec-bright); }
.ec-facts-list li.is-disclaimer { grid-column: 1 / -1; border-color: rgba(255, 191, 71, 0.45); background: linear-gradient(180deg, rgba(255, 191, 71, 0.08), var(--rk-panel)); }
.ec-facts-list li.is-disclaimer svg { color: #ffbf47; }
.ec-facts-list li.is-disclaimer strong { color: #ffd98a; }

@media (max-width: 720px) {
  .ec-hero-art { width: 200px; margin: 0 auto; }
  .ec-toolbar { top: 58px; }
  .ec-count { margin-left: 0; flex-basis: 100%; }
  .ec-grid { grid-template-columns: 1fr; }
  .ec-modal { padding: 0; align-items: end; }
  .ec-modal-panel { max-height: 94vh; border-radius: 18px 18px 0 0; }
  .ec-modal-head { padding: 1.1rem 1.1rem 0.9rem; }
  .ec-modal-body { padding: 1rem 1.1rem 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ec-hero-art img, .ec-hero-art .ec-ring, .ec-updated i, .ec-card, .ec-modal-panel, .ec-modal-backdrop, .ec-loading::after { animation: none; }
  .ec-card:hover { transform: none; }
}

/* A long Good To Know card keeps the row's height and scrolls inside instead of stretching its neighbours */
.ec-facts-list li.is-scroll > span { max-height: 7.6rem; overflow-y: auto; padding-right: 0.5rem; scrollbar-width: thin; scrollbar-color: var(--ec-line) transparent; }
.ec-facts-list li.is-scroll > span::-webkit-scrollbar { width: 6px; }
.ec-facts-list li.is-scroll > span::-webkit-scrollbar-thumb { background: var(--ec-line); border-radius: 999px; }
