/* Tools pages (/tools, /pearl-calculator, /pill-calculator, /lb-calculator): tools.js, pearls.js, pills.js, lb-calc.js.
   Game art is shown as it is (no filters or overlays). Phone first; the boxes keep their room while data loads. */
.tl-hero { padding-bottom: 12px; }
.tl-crumb { margin: 0; }
.tl-wrap { padding-bottom: 40px; }
.tl-note { color: var(--faint); font-size: 0.86rem; margin: 14px 0 0; max-width: 820px; }
.tl-empty { color: var(--muted); padding: 28px 0; margin: 0; }
.tl-noicon { display: inline-block; border-radius: 10px; background: var(--panel-2); }

/* tools index */
.tl-index { list-style: none; margin: 0 0 48px; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.tl-tool { position: relative; display: flex; gap: 18px; align-items: center; height: 100%; min-height: 136px; padding: 20px 64px 20px 22px; border-radius: var(--r-xl); border: 0; background: var(--surface); box-shadow: var(--shadow-card); color: var(--text); }
.tl-tool:hover { color: var(--text); box-shadow: 0 0 0 1px var(--line-3), 0 14px 26px -16px rgba(0, 0, 0, 0.7); }
.tl-tool img { padding: 8px; border-radius: var(--r-md); background: var(--well); box-shadow: var(--ring); box-sizing: content-box; }
.tl-tool img { flex: none; width: 64px; height: 64px; object-fit: contain; }
.tl-tool b { display: block; font: 700 var(--fs-lg)/1.15 var(--head); letter-spacing: -0.01em; margin-bottom: 4px; }
.tl-tool small { display: block; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }

/* character picker */
.tl-picker { position: relative; max-width: 560px; margin: 0 0 18px; }
.tl-picker .search { display: block; }
.tl-results { list-style: none; margin: 6px 0 0; padding: 6px; position: absolute; left: 0; right: 0; top: 100%; z-index: 30; max-height: min(420px, 60vh); overflow: auto;
  background: var(--surface); border: 0; border-radius: var(--r-md); box-shadow: var(--shadow-pop); }
.tl-unit { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 6px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.tl-unit:hover, .tl-unit:focus-visible { background: var(--panel-2); }
.tl-unit img { width: 44px; height: 44px; }
.tl-unit-t { min-width: 0; }
.tl-unit-t b, .tl-unit-t small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-unit-t small { color: var(--muted); font-size: 0.8rem; }
.tl-unit-s { display: inline-flex; }
.tl-unit-s img { width: 12px; height: 12px; }
.tl-more { color: var(--faint); font-size: 0.84rem; padding: 8px 6px; }

/* picked character */
.tl-out { min-height: max(320px, 70vh); }
.tl-head { display: flex; gap: 14px; align-items: center; margin: 4px 0 16px; }
.tl-head > img, .tl-head > .tl-noicon { flex: none; width: 64px; height: 64px; border-radius: 10px; }
.tl-head-t { min-width: 0; }
.tl-head h2 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 0; }
.tl-head p { margin: 2px 0 6px; color: var(--muted); }
.tl-head-m { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 0.9rem; }
.tl-head-m img { display: inline-block; }
.tl-el { width: 20px; height: 20px; }

.tl-card { background: var(--surface); border: 0; box-shadow: var(--shadow-card); border-radius: var(--r-xl); padding: 18px 20px; margin: 0 0 12px; }
.tl-card h3 { margin: 0 0 8px; }
.tl-sub { margin: 14px 0 8px; font: 700 var(--fs-label)/1 var(--sans); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--faint); }
.tl-line { margin: 8px 0 0; color: var(--muted); font-size: 0.92rem; }
.tl-x { font-weight: 800; color: var(--gold); white-space: nowrap; }

/* pills */
.tl-stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.tl-stat { margin: 0; }
.tl-stat-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tl-cap { font-weight: 800; color: var(--gold); }
.tl-num { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 0; font-size: 0.92rem; color: var(--muted); }
.tl-num input { width: 96px; height: 40px; padding: 0 10px; border-radius: var(--r-sm); border: 0; box-shadow: var(--ring); background: var(--well); color: var(--text); font: 600 1rem var(--sans); }
.tl-togo { margin: 10px 0 0; }
.tl-done { color: var(--ok); margin: 12px 0 0; }
.tl-pills { display: grid; gap: 8px; }
.tl-pill { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); }
.tl-pill:hover { color: var(--text); background: var(--surface-3); }
.tl-pill img { width: 32px; height: 32px; }
.tl-pill b, .tl-pill small { display: block; }
.tl-pill small { color: var(--muted); font-size: 0.8rem; }
.tl-pill .tl-x { font-size: 1.15rem; }
.tl-only { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tl-only li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: 0.9rem; }
.tl-only img { width: 24px; height: 24px; }
.tl-only small { color: var(--faint); }

/* Limit Break */
.tl-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 560px; margin: 0 0 14px; }
.tl-range label { display: grid; gap: 4px; font-size: 0.8rem; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; min-width: 0; }
.tl-range .select { width: 100%; min-width: 0; text-transform: none; letter-spacing: 0; }
.tl-mats { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.tl-mats a { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); }
.tl-mats a:hover { color: var(--text); background: var(--surface-3); }
.tl-mats img { width: 40px; height: 40px; }
.tl-mat-n { font-size: 0.9rem; min-width: 0; }
.tl-mats .tl-x { font-size: 1.1rem; }
.tl-mats-s { margin-top: 6px; }
.tl-mats-s a { grid-template-columns: 32px minmax(0, 1fr) auto; padding: 6px 8px; }
.tl-mats-s img { width: 32px; height: 32px; }
.tl-steps summary { cursor: pointer; list-style: none; }
.tl-steps summary::-webkit-details-marker { display: none; }
.tl-steps summary h3 { display: inline; }
.tl-steps summary::after { content: " +"; color: var(--faint); font-weight: 800; }
.tl-steps[open] summary::after { content: " -"; }
.tl-stage-list { margin: 12px 0 0; padding: 0 0 0 20px; display: grid; gap: 12px; }
.tl-farms { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.tl-farm { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); height: 100%; }
.tl-farm:hover { color: var(--text); background: var(--surface-3); }
.tl-farm img { width: 32px; height: 32px; }
.tl-farm-t { min-width: 0; display: grid; gap: 2px; font-size: 0.86rem; color: var(--muted); }
.tl-farm-t small { color: var(--faint); }
.tl-farm-t b { color: var(--text); font-size: 0.95rem; }

/* Ninja Pearls */
.pc-groups { min-height: 840px; display: grid; gap: 8px; align-content: start; }
.pc-group { background: var(--surface); border: 0; box-shadow: var(--shadow-card); border-radius: var(--r-lg); }
.pc-group summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; }
.pc-group summary::-webkit-details-marker { display: none; }
.pc-g-t { font: 700 var(--fs-md)/1.15 var(--head); }
.pc-g-n { margin-left: auto; color: var(--muted); font-size: 0.86rem; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; text-align: right; }
.pc-g-n img { display: inline-block; }
.pc-chev { flex: none; color: var(--faint); transition: transform 0.15s; }
.pc-group[open] .pc-chev { transform: rotate(180deg); }
.pc-g-tools { display: flex; gap: 6px; padding: 0 16px 8px; }
.pc-rows { list-style: none; margin: 0; padding: 0 8px 8px; }
.pc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 36px; gap: 8px; align-items: center; border-top: 1px solid var(--line); min-height: 52px; }
.pc-pick { display: flex; gap: 10px; align-items: center; padding: 8px; cursor: pointer; min-width: 0; }
.pc-pick input { flex: none; width: 20px; height: 20px; accent-color: var(--orange); }
.pc-name { min-width: 0; font-size: 0.93rem; }
.pc-split { display: block; color: var(--faint); font-size: 0.78rem; }
.pc-q { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; min-width: 3ch; justify-content: flex-end; }
.pc-q img { width: 18px; height: 20px; }
.pc-go { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--muted); }
.pc-go:hover { background: rgba(255, 255, 255, 0.06); }
.pc-bar { position: sticky; bottom: 0; z-index: 25; margin: 16px calc(-1 * min(var(--gutter), 16px)) 0; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(20, 24, 31, 0.97); border: 0; box-shadow: var(--shadow-pop); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4); }
.pc-bar img { width: 29px; height: 32px; }
.pc-bar-t { min-width: 0; }
.pc-bar-t span, .pc-bar-t small { display: block; }
.pc-bar-t small { color: var(--muted); font-size: 0.8rem; }
.pc-total { font: 700 1.8rem/1 var(--head); letter-spacing: var(--tracking-tight); color: var(--gold); }
.pc-bar .chip:disabled { opacity: 0.5; cursor: default; }
@media (min-width: 900px) {
  .pc-bar { margin-left: 0; margin-right: 0; border-radius: var(--r-lg); bottom: 12px; }
}

.tl-kind { display: block; margin: 0 0 4px; font: 800 0.625rem/1.2 var(--sans); font-style: normal; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.tl-tool .go-arrow { position: absolute; right: 18px; bottom: 18px; }
.tl-tool:hover .go-arrow { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
