/* ═══════════════════════════════════════════════════════════════════
   Tools section — shared styling (uses theme design tokens)
   Auto-enqueued by inc/tools-studio.php on /tools/, /tier-list/,
   /pity-tracker/, /compare/
   ═══════════════════════════════════════════════════════════════════ */

.tl-wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.2rem 6rem; color: var(--c1); }

/* ---- Banner ---- */
.tl-banner { text-align: center; padding: 2rem 1rem 1.4rem; position: relative; }
.tl-back {
  position: absolute; left: 0; top: 1.2rem;
  color: var(--c2); text-decoration: none; font-size: 0.82rem;
  transition: color var(--t);
}
.tl-back:hover { color: var(--gold); }
.tl-banner__title {
  font-family: var(--fd); font-size: 1.9rem; font-weight: 700;
  letter-spacing: 0.05em; color: var(--c1); margin: 0;
}
.tl-banner__sub { color: var(--c2); font-size: 0.92rem; margin: 0.5rem auto 0; max-width: 600px; line-height: 1.55; }
@media (max-width: 600px) {
  .tl-banner__title { font-size: 1.4rem; }
  .tl-back { position: static; display: inline-block; margin-bottom: 0.8rem; }
}

/* ---- Hub card grid ---- */
.tl-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.tl-hubcard {
  display: block; text-decoration: none; color: inherit;
  background: linear-gradient(160deg, var(--bg3), var(--bg2));
  border: 1px solid var(--border); border-radius: 12px;
  padding: 1.4rem 1.4rem 1.3rem; transition: all var(--t); position: relative; overflow: hidden;
}
.tl-hubcard::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 90% 0%, rgba(200,167,78,0.12), transparent 55%);
  opacity: 0; transition: opacity var(--t); pointer-events: none;
}
.tl-hubcard:hover { border-color: var(--gold); transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.35); }
.tl-hubcard:hover::after { opacity: 1; }
.tl-hubcard__icon { font-size: 2rem; line-height: 1; margin-bottom: 0.8rem; display: block; }
.tl-hubcard__title { font-family: var(--fd); font-size: 1.15rem; font-weight: 600; color: var(--c1); margin: 0 0 0.5rem; }
.tl-hubcard__desc { color: var(--c2); font-size: 0.86rem; line-height: 1.55; margin: 0; }
.tl-hubcard__go { margin-top: 1rem; color: var(--gold); font-size: 0.82rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.3rem; }

/* ---- Generic card / section ---- */
.tl-card {
  background: linear-gradient(180deg, var(--bg3), var(--bg2));
  border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.tl-card__h { font-family: var(--fd); font-size: 0.95rem; font-weight: 600; letter-spacing: 0.03em; color: var(--c1); margin: 0 0 0.9rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tl-card__h small { font-size: 0.72rem; font-weight: 400; color: var(--c3); letter-spacing: 0; }

/* ---- Buttons ---- */
.tl-btn { background: var(--gold); color: #1a1a1a; border: none; border-radius: 7px; padding: 0.55rem 1.1rem; font-size: 0.85rem; font-weight: 700; cursor: pointer; font-family: var(--ff); transition: all var(--t); }
.tl-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.tl-btn--ghost { background: var(--bg4); color: var(--c1); }
.tl-btn--ghost:hover { background: var(--bg-hover); }
.tl-btn--red { background: var(--red); color: #fff; }
.tl-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--green); color: #fff; padding: 0.7rem 1.4rem; border-radius: 8px; font-size: 0.9rem; z-index: 10000; box-shadow: 0 6px 20px rgba(0,0,0,0.4); opacity: 0; transition: opacity var(--t); pointer-events: none; }
.tl-toast.show { opacity: 1; }

/* ---- Form fields ---- */
.tl-field { display: block; margin-bottom: 0.7rem; }
.tl-field > span { display: block; font-size: 0.8rem; color: var(--c2); margin-bottom: 0.35rem; }
.tl-field input, .tl-field select {
  width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--c1); padding: 0.55rem 0.7rem; font-size: 0.92rem; font-family: var(--ff); outline: none; transition: border-color var(--t);
}
.tl-field input:focus, .tl-field select:focus { border-color: var(--gold); }
.tl-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
@media (max-width: 480px) { .tl-row2 { grid-template-columns: 1fr; } }

/* ───────────────── TIER LIST ───────────────── */
.tier-toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.tier-board { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1.4rem; }
.tier-line { display: flex; align-items: stretch; min-height: 84px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.tier-label { width: 70px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: var(--fd); font-size: 1.4rem; font-weight: 700; color: #1a1a1a; text-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.tier-drop { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; align-content: flex-start; min-height: 84px; transition: background var(--t); }
.tier-drop.dragover { background: rgba(200,167,78,0.1); }
.tier-pool { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.tier-pool__h { font-size: 0.78rem; color: var(--c2); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.tier-pool__grid { display: flex; flex-wrap: wrap; gap: 4px; min-height: 80px; }
.tier-chip {
  width: 64px; height: 72px; border-radius: 6px; overflow: hidden; cursor: grab;
  background: var(--bg4); border: 1px solid var(--border); position: relative; flex-shrink: 0;
  transition: transform var(--t), border-color var(--t);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.tier-chip:hover { border-color: var(--gold); transform: scale(1.05); z-index: 2; }
.tier-chip.dragging { opacity: 0.4; }
.tier-chip img { width: 100%; height: 52px; object-fit: cover; display: block; }
.tier-chip__noimg { height: 52px; display: flex; align-items: center; justify-content: center; color: var(--c3); font-size: 1.2rem; }
.tier-chip__name { font-size: 0.56rem; line-height: 1.1; text-align: center; padding: 2px 1px; color: var(--c1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tier-chip__rank { position: absolute; top: 1px; left: 1px; font-size: 0.52rem; font-weight: 700; background: rgba(0,0,0,0.7); color: var(--rank-s); border-radius: 2px; padding: 0 3px; }
.tier-chip__rank--a { color: var(--rank-a); } /* purple */
.tier-chip__rank--b { color: var(--rank-b); } /* blue */
.tier-search { max-width: 260px; }

/* ── drag & drop visuals ── */
.tier-chip img { pointer-events: none; }
.tier-chip--ghost { opacity: 0.3; }
.tier-chip--ph { border: 2px dashed var(--gold) !important; background: rgba(200,167,78,0.14) !important; box-sizing: border-box; pointer-events: none; }
.tier-chip--clone { position: fixed; left: 0; top: 0; z-index: 10060; margin: 0 !important; pointer-events: none;
  box-shadow: 0 10px 26px rgba(0,0,0,0.55); transform: rotate(2deg); opacity: 0.96; border-color: var(--gold) !important; }
body.tl-dragging, body.tl-dragging .tier-chip { cursor: grabbing; }

/* ── row controls + inline-editable label ── */
.tier-label { outline: none; cursor: text; word-break: break-word; padding: 2px 4px; }
.tier-label:focus { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.55); }
.tier-rowctl { width: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 2px; background: var(--bg3); border-left: 1px solid var(--border); }
.tier-gear { background: none; border: none; color: var(--c2); font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 5px; border-radius: 5px; transition: all var(--t); }
.tier-gear:hover { color: var(--c1); background: rgba(255,255,255,0.08); }
.tier-arrows { display: flex; flex-direction: column; }
.tier-arrow { background: none; border: none; color: var(--c3); font-size: 0.72rem; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px; transition: all var(--t); }
.tier-arrow:hover { color: var(--c1); background: rgba(255,255,255,0.08); }

/* ── row settings modal ── */
.tlm { position: fixed; inset: 0; z-index: 10080; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); padding: 1rem; }
.tlm[hidden] { display: none; }
.tlm__box { background: #26262b; border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem 1.6rem 1.6rem; max-width: 760px; width: 100%; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,0.55); }
.tlm__x { position: absolute; top: 8px; right: 14px; background: none; border: none; color: var(--c2); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.tlm__x:hover { color: #fff; }
.tlm__h { text-align: center; font-size: 1rem; font-weight: 700; color: #fff; margin: 0.4rem 0 0.9rem; }
.tlm__palette { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 1.1rem; }
.tlm-sw { width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.22); cursor: pointer; padding: 0; transition: transform var(--t), box-shadow var(--t); }
.tlm-sw:hover { transform: scale(1.12); }
.tlm-sw.is-active { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,0.35); }
.tlm__text { width: 100%; min-height: 48px; resize: vertical; background: #fff; color: #111; border: none; border-radius: 6px; padding: 0.55rem 0.8rem; font-size: 1rem; font-family: var(--ff); margin-bottom: 1rem; }
.tlm__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.tlm-btn { background: #ededed; color: #1a1a1a; border: none; border-radius: 6px; padding: 0.7rem 1rem; font-size: 0.9rem; font-weight: 600; cursor: pointer; font-family: var(--ff); transition: all var(--t); }
.tlm-btn:hover { background: #fff; }
.tlm-btn--danger:hover { background: #ffdede; color: var(--red); }
@media (max-width: 520px) { .tlm__grid { grid-template-columns: 1fr; } }

/* ── bigger hero icons on desktop (~1.5×) ── */
@media (min-width: 768px) {
  .tier-chip { width: 96px; height: 108px; }
  .tier-chip img, .tier-chip__noimg { height: 80px; }
  .tier-chip__name { font-size: 0.74rem; padding: 3px 2px; }
  .tier-chip__rank { font-size: 0.64rem; }
  .tier-line, .tier-drop, .tier-pool__grid { min-height: 122px; }
  .tier-label { width: 92px; font-size: 1.7rem; }
  .tier-rowctl { width: 62px; }
  .tier-gear { font-size: 1.3rem; }
}
@media (max-width: 767px) {
  .tier-rowctl { width: 60px; }
  .tier-arrow { font-size: 0.95rem; padding: 7px 6px; }
}

/* ───────────────── PITY TRACKER ───────────────── */
.pity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 760px) { .pity-grid { grid-template-columns: 1fr; } }
.pity-meter { text-align: center; padding: 1.4rem 1rem; }
.pity-ring { position: relative; width: 180px; height: 180px; margin: 0 auto 1rem; }
.pity-ring svg { transform: rotate(-90deg); }
.pity-ring__num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pity-ring__big { font-family: var(--fd); font-size: 2.6rem; font-weight: 700; color: var(--c1); line-height: 1; }
.pity-ring__lbl { font-size: 0.72rem; color: var(--c2); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; }
.pity-stepper { display: flex; gap: 0.5rem; justify-content: center; align-items: center; margin-top: 0.8rem; }
.pity-stepbtn { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg4); color: var(--c1); font-size: 1.4rem; cursor: pointer; transition: all var(--t); }
.pity-stepbtn:hover { border-color: var(--gold); background: var(--bg-hover); }
.pity-stat { display: flex; justify-content: space-between; padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.pity-stat span { color: var(--c2); }
.pity-stat b { color: var(--c1); font-variant-numeric: tabular-nums; }
.pity-stat b.good { color: var(--green); }
.pity-stat b.warn { color: var(--gold); }
.pity-bar { height: 10px; background: var(--bg4); border-radius: 6px; overflow: hidden; margin: 0.4rem 0 0.2rem; }
.pity-bar__fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); transition: width 0.3s; }

/* ───────────────── COMPARE ───────────────── */
.cmp-pickers { display: grid; gap: 0.7rem; margin-bottom: 1.2rem; }
.cmp-table-wrap { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; min-width: 480px; }
.cmp-table th, .cmp-table td { padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--border); text-align: center; }
.cmp-table th.cmp-rowlbl, .cmp-table td.cmp-rowlbl { text-align: left; color: var(--c2); font-size: 0.82rem; white-space: nowrap; }
.cmp-hero-head { vertical-align: bottom; }
.cmp-hero-head img { width: 84px; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; margin: 0 auto 0.4rem; }
.cmp-hero-head__name { font-family: var(--fd); font-size: 0.95rem; color: var(--c1); }
.cmp-hero-head__rank { font-size: 0.72rem; color: var(--rank-s); }
.cmp-stat-best { color: var(--green); font-weight: 700; }
.cmp-stat-bar { height: 6px; background: var(--bg4); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.cmp-stat-bar__fill { height: 100%; background: var(--gold); }
.cmp-tag { display: inline-block; background: var(--bg4); border: 1px solid var(--border); border-radius: 4px; padding: 1px 7px; font-size: 0.72rem; color: var(--c2); margin: 2px; }
.cmp-empty { color: var(--c3); font-size: 0.85rem; }

/* ---- Dark search box with monochrome magnifier (shared) ---- */
.tl-searchbox { position: relative; display: inline-flex; align-items: center; max-width: 260px; width: 100%; }
.tl-searchbox__ico { position: absolute; left: 9px; width: 16px; height: 16px; fill: var(--c3); pointer-events: none; }
.tl-searchbox__input {
  width: 100%; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--c1); padding: 0.5rem 0.7rem 0.5rem 2rem; font-size: 0.9rem;
  font-family: var(--ff); outline: none; transition: border-color var(--t);
}
.tl-searchbox__input::placeholder { color: var(--c3); }
.tl-searchbox__input:focus { border-color: var(--gold); }
.tl-searchbox__input:focus + .tl-searchbox__ico,
.tl-searchbox:focus-within .tl-searchbox__ico { fill: var(--c2); }
