/* =========================================================
   MEDUSA - bioluminescent abyss / pixel CRT
   ========================================================= */

:root {
  --abyss-0: #01050c;
  --abyss-1: #04101f;
  --abyss-2: #072034;
  --ink: #071726;
  --ink-2: #0a2032;

  --bio: #4ff0d0;
  --bio-deep: #1d8f7c;
  --jelly: #ff5fc8;
  --jelly-2: #a06bff;
  --amber: #ffc857;
  --coral: #ff7a5c;

  --foam: #dcf3ff;
  --muted: #6f95ab;
  --dim: #47697d;

  --edge: #123449;
  --edge-lit: #1d5e78;

  --px: 4px;
  --shadow-hard: 4px 4px 0 rgba(0, 0, 0, 0.6);

  --font-pixel: 'Silkscreen', 'Courier New', monospace;
  --font-term: 'VT323', 'Courier New', monospace;
  --font-body: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--foam);
  background:
    radial-gradient(120% 80% at 50% -10%, #0b3350 0%, transparent 60%),
    linear-gradient(180deg, var(--abyss-2) 0%, var(--abyss-1) 35%, var(--abyss-0) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- ambient layers ---------- */

#ocean {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

.caustics {
  position: fixed; inset: -20%;
  z-index: 0; pointer-events: none;
  background:
    radial-gradient(40% 30% at 20% 10%, rgba(79, 240, 208, 0.10), transparent 70%),
    radial-gradient(35% 45% at 78% 25%, rgba(160, 107, 255, 0.09), transparent 70%),
    radial-gradient(50% 35% at 55% 85%, rgba(255, 95, 200, 0.06), transparent 70%);
  filter: blur(40px);
  animation: drift 34s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(4%, 3%, 0) scale(1.12); }
}

.scanlines {
  position: fixed; inset: 0; z-index: 900; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px);
  opacity: 0.4;
  mix-blend-mode: multiply;
}

.vignette {
  position: fixed; inset: 0; z-index: 899; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 45%, rgba(0, 0, 0, 0.72) 100%);
}

/* =========================================================
   LANDING
   ========================================================= */

.gate {
  position: relative; z-index: 10;
  min-height: 100svh;
  display: grid; place-items: center;
  padding: 32px 20px;
}

.gate-inner { width: min(560px, 100%); text-align: center; }

.jelly-mark {
  position: relative;
  width: 96px; height: 96px;
  margin: 0 auto 26px;
  animation: bob 5.5s ease-in-out infinite;
}
.jelly-mark span {
  position: absolute; display: block; background: var(--bio);
  box-shadow: 0 0 18px rgba(79, 240, 208, 0.55);
}
/* stepped pixel bell */
.jelly-mark .b1 { left: 32px; top: 4px;  width: 32px; height: 8px; }
.jelly-mark .b2 { left: 20px; top: 12px; width: 56px; height: 8px; }
.jelly-mark .b3 { left: 12px; top: 20px; width: 72px; height: 12px; }
.jelly-mark .b4 { left: 8px;  top: 32px; width: 80px; height: 8px; }
.jelly-mark .skirt {
  left: 8px; top: 40px; width: 80px; height: 6px;
  background: var(--jelly-2);
  box-shadow: 0 0 16px rgba(160, 107, 255, 0.65);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 90% 100%, 80% 60%, 70% 100%, 60% 60%,
                     50% 100%, 40% 60%, 30% 100%, 20% 60%, 10% 100%, 0 60%);
}
.jelly-mark .eye {
  top: 22px; width: 6px; height: 6px;
  background: #02131a; box-shadow: none;
}
.jelly-mark .e1 { left: 32px; }
.jelly-mark .e2 { left: 58px; }

/* tentacles */
.jelly-mark .t {
  top: 46px; width: 6px;
  background: linear-gradient(180deg, var(--jelly) 0%, rgba(255, 95, 200, 0) 100%);
  transform-origin: top center;
  animation: sway 3.2s ease-in-out infinite;
}
.jelly-mark .t1 { left: 18px; height: 34px; animation-delay: -0.2s; }
.jelly-mark .t2 { left: 36px; height: 46px; animation-delay: -1.1s; }
.jelly-mark .t3 { left: 54px; height: 40px; animation-delay: -0.6s; }
.jelly-mark .t4 { left: 70px; height: 30px; animation-delay: -1.6s; }

@keyframes bob  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes sway { 0%, 100% { transform: skewX(0deg); } 50% { transform: skewX(-14deg); } }

.wordmark {
  font-family: var(--font-pixel);
  font-size: clamp(34px, 9vw, 62px);
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 0 0 10px;
  color: var(--foam);
  text-shadow:
    0 0 2px var(--bio),
    0 0 22px rgba(79, 240, 208, 0.55),
    4px 4px 0 rgba(160, 107, 255, 0.35);
}

.tagline {
  font-size: 13px; color: var(--muted);
  margin: 0 0 34px; letter-spacing: 0.04em;
}
.tagline em { color: var(--bio); font-style: normal; }

/* ---------- search ---------- */

.search { display: flex; gap: 10px; justify-content: center; }

.search input {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-term);
  font-size: 26px;
  padding: 6px 14px;
  color: var(--foam);
  background: rgba(3, 16, 28, 0.86);
  border: 3px solid var(--edge);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.6), var(--shadow-hard);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.search input::placeholder { color: var(--dim); }
.search input:focus {
  border-color: var(--bio-deep);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(79, 240, 208, 0.16), var(--shadow-hard);
}

.btn {
  font-family: var(--font-pixel);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding: 12px 16px;
  color: var(--foam);
  background: var(--ink-2);
  border: 3px solid var(--edge-lit);
  box-shadow: var(--shadow-hard);
  cursor: pointer;
  transition: transform 0.08s, background 0.18s, color 0.18s, box-shadow 0.18s;
}
.btn:hover { background: #10314a; color: var(--bio); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--bio-deep);
  border-color: var(--bio);
  color: #02141a;
  text-shadow: none;
}
.btn-primary:hover { background: var(--bio); color: #011014; }

.btn-ghost { background: transparent; border-color: var(--edge); }

.gate-msg { min-height: 22px; margin: 16px 0 0; font-size: 12px; color: var(--coral); }
.gate-msg.ok { color: var(--bio); }

.gate-links { display: flex; gap: 22px; justify-content: center; }

.linkish {
  margin-top: 22px; padding: 0;
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-body); font-size: 11px; letter-spacing: 0.1em;
  color: var(--dim); text-decoration: underline dotted;
}
.linkish:hover { color: var(--bio); }

.depth-marks {
  display: flex; justify-content: space-between;
  margin-top: 48px; font-family: var(--font-term); font-size: 15px;
  color: rgba(71, 105, 125, 0.5); letter-spacing: 0.1em;
}

/* =========================================================
   DASHBOARD
   ========================================================= */

.app { position: relative; z-index: 10; }

.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  background: rgba(2, 10, 19, 0.92);
  border-bottom: 3px solid var(--edge);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 0; cursor: pointer; padding: 0;
  color: var(--foam);
}
.brand-jelly {
  width: 18px; height: 14px; display: block;
  background: var(--bio);
  clip-path: polygon(20% 0, 80% 0, 100% 45%, 82% 45%, 82% 100%, 62% 62%, 50% 100%, 38% 62%, 18% 100%, 18% 45%, 0 45%);
  box-shadow: 0 0 12px rgba(79, 240, 208, 0.7);
}
.brand-text {
  font-family: var(--font-pixel); font-size: 14px; letter-spacing: 0.12em;
}

.search-sm { flex: 0 1 260px; }
.search-sm input { font-size: 19px; padding: 3px 10px; border-width: 2px; }
.search-sm .btn { padding: 8px 12px; border-width: 2px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.06em;
  padding: 6px 9px; cursor: pointer;
  color: var(--muted);
  background: rgba(10, 32, 50, 0.7);
  border: 2px solid var(--edge);
  transition: all 0.16s;
}
.chip:hover { color: var(--foam); border-color: var(--edge-lit); }
.chip.active {
  color: #02141a; background: var(--bio); border-color: var(--bio);
  box-shadow: 0 0 14px rgba(79, 240, 208, 0.4);
}
.chip .gm { color: var(--jelly); }
.chip.active .gm { color: #4a0a30; }

/* ---------- grid ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 18px;
  padding: 18px;
  max-width: 1560px;
  margin: 0 auto;
  align-items: start;
}

.col-data { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.col-chat { position: sticky; top: 74px; }

/* ---------- pixel panels ---------- */

.panel {
  position: relative;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(13, 40, 61, 0.72), rgba(5, 18, 31, 0.85));
  border: 3px solid var(--edge);
  box-shadow: var(--shadow-hard), inset 0 0 0 1px rgba(79, 240, 208, 0.05);
}
.panel::before, .panel::after {
  content: ''; position: absolute; width: 5px; height: 5px;
  background: var(--bio-deep);
}
.panel::before { top: -3px; left: -3px; }
.panel::after  { bottom: -3px; right: -3px; }

.panel-title {
  font-family: var(--font-pixel);
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  margin: 0 0 16px;
  color: var(--bio);
  display: flex; align-items: center; gap: 10px;
}
.panel-title::after {
  content: ''; flex: 1; height: 2px;
  background: repeating-linear-gradient(90deg, var(--edge-lit) 0 4px, transparent 4px 8px);
}

.tag {
  font-family: var(--font-term); font-size: 17px;
  color: var(--amber); letter-spacing: 0.05em;
}

/* ---------- identity ---------- */

.identity { display: flex; gap: 22px; align-items: center; }

.skin {
  width: 96px; height: auto; flex: none;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 18px rgba(79, 240, 208, 0.28))
          drop-shadow(0 10px 10px rgba(0, 0, 0, 0.5));
  animation: bob 7s ease-in-out infinite;
}

.identity-body { flex: 1; min-width: 0; }

.player-name {
  font-family: var(--font-pixel); font-size: clamp(18px, 3vw, 27px);
  letter-spacing: 0.08em; margin: 0;
  text-shadow: 0 0 18px rgba(79, 240, 208, 0.35);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* ---------- booster cookie ---------- */

.cookie-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px;
  border: 1px solid var(--edge);
  background: rgba(2, 12, 22, 0.6);
}
.cookie-mark img {
  width: 22px; height: 22px;
  image-rendering: pixelated;
  display: block;
}
.cookie-mark.on {
  border-color: var(--amber);
  background: rgba(255, 200, 87, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 200, 87, 0.25), 0 0 16px rgba(255, 200, 87, 0.35);
  animation: cookie-pulse 2.6s ease-in-out infinite;
}
.cookie-mark.on img { filter: drop-shadow(0 0 5px rgba(255, 200, 87, 0.8)); }
.cookie-mark.off {
  border-color: rgba(255, 122, 92, 0.45);
  background: rgba(255, 122, 92, 0.06);
}
.cookie-mark.off img { filter: grayscale(1) brightness(0.65); opacity: 0.55; }

@keyframes cookie-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 200, 87, 0.25), 0 0 10px rgba(255, 200, 87, 0.25); }
  50%      { box-shadow: 0 0 0 1px rgba(255, 200, 87, 0.45), 0 0 20px rgba(255, 200, 87, 0.5); }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-mark.on { animation: none; }
  .skin { animation: none; }
}
.player-sub { margin: 4px 0 14px; font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }

.headline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}
.stat {
  padding: 8px 10px;
  background: rgba(2, 12, 22, 0.6);
  border-left: 3px solid var(--bio-deep);
}
.stat .k {
  display: block; font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--dim);
}
.stat .v {
  display: block; font-family: var(--font-term); font-size: 27px; line-height: 1.1;
  color: var(--foam);
}
.stat.gold .v  { color: var(--amber); }
.stat.pink .v  { color: var(--jelly); }
.stat.cyan .v  { color: var(--bio); }
.stat.violet .v{ color: var(--jelly-2); }
.stat.gold  { border-left-color: var(--amber); }
.stat.pink  { border-left-color: var(--jelly); }
.stat.violet{ border-left-color: var(--jelly-2); }

/* ---------- pixel bars ---------- */

.bar {
  position: relative; height: 10px; margin-top: 5px;
  background: rgba(1, 8, 15, 0.85);
  border: 1px solid var(--edge);
  overflow: hidden;
}
.bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--bio-deep), var(--bio));
  box-shadow: 0 0 10px rgba(79, 240, 208, 0.55);
  transition: width 0.7s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.bar::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 3px, rgba(1, 8, 15, 0.55) 3px 4px);
}
.bar.pink > i   { background: linear-gradient(90deg, #a02f7e, var(--jelly)); box-shadow: 0 0 10px rgba(255, 95, 200, 0.5); }
.bar.violet > i { background: linear-gradient(90deg, #5b3aa8, var(--jelly-2)); box-shadow: 0 0 10px rgba(160, 107, 255, 0.5); }
.bar.gold > i   { background: linear-gradient(90deg, #9c7420, var(--amber)); box-shadow: 0 0 10px rgba(255, 200, 87, 0.45); }
.bar.maxed > i  { background: linear-gradient(90deg, var(--amber), #fff0c0); }

/* ---------- skills ---------- */

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 12px; }

.skill {
  padding: 10px 12px;
  background: rgba(3, 14, 25, 0.55);
  border: 1px solid var(--edge);
  transition: border-color 0.18s, transform 0.18s;
}
.skill:hover { border-color: var(--edge-lit); transform: translateY(-2px); }
.skill.max { border-color: rgba(255, 200, 87, 0.4); }

.skill-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.skill-name { font-size: 11px; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }
.skill-lvl { font-family: var(--font-term); font-size: 24px; color: var(--foam); }
.skill.max .skill-lvl { color: var(--amber); }
.skill-foot { margin-top: 5px; font-size: 10px; color: var(--dim); }

/* ---------- mining ---------- */

.mining { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; }

.hotm-core { text-align: center; }
.hotm-ring {
  --p: 0;
  position: relative;
  width: 148px; height: 148px; margin: 0 auto 12px;
  border-radius: 50%;
  background:
    conic-gradient(var(--jelly) calc(var(--p) * 1%), rgba(6, 22, 36, 0.9) 0),
    radial-gradient(circle, transparent 60%, transparent 61%);
  display: grid; place-items: center;
  filter: drop-shadow(0 0 16px rgba(255, 95, 200, 0.3));
}
.hotm-ring::before {
  content: ''; position: absolute; inset: 12px;
  border-radius: 50%; background: var(--abyss-0);
  border: 2px solid var(--edge);
}
.hotm-ring span {
  position: relative; font-family: var(--font-term); line-height: 1;
}
.hotm-ring .n { font-size: 52px; color: var(--foam); display: block; }
.hotm-ring .l { font-size: 14px; color: var(--muted); letter-spacing: 0.18em; }

.perks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.perk {
  font-size: 10px; padding: 3px 7px;
  background: rgba(29, 94, 120, 0.2);
  border: 1px solid var(--edge);
  color: var(--muted);
}
.perk b { color: var(--bio); font-weight: 600; }

/* ---------- slayers ---------- */

.slayers { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.slayer {
  padding: 10px 12px;
  background: rgba(3, 14, 25, 0.55);
  border: 1px solid var(--edge);
}
.slayer-top { display: flex; justify-content: space-between; align-items: baseline; }
.slayer-name { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.slayer-lvl { font-family: var(--font-term); font-size: 24px; color: var(--jelly); }
.slayer-kills { margin-top: 6px; font-size: 10px; color: var(--dim); display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- dungeons ---------- */

.dungeons { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 20px; }
.cata-level { text-align: center; padding: 10px 0; }
.cata-level .n { font-family: var(--font-term); font-size: 66px; line-height: 1; color: var(--jelly-2); display: block; text-shadow: 0 0 24px rgba(160, 107, 255, 0.45); }
.cata-level .l { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }

.floors { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.floor {
  font-family: var(--font-term); font-size: 16px;
  padding: 2px 8px;
  background: rgba(29, 94, 120, 0.16);
  border: 1px solid var(--edge);
}
.floor b { color: var(--bio); font-weight: 400; }

/* ---------- gear / pets ---------- */

.gear { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 10px; }

.item {
  padding: 9px 11px;
  background: rgba(3, 14, 25, 0.6);
  border-left: 3px solid var(--edge-lit);
  min-width: 0;
}
.item .iname {
  font-size: 12px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item .imeta { margin-top: 3px; font-size: 10px; color: var(--dim); }
.item .islot { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }

/* One colour per rarity, inherited so any icon nested in a rarity-tagged card
   can paint its own backdrop with it. */
.r-COMMON    { --rar: #9aa7b0; }
.r-UNCOMMON  { --rar: #55e06a; }
.r-RARE      { --rar: #4d7bff; }
.r-EPIC      { --rar: #a95bff; }
.r-LEGENDARY { --rar: #ffc857; }
.r-MYTHIC    { --rar: #ff5fc8; }
.r-DIVINE    { --rar: #5ce1ff; }
.r-SPECIAL   { --rar: #ff7a5c; }
.r-VERY_SPECIAL { --rar: #ff7a5c; }
.r-SUPREME   { --rar: #ff3b3b; }
.r-ADMIN     { --rar: #ff3b3b; }
.r-ULTIMATE  { --rar: #ff3b3b; }

.r-COMMON    { border-left-color: #9aa7b0; } .r-COMMON .iname    { color: #cfd8dd; }
.r-UNCOMMON  { border-left-color: #55e06a; } .r-UNCOMMON .iname  { color: #7bef8c; }
.r-RARE      { border-left-color: #4d7bff; } .r-RARE .iname      { color: #7c9dff; }
.r-EPIC      { border-left-color: #a95bff; } .r-EPIC .iname      { color: #c48cff; }
.r-LEGENDARY { border-left-color: var(--amber); } .r-LEGENDARY .iname { color: var(--amber); }
.r-MYTHIC    { border-left-color: var(--jelly); } .r-MYTHIC .iname    { color: #ff8fda; }
.r-DIVINE    { border-left-color: #5ce1ff; } .r-DIVINE .iname    { color: #8beeff; }
.r-SPECIAL   { border-left-color: var(--coral); } .r-SPECIAL .iname { color: #ff9c85; }

.pets { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.pet { padding: 9px 11px; background: rgba(3, 14, 25, 0.6); border-left: 3px solid var(--edge-lit); }
.pet.active { border-left-color: var(--bio); box-shadow: inset 0 0 20px rgba(79, 240, 208, 0.07); }
.pet.r-UNCOMMON  { border-left-color: #55e06a; }
.pet.r-RARE      { border-left-color: #4d7bff; }
.pet.r-EPIC      { border-left-color: #a95bff; }
.pet.r-LEGENDARY { border-left-color: var(--amber); }
.pet.r-MYTHIC    { border-left-color: var(--jelly); }
.pet.active      { border-left-color: var(--bio); }
/* The held item has a tier of its own, so it must not borrow the pet's: the
   line that carries no r- class of its own clears it. */
.pet .pm { --rar: initial; }
.pet .pm.r-COMMON    { --rar: #9aa7b0; }
.pet .pm.r-UNCOMMON  { --rar: #55e06a; }
.pet .pm.r-RARE      { --rar: #4d7bff; }
.pet .pm.r-EPIC      { --rar: #a95bff; }
.pet .pm.r-LEGENDARY { --rar: #ffc857; }
.pet .pm.r-MYTHIC    { --rar: #ff5fc8; }
.pet .pn { font-size: 12px; text-transform: capitalize; }
.pet .pl { font-family: var(--font-term); font-size: 20px; color: var(--bio); }
.pet .pm { font-size: 10px; color: var(--dim); }

.empty { font-size: 12px; color: var(--dim); font-style: italic; }

.empty-notice {
  margin: 12px 0 0; padding: 9px 12px;
  font-size: 12px; color: #ffcfc4;
  background: rgba(255, 122, 92, 0.08);
  border-left: 3px solid var(--coral);
}
.empty-notice b { color: var(--amber); }

.credits {
  padding: 6px 2px 28px;
  font-size: 10px; letter-spacing: 0.08em; color: rgba(71, 105, 125, 0.7);
}

/* =========================================================
   CHAT
   ========================================================= */

.chatbox {
  display: flex; flex-direction: column;
  height: calc(100svh - 92px);
  min-height: 460px;
  padding: 0;
  overflow: hidden;
}

.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 2px solid var(--edge);
  background: rgba(3, 16, 28, 0.6);
}
.chat-head .panel-title { margin: 0; }
.chat-head .panel-title::after { display: none; }

.chat-orb {
  width: 26px; height: 26px; flex: none;
  background: radial-gradient(circle at 40% 35%, var(--bio), var(--jelly-2) 70%, transparent 72%);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(79, 240, 208, 0.6);
  animation: pulse 3.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%      { transform: scale(1.16); opacity: 1; }
}

.chat-head-body { min-width: 0; }
.chat-mode { margin: 2px 0 0; font-size: 10px; letter-spacing: 0.08em; color: var(--dim); }

.chat-controls {
  margin-left: auto; display: flex; flex-direction: column;
  align-items: flex-end; gap: 6px; flex: none;
}

.mini-select {
  font-family: var(--font-body); font-size: 10px;
  padding: 3px 6px; color: var(--foam);
  background: rgba(1, 9, 17, 0.85);
  border: 1px solid var(--edge-lit);
  outline: none; cursor: pointer;
}
.mini-select:focus { border-color: var(--bio-deep); }

.switch {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; letter-spacing: 0.1em; color: var(--muted); cursor: pointer;
  user-select: none;
}
.switch input { accent-color: var(--bio); width: 14px; height: 14px; }

.chat-log {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--edge-lit) transparent;
}
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--edge-lit); }

.msg { max-width: 100%; font-size: 13px; }
.msg .who {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; margin-bottom: 6px; display: block;
}
.msg.user .who { color: var(--amber); }
.msg.bot .who  { color: var(--bio); }

.msg .bubble {
  padding: 10px 13px;
  background: rgba(4, 18, 31, 0.8);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--bio-deep);
}
.msg.user .bubble { border-left-color: var(--amber); background: rgba(28, 20, 5, 0.4); }

.bubble h3, .bubble h4 {
  font-family: var(--font-pixel); font-size: 11px; letter-spacing: 0.08em;
  color: var(--bio); margin: 14px 0 8px; text-transform: uppercase;
}
.bubble h3:first-child, .bubble h4:first-child { margin-top: 0; }
.bubble p { margin: 0 0 9px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 0 0 9px; padding-left: 20px; }
.bubble li { margin-bottom: 4px; }
.bubble strong { color: var(--amber); font-weight: 600; }
.bubble em { color: var(--jelly); font-style: normal; }
.bubble mark {
  background: rgba(79, 240, 208, 0.18);
  color: var(--bio);
  padding: 0 3px;
  border-bottom: 1px solid var(--bio-deep);
  font-weight: 600;
}
.bubble code {
  font-family: var(--font-term); font-size: 15px;
  padding: 0 4px; background: rgba(79, 240, 208, 0.1); color: var(--bio);
}
.bubble blockquote {
  margin: 8px 0; padding: 6px 10px;
  border-left: 2px solid var(--jelly-2);
  color: var(--muted); font-size: 12px;
}
.bubble a { color: var(--bio); }

.status-line {
  font-size: 10px; letter-spacing: 0.1em; color: var(--jelly-2);
  margin-top: 6px; display: flex; align-items: center; gap: 6px;
}
.status-line::before {
  content: ''; width: 6px; height: 6px; background: var(--jelly-2);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0.15; } }

/* The turn is over: what it cost, no pulse. */
.status-line.spent { color: var(--dim); }
.status-line.spent::before { background: var(--dim); animation: none; opacity: 0.5; }

/* The gate answered, not the model. */
.status-line.refused { color: var(--coral); }
.status-line.refused::before { background: currentColor; animation: none; }

.caret {
  display: inline-block; width: 8px; height: 14px;
  background: var(--bio); vertical-align: -2px; margin-left: 2px;
  animation: blink 1.05s steps(2) infinite;
}

.suggestions {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 0 16px 12px;
}
.sugg {
  font-size: 10px; padding: 6px 9px; cursor: pointer; text-align: left;
  color: var(--muted);
  background: rgba(29, 94, 120, 0.14);
  border: 1px solid var(--edge);
  transition: all 0.16s;
}
.sugg:hover { color: var(--bio); border-color: var(--bio-deep); background: rgba(79, 240, 208, 0.08); }

.chat-form {
  display: flex; gap: 8px; padding: 12px 16px 16px;
  border-top: 2px solid var(--edge);
  background: rgba(3, 16, 28, 0.6);
}
.chat-form textarea {
  flex: 1; resize: none; min-height: 42px; max-height: 140px;
  font-family: var(--font-body); font-size: 13px; line-height: 1.5;
  padding: 10px 12px; color: var(--foam);
  background: rgba(1, 9, 17, 0.8);
  border: 2px solid var(--edge);
  outline: none;
}
.chat-form textarea:focus { border-color: var(--bio-deep); }
.chat-form textarea::placeholder { color: var(--dim); }

.chat-fab { display: none; }

/* =========================================================
   SETTINGS / TOAST
   ========================================================= */

.settings {
  border: 3px solid var(--edge-lit);
  background: var(--ink);
  color: var(--foam);
  padding: 0;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.65);
  max-width: 460px; width: calc(100% - 32px);
}
.settings::backdrop { background: rgba(1, 5, 12, 0.8); backdrop-filter: blur(3px); }
.settings-inner { padding: 22px; }
.hint { font-size: 11px; color: var(--muted); margin: 0 0 18px; }

.field { display: block; margin-bottom: 18px; }
.field > span {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 6px;
}
.field > span em { font-style: normal; font-size: 10px; color: var(--bio); }
.field input {
  width: 100%; font-family: var(--font-body); font-size: 12px;
  padding: 9px 11px; color: var(--foam);
  background: rgba(1, 9, 17, 0.85);
  border: 2px solid var(--edge); outline: none;
}
.field input:focus { border-color: var(--bio-deep); }
.field textarea {
  width: 100%; resize: vertical;
  font-family: var(--font-body); font-size: 10px; line-height: 1.45;
  padding: 9px 11px; color: var(--foam);
  background: rgba(1, 9, 17, 0.85);
  border: 2px solid var(--edge); outline: none;
  white-space: pre;
}
.field textarea:focus { border-color: var(--bio-deep); }
.field small { display: block; margin-top: 6px; font-size: 10px; color: var(--dim); }
.field small b { color: var(--bio); }

.settings-actions { display: flex; gap: 10px; align-items: center; margin: 0; padding: 0; }
.settings-actions .spacer { flex: 1; }

.local-row { margin: -6px 0 16px; }
.local-row b { color: var(--bio); }

.keytest { display: grid; gap: 6px; margin: 0 0 18px; }
.kt {
  font-size: 11px; line-height: 1.5;
  padding: 7px 10px;
  background: rgba(1, 9, 17, 0.7);
  border-left: 3px solid var(--edge-lit);
  word-break: break-word;
}
.kt b { display: inline-block; min-width: 74px; color: var(--muted); }
.kt.ok { border-left-color: var(--bio); }
.kt.ok b { color: var(--bio); }
.kt.bad { border-left-color: var(--coral); }
.kt.bad b { color: var(--coral); }
.kt.pending { border-left-color: var(--jelly-2); color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  z-index: 1000;
  padding: 11px 18px; font-size: 12px;
  background: var(--ink-2); color: var(--foam);
  border: 2px solid var(--edge-lit);
  box-shadow: var(--shadow-hard);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--coral); color: #ffcfc4; }

/* ---------- load reveal ---------- */

.reveal { opacity: 0; transform: translateY(14px); animation: rise 0.55s ease forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }

  .col-chat {
    position: fixed; inset: auto 0 0 0; z-index: 80;
    height: 76svh;
    transform: translateY(102%);
    transition: transform 0.32s cubic-bezier(0.3, 0.9, 0.3, 1);
  }
  .col-chat.open { transform: translateY(0); }
  .chatbox { height: 100%; border-bottom: 0; }

  .chat-fab {
    display: grid; place-items: center;
    position: fixed; right: 18px; bottom: 18px; z-index: 85;
    width: 58px; height: 58px;
    background: var(--bio-deep);
    border: 3px solid var(--bio);
    box-shadow: var(--shadow-hard), 0 0 26px rgba(79, 240, 208, 0.35);
    cursor: pointer;
  }
  .chat-fab span {
    width: 24px; height: 19px; background: #02141a;
    clip-path: polygon(20% 0, 80% 0, 100% 45%, 82% 45%, 82% 100%, 62% 62%, 50% 100%, 38% 62%, 18% 100%, 18% 45%, 0 45%);
  }
  .col-chat.open ~ .chat-fab { display: none; }

  /* The button floats over the page, so the page ends above it: without this
     the last panel can never be scrolled out from under it. */
  .col-data { padding-bottom: 94px; }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .search-sm { order: 3; flex: 1 1 100%; }
  .mining, .dungeons { grid-template-columns: minmax(0, 1fr); }
  .identity { flex-direction: column; text-align: center; }
  .skin { width: 74px; }
  .layout { padding: 12px; gap: 12px; }
  .panel { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   TABS / TABLES / STATES  (added with the sectioned layout)
   ========================================================= */

.scroll-hint {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: 30px auto 0; padding: 8px 16px;
  background: none; border: 0; cursor: pointer;
  color: var(--bio);
  animation: bob 2.6s ease-in-out infinite;
}
.scroll-label {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.16em;
  text-transform: uppercase;
}
.scroll-arrow {
  width: 12px; height: 12px;
  border-right: 3px solid var(--bio);
  border-bottom: 3px solid var(--bio);
  transform: rotate(45deg);
  box-shadow: 2px 2px 0 rgba(79, 240, 208, 0.25);
}

.tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 4px 0;
  position: sticky; top: 56px; z-index: 40;
  background: linear-gradient(180deg, rgba(2, 10, 19, 0.96) 70%, transparent);
  backdrop-filter: blur(6px);
}
.tab {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.08em;
  padding: 9px 11px; cursor: pointer;
  color: var(--muted);
  background: rgba(8, 26, 42, 0.8);
  border: 2px solid var(--edge);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
  transition: color 0.16s, border-color 0.16s, transform 0.08s;
}
.tab:hover { color: var(--foam); border-color: var(--edge-lit); }
.tab:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5); }
.tab.active {
  color: #02141a; background: var(--bio); border-color: var(--bio);
  box-shadow: 3px 3px 0 rgba(29, 143, 124, 0.5);
}

/* ---------- history: two curves together, and the export ---------- */

.overlay-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.ol-pick {
  padding: 6px 9px;
  font-family: var(--font-body); font-size: 11px; color: var(--foam);
  background: rgba(1, 8, 15, 0.8); border: 1px solid var(--edge); cursor: pointer;
}
.ol-pick:focus { outline: none; border-color: var(--bio); }

.overlay-chart {
  display: block; width: 100%; height: 150px;
  background: rgba(1, 8, 15, 0.6); border: 1px solid var(--edge);
}
.ol-line { fill: none; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.ol-line.ol-0 { stroke: var(--bio); }
.ol-line.ol-1 { stroke: var(--amber); stroke-dasharray: 4 3; }

.overlay-keys { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; }
.ol-key { display: inline-flex; align-items: baseline; gap: 8px; }
.ol-key::before { content: ''; width: 14px; height: 3px; align-self: center; }
.ol-key.ol-0::before { background: var(--bio); }
.ol-key.ol-1::before { background: var(--amber); }
.ol-name { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.ol-val { font-family: var(--font-term); font-size: 15px; color: var(--foam); }

.hexport {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--edge);
}

/* ---------- in-tab filter toolbar ---------- */

.tfilter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.tfilter-q, .tfilter-sort {
  padding: 6px 9px;
  font-family: var(--font-body); font-size: 11px;
  color: var(--foam);
  background: rgba(1, 8, 15, 0.8);
  border: 1px solid var(--edge);
}
.tfilter-q { flex: 1 1 180px; min-width: 0; }
.tfilter-q::placeholder { color: var(--dim); }
.tfilter-q:focus, .tfilter-sort:focus { outline: none; border-color: var(--bio); }
.tfilter-sort { cursor: pointer; }
.tfilter-count {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bio);
}

/* ---------- what moved since last time ---------- */

.moves { display: flex; flex-wrap: wrap; gap: 8px; }
.move {
  display: inline-flex; flex-direction: column; gap: 2px;
  padding: 7px 11px;
  background: rgba(2, 12, 22, 0.6);
  border-left: 3px solid var(--edge-lit);
}
.move-k {
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim);
}
.move-v { font-family: var(--font-term); font-size: 20px; line-height: 1; }
.move.up { border-left-color: var(--bio); }
.move.up .move-v { color: var(--bio); }
.move.down { border-left-color: var(--coral); }
.move.down .move-v { color: var(--coral); }

/* A section that threw on its last render, so the tab is not a surprise. */
.tab.broken { border-color: var(--coral); color: var(--coral); }
.tab.broken::after { content: ' !'; }

.tab-content { display: flex; flex-direction: column; gap: 18px; }

.sub { font-size: 13px; color: var(--dim); }
.badge { font-size: 10px; color: var(--bio); }
.muted-line { font-size: 11px; color: var(--muted); }
.dim-line { font-size: 10px; color: var(--dim); margin-top: 4px; }

.warn {
  margin: 0 0 4px; padding: 11px 14px;
  font-size: 12px; line-height: 1.6; color: #ffe1b0;
  background: rgba(255, 200, 87, 0.08);
  border-left: 3px solid var(--amber);
}
.warn b { color: var(--amber); }

.chiplets { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chiplet {
  font-size: 9px; padding: 2px 5px;
  color: var(--muted);
  background: rgba(29, 94, 120, 0.22);
  border: 1px solid var(--edge);
}
.chiplet.attr { color: var(--jelly); border-color: rgba(255, 95, 200, 0.35); }

.perk.r-LEGENDARY { border-color: rgba(255, 200, 87, 0.45); color: var(--amber); }
.perk.r-MYTHIC    { border-color: rgba(255, 95, 200, 0.45); color: #ff8fda; }
.perk.r-EPIC      { border-color: rgba(169, 91, 255, 0.45); color: #c48cff; }
.perk.r-RARE      { border-color: rgba(77, 123, 255, 0.45); color: #7c9dff; }
.perk.r-UNCOMMON  { border-color: rgba(85, 224, 106, 0.45); color: #7bef8c; }

.chatbox.disabled .chat-form { opacity: 0.4; pointer-events: none; }
.chat-off {
  padding: 14px;
  font-size: 12px; line-height: 1.6; color: var(--muted);
  background: rgba(4, 18, 31, 0.7);
  border-left: 3px solid var(--jelly-2);
}
.chat-off strong { color: var(--jelly); }
.chat-off code {
  font-family: var(--font-term); font-size: 14px;
  padding: 0 4px; background: rgba(79, 240, 208, 0.1); color: var(--bio);
}

@media (max-width: 1180px) {
  .tabs { top: 0; }
}

/* =========================================================
   COLLECTIONS / MUSEUM / PRESETS
   ========================================================= */

.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px; }
.coll {
  padding: 9px 11px;
  background: rgba(3, 14, 25, 0.6);
  border-left: 3px solid var(--edge-lit);
}
.coll.done { border-left-color: var(--amber); }
.coll-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.coll-name {
  font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.coll-tier { font-family: var(--font-term); font-size: 18px; color: var(--foam); }
.coll.done .coll-tier { color: var(--amber); }
.coll-amount { margin-top: 4px; font-family: var(--font-term); font-size: 16px; color: var(--muted); }

.museum-grid { display: flex; flex-wrap: wrap; gap: 5px; }
.mus {
  font-size: 10px; padding: 4px 7px;
  border: 1px solid var(--edge);
  background: rgba(3, 14, 25, 0.5);
}
.mus.out { color: rgba(71, 105, 125, 0.65); border-color: rgba(18, 52, 73, 0.6); }
.mus.in { color: var(--foam); background: rgba(79, 240, 208, 0.09); border-color: var(--bio-deep); }
.mus.in.r-LEGENDARY { color: var(--amber); border-color: rgba(255, 200, 87, 0.5); }
.mus.in.r-MYTHIC    { color: #ff8fda; border-color: rgba(255, 95, 200, 0.5); }
.mus.in.r-EPIC      { color: #c48cff; border-color: rgba(169, 91, 255, 0.5); }
.mus.in.r-RARE      { color: #7c9dff; border-color: rgba(77, 123, 255, 0.5); }
.mus.in.r-SPECIAL   { color: #ff9c85; border-color: rgba(255, 122, 92, 0.5); }

.preset {
  margin-bottom: 12px; padding: 10px;
  background: rgba(2, 12, 22, 0.45);
  border: 1px solid var(--edge);
}
.preset.equipped {
  border-color: var(--bio-deep);
  box-shadow: inset 0 0 24px rgba(79, 240, 208, 0.07);
}
.preset-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.preset.equipped .preset-head { color: var(--bio); }

.perk.on { border-color: var(--bio-deep); color: var(--bio); }

/* =========================================================
   METERS / TREE BOARD / LEDGER / POWDER
   ========================================================= */

.meters { display: grid; gap: 9px; }

.meter { padding: 7px 10px; background: rgba(2, 12, 22, 0.45); border-left: 3px solid var(--edge-lit); }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.meter-label {
  font-size: 11px; color: var(--foam);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.meter-value { font-family: var(--font-term); font-size: 19px; color: var(--foam); flex: none; }
.meter-track {
  position: relative; height: 8px; margin-top: 5px;
  background: rgba(1, 8, 15, 0.85); border: 1px solid var(--edge); overflow: hidden;
}
.meter-track > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--bio-deep), var(--bio));
  box-shadow: 0 0 10px rgba(79, 240, 208, 0.45);
  transition: width 0.6s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.meter-track::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 3px, rgba(1, 8, 15, 0.5) 3px 4px);
}
.meter-foot { margin-top: 4px; font-size: 10px; color: var(--dim); }

.meter.gold   { border-left-color: var(--amber); }
.meter.gold .meter-value { color: var(--amber); }
.meter.gold .meter-track > i { background: linear-gradient(90deg, #9c7420, var(--amber)); box-shadow: 0 0 10px rgba(255, 200, 87, 0.4); }
.meter.violet { border-left-color: var(--jelly-2); }
.meter.violet .meter-value { color: var(--jelly-2); }
.meter.violet .meter-track > i { background: linear-gradient(90deg, #5b3aa8, var(--jelly-2)); box-shadow: 0 0 10px rgba(160, 107, 255, 0.4); }
.meter.pink   { border-left-color: var(--jelly); }
.meter.pink .meter-value { color: var(--jelly); }
.meter.pink .meter-track > i { background: linear-gradient(90deg, #a02f7e, var(--jelly)); box-shadow: 0 0 10px rgba(255, 95, 200, 0.4); }
.meter.coral  { border-left-color: var(--coral); }
.meter.coral .meter-value { color: var(--coral); }
.meter.coral .meter-track > i { background: linear-gradient(90deg, #a8412c, var(--coral)); }
.meter.cyan   { border-left-color: var(--bio); }
.meter.cyan .meter-value { color: var(--bio); }

.stat.coral .v { color: var(--coral); }
.stat.coral { border-left-color: var(--coral); }

/* ---------- skill tree board ---------- */

.tree-switch { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tree-btn {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.08em;
  padding: 8px 11px; cursor: pointer;
  color: var(--muted);
  background: rgba(8, 26, 42, 0.8);
  border: 2px solid var(--edge);
  transition: all 0.16s;
}
.tree-btn:hover { color: var(--foam); border-color: var(--edge-lit); }
.tree-btn.active { color: #02141a; background: var(--bio); border-color: var(--bio); }



.node {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 62px; padding: 7px 8px;
  background: rgba(3, 16, 28, 0.85);
  border: 2px solid var(--edge);
  cursor: default;
  transition: transform 0.12s, border-color 0.16s, box-shadow 0.16s;
}
.node:hover { transform: translateY(-3px); border-color: var(--bio); box-shadow: 0 0 18px rgba(79, 240, 208, 0.25); z-index: 5; }
.node-name { font-size: 9px; line-height: 1.35; color: var(--muted); }
.node-lv { font-family: var(--font-term); font-size: 21px; line-height: 1; color: var(--bio); align-self: flex-end; }

.node.lv1 { box-shadow: inset 0 -2px 0 rgba(79, 240, 208, 0.15); }
.node.lv2, .node.lv3 { box-shadow: inset 0 -3px 0 rgba(79, 240, 208, 0.3); }
.node.lv4, .node.lv5 { box-shadow: inset 0 -4px 0 rgba(79, 240, 208, 0.45); border-color: rgba(29, 143, 124, 0.7); }
.node.lv6, .node.lv7 { box-shadow: inset 0 -5px 0 rgba(255, 200, 87, 0.5); border-color: rgba(255, 200, 87, 0.4); }
.node.lv6 .node-lv, .node.lv7 .node-lv { color: var(--amber); }
.node.lv8, .node.lv9 { box-shadow: inset 0 -6px 0 rgba(255, 95, 200, 0.55); border-color: rgba(255, 95, 200, 0.45); }
.node.lv8 .node-lv, .node.lv9 .node-lv { color: var(--jelly); }
.node.forest .node-lv { color: #8ce06a; }
.node.forest:hover { border-color: #8ce06a; box-shadow: 0 0 18px rgba(140, 224, 106, 0.25); }

[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 50;
  padding: 6px 9px;
  font-family: var(--font-body); font-size: 10px; line-height: 1.4;
  white-space: nowrap;
  color: var(--foam);
  background: var(--ink);
  border: 2px solid var(--bio-deep);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* ---------- crystals ---------- */

.crystal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; }
.crystal {
  padding: 8px 10px;
  border: 1px solid var(--edge);
  background: rgba(3, 14, 25, 0.5);
}
.crystal-name { display: block; font-size: 11px; text-transform: capitalize; }
.crystal-state {
  display: block; margin-top: 3px;
  font-family: var(--font-term); font-size: 15px; letter-spacing: 0.06em;
}
.crystal.found { border-color: var(--bio-deep); background: rgba(79, 240, 208, 0.07); }
.crystal.found .crystal-name { color: var(--foam); }
.crystal.found .crystal-state { color: var(--bio); }
.crystal.missing { opacity: 0.45; }
.crystal.missing .crystal-name { color: var(--dim); }
.crystal.missing .crystal-state { color: var(--dim); }

/* ---------- ledger (dense lists) ---------- */

.ledger { display: grid; gap: 3px; max-height: 620px; overflow-y: auto; padding-right: 4px; }
.ledger.dense { max-height: 460px; }
.ledger-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline; gap: 12px;
  padding: 5px 10px;
  background: rgba(2, 12, 22, 0.4);
  border-left: 3px solid var(--edge-lit);
  font-size: 11px;
}
.ledger-row:hover { background: rgba(79, 240, 208, 0.06); }
.ledger-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-tag { font-size: 9px; color: var(--dim); text-align: right; }
.ledger-value { font-family: var(--font-term); font-size: 17px; color: var(--foam); }
.ledger-row.r-LEGENDARY { border-left-color: var(--amber); }
.ledger-row.r-LEGENDARY .ledger-name { color: var(--amber); }
.ledger-row.r-MYTHIC { border-left-color: var(--jelly); }
.ledger-row.r-MYTHIC .ledger-name { color: #ff8fda; }
.ledger-row.r-EPIC { border-left-color: #a95bff; }
.ledger-row.r-EPIC .ledger-name { color: #c48cff; }
.ledger-row.r-RARE { border-left-color: #4d7bff; }
.ledger-row.r-RARE .ledger-name { color: #7c9dff; }
.ledger-row.r-UNCOMMON { border-left-color: #55e06a; }
.ledger-row.r-UNCOMMON .ledger-name { color: #7bef8c; }
.ledger-row.r-COMMON { border-left-color: #9aa7b0; }

/* ---------- powder ---------- */

.powder-stack { display: grid; gap: 12px; align-content: start; }
.powder-card { padding: 9px 11px; background: rgba(3, 14, 25, 0.55); border-left: 3px solid var(--edge-lit); }
.powder-head { display: flex; justify-content: space-between; align-items: baseline; }
.powder-name { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.powder-now { font-family: var(--font-term); font-size: 24px; }
.powder-legend {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 5px;
  font-size: 9px; color: var(--dim);
}
.powder-legend b { color: var(--muted); font-weight: 500; }
.powder-card.mithril { border-left-color: var(--bio); }
.powder-card.mithril .powder-now { color: var(--bio); }
.powder-card.gemstone { border-left-color: var(--jelly); }
.powder-card.gemstone .powder-now { color: var(--jelly); }
.powder-card.gemstone .meter-track > i { background: linear-gradient(90deg, #a02f7e, var(--jelly)); }
.powder-card.glacite { border-left-color: #7fc7ff; }
.powder-card.glacite .powder-now { color: #7fc7ff; }
.powder-card.glacite .meter-track > i { background: linear-gradient(90deg, #3f7fb5, #7fc7ff); }
/* The Forest's three, tinted like their nodes on the board. */
.powder-card.token { border-left-color: #c8a2ff; }
.powder-card.token .powder-now { color: #c8a2ff; }
.powder-card.token .meter-track > i { background: linear-gradient(90deg, #6e4aa8, #c8a2ff); }
.powder-card.forest { border-left-color: #4ff0d0; }
.powder-card.forest .powder-now { color: #4ff0d0; }
.powder-card.forest .meter-track > i { background: linear-gradient(90deg, #1f8f7c, #4ff0d0); }
.powder-card.desert { border-left-color: #ffc857; }
.powder-card.desert .powder-now { color: #ffc857; }
.powder-card.desert .meter-track > i { background: linear-gradient(90deg, #b07a1e, #ffc857); }

/* =========================================================
   MAXED CONVENTION / FACTS / SLOT GRID / SCROLLBARS
   ========================================================= */

/* One mark for "this is finished", used on every section. */
.maxed-mark {
  display: inline-block;
  margin-left: 5px;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 200, 87, 0.7);
  font-size: 0.85em;
}
.is-maxed { border-left-color: var(--amber) !important; }
.meter.is-maxed .meter-track > i,
.bar.maxed > i { background: linear-gradient(90deg, var(--amber), #fff0c0) !important; }
.skill.is-maxed, .slayer.is-maxed, .coll.is-maxed {
  border-color: rgba(255, 200, 87, 0.45);
  box-shadow: inset 0 0 22px rgba(255, 200, 87, 0.06);
}

/* ---------- key/value facts, replaces tag soup ---------- */

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 8px; }
.fact {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 11px;
  background: rgba(2, 12, 22, 0.5);
  border-left: 3px solid var(--edge-lit);
}
.fact-k {
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim);
}
.fact-v { font-family: var(--font-term); font-size: 21px; line-height: 1.1; color: var(--foam); }
.fact.is-maxed .fact-v { color: var(--amber); }

/* ---------- inventory as the game shows it ---------- */

.slot-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 4px;
}
.cell {
  position: relative;
  display: flex; align-items: flex-end;
  min-height: 54px; padding: 4px 5px;
  background: rgba(3, 16, 28, 0.8);
  border: 2px solid var(--edge);
  overflow: hidden;
}
.cell-name {
  font-size: 8px; line-height: 1.25; color: var(--foam);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cell-count {
  position: absolute; right: 3px; bottom: 2px;
  font-family: var(--font-term); font-size: 14px; color: var(--foam);
  text-shadow: 1px 1px 0 #000;
}
.empty-cell { background: rgba(1, 8, 15, 0.5); border-style: dashed; border-color: rgba(18, 52, 73, 0.5); }
.cell.r-LEGENDARY { border-color: rgba(255, 200, 87, 0.5); } .cell.r-LEGENDARY .cell-name { color: var(--amber); }
.cell.r-MYTHIC    { border-color: rgba(255, 95, 200, 0.5); } .cell.r-MYTHIC .cell-name { color: #ff8fda; }
.cell.r-EPIC      { border-color: rgba(169, 91, 255, 0.5); } .cell.r-EPIC .cell-name { color: #c48cff; }
.cell.r-RARE      { border-color: rgba(77, 123, 255, 0.5); } .cell.r-RARE .cell-name { color: #7c9dff; }
.cell.r-UNCOMMON  { border-color: rgba(85, 224, 106, 0.5); } .cell.r-UNCOMMON .cell-name { color: #7bef8c; }

@media (max-width: 820px) {
  .slot-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ---------- resource pack icons ---------- */

.ico {
  display: block;
  flex: 0 0 auto;
  width: 32px; height: 32px;
  image-rendering: pixelated;
  /* Rarity backdrop: --rar comes from the card the icon sits in, and stays
     unset everywhere else, which leaves the tile transparent. */
  background-color: color-mix(in srgb, var(--rar, transparent) 20%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rar, transparent) 40%, transparent);
}
.ico.blank {
  background:
    repeating-linear-gradient(45deg, rgba(18, 52, 73, 0.55) 0 3px, transparent 3px 6px),
    rgba(3, 16, 28, 0.7);
  border: 1px solid rgba(18, 52, 73, 0.7);
}
/* Face at (8,8) and hat at (40,8) of a 64x64 skin, both scaled 4x. */
.ico.head {
  background-image: var(--skin), var(--skin);
  background-position: -160px -32px, -32px -32px;
  background-size: 256px 256px, 256px 256px;
  background-repeat: no-repeat;
}

.item .ihead { display: flex; align-items: flex-start; gap: 9px; }
.item .itext { flex: 1; min-width: 0; }

.cell { flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.cell .cell-ico { width: 28px; height: 28px; margin-top: 2px; }
.cell .cell-ico.head { background-position: -140px -28px, -28px -28px; background-size: 224px 224px, 224px 224px; }
.cell .cell-name { text-align: center; -webkit-line-clamp: 2; }

.ico.inline { display: inline-block; width: 18px; height: 18px; vertical-align: -4px; margin-right: 5px; }
.ico.inline.head { background-position: -90px -18px, -18px -18px; background-size: 144px 144px, 144px 144px; }
.ico.inline.sm { width: 14px; height: 14px; vertical-align: -3px; }
.ico.inline.sm.head { background-position: -70px -14px, -14px -14px; background-size: 112px 112px, 112px 112px; }
.ico.inline.blank { display: none; }

/* An item model can stack layers: the dyeable base, then the trim above it. */
.ico.stack { position: relative; }
.ico.stack .lay {
  position: absolute; inset: 0;
  background: var(--tex) center / contain no-repeat;
  image-rendering: pixelated;
}
/* The vanilla texture is a greyscale base the game multiplies by the dye, and
   the mask keeps the colour inside the sprite. */
.ico.stack .lay.dye {
  background-color: rgb(var(--dye));
  background-blend-mode: multiply;
  -webkit-mask: var(--tex) center / contain no-repeat;
  mask: var(--tex) center / contain no-repeat;
}

.ico.mat { color: var(--muted); opacity: 0.75; }
.ico.mat svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.mus .ico.inline, .mob-name .ico.inline, .crystal-name .ico.inline { margin-right: 4px; }

/* ---------- coop members, search, compare ---------- */

.chips.coop { border-right: 2px solid var(--edge); padding-right: 10px; }
.coop-chip { display: flex; align-items: center; gap: 2px; }
.coop-chip .ico.head { margin-right: 3px; }

.search-bar {
  display: flex; gap: 8px;
  padding: 12px 20px;
  border-bottom: 2px solid var(--edge);
  background: rgba(3, 16, 28, 0.5);
}
.search-bar input {
  flex: 1; min-width: 0;
  font-family: var(--font-body); font-size: 13px;
  color: var(--foam);
  background: var(--abyss-1);
  border: 2px solid var(--edge);
  padding: 9px 11px;
}
.search-bar input:focus { outline: none; border-color: var(--bio-deep); }

#search-results, #compare-body { display: block; }

.search-hit {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 9px; text-align: left; cursor: pointer;
  font-family: var(--font-body); font-size: 12px;
  color: var(--foam);
  background: rgba(7, 32, 52, 0.5);
  border: 2px solid transparent;
}
.search-hit + .search-hit { margin-top: 4px; }
.search-hit:hover { border-color: var(--edge-lit); background: rgba(29, 94, 120, 0.18); }
.search-hit .ico.inline { margin-right: 0; }
.hit-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-where { font-size: 10px; color: var(--dim); white-space: nowrap; }
.hit-tab {
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.08em;
  color: var(--bio-deep); border: 1px solid var(--edge); padding: 3px 5px; white-space: nowrap;
}

.cmp { width: 100%; border-collapse: collapse; font-size: 12px; }
.cmp th {
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: 0.06em;
  color: var(--foam); text-align: right; padding: 0 8px 10px; vertical-align: bottom;
}
.cmp th small { display: block; margin-top: 3px; font-family: var(--font-body); font-size: 9px; color: var(--dim); }
.cmp td { padding: 6px 8px; border-top: 1px solid var(--edge); text-align: right; }
.cmp .cmp-k { text-align: left; color: var(--muted); font-size: 11px; }
.cmp .cmp-v { color: var(--foam); font-variant-numeric: tabular-nums; }
.cmp .cmp-d { color: var(--dim); font-variant-numeric: tabular-nums; }
.cmp .cmp-d.up { color: var(--bio); }
.cmp .cmp-d.down { color: var(--coral); }

/* ---------- history ---------- */

.hrows { display: grid; gap: 3px; margin-top: 12px; }
.hrow {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
  padding: 6px 8px;
  background: rgba(7, 32, 52, 0.42);
  border-left: 2px solid var(--edge);
}
.hrow-k { font-size: 11px; color: var(--muted); }
.hrow-v { font-size: 12px; color: var(--foam); font-variant-numeric: tabular-nums; }
.hrow-d { display: flex; gap: 4px; }
.hd {
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.04em;
  padding: 3px 5px; border: 1px solid var(--edge); color: var(--dim);
  white-space: nowrap;
}
.hd.up { color: var(--bio); border-color: var(--bio-deep); }
.hd.down { color: var(--coral); border-color: rgba(255, 122, 92, 0.45); }
.hd.flat, .hd.none { opacity: 0.55; }

.hcharts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.hchart {
  padding: 9px 10px 8px;
  background: rgba(7, 32, 52, 0.42);
  border: 2px solid var(--edge);
}
.hchart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.hchart-k {
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.hchart-v { font-size: 12px; color: var(--foam); font-variant-numeric: tabular-nums; }
.hchart-foot { margin-top: 5px; font-size: 9px; color: var(--dim); }

.spark { display: block; width: 100%; height: 38px; margin-top: 7px; overflow: visible; }
.spark-line { fill: none; stroke: var(--bio); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.spark-fill { fill: color-mix(in srgb, var(--bio) 16%, transparent); stroke: none; }
.spark.gold .spark-line { stroke: var(--amber); }
.spark.gold .spark-fill { fill: color-mix(in srgb, var(--amber) 16%, transparent); }
.spark.pink .spark-line { stroke: var(--jelly); }
.spark.pink .spark-fill { fill: color-mix(in srgb, var(--jelly) 16%, transparent); }
.spark.violet .spark-line { stroke: var(--jelly-2); }
.spark.violet .spark-fill { fill: color-mix(in srgb, var(--jelly-2) 16%, transparent); }
.spark.coral .spark-line { stroke: var(--coral); }
.spark.coral .spark-fill { fill: color-mix(in srgb, var(--coral) 16%, transparent); }

/* ---------- animated pack textures ---------- */

/* The file is a vertical strip of frames; the keyframe rule walks down it. */
.ico.anim {
  position: relative;
  background-image: var(--tex);
  background-size: 100% auto;
  background-repeat: no-repeat;
  background-position: 50% 0;
  animation: var(--anim) var(--anim-time) step-end infinite;
}
.ico.anim .lay { position: absolute; inset: 0; }
@media (prefers-reduced-motion: reduce) {
  .ico.anim { animation: none; }
}

/* ---------- minecraft tooltip frame ---------- */

/* The pack ships one nine-slice frame per rarity; the border is drawn at the
   sprite's own scale, so no pixel is resampled. The fill is the same navy in
   every one of them, so it stays a plain colour. */
.detail.tip {
  --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/common_frame.png');
  /* The frame carries the rarity; the icons inside keep their own. */
  --rar: initial;
  border: 24px solid transparent;
  border-image: var(--tip) 24 stretch;
  background: rgba(5, 18, 38, 0.94);
  image-rendering: pixelated;
  /* The frame eats 48px of width; the body keeps the room it had. The dialog
     itself never scrolls, the body inside it does. */
  max-width: 668px;
  overflow: hidden;
}
.detail.tip .detail-head { padding: 2px 34px 12px 2px; background: none; }
.detail.tip .detail-body { padding: 14px 6px 2px; overflow-x: hidden; }
.detail.tip .detail-close { top: -4px; right: -4px; }
.detail.tip.r-UNCOMMON { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/uncommon_frame.png'); }
.detail.tip.r-RARE { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/rare_frame.png'); }
.detail.tip.r-EPIC { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/epic_frame.png'); }
.detail.tip.r-LEGENDARY { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/legendary_frame.png'); }
.detail.tip.r-MYTHIC { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/mythic_frame.png'); }
.detail.tip.r-SPECIAL { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/special_frame.png'); }
.detail.tip.r-VERY_SPECIAL { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/very_special_frame.png'); }
.detail.tip.r-SUPREME { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/supreme_frame.png'); }
.detail.tip.r-ULTIMATE { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/ultimate_frame.png'); }
.detail.tip.r-ADMIN { --tip: url('/pack/assets/hypixel_skyblock/textures/gui/sprites/tooltip/admin_frame.png'); }

/* ---------- custom scrollbars ---------- */

.scroll { max-height: 620px; overflow: auto; padding-right: 6px; padding-bottom: 6px; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-track {
  background: rgba(1, 8, 15, 0.8);
  border: 1px solid var(--edge);
}
.scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--bio-deep), #0d5f52);
  border: 1px solid var(--bio-deep);
  box-shadow: inset 0 0 6px rgba(79, 240, 208, 0.35);
}
.scroll::-webkit-scrollbar-thumb:hover { background: var(--bio-deep); }
.scroll::-webkit-scrollbar-corner { background: rgba(1, 8, 15, 0.8); }
.scroll { scrollbar-width: thin; scrollbar-color: var(--bio-deep) rgba(1, 8, 15, 0.8); }

/* Apply styled scrollbars to all scrollable elements */
body, html { scrollbar-width: thin; scrollbar-color: var(--bio-deep) rgba(1, 8, 15, 0.8); }
body::-webkit-scrollbar, html::-webkit-scrollbar { width: 10px; height: 10px; }
body::-webkit-scrollbar-track, html::-webkit-scrollbar-track {
  background: rgba(1, 8, 15, 0.8);
  border: 1px solid var(--edge);
}
body::-webkit-scrollbar-thumb, html::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--bio-deep), #0d5f52);
  border: 1px solid var(--bio-deep);
  box-shadow: inset 0 0 6px rgba(79, 240, 208, 0.35);
}
body::-webkit-scrollbar-thumb:hover, html::-webkit-scrollbar-thumb:hover { background: var(--bio-deep); }
body::-webkit-scrollbar-corner, html::-webkit-scrollbar-corner { background: rgba(1, 8, 15, 0.8); }
.attr-list { max-height: 560px; }
.preset-list { max-height: 720px; }

/* ---------- tree board fixes and layout ---------- */

.tree-board { display: block; }
.tree-board[hidden] { display: none; }
.tree-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.tree-grid.small { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); margin-top: 6px; }
.tree-sub {
  margin: 14px 0 2px;
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--dim);
}
.node.unlock { min-height: 48px; border-style: dashed; }
.node.unlock .node-lv { color: var(--muted); font-size: 15px; }




/* ---------- forge ---------- */

.forge { display: grid; gap: 8px; }
.forge-slot {
  padding: 9px 11px;
  background: rgba(2, 12, 22, 0.5);
  border-left: 3px solid var(--edge-lit);
}
.forge-slot.done { border-left-color: var(--amber); background: rgba(255, 200, 87, 0.07); }
.forge-name { display: block; font-size: 12px; }
.forge-state { display: block; margin: 2px 0 5px; font-size: 10px; color: var(--muted); }
.forge-slot.done .forge-state { color: var(--amber); }
.forge-foot { display: block; margin-top: 6px; font-size: 9px; color: var(--dim); }
.forge + .facts, .facts + .forge { margin-top: 14px; }

/* ---------- misc ---------- */

.chip-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.chip-tag {
  font-size: 10px; padding: 4px 8px;
  color: var(--dim);
  background: rgba(3, 14, 25, 0.5);
  border: 1px solid var(--edge);
}
.chip-tag.on { color: var(--foam); border-color: var(--bio-deep); background: rgba(79, 240, 208, 0.08); }

.recomb {
  display: inline-block; margin-left: 5px; padding: 0 3px;
  font-size: 8px; color: #02141a; background: var(--jelly);
}

.tier-dot {
  display: inline-block; width: 14px; height: 14px; margin-right: 3px;
  font-size: 8px; line-height: 14px; text-align: center; text-transform: uppercase;
  color: var(--dim); background: rgba(1, 8, 15, 0.7); border: 1px solid var(--edge);
}
.tier-dot.on { color: #02141a; }
.tier-dot.on.bronze { background: #c87f43; border-color: #c87f43; }
.tier-dot.on.silver { background: #c9d4dd; border-color: #c9d4dd; }
.tier-dot.on.gold { background: var(--amber); border-color: var(--amber); }
.tier-dot.on.diamond { background: #7fe9ff; border-color: #7fe9ff; }
.tier-note { margin-left: 6px; color: var(--dim); }

.tier-bars { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tier-bar {
  font-family: var(--font-term); font-size: 14px;
  padding: 1px 6px; color: var(--muted);
  background: rgba(29, 94, 120, 0.18); border: 1px solid var(--edge);
}
.tier-bar b { color: var(--jelly); font-weight: 400; margin-right: 4px; }

.attr-src {
  display: inline-block; margin-top: 2px;
  font-size: 9px; color: var(--muted);
}
.attr-src.r-LEGENDARY { color: var(--amber); }
.attr-src.r-MYTHIC { color: #ff8fda; }
.attr-src.r-EPIC { color: #c48cff; }
.attr-src.r-RARE { color: #7c9dff; }

.museum-grid.scroll { max-height: 420px; }

/* ---------- skill tree board (Heart of the Mountain and of the Forest) ----- */

.tree-grid { display: grid; gap: 4px; }
.tnode {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 60px; padding: 4px 5px;
  background: rgba(3, 16, 28, 0.85);
  border: 2px solid var(--edge);
  overflow: hidden;
  transition: transform 0.12s, border-color 0.16s, box-shadow 0.16s;
}
.tnode.blank { background: none; border: 1px dashed rgba(18, 52, 73, 0.35); min-height: 60px; }
.tnode:not(.blank):hover {
  transform: translateY(-3px); border-color: var(--bio);
  box-shadow: 0 0 18px rgba(79, 240, 208, 0.3); z-index: 6;
}
.tnode-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(79, 240, 208, 0.35), rgba(79, 240, 208, 0.12));
  pointer-events: none;
}
.tnode-name {
  position: relative; font-size: 8px; line-height: 1.2; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tnode-lv {
  position: relative; align-self: flex-end;
  font-family: var(--font-term); font-size: 17px; line-height: 1; color: var(--bio);
}
.tnode.locked { opacity: 0.42; }
.tnode.locked .tnode-lv { color: var(--dim); }
.tnode.on .tnode-name { color: var(--foam); }
.tnode.maxed { border-color: rgba(255, 200, 87, 0.65); }
.tnode.maxed .tnode-fill { background: linear-gradient(180deg, rgba(255, 200, 87, 0.4), rgba(255, 200, 87, 0.14)); }
.tnode.maxed .tnode-lv { color: var(--amber); }
.tnode.ability { border-style: double; border-width: 3px; }
.tnode.ability .tnode-lv { color: var(--jelly); }
.tnode.special { border-color: var(--jelly-2); }
.tnode.special .tnode-fill { background: linear-gradient(180deg, rgba(160, 107, 255, 0.4), rgba(160, 107, 255, 0.12)); }
.tnode.special .tnode-lv { color: var(--jelly-2); }
.tnode.gated { opacity: 0.38; border-style: dashed; }

/* One currency, one tint, whichever tree the node belongs to. */
.tnode.cur-mithril  .tnode-fill { background: linear-gradient(180deg, rgba(79, 240, 208, 0.34), rgba(79, 240, 208, 0.10)); }
.tnode.cur-gemstone .tnode-fill { background: linear-gradient(180deg, rgba(255, 95, 200, 0.30), rgba(255, 95, 200, 0.10)); }
.tnode.cur-glacite  .tnode-fill { background: linear-gradient(180deg, rgba(127, 199, 255, 0.30), rgba(127, 199, 255, 0.10)); }
.tnode.cur-forest   .tnode-fill { background: linear-gradient(180deg, rgba(79, 240, 208, 0.34), rgba(79, 240, 208, 0.10)); }
.tnode.cur-desert   .tnode-fill { background: linear-gradient(180deg, rgba(255, 200, 87, 0.32), rgba(255, 200, 87, 0.10)); }
.tnode.cur-mixed    .tnode-fill { background: linear-gradient(180deg, rgba(160, 107, 255, 0.32), rgba(160, 107, 255, 0.10)); }

/* The gutter cell: a tier number in the Forest, an empty rail in the Mountain. */
.tnode.tier-mark {
  justify-content: center; align-items: center; gap: 2px;
  background: rgba(3, 16, 28, 0.5);
  border-color: rgba(18, 52, 73, 0.75);
}
.tnode.tier-mark .tnode-name {
  font-size: 7px; letter-spacing: 0.12em; text-transform: uppercase; text-align: center;
}
.tnode.tier-mark .tnode-lv { align-self: center; font-size: 20px; }
.tnode.tier-mark.on { border-color: rgba(79, 240, 208, 0.5); }
.tnode.tier-mark.on .tnode-lv { color: var(--bio); }
.tnode.tier-mark.next { border-color: rgba(255, 200, 87, 0.55); }
.tnode.tier-mark.next .tnode-lv { color: var(--amber); }
.tnode.tier-mark.locked { opacity: 0.4; }

/* Per-loadout counters above the board, and the shared legend under it. */
.tree-stats {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 9px;
  font-size: 10px; letter-spacing: 0.06em; color: var(--muted);
}
.tree-stats span { font-family: var(--font-term); font-size: 14px; color: var(--foam); }

.tree-legend {
  display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 12px;
}
.tleg {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim);
}
.tleg::before {
  content: ''; width: 10px; height: 10px;
  border: 1px solid var(--edge); background: rgba(3, 16, 28, 0.85);
}
.tleg.cur-mithril::before  { background: rgba(79, 240, 208, 0.55); }
.tleg.cur-gemstone::before { background: rgba(255, 95, 200, 0.55); }
.tleg.cur-glacite::before  { background: rgba(127, 199, 255, 0.55); }
.tleg.cur-forest::before   { background: rgba(79, 240, 208, 0.55); }
.tleg.cur-desert::before   { background: rgba(255, 200, 87, 0.55); }
.tleg.cur-mixed::before    { background: rgba(160, 107, 255, 0.55); }
.tleg.is-maxed::before   { border-color: rgba(255, 200, 87, 0.75); }
.tleg.is-ability::before { border-style: double; border-width: 3px; }
.tleg.is-gated::before   { border-style: dashed; opacity: 0.5; }

.powder-tier {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 7px 0 3px; font-size: 9px; letter-spacing: 0.06em; color: var(--dim);
}
.powder-tier-val { font-family: var(--font-term); font-size: 14px; color: var(--muted); }
.powder-tier-val.done { color: var(--amber); }
.powder-pace {
  margin-top: 7px; padding-top: 7px;
  border-top: 1px dashed var(--edge);
  font-size: 10px; line-height: 1.5; color: var(--dim);
}
.powder-pace b { font-family: var(--font-term); font-size: 14px; color: var(--bio); font-weight: 400; }
.meter-track.nodes > i { background: linear-gradient(90deg, #9c7420, var(--amber)); }

@media (max-width: 900px) {
  .tnode-name { font-size: 7px; -webkit-line-clamp: 2; }
  .tnode, .tnode.blank { min-height: 46px; }
}

/* =========================================================
   CLICKABLE CONVENTION + DETAIL DIALOG
   ========================================================= */

/* Anything with real detail behind it carries a pixel corner tab. */
.clickable { position: relative; cursor: pointer; }
.clickable::before {
  content: '';
  position: absolute; right: 0; bottom: 0;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-bottom: 8px solid var(--bio-deep);
  opacity: 0.55;
  transition: opacity 0.16s, border-bottom-color 0.16s;
  pointer-events: none;
}
.clickable:hover::before, .clickable:focus-visible::before {
  opacity: 1;
  border-bottom-color: var(--bio);
}
.clickable:hover { border-color: var(--bio-deep); }
.clickable:focus-visible {
  outline: 2px solid var(--bio);
  outline-offset: 1px;
}
.clickable:active { transform: translateY(1px); }
.cell.clickable::before { border-left-width: 6px; border-bottom-width: 6px; }
.mus.clickable::before { border-left-width: 5px; border-bottom-width: 5px; }
.tnode.clickable.locked::before { opacity: 0.25; }

.detail {
  border: 3px solid var(--edge-lit);
  background: var(--ink);
  color: var(--foam);
  padding: 0;
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.7);
  max-width: 620px; width: calc(100% - 32px);
}
.detail::backdrop { background: rgba(1, 5, 12, 0.82); backdrop-filter: blur(4px); }
.detail-inner { display: flex; flex-direction: column; max-height: 82vh; }

.detail-head {
  position: relative;
  padding: 18px 52px 14px 20px;
  border-bottom: 2px solid var(--edge);
  background: rgba(3, 16, 28, 0.7);
}
.detail-title {
  margin: 0;
  font-family: var(--font-pixel); font-size: 15px; letter-spacing: 0.06em;
  color: var(--foam); line-height: 1.4;
}
.detail-title.r-LEGENDARY { color: var(--amber); }
.detail-title.r-MYTHIC { color: #ff8fda; }
.detail-title.r-EPIC { color: #c48cff; }
.detail-title.r-RARE { color: #7c9dff; }
.detail-title.r-UNCOMMON { color: #7bef8c; }
.detail-title.r-DIVINE { color: #8beeff; }
.detail-title.r-SPECIAL { color: #ff9c85; }
.detail-sub {
  margin: 5px 0 0;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim);
}
.detail-close {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px;
  font-family: var(--font-pixel); font-size: 12px;
  color: var(--muted);
  background: var(--ink-2);
  border: 2px solid var(--edge);
  cursor: pointer;
}
.detail-close:hover { color: var(--coral); border-color: var(--coral); }

.detail-body { padding: 16px 20px 20px; display: grid; gap: 14px; max-height: 62vh; }
.detail-h {
  margin: 4px 0 -4px;
  font-family: var(--font-pixel); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--bio);
}
.lore {
  display: grid; gap: 3px;
  padding: 11px 13px;
  background: rgba(1, 9, 17, 0.75);
  border-left: 3px solid var(--jelly-2);
  font-size: 11px; line-height: 1.5; color: var(--muted);
}
.mono { font-family: var(--font-body); font-size: 11px; color: var(--bio); }
.src { font-size: 9px; color: var(--dim); }

/* =========================================================
   SPACING PASS + POWDER CARD REWORK
   ========================================================= */

/* Blocks inside a panel were butting into each other. Give every
   adjacent pair breathing room instead of patching case by case. */
.panel > * + * { margin-top: 14px; }
.panel > .panel-title + * { margin-top: 0; }
.facts + .meters,
.meters + .facts,
.meters + .meters,
.facts + .facts,
.headline + .meters,
.facts + .perks,
.meters + .perks,
.facts + .table,
.facts + .ledger,
.meters + .ledger,
.facts + .gear,
.meters + .gear,
.facts + .chip-row,
.facts + .lore { margin-top: 14px; }
.meter + .meter { margin-top: 0; }
.detail-body > * + * { margin-top: 0; }
.detail-body .facts + .meters { margin-top: 4px; }
.preset + .preset { margin-top: 12px; }
.tree-switch + .tree-board { margin-top: 4px; }
.tree-board + .dim-line { margin-top: 12px; }

.powder-sub {
  margin-top: 2px;
  font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim);
}
.powder-card .powder-tier { margin-top: 12px; }
.powder-card .meter-track { margin-top: 4px; }
.powder-card .powder-legend { margin-top: 7px; }
.powder-legend .ok { color: var(--bio); }
.powder-legend .short { color: var(--coral); }

/* ---------- forest tree, grouped by tier ---------- */

.tier-row + .tier-row { margin-top: 12px; }
.tier-label {
  margin-bottom: 5px;
  font-family: var(--font-pixel); font-size: 8px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--dim);
}
.detail-desc {
  margin: 0 0 12px; padding: 9px 11px;
  background: rgba(6, 24, 40, 0.75); border-left: 3px solid var(--jelly);
  font-size: 11px; line-height: 1.55; color: var(--muted);
}

/* ---------- long grids get their own scroll box ---------- */

.crystal-grid.scroll { max-height: 440px; overflow-y: auto; padding-right: 4px; }
.ledger-row .ledger-value { white-space: nowrap; }
.panel > .facts + .ledger, .panel > .facts + .meters { margin-top: 14px; }

/* ---------- bestiary board ---------- */

.mob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 6px; }
.mob-grid.scroll { max-height: 430px; overflow-y: auto; padding-right: 4px; }
.mob {
  position: relative; overflow: hidden;
  display: grid; gap: 2px;
  padding: 7px 9px;
  background: rgba(3, 16, 28, 0.8);
  border: 1px solid var(--edge);
}
.mob-fill {
  position: absolute; left: 0; bottom: 0; height: 2px;
  background: var(--bio); opacity: 0.75;
}
.mob-name { position: relative; font-size: 10.5px; color: var(--foam); }
.mob-tier {
  position: relative; justify-self: start;
  font-family: var(--font-term); font-size: 16px; line-height: 1; color: var(--bio);
}
.mob-kills { position: relative; font-size: 9px; color: var(--dim); }
.mob.empty { opacity: 0.45; }
.mob.is-maxed { border-color: rgba(255, 200, 87, 0.55); }
.mob.is-maxed .mob-tier { color: var(--amber); }
.mob.is-maxed .mob-fill { background: var(--amber); }

/* ---------- pet perks and gemstones in the detail dialog ---------- */

.perk {
  display: grid; gap: 3px;
  margin-top: 8px; padding: 9px 11px;
  background: rgba(6, 24, 40, 0.7); border-left: 3px solid var(--jelly-2);
}
.perk-name { font-size: 11px; color: var(--jelly-2); }
.perk-desc { font-size: 11px; line-height: 1.5; color: var(--muted); }

.gem-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.gem {
  display: grid; gap: 2px;
  padding: 8px 10px;
  background: rgba(6, 24, 40, 0.7); border: 1px solid var(--edge);
}
.gem-head { font-size: 11px; color: var(--bio); }
.gem-slot { font-size: 9px; letter-spacing: 0.06em; color: var(--dim); }
.gem-stat { font-size: 10.5px; color: var(--muted); }

.mus.via { border-style: dotted; }
