:root {
  --bg: #13100b;
  --panel: #221c12;
  --panel-2: #18140d;
  --line: #433927;
  --text: #f9f7f3;
  --muted: #b1a48d;
  --a: #ff9f43;
  --b: #48cae4;
  --good: #66e3a4;
  --danger: #ff647c;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0, #221a1c 0, transparent 34%),
    radial-gradient(circle at 90% 8%, #282114 0, transparent 30%),
    var(--bg);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Header (class-scoped so a host site's own <header> is untouched) */
.lab-header {
  max-width: 1440px;
  margin: auto;
  padding: 40px 28px 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
h1 { font-size: clamp(38px, 6vw, 72px); line-height: .9; margin: 8px 0 16px; letter-spacing: -.055em; }
.eyebrow { letter-spacing: .18em; color: var(--a); font-weight: 800; margin: 0; font-size: 12px; }
.lede { color: var(--muted); font-size: 16px; max-width: 700px; margin: 0; }
.badges { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.chip {
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 99px;
  color: #d6cbb8;
  white-space: nowrap;
}
.chip.ok { border-color: #275a43; color: var(--good); }

main { max-width: 1440px; margin: auto; padding: 22px 28px 60px; }

/* Toolbar */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(27, 22, 14, .92);
  backdrop-filter: blur(8px);
}
.toolbar label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; width: 150px; }
.toolbar .spacer { flex: 1; }
button {
  border: 0;
  border-radius: 10px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.primary { background: linear-gradient(135deg, var(--a), #ff6b35); color: #17100a; }
.primary:disabled { opacity: .6; cursor: progress; }
.ghost { background: #382f20; color: var(--text); }
.ghost:hover { background: #463b28; }

/* Fighters */
.fighters { display: grid; grid-template-columns: 1fr 56px 1fr; gap: 14px; align-items: start; }
.fighter {
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent), var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 22px 60px rgba(0,0,0,.22);
  min-width: 0;
}
.fighter[data-side="a"] { border-top: 3px solid var(--a); }
.fighter[data-side="b"] { border-top: 3px solid var(--b); }
.fighter-title { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.fighter-title span {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 10px;
  background: #3b3325; font-weight: 900;
}
[data-side="a"] .fighter-title span { color: var(--a); }
[data-side="b"] .fighter-title span { color: var(--b); }
.fighter-title input { font-size: 22px; font-weight: 800; background: transparent; border: 0; padding: 4px 0; box-shadow: none; }

.derived { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.derived div { background: var(--panel-2); border: 1px solid #342b1c; border-radius: 10px; padding: 8px 9px; min-width: 0; }
.derived b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.derived span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.derived .low { grid-column: 1 / -1; font-size: 11px; color: var(--muted); background: transparent; border: 0; padding: 0 2px; }

.section { border: 1px solid #352c1d; border-radius: 12px; margin-top: 8px; background: rgba(18, 15, 10, .45); }
.section > summary {
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section > summary::-webkit-details-marker { display: none; }
.section > summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1; }
.section[open] > summary::after { content: "−"; }
.section > summary small { color: var(--muted); font-weight: 500; margin-left: 8px; flex: 1; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 12px 12px; }
.grid label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; min-width: 0; }
.grid label.wide { grid-column: 1 / -1; }
.grid label[title] { cursor: help; }
.grid label[title] > .lbl::after { content: " ⓘ"; color: #7a6c55; font-weight: 400; }

input, select {
  width: 100%;
  background: #17130c;
  border: 1px solid #483d2a;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 8px;
  font: inherit;
  outline: 0;
  font-variant-numeric: tabular-nums;
}
input:focus, select:focus { border-color: #9c8a6a; box-shadow: 0 0 0 3px rgba(156, 138, 106, .14); }

.versus { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 120px; color: #8c7d64; font-weight: 900; }
.versus button { width: 42px; height: 42px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 18px; }

/* Results */
.results { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 20px; min-width: 0; }
.card h2 { margin: 0; font-size: 17px; }
.card h2 .arrow { color: var(--muted); }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.hero { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 14px 0 2px; }
.hero-number { font-size: clamp(36px, 4.6vw, 58px); font-weight: 900; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.hero-label { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 11px; }

.histo { width: 100%; height: 120px; margin-top: 14px; display: block; }
.histo .axis { fill: var(--muted); font-size: 10px; font-family: var(--mono); }

.chain { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 12px; }
.chain th, .chain td { padding: 6px 8px; border-bottom: 1px solid #352c1d; text-align: right; font-variant-numeric: tabular-nums; }
.chain th:first-child, .chain td:first-child { text-align: left; }
.chain th { color: var(--muted); font-weight: 700; font-size: 11px; }
.chain td code { font-family: var(--mono); color: #cebda0; font-size: 11px; }
.chain tr.final td { font-weight: 800; border-bottom: 0; }

.duel { grid-column: 1 / -1; }
.winbar { display: flex; height: 34px; border-radius: 10px; overflow: hidden; margin-top: 14px; background: var(--panel-2); font-weight: 800; font-size: 13px; }
.winbar div { display: flex; align-items: center; padding: 0 12px; white-space: nowrap; min-width: 0; overflow: hidden; }
.winbar .wa { background: linear-gradient(90deg, #a35b1c, var(--a)); color: #1a0f05; }
.winbar .wd { background: #443a2a; color: var(--muted); justify-content: center; }
.winbar .wb { background: linear-gradient(90deg, var(--b), #1d6f85); color: #120f09; justify-content: flex-end; }
.timeline { width: 100%; height: 170px; margin-top: 14px; display: block; }
.timeline .grid-line { stroke: #352c1d; }
.timeline .axis { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.notes { margin-top: 22px; border: 1px solid var(--line); border-radius: 14px; background: rgba(34, 28, 18, .6); }
.notes summary { padding: 15px 18px; cursor: pointer; font-weight: 800; }
.notes > div { padding: 0 18px 18px; color: var(--muted); }
.notes h3 { color: var(--text); font-size: 14px; margin: 18px 0 6px; }
.notes code { font-family: var(--mono); color: #efe9df; }
.notes pre {
  background: #120f0a; border: 1px solid #382f20; padding: 10px 12px;
  border-radius: 8px; color: #efe9df; overflow-x: auto; font-size: 12px; margin: 8px 0;
}
.notes table { border-collapse: collapse; font-size: 12px; margin: 8px 0; }
.notes td, .notes th { border: 1px solid #382f20; padding: 4px 8px; text-align: center; }
.notes th { color: var(--text); }
.notes ul { padding-left: 18px; }
.notes li { margin: 4px 0; }

.empty { color: var(--muted); padding: 30px; text-align: center; grid-column: 1 / -1; }

/* Identity row + tabs */
.identity { display: grid; grid-template-columns: 1fr 1.6fr 0.8fr; gap: 10px; margin-bottom: 12px; }
.identity label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; min-width: 0; }
.tabs { display: flex; gap: 4px; margin: 4px 0 12px; background: var(--panel-2); border: 1px solid #342b1c; border-radius: 12px; padding: 4px; }
.tabs button { flex: 1; padding: 8px 10px; background: transparent; color: var(--muted); font-size: 13px; border-radius: 9px; }
.tabs button[aria-selected="true"] { background: #3c3323; color: var(--text); }
[data-side="a"] .tabs button[aria-selected="true"] { box-shadow: inset 0 -2px 0 var(--a); }
[data-side="b"] .tabs button[aria-selected="true"] { box-shadow: inset 0 -2px 0 var(--b); }
.panel[hidden] { display: none; }
.note { color: var(--muted); font-size: 12px; margin: 6px 0 10px; }
.muted { color: var(--muted); }
.bad { color: var(--danger) !important; }
.ptitle { font-size: 13px; margin: 14px 0 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ptitle small { color: var(--muted); font-weight: 600; font-size: 12px; }
label.locked input, label.locked select { color: #cebda0; background: #1d180f; border-style: dashed; }
label.locked .lbl::before { content: "🔒 "; font-size: 10px; }
.inline { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.inline select { width: auto; }
.inline input[type="checkbox"] { width: auto; }

.toggle-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; font-size: 13px; }
.switch input { appearance: none; width: 38px; height: 22px; padding: 0; border-radius: 99px; background: #483d2a; position: relative; cursor: pointer; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #b1a48d; transition: transform .15s; }
.switch input:checked { background: #2f6b4f; }
.switch input:checked::after { transform: translateX(16px); background: var(--good); }

/* Stat allocation */
.stats-alloc { display: grid; gap: 6px; }
.alloc-row { display: grid; grid-template-columns: 40px 50px 50px minmax(0, 1fr) 52px; gap: 6px; align-items: center; }
.alloc-head span { color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; }
.alloc-head span:first-child { text-align: left; }
.alloc-head .hb { color: #e8923a; }
.alloc-head .hp { color: var(--good); }
.alloc-row .an { font-weight: 800; font-size: 12px; }
.alloc-row .ab { padding: 6px 0; border: 1px solid var(--line, #463c2a); border-radius: 8px; background: #292216; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.alloc-row .ab.bonus { color: #e8923a; }
.alloc-row .ab.zero { color: var(--muted); opacity: .6; }
.alloc-ctl { display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px 40px; gap: 4px; }
.alloc-row input { padding: 6px 4px; text-align: center; color: var(--good); font-weight: 700; }
.alloc-row .at { text-align: center; font-variant-numeric: tabular-nums; font-size: 16px; }
.step { padding: 6px 0; background: #382f20; color: var(--text); border-radius: 8px; font-size: 14px; }
.step:hover { background: #493e2b; }
.step.max { font-size: 11px; color: var(--muted); }

/* Gear grid */
/* gear grid on the left, 3D character on the right (kobugda-like) */
.equip-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
.gear { display: grid; grid-template-columns: repeat(3, 52px); gap: 6px 4px; align-content: start; padding: 7px; border: 1px solid #342b1c; border-radius: 12px; background: #1a160e; }
.gear.sub { grid-template-columns: repeat(4, 52px); margin-bottom: 8px; }
.slot {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; background: none; border: 0;
  color: var(--text); min-width: 0; text-align: center; cursor: pointer;
}
.slot .ico { width: 46px; height: 46px; border-radius: 4px; }
.slot.pet { cursor: default; opacity: .5; }
.slot.trash .ico { border-color: #6b2a2a; color: #ff6b6b; background: #1a0c0e; }
.slot.trash .slot-label { color: #ff6b6b; }
.slot.trash:hover .ico { border-color: #ff6b6b; box-shadow: 0 0 0 1px #ff6b6b; }
.slot:hover .ico { border-color: #c2ad8a; box-shadow: 0 0 0 1px #c2ad8a, inset 0 0 12px rgba(0, 0, 0, .6); }
.slot.filled .ico { border-color: var(--c); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 25%, transparent), inset 0 0 12px rgba(0, 0, 0, .6); }
.slot.wide { grid-column: 2; }
.slot-label { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52px; }
.slot.filled .slot-label { color: #e3d9c9; }
.equip-wrap .viewer-card { margin-top: 0; display: flex; flex-direction: column; min-height: 100%; }
.equip-wrap .viewer { flex: 1; height: auto; min-height: 300px; }
/* equipped items with bonus type / +level pickers */
.equipped { display: grid; gap: 4px; margin-top: 10px; }
.eq-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 24px; gap: 4px 8px; align-items: center; padding: 5px 6px; border: 1px solid #342b1c; border-radius: 10px; background: var(--panel-2); }
.eq-row .eq-ico { grid-row: span 2; }
.eq-row .eq-ctl { grid-column: 2 / 4; grid-row: 2; flex-wrap: wrap; }
.eq-row .eq-x { grid-column: 3; grid-row: 1; }
.eq-ico .ico { width: 34px; height: 34px; border-radius: 7px; cursor: pointer; }
.eq-main { display: grid; min-width: 0; line-height: 1.2; }
.eq-main small { color: var(--muted); font-size: 10px; }
.eq-main b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eq-ctl { display: flex; gap: 4px; align-items: center; }
.eq-ctl select { width: auto; padding: 4px 6px; font-size: 12px; }
.eq-type { font-size: 11px; font-weight: 700; }
/* inline item panel */
.slot.active .ico { border-color: #ffb24a; box-shadow: 0 0 0 2px #ffb24a, 0 0 14px rgba(255, 178, 74, .35); }
.slot.active .slot-label { color: #ffb24a; }
.item-panel { margin-top: 10px; border: 1px solid #483d2a; border-radius: 12px; background: #1a160e; padding: 10px; }
.ip-empty { margin: 0; color: var(--muted); font-size: 12px; text-align: center; padding: 6px; }
.ip-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ip-head b { font-size: 14px; }
.ip-slot { color: #1a1006; background: #ffb24a; border-radius: 99px; padding: 1px 10px; font-size: 12px; margin-left: 4px; }
.ip-x { width: 26px; height: 26px; padding: 0; background: transparent; color: var(--muted); font-size: 17px; border-radius: 6px; }
.ip-x:hover { color: var(--text); background: #332a1b; }
.ip-tools { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.ip-tools input[type="search"] { flex: 1 1 140px; width: auto; padding: 7px 10px; }
.ip-tools select { width: auto; flex: 0 1 150px; padding: 6px 8px; }
.ip-tools .inline { font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.ip-tools .inline input { width: auto; }
.ip-list { max-height: 440px; overflow-y: auto; display: grid; gap: 4px; align-content: start; padding-right: 2px; }
.ip-item { border: 1px solid #342b1c; border-radius: 10px; background: var(--panel-2); }
.ip-item.open { border-color: #836c44; box-shadow: 0 0 0 1px #836c44 inset; }
.ip-item.worn { border-color: #4f6a3a; }
.ip-row { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; background: transparent; color: var(--text); padding: 5px 8px; font-weight: 700; border-radius: 10px; }
.ip-row:hover { background: #2a2215; }
.ip-row .ico { width: 38px; height: 38px; border-radius: 8px; }
.ip-row .pg-name { font-size: 13px; }
.set-badge { font-size: 9.5px; font-weight: 800; color: #d6b4ff; border: 1px solid #6a4a99; background: #2a1f3d; border-radius: 99px; padding: 1px 7px; }
.ip-detail { padding: 2px 10px 10px; display: grid; gap: 6px; }
.ip-lbl { color: var(--muted); font-size: 10.5px; font-weight: 700; }
.ip-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chipb { --c: #e3d9c9; padding: 4px 9px; font-size: 12px; font-weight: 700; border-radius: 7px; background: #261f13; color: var(--c); border: 1px solid #483d2a; }
.chipb:hover { border-color: var(--c); }
.chipb.stat { --c: #7ddc7d; }
.chipb.on {background: color-mix(in srgb, var(--c) 18%, #261f13); border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.ip-stats { font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ip-stats .ap { color: #ff8f6b; } .ip-stats .ac { color: #7fc4ff; } .ip-stats .good { color: #7ddc7d; }
.ip-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.ip-btn { padding: 7px 16px; font-size: 12.5px; font-weight: 800; border-radius: 8px; background: linear-gradient(180deg, #ffb24a, #ff8a3a); color: #1a1006; }
.ip-btn.set { background: linear-gradient(180deg, #8a5cff, #6a3ee0); color: #fff; }
.ip-btn:disabled { opacity: .4; cursor: not-allowed; filter: grayscale(.6); }
.eq-all {display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 6px 8px; border: 1px dashed #5a4c34; border-radius: 10px; font-size: 12px; }
.eq-all b { margin-right: auto; color: #e3d9c9; }
.eq-all select { width: auto; padding: 4px 6px; font-size: 12px; }
.set-btn { margin-left: auto; padding: 6px 12px; font-size: 12px; font-weight: 800; border-radius: 9px; background: linear-gradient(180deg, #ffb24a, #ff7a3a); color: #1a1006; }
.set-btn:hover { filter: brightness(1.08); }
.ptitle:has(.set-btn) { display: flex; align-items: center; gap: 8px; }
.hint { margin: -2px 0 8px; color: var(--muted); font-size: 11px; }
.set-row {
  width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; background: var(--panel-2); color: var(--text);
  padding: 7px 10px; font-weight: 700; border-radius: 10px; border: 1px solid #342b1c;
}
.set-row:hover { background: #2a2215; border-color: #5a4c34; }
.set-icons { display: flex; gap: 3px; flex: none; }
.set-icons .ico { width: 34px; height: 34px; border-radius: 7px; }
.set-row.locked, .pg-row.locked { opacity: .55; cursor: not-allowed; }
.set-row.locked:hover, .pg-row.locked:hover { background: var(--panel-2); border-color: #342b1c; }
.set-miss { color: #ff6b6b; font-size: 11px; font-weight: 600; }
.pg-stat .warn { color: #f0c27a; }
.eq-x { width: 24px; height: 24px; padding: 0; background: transparent; color: var(--muted); border-radius: 6px; font-size: 15px; }
.eq-x:hover { color: var(--danger); background: #2a1820; }
/* Item icon (game icon, 64px source) */
.ico {
  --c: #5a4e3a; width: 44px; height: 44px; flex: none; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--c) 70%, #000);
  background: #0f0c07; display: block; position: relative; overflow: hidden; box-shadow: 0 0 0 1px #000;
}
/* icons are the game's 45x45 artwork: fill the frame edge to edge */
.ico img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; display: block; }
.ico.empty { display: grid; place-items: center; }
.ico.empty { border: 1px dashed #4d422f; color: #72644c; font-size: 18px; }
.ico.big { width: 52px; height: 52px; }
.slot-x { position: absolute; top: 4px; right: 6px; color: var(--muted); font-size: 15px; line-height: 1; padding: 2px 4px; border-radius: 6px; }
.slot-x:hover { color: var(--danger); background: #2a1820; }
/* 3D character */
.viewer-card { margin-top: 14px; min-width: 0;border: 1px solid #3d3322; border-radius: 14px; overflow: hidden; background: radial-gradient(120% 90% at 50% 15%, #362d1d 0%, #18140c 70%); }
.viewer-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 12px 0; }
.viewer-head b { font-size: 13px; }
.viewer-head small { color: var(--muted); font-size: 11px; }
.viewer { display: block; width: 100%; height: 340px; cursor: grab; touch-action: none; }
.viewer:active { cursor: grabbing; }
.viewer-hint { margin: 0; padding: 0 12px 9px; color: #72644c; font-size: 10.5px; text-align: center; }
.sub-gear { margin-top: 8px; }
.sub-gear > summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 700; padding: 6px 0; }
.gear-sum { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.gear-sum b { color: var(--text); font-variant-numeric: tabular-nums; }

/* Skills panel */
.trees { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.trees label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; min-width: 0; }
.attack-list { display: grid; gap: 4px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.atk { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 8px; padding: 7px 10px; border-radius: 9px; background: var(--panel-2); border: 1px solid #342b1c; cursor: pointer; }
.atk input { width: auto; grid-row: span 2; margin: 2px 0 0; }
.atk-name { font-weight: 700; font-size: 13px; }
.atk-name em, .skill-table em { font-style: normal; font-size: 10px; color: var(--muted); border: 1px solid #483d2a; border-radius: 99px; padding: 1px 6px; margin-left: 4px; font-weight: 700; }
.atk-meta { color: var(--muted); font-size: 11px; }
.atk:has(input:checked) { border-color: #86765a; background: #2d2517; }
.lockedskill { opacity: .55; }

/* Item picker */
#picker {
  width: min(760px, calc(100vw - 24px)); max-height: min(86vh, 900px); padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); color: var(--text); display: none; flex-direction: column; overflow: hidden;
}
#picker[open] { display: flex; }
#picker::backdrop { background: rgba(9, 7, 4, .72); }
.picker-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; }
.picker-head h2 { margin: 0; font-size: 16px; }
.picker-head button { padding: 6px 12px; }
.picker-tools { display: flex; gap: 8px; padding: 0 16px; flex-wrap: wrap; align-items: center; }
.picker-tools input[type="search"] { flex: 1 1 220px; width: auto; }
.picker-tools select { width: auto; flex: 0 1 200px; }
#pickerCount { padding: 0 16px; margin: 8px 0 4px; font-size: 12px; }
.picker-list { overflow-y: auto; overflow-x: hidden;padding: 0 16px 16px; display: grid; gap: 4px; align-content: start; }
.pg-row {
  width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; background: var(--panel-2); color: var(--text);
  padding: 6px 10px; font-weight: 700; border-radius: 10px; border: 1px solid #342b1c;
}
.pg-row:hover { background: #2a2215; border-color: #5a4c34; }
.pg-row.on { border-color: #4f6a3a; background: #141d18; }
.pg-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.pg-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-stat { color: var(--muted); font-size: 11.5px; font-weight: 500; }
.pg-stat .ap { color: #ff8f6b; font-weight: 700; }
.pg-stat .ac { color: #7fc4ff; font-weight: 700; }
.pg-n { display: grid; justify-items: end; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.pg-on { color: #7ddc7d; font-size: 10.5px; border: 1px solid #3c5a35; border-radius: 99px; padding: 0 7px; }
/* Item tooltip — styled after the in-game tooltip (centred header lines, left-aligned stats, red = requirement not met) */
.itip {
  position: fixed; z-index: 1000; width: 280px; pointer-events: none; background: rgba(9, 8, 5, .94); border: 1px solid #6b5a33;
  border-radius: 4px; padding: 10px 12px 8px; box-shadow: 0 0 0 1px #000, 0 14px 36px rgba(0, 0, 0, .6); font: 12px/1.45 Tahoma, Verdana, sans-serif; color: #f2f2f2;
}
.kt-icon { display: flex; justify-content: center; margin-bottom: 6px; }
.kt-name { text-align: center; font-weight: 700; font-size: 13px; }
.kc { text-align: center; }
.kl { text-align: left; }
.itip .bonus { color: #8cf08c; }
.itip .good { color: #8cf08c; }
.itip .bad { color: #ff4f4f; }
.kt-num { color: #8a7f6b; font-size: 10px; margin-top: 6px; text-align: right; }

/* In-game style skill window */
@property --kw-ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.kw-attack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.kw-attack b { color: #ffd166; }
.kw-r { padding: 4px 10px; font-size: 11.5px; }
.kw {
  position: relative; max-width: 470px; margin: 0 auto; padding: 10px 12px 12px; border-radius: 10px; color: #e8dcc2;
  font-family: Tahoma, Verdana, sans-serif;
  background: linear-gradient(180deg, #2a2a1c, #161a12 40%, #12150f);
  border: 2px solid #6b5a33; box-shadow: 0 0 0 2px #1a160c, inset 0 0 0 1px #9c8450, inset 0 0 30px #000a, 0 18px 40px #0008;
}
.kw-title { display: flex; justify-content: center; margin: -2px 0 10px; }
.kw-title span {
  min-width: 60%; text-align: center; padding: 6px 20px; border-radius: 6px; font-size: 17px; font-weight: 700; color: #2a1a05;
  background: linear-gradient(180deg, #f3d27a, #c99a3a 55%, #9e7320); border: 1px solid #5a3f0f; box-shadow: inset 0 1px 0 #fff6, 0 2px 6px #0008;
}
.kw-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.kw-btnlike { padding: 5px 14px; border-radius: 4px; font-size: 12.5px; background: linear-gradient(180deg, #5a3a14, #2f1e09); border: 1px solid #a8823c; color: #f3e2b5; }
.kw-btnlike b { color: #ff9ad0; margin-left: 6px; }
.kw-bar small { color: #9c9a86; font-size: 11px; }
.kw-trees { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 8px; margin-bottom: 8px; border: 1px solid #4a4128; border-radius: 6px; background: #0e100b; }
.kw-tree { display: grid; grid-template-columns: minmax(0, 1fr) 54px 22px 22px; gap: 4px; align-items: center; }
.kw-tname { padding: 4px 8px; font-size: 11.5px; border: 1px solid #4a4128; border-radius: 3px; background: #1b1d15; color: #d9cfae; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kw-tree input { padding: 4px 6px; text-align: center; font: 12px Tahoma, sans-serif; color: #f3e2b5; background: #070806; border: 1px solid #4a4128; border-radius: 3px; }
.kw-up { width: 22px; height: 24px; padding: 0; font-size: 10px; border-radius: 3px; color: #e9dcff; background: linear-gradient(180deg, #6b4fb0, #685636); border: 1px solid #cbb99b; }
.kw-up.dn { background: linear-gradient(180deg, #4a4a4a, #262626); border-color: #777; color: #ddd; }
.kw-up:hover { filter: brightness(1.2); }
.kw-tabs { display: flex; gap: 3px; margin: 2px 0 0; padding: 0 2px; flex-wrap: wrap; }
.kw-tabs button {
  flex: 1 1 0; min-width: 0; padding: 5px 6px; font: 11px Tahoma, sans-serif; color: #8c8a76; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #24261b, #15170f); border: 1px solid #3f3a26; border-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kw-tabs button[aria-selected="true"] { color: #fff; background: linear-gradient(180deg, #4b4a33, #26261a); border-color: #9c8450; }
.kw-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 8px; padding: 14px 12px; min-height: 248px; align-content: start;
  background: radial-gradient(120% 100% at 50% 0, #1d2018, #0b0c08); border: 1px solid #4a4128; }
.kw-sk { display: flex; align-items: center; gap: 10px; padding: 2px; text-align: left; background: none; border: 0; color: #e8dcc2; font: 12.5px Tahoma, sans-serif; cursor: pointer; }
.kw-sk.locked { color: #8c8a76; }
.kw-sk.locked .kw-ico img { filter: grayscale(.7) brightness(.6); }
.kw-ico { position: relative; flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 4px; background: #050605;
  border: 1px solid #5c5236; box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #000; color: #6d6650; font-size: 18px; }
.kw-ico img { width: 40px; height: 40px; display: block; border-radius: 2px; }
/* hover: green ring sweeping around the icon, like the game */
.kw-sk:hover .kw-ico::after, .kw-sk:focus-visible .kw-ico::after {
  content: ""; position: absolute; inset: -4px; border-radius: 6px; padding: 3px;
  background: conic-gradient(from var(--kw-ang), #2bff6a 0deg, #c8ffd6 40deg, transparent 120deg, transparent 180deg, #2bff6a 220deg, #c8ffd6 260deg, transparent 340deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: kw-spin 1.1s linear infinite; filter: drop-shadow(0 0 4px #2bff6a);
}
@keyframes kw-spin { to { --kw-ang: 360deg; } }
.kw-sk.sel .kw-ico { border-color: #ffd166; box-shadow: 0 0 0 1px #ffd166, 0 0 12px #ffd16688; }
.kw-sk.sel .kw-nm { color: #ffd166; }
.kw-sk.dmg .kw-nm::after { content: " ⚔"; font-size: 10px; color: #c9a45a; }
.kw-book {
  min-height: 168px; margin-top: 10px; padding: 14px 18px; border-radius: 6px 6px 2px 2px; font: 12px/1.55 Tahoma, sans-serif; color: #efe4c6;
  background: linear-gradient(90deg, #3a2410 0%, #5b3a1c 12%, #6a4522 49%, #3b2410 50%, #6a4522 51%, #5b3a1c 88%, #3a2410 100%);
  border: 1px solid #2a1a08; box-shadow: inset 0 0 22px #0009;
}
.kw-book p { margin: 0 0 2px; }
.kw-desc { color: #39ff7a; margin-bottom: 10px !important; text-shadow: 0 1px 1px #000; }
.kw-bad { color: #ff6b6b; }
.kw-extra { margin-top: 8px !important; padding-top: 6px; border-top: 1px dashed #a07a4a66; color: #ffd9a0; font-size: 11.5px; }
.kw-extra b { color: #fff; }
.kw-hint { color: #d8c49c; font-style: italic; }
.kw-pages { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 8px; font: 12px Tahoma, sans-serif; color: #e8dcc2; }
.kw-pages button { width: 22px; height: 20px; padding: 0; font-size: 10px; border-radius: 3px; color: #2a1a05; background: linear-gradient(180deg, #f3d27a, #b9892f); border: 1px solid #5a3f0f; }
.kw-pages button:disabled { opacity: .35; }
.kw-note { color: #9c9a86; font-size: 12px; grid-column: 1 / -1; }
@media (max-width: 520px) {
  .kw { padding: 8px; }
  .kw-trees { grid-template-columns: 1fr; }
  .kw-list { grid-template-columns: 1fr 1fr; gap: 8px 4px; padding: 10px 6px; }
  .kw-sk { font-size: 11.5px; gap: 6px; }
}

/* Skill table */
.skills-card { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
.skill-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.skill-table th, .skill-table td { padding: 6px 8px; border-bottom: 1px solid #352c1d; text-align: left; white-space: nowrap; }
.skill-table th { color: var(--muted); font-size: 11px; font-weight: 700; }
.skill-table td.num { text-align: right; font-variant-numeric: tabular-nums; position: relative; }
.skill-table tr[data-use-skill] { cursor: pointer; }
.skill-table tr[data-use-skill]:hover td { background: #2a2215; }
.skill-table tr.current td { background: #332a1a; }
.skill-table tr.current td:first-child { box-shadow: inset 3px 0 0 var(--good); }
.skill-table .bar { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 3px; border-radius: 2px; background: #352c1d; }
.skill-table .bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--c); border-radius: 2px; opacity: .8; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .derived { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .lab-header { flex-direction: column; align-items: flex-start; }
  .badges { align-items: flex-start; }
  .chip { white-space: normal; }
  .fighters { grid-template-columns: 1fr; }
  .versus { padding: 0; flex-direction: row; justify-content: center; }
  .results { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .lab-header, main { padding-left: 16px; padding-right: 16px; }
  .toolbar { position: static; }
  .toolbar label { width: calc(50% - 6px); }
  .toolbar button { flex: 1; }
  .toolbar .spacer { display: none; }
  .grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .identity { grid-template-columns: 1fr 1fr; }
  .identity label:nth-child(2) { grid-column: 1 / -1; order: -1; }
  .derived { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .alloc-row { grid-template-columns: 32px 40px 40px minmax(0, 1fr) 40px; gap: 4px; }
  .alloc-ctl { grid-template-columns: 26px minmax(0, 1fr) 26px 34px; gap: 3px; }
  .trees { grid-template-columns: 1fr 1fr; }
  .gear, .gear.sub { grid-template-columns: repeat(3, 50px); padding: 6px; gap: 5px 4px; }
  .slot .ico { width: 44px; height: 44px; }
  .slot-label { max-width: 50px; font-size: 8.5px; }
  .equip-wrap .viewer { min-height: 260px; }
  .eq-row { gap: 6px; }
  .set-row { flex-wrap: wrap; }
  .set-icons .ico { width: 30px; height: 30px; }
  .eq-ctl select { padding: 3px 4px; font-size: 11px; }
  .tabs button { font-size: 12px; padding: 8px 4px; }
}

/* ---------- Character Info (in-game window look) ---------- */
.cinfo-wrap { margin-bottom: 14px; }
.cinfo { font-family: Tahoma, Verdana, sans-serif; color: #e8dcc2; padding: 8px 10px 10px; border-radius: 10px;
  background: linear-gradient(180deg, #2c2e22, #1a1c14 40%, #141610); border: 2px solid #5d5a3e;
  box-shadow: 0 0 0 1px #0b0c08, inset 0 0 0 1px #8a8460, inset 0 0 24px #000a; display: grid; gap: 6px; }
.ci-title { display: flex; justify-content: center; }
.ci-title span { padding: 4px 26px; border-radius: 6px; font-size: 13px; font-weight: 700; color: #f6e7b8;
  background: linear-gradient(180deg, #8a5a1c, #4d2f0b); border: 1px solid #c9a24f; box-shadow: inset 0 1px 0 #ffffff40, 0 2px 5px #0008; }
.ci-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 4px; }
.ci-head b { font-size: 14px; color: #fff; }
.ci-head small { color: #f2d54b; font-size: 11.5px; }
.ci-box { padding: 6px 8px; border: 1px solid #4a4730; border-radius: 6px; background: #0e100b; }
.ci-two { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 4px 8px; align-items: center; }
.ci-l { font-size: 12px; color: #d9cfae; white-space: nowrap; }
.ci-l.up { color: #4f8dff; }
.ci-v { padding: 2px 8px; text-align: center; font-size: 12.5px; font-variant-numeric: tabular-nums; color: #fff; background: #050605;
  border: 1px solid #3a3826; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-v.up { color: #7fb2ff; }
.ci-v.big { font-weight: 700; color: #ffe08a; }
.ci-v small { margin-left: 4px; font-size: 10px; color: #8fe3b0; font-weight: 400; }
.ci-v.pt { color: #ff9ad0; }
.ci-v.bad { color: #ff6b6b; }
.ci-bars { display: grid; gap: 3px; }
.ci-bar { position: relative; height: 15px; border-radius: 3px; border: 1px solid #000; }
.ci-bar.hp { background: linear-gradient(180deg, #ff4a4a, #a80f0f); }
.ci-bar.mp { background: linear-gradient(180deg, #4f7dff, #1636a8); }
.ci-bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: #fff; text-shadow: 0 1px 1px #000; }
.ci-sub { text-align: center; font-size: 11.5px; color: #d9cfae; margin-bottom: 4px; }
.ci-wr { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 11px; color: #a9a184; }
.ci-wr b { color: #fff; font-weight: 400; }
.ci-buffs { display: flex; flex-wrap: wrap; gap: 4px; }
.ci-buffs span { padding: 1px 7px; border-radius: 10px; font-size: 10.5px; color: #c8ffd6; background: #12301c; border: 1px solid #2b7a45; }
.ci-buffs span.deb { color: #ffd0d0; background: #3a1414; border-color: #8a3030; }
.ci-note { font-size: 11px; color: #a9a184; }

/* sub equipment under the main gear grid */
.gear-col { display: grid; gap: 6px; align-content: start; }
.sub-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-left: 2px; }
.gear.sub { grid-template-columns: repeat(3, 52px); margin-bottom: 0; }

/* buffs & scrolls */
.buffs { display: grid; gap: 10px; margin-top: 6px; }
.bf-sec h4 { margin: 0 0 6px; font-size: 11.5px; color: #f0c674; text-transform: uppercase; letter-spacing: .05em; }
.bf-sec.deb h4 { color: #ff8a8a; }
.bf-sec select { width: 100%; }
.bf-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 5px; }
.bf { display: grid; grid-template-columns: 28px minmax(0, 1fr) 30px; gap: 7px; align-items: center; padding: 4px 6px; text-align: left;
  border-radius: 8px; background: var(--panel-2); border: 1px solid #3d3322; color: var(--text); cursor: pointer; }
.bf:hover { border-color: #68583d; }
.bf-ico { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; overflow: hidden; background: #050605; border: 1px solid #3a3826; }
.bf-ico img { width: 100%; height: 100%; display: block; }
.bf-ico i { font-style: normal; color: #c9a45a; font-size: 13px; }
.bf-t { display: grid; min-width: 0; line-height: 1.2; }
.bf-t b { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-t small { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-sw { position: relative; width: 30px; height: 16px; border-radius: 9px; background: #443a2a; transition: background .15s; }
.bf-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #b1a48d; transition: transform .15s, background .15s; }
.bf[aria-pressed="true"] { border-color: #2b7a45; background: #0f2017; }
.bf[aria-pressed="true"] .bf-sw { background: #2b7a45; }
.bf[aria-pressed="true"] .bf-sw::after { transform: translateX(14px); background: #c8ffd6; }
.bf-sec.deb .bf[aria-pressed="true"] { border-color: #8a3030; background: #241010; }
.bf-sec.deb .bf[aria-pressed="true"] .bf-sw { background: #8a3030; }
@media (max-width: 520px) {
  .ci-two { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 3px 5px; }
  .bf-list { grid-template-columns: 1fr; }
}

/* ---------- one character at a time, three columns (character | equipment + 3D | sub equipment + items) ---------- */
.side-tabs { display: flex; gap: 10px; align-items: stretch; margin-bottom: 14px; }
.side-tabs [data-side-tab] { flex: 1; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  text-align: left; padding: 10px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.side-tabs [data-side-tab] .st-l { grid-row: span 2; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #332a1b; font-weight: 900; }
.side-tabs [data-side-tab] b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-tabs [data-side-tab] small { color: var(--muted); font-size: 12px; }
.side-tabs [data-side-tab][aria-pressed="true"] { border-color: var(--a); box-shadow: 0 0 0 1px var(--a) inset; }
.side-tabs [data-side-tab="a"][aria-pressed="true"] .st-l { background: var(--a); color: #17100a; }
.side-tabs [data-side-tab="b"][aria-pressed="true"] { border-color: var(--b); box-shadow: 0 0 0 1px var(--b) inset; }
.side-tabs [data-side-tab="b"][aria-pressed="true"] .st-l { background: var(--b); color: #15110b; }
.side-tabs #swap { width: 46px; padding: 0; border-radius: 12px; font-size: 18px; }
.fighters.single { display: block; }
.fighters.single .fighter[hidden] { display: none; }

.fb-grid { display: grid; grid-template-columns: minmax(280px, 330px) minmax(0, 1fr); gap: 14px; align-items: start; }
.fb-left { display: grid; gap: 12px; align-content: start; }
.fb-main { min-width: 0; }
.fb-card { border: 1px solid #342b1c; border-radius: 14px; background: var(--panel-2); padding: 12px; min-width: 0; }
.fb-h { margin: 0 0 10px; font-size: 15px; color: #f0b44a; font-weight: 800; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.fb-h small { color: var(--muted); font-size: 11px; font-weight: 600; }
.fb-left .identity { grid-template-columns: 1fr 1fr; }
.fb-left .identity label:nth-child(2) { grid-column: 1 / -1; order: -1; }
.fb-race { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; margin-bottom: 10px; }
.fb-left .alloc-row { grid-template-columns: 34px 40px 40px minmax(0, 1fr) 40px; gap: 4px; }
.fb-left .alloc-ctl { grid-template-columns: 24px minmax(0, 1fr) 24px 32px; gap: 3px; }
.fb-points { margin: 10px 0 0; padding: 7px; border-radius: 8px; text-align: center; font-weight: 800; font-size: 13px; color: var(--good); background: #10241a; border: 1px solid #1f4a30; }
.fb-points small { color: var(--muted); font-weight: 600; }
.fb-points.bad { color: var(--danger); background: #2a1216; border-color: #5a2430; }
.fb-buffs summary { list-style: none; cursor: pointer; }
.fb-buffs summary::-webkit-details-marker { display: none; }
.fb-buffs summary .fb-h { margin: 0; }
.fb-buffs summary .fb-h::after { content: "▾"; margin-left: auto; color: var(--muted); }
.fb-buffs[open] summary .fb-h { margin-bottom: 8px; }
.fb-buffs .bf-list { grid-template-columns: 1fr; }

.fb-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr); gap: 12px; align-items: start; }
.fb-right { display: grid; gap: 12px; align-content: start; }
.fb-equip .equip-wrap { grid-template-columns: auto minmax(0, 1fr); }
.fb-equip .viewer { min-height: 360px; }
.fb-right .gear.sub { grid-template-columns: repeat(3, 56px); justify-content: center; margin: 0 auto; }
.slot.ghost { visibility: hidden; }
.fb-right .item-panel { margin-top: 0; background: var(--panel-2); border-color: #342b1c; }
.fb-right .ip-list { max-height: 520px; }
.ip-empty { display: grid; justify-items: center; gap: 6px; padding: 26px 10px; }
.ip-empty-ico { font-size: 26px; opacity: .6; }
.ip-empty b { color: var(--text); font-size: 13px; }
.ip-empty span:last-child { font-size: 12px; }
.ip-head .fb-h { margin: 0; }

@media (max-width: 1200px) {
  .fb-cols { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .fb-grid { grid-template-columns: 1fr; }
  .side-tabs [data-side-tab] { padding: 8px 10px; }
}
@media (max-width: 520px) {
  .fb-equip .equip-wrap { grid-template-columns: 1fr; }
  .fb-equip .gear { justify-content: center; }
}
.sub-lbl { color: #c9a45a; font-weight: 600; }
.ip-count { margin: 6px 2px 0; text-align: right; font-size: 11px; color: var(--muted); }
/* ready-made characters + import/export */
.fb-presets { display: grid; gap: 6px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed #443926; }
.fb-presets > span { font-size: 12px; font-weight: 800; color: var(--text); display: grid; }
.fb-presets > span small { color: var(--muted); font-weight: 600; font-size: 11px; }
.fb-presets > div { display: flex; flex-wrap: wrap; gap: 5px; }
.fb-presets .chipb[data-clear-char] { border-style: dashed; }
.fb-io textarea { width: 100%; resize: vertical; min-height: 64px; font: 11px/1.4 var(--mono); padding: 8px; border-radius: 8px; }
.fb-io-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.fb-io-btns button { padding: 8px; font-size: 12.5px; }
.fb-io-msg { margin: 6px 0 0; min-height: 1em; font-size: 12px; color: var(--good); }
.fb-io-msg.bad { color: var(--danger); }
.fb-preset-card { border-color: #5a4318; background: linear-gradient(180deg, #2a2111, var(--panel-2) 70%); }
.fb-preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fb-preset { padding: 9px 6px; border-radius: 9px; font-size: 12.5px; font-weight: 800; color: #1a1006; background: linear-gradient(180deg, #ffc46b, #f08a2c); border: 1px solid #7a4a12; }
.fb-preset:hover { filter: brightness(1.08); }
.fb-preset.on { box-shadow: 0 0 0 2px #fff4 inset; }
.fb-preset.empty { color: var(--text); background: #332a1b; border: 1px dashed #68583d; }
.fb-preset:disabled { opacity: .6; cursor: progress; }
