:root {
  --bg: #15120f;
  --panel: #1e1a16;
  --panel-2: #26211c;
  --panel-3: #2f2923;
  --line: #3b332b;
  --line-2: #4c4238;
  --text: #ece4d6;
  --muted: #a3968a;
  --faint: #776b60;
  --gold: #d9a94e;
  --gold-soft: rgba(217, 169, 78, .14);
  --bad: #e2675b;
  --bad-soft: rgba(226, 103, 91, .13);
  --warn: #e0b04a;
  --warn-soft: rgba(224, 176, 74, .12);
  --ok: #6fbf7f;
  --info: #7fa6d9;
  --wei: #5b8ee6;
  --shu: #55b06b;
  --wu: #e0605a;
  --qun: #a59a8c;
  --han: #d8ab3e;
  --q-s: #f08a3c;
  --q-a: #b07de8;
  --q-b: #5fa0ea;
  --q-c: #6cc07a;
  --q-d: #9a9a9a;
  --radius: 10px;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh; height: 100dvh; overflow: hidden;
}
button, select, input { font: inherit; color: inherit; }
button {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
button:hover { border-color: var(--gold); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
button.primary { background: var(--gold); color: #1b140a; border-color: var(--gold); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
select, input[type=search] {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px;
}
h1, h2, h3 { margin: 0; font-weight: 700; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: #110e0c;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { font-size: 19px; letter-spacing: .06em; color: var(--gold); }
.read-at { color: var(--muted); font-size: 12px; }
.res { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted);
}
.chip b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions select { max-width: 150px; }

.summary {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 7px 16px; border-bottom: 1px solid var(--line); background: var(--panel); font-size: 13px;
}
.summary .sep { color: var(--faint); }
.summary .bad { color: var(--bad); }
.summary .ok { color: var(--ok); }
.summary .warn { color: var(--warn); }

.tabs { display: none; }

/* ---------- layout ---------- */
.layout {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr) 360px;
}
.col { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.col:last-child { border-right: 0; }
.col-head { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line); }
.col-head h2 { font-size: 15px; display: flex; align-items: baseline; gap: 6px; }
.count { color: var(--muted); font-weight: 400; font-size: 12px; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.fbtn {
  padding: 2px 9px; font-size: 12px; border-radius: 999px; background: transparent; border: 1px solid var(--line-2); color: var(--muted);
}
.fbtn.on { background: var(--gold-soft); border-color: var(--gold); color: var(--text); }
.f-label { font-size: 11.5px; color: var(--faint); align-self: center; margin-right: 2px; }
.fbtn.qf { font-weight: 700; }
.fbtn.qf.q-S { color: var(--q-s); } .fbtn.qf.q-A { color: var(--q-a); } .fbtn.qf.q-B { color: var(--q-b); } .fbtn.qf.q-C { color: var(--q-c); } .fbtn.qf.q-D { color: var(--q-d); }
.fbtn.qf.on { background: color-mix(in srgb, currentColor 16%, transparent); border-color: currentColor; }
.fbtn .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }

.pool-list, .lib-list { flex: 1; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.teams { overflow: auto; padding: 12px 14px 40px; }
.lib { display: flex; flex-direction: column; position: relative; }
.lib-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* detail slides over the whole right column instead of squeezing the skill list */
.detail {
  position: absolute; inset: 0; z-index: 6; overflow: auto; background: #191512; padding: 0 12px 20px;
  border-left: 1px solid var(--line); box-shadow: -14px 0 28px rgba(0,0,0,.4); animation: slideIn .16s ease-out;
}
.detail:empty { display: none; }
@keyframes slideIn { from { transform: translateX(28px); } }
.d-bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; margin: 0 -12px 12px; padding: 8px 12px;
  background: rgba(25,21,18,.94); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.d-bar .back { font-weight: 600; }
.d-bar .kind { color: var(--muted); font-size: 12px; }
.d-bar .grow { flex: 1; }
.d-bar .hint { color: var(--gold); font-size: 12px; }
.lib-hint { color: var(--faint); font-size: 11.5px; font-weight: 400; }

/* hover preview for skills */
.peek {
  position: fixed; z-index: 70; width: 320px; pointer-events: none; display: none;
  background: #221d18; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.55);
}
.peek.on { display: block; }
.peek-h { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.peek-h b { font-size: 14px; }
.peek p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.55; color: #ddd3c4; }
.peek .facts { color: var(--muted); font-size: 11.5px; margin-top: 6px; display: flex; gap: 4px 8px; flex-wrap: wrap; }
.peek .tip { color: var(--faint); font-size: 11px; margin-top: 6px; }

.drop-zone.drop-hot { background: var(--gold-soft); outline: 1px dashed var(--gold); outline-offset: -4px; }

/* ---------- hero chip (pool) ---------- */
.hero, .skill { -webkit-touch-callout: none; }
.hero {
  display: grid; grid-template-columns: 46px 1fr; gap: 9px; align-items: center;
  padding: 6px 8px 6px 6px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: manipulation; position: relative;
}
.hero:hover { border-color: var(--line-2); }
.hero.sel, .skill.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.hero.used { opacity: .5; }
.hero.used:hover { opacity: .8; }
.pic {
  width: 46px; height: 46px; border-radius: 8px; overflow: hidden; background: #0d0b09; position: relative;
  border: 2px solid var(--camp, var(--line-2));
}
.pic img { -webkit-user-drag: none; pointer-events: none; width: 100%; height: 160%; object-fit: cover; object-position: 50% 6%; display: block; }
.pic .lv {
  position: absolute; right: 0; bottom: 0; background: rgba(0,0,0,.75); font-size: 10.5px; padding: 0 4px; border-top-left-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.h-main { min-width: 0; }
.h-name { display: flex; align-items: center; flex-wrap: wrap; gap: 0 5px; font-weight: 600; white-space: nowrap; }
/* the name never shrinks; stars and tags wrap to the next line when the card is narrow */
.h-name .nm { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.h-sub { display: flex; gap: 6px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.h-sk { color: var(--faint); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stars { color: var(--gold); font-size: 11px; letter-spacing: -1px; }
.adv { color: #e2564b; font-size: 11px; letter-spacing: -1px; }
.tag {
  display: inline-block; font-size: 10.5px; line-height: 16px; padding: 0 5px; border-radius: 4px; background: var(--panel-3); color: var(--muted); font-weight: 500;
}
.tag.awake { background: rgba(176,125,232,.18); color: #cfadf5; }
.tag.where { background: var(--gold-soft); color: var(--gold); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.camp { font-weight: 700; }
.c-魏 { --camp: var(--wei); } .c-蜀 { --camp: var(--shu); } .c-吳 { --camp: var(--wu); } .c-群 { --camp: var(--qun); } .c-漢 { --camp: var(--han); }
.camp-txt { color: var(--camp); font-weight: 700; }

/* ---------- city / team ---------- */
.city { margin-bottom: 22px; }
.city-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 2px 10px; }
.city-head h2 { font-size: 16px; color: var(--gold); }
.city-head .meta { color: var(--muted); font-size: 12.5px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 12px; }
.team { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.team.has-bad { border-color: rgba(226,103,91,.55); }
.team-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); flex-wrap: wrap;
}
.team-head h3 { font-size: 14px; }
.team-head .stat { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.team-head .stat b { color: var(--text); font-weight: 600; }
.team-head .stat.over b { color: var(--bad); }
.team-head .grow { flex: 1; }
.team-head .changed { color: var(--gold); font-size: 11.5px; }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.slot { padding: 8px; border-right: 1px solid var(--line); min-height: 150px; display: flex; flex-direction: column; gap: 6px; }
.slot:last-child { border-right: 0; }
.slot-label { font-size: 11px; color: var(--faint); letter-spacing: .1em; display: flex; justify-content: space-between; }
.slot.empty .slot-body {
  flex: 1; border: 1.5px dashed var(--line-2); border-radius: 10px; display: grid; place-items: center; color: var(--faint); font-size: 12px; min-height: 110px;
}
.slot.drop-hot .slot-body, .slot.can-drop .slot-body { border-color: var(--gold); background: var(--gold-soft); }
.slot.drop-hot { background: var(--gold-soft); }
.member { display: flex; flex-direction: column; gap: 6px; }
.member .hero { grid-template-columns: 40px 1fr; padding: 4px 6px 4px 4px; }
.member .pic { width: 40px; height: 40px; }
.troops { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 4px; background: #0d0b09; border-radius: 3px; overflow: hidden; margin-top: 2px; }
.bar i { display: block; height: 100%; background: var(--ok); }
.bar i.low { background: var(--warn); }
.sks { display: flex; flex-direction: column; gap: 4px; }
.sk-slot {
  border-radius: 7px; min-height: 28px; display: flex; align-items: stretch;
}
.sk-slot.empty {
  border: 1.5px dashed var(--line-2); color: var(--faint); font-size: 11.5px; align-items: center; justify-content: center;
}
.sk-slot.locked { border: 1px solid var(--line); color: var(--faint); font-size: 11.5px; align-items: center; justify-content: center; background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255,255,255,.02) 6px 12px); }
.sk-slot.drop-hot, .sk-slot.can-drop { outline: 1.5px solid var(--gold); background: var(--gold-soft); }
.team-foot { padding: 7px 12px; border-top: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.team-foot:empty { display: none; }
.msg { padding: 2px 7px; border-radius: 5px; }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.ok { background: rgba(111,191,127,.12); color: var(--ok); }
.msg.info { background: rgba(127,166,217,.12); color: var(--info); }

/* ---------- skill chip ---------- */
.skill {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 4px 7px; border-radius: 7px; background: var(--panel-3); border: 1px solid var(--line);
  cursor: grab; user-select: none; -webkit-user-select: none; font-size: 12.5px; min-width: 0; touch-action: manipulation;
}
.skill.self { cursor: default; background: #2a241c; border-color: #4a3d2a; }
.skill.new { border-color: rgba(217,169,78,.6); }
.skill.bad { border-color: rgba(226,103,91,.7); }
.skill .q { font-weight: 800; font-size: 11px; width: 12px; text-align: center; flex: none; }
.q-S { color: var(--q-s); } .q-A { color: var(--q-a); } .q-B { color: var(--q-b); } .q-C { color: var(--q-c); } .q-D { color: var(--q-d); }
.skill .sn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill .sl { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.skill .sl.up { color: var(--gold); }
.skill .st { font-size: 10px; color: var(--faint); flex: none; }
.type-主動 { --tc: #e58b5a; } .type-指揮 { --tc: #e2c35a; } .type-被動 { --tc: #79b8e0; } .type-追擊 { --tc: #e06a8a; }
.skill .tt { font-size: 10px; color: var(--tc, var(--faint)); flex: none; }

.lib-item { display: flex; flex-direction: column; gap: 3px; }
.lib-item .skill { padding: 6px 8px; font-size: 13px; }
.lib-meta { display: flex; gap: 6px; font-size: 11.5px; color: var(--muted); padding: 0 4px 2px; flex-wrap: wrap; }
.lib-meta .bad { color: var(--bad); }
.lib-meta .full { color: var(--faint); }
.lib-sec { font-size: 12px; color: var(--gold); margin: 8px 2px 2px; letter-spacing: .08em; }
.lib-sec small { color: var(--faint); letter-spacing: 0; }

/* ---------- detail ---------- */
.d-head { display: flex; gap: 12px; align-items: flex-start; }
.d-card { width: 92px; flex: none; border-radius: 10px; overflow: hidden; border: 2px solid var(--camp, var(--line-2)); background: #0d0b09; }
.d-card img { width: 100%; display: block; }
.d-title { font-size: 17px; font-weight: 700; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.d-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.d-sec { margin-top: 12px; }
.d-sec h4 { margin: 0 0 6px; font-size: 12px; color: var(--gold); letter-spacing: .08em; font-weight: 600; }
.stat-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.stat-tbl th, .stat-tbl td { padding: 3px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.stat-tbl th:first-child, .stat-tbl td:first-child { text-align: left; color: var(--muted); font-weight: 400; }
.stat-tbl thead th { color: var(--faint); font-weight: 400; font-size: 11.5px; }
.d-skill { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 6px; }
.d-skill .top-line { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; font-size: 13px; }
.d-skill .top-line b { font-size: 14px; }
.d-skill p { margin: 5px 0 0; color: #d6ccbd; font-size: 12.5px; line-height: 1.55; }
.d-skill .facts { color: var(--muted); font-size: 11.5px; margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.d-skill select { padding: 1px 4px; font-size: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.d-close { display: none; }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: #2d261f; border: 1px solid var(--gold); color: var(--text); padding: 8px 14px; border-radius: 10px; transition: .2s; z-index: 50; max-width: 90vw;
}
.toast.on { opacity: 1; transform: translateX(-50%); }
.ghost-drag {
  position: fixed; left: 0; top: 0; pointer-events: none; z-index: 60; display: none; opacity: .92;
  transform: translate(-50%, -60%) rotate(-2deg); filter: drop-shadow(0 6px 14px rgba(0,0,0,.6));
}
.ghost-drag.on { display: block; }
body.dragging, body.dragging * { cursor: grabbing !important; }
body.picking .can-drop { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px rgba(217,169,78,.35); } }

dialog {
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0;
  width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
.dlg-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 42px); }
.dlg-body { padding: 18px 20px; overflow: auto; }
.dlg-body h3 { font-size: 16px; color: var(--gold); margin: 0 0 10px; }
.dlg-body h4 { font-size: 13px; margin: 16px 0 6px; color: var(--gold); }
.dlg-body ul { margin: 0; padding-left: 18px; }
.dlg-body li { margin: 3px 0; }
.dlg-body p { margin: 6px 0; color: #d6ccbd; }
.dlg-body textarea { width: 100%; min-height: 70px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px; font: 12px/1.4 ui-monospace, monospace; }
.dlg-foot { padding: 10px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.diff-old { color: var(--faint); text-decoration: line-through; }
.diff-new { color: var(--gold); }
.muted { color: var(--muted); }

/* ---------- responsive ---------- */
.layout.pool-grid { grid-template-columns: 336px minmax(0, 1fr) 360px; }
@media (max-width: 1180px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr) 320px; }
  .layout.pool-grid { grid-template-columns: 300px minmax(0, 1fr) 320px; }
  .team-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  body { height: auto; min-height: 100dvh; overflow: auto; }
  .top { padding: 10px 16px; gap: 8px; }
  .actions { width: 100%; }
  .actions select { flex: 1; max-width: none; }
  .sticky { position: sticky; top: 0; z-index: 30; }
  .summary { padding: 6px 16px; font-size: 12.5px; }
  .tabs { display: flex; background: #110e0c; border-bottom: 1px solid var(--line); }
  .tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 10px; color: var(--muted); border-bottom: 2px solid transparent; }
  .tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }
  .layout { display: block; }
  .col { border-right: 0; display: none; }
  .layout[data-tab=pool] .pool, .layout[data-tab=teams] .teams, .layout[data-tab=lib] .lib { display: flex; }
  .teams { display: none; padding: 12px 16px 120px; }
  .layout[data-tab=teams] .teams { display: block; }
  .pool-list, .lib-list { overflow: visible; padding: 8px 16px 120px; }
  .col-head { padding: 12px 16px 8px; }
  .slots { grid-template-columns: 1fr; }
  .slot { border-right: 0; border-bottom: 1px solid var(--line); min-height: 0; }
  .slot:last-child { border-bottom: 0; }
  .slot.empty .slot-body { min-height: 48px; }
  .member { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; align-items: start; }
  .detail {
    position: fixed; inset: auto 0 0 0; max-height: 66dvh; z-index: 40; border: 0; border-top: 1px solid var(--gold);
    border-radius: 14px 14px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.6); padding: 0 16px calc(16px + env(safe-area-inset-bottom));
    animation: sheetIn .18s ease-out;
  }
  @keyframes sheetIn { from { transform: translateY(40px); } }
  .d-bar { margin: 0 -16px 12px; padding: 10px 16px; border-radius: 14px 14px 0 0; }
  .lib-hint { display: none; }
}
@media (max-width: 420px) {
  .member { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
.f-break { flex-basis: 100%; height: 0; }

.faint { color: var(--faint); }
.lib-meta .faint { font-size: 11px; }
.sk-slot .was { color: var(--faint); font-size: 11px; margin-left: 2px; }
.h-sk .dis-hint { color: #b98f63; }
.skill .tag.warn { font-size: 10px; line-height: 14px; padding: 0 4px; flex: none; }

/* ---------- 1 / 2 / 3 per row ---------- */
.h2-ctl { margin-left: auto; }
.seg { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; font-weight: 400; }
.seg button { border: 0; border-radius: 0; padding: 2px 9px; font-size: 12px; background: transparent; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--gold-soft); color: var(--gold); font-weight: 700; }
.seg .seg-l { font-size: 11.5px; color: var(--faint); padding: 0 7px 0 5px; border-left: 1px solid var(--line-2); }
.pool-list.cols-2, .pool-list.cols-3, .lib-list.cols-2, .lib-list.cols-3 { display: grid; gap: 6px; align-content: start; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lib-list .lib-sec, .span-all, .lib-list > p { grid-column: 1 / -1; }

.hero.tile { gap: 6px; }
.hero.tile.t2 { grid-template-columns: 38px minmax(0, 1fr); padding: 5px 6px 5px 5px; align-items: center; }
.hero.tile.t2 .pic { width: 38px; height: 38px; }
.hero.tile.t3 { display: flex; flex-direction: column; align-items: stretch; padding: 5px; gap: 2px; }
.hero.tile.t3 .pic { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.hero.tile.t3 .pic img { height: 150%; }
.tile-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-name .stars { margin-left: 3px; font-size: 9.5px; }
.hero.tile.t3 .tile-name, .hero.tile.t3 .tile-sub { text-align: center; }
.tile-sub { font-size: 11px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.tile-sub .stars { font-size: 9.5px; }
.aw { font-size: 9.5px; color: #cfadf5; background: rgba(176,125,232,.18); border-radius: 3px; padding: 0 3px; margin-left: 3px; }
.badge { font-size: 10.5px; color: var(--gold); }
.badge.bad { color: var(--bad); }
.pic .badge { position: absolute; left: 0; top: 0; background: rgba(0,0,0,.72); padding: 0 4px; border-bottom-right-radius: 6px; font-size: 10px; }

.lib-item.t2 .skill, .lib-item.t3 .skill { padding: 5px 6px; font-size: 12.5px; gap: 4px; }
/* grid mode: short meta that wraps instead of being cut off */
.lib-item.t2 .lib-meta, .lib-item.t3 .lib-meta { flex-wrap: wrap; font-size: 11px; gap: 0 6px; padding: 0 3px 2px; line-height: 1.4; }
.lib-item.t3 .skill .tt { display: none; }
.lib-item.t3 .skill { border-left: 3px solid var(--tc, var(--line)); }


.tile-name .stars { letter-spacing: 0; }
.tile-name .adv { font-size: 9.5px; margin-left: 2px; letter-spacing: 0; }
.tabs button, .seg button, .fbtn { -webkit-tap-highlight-color: transparent; }

.tile-name.wrap { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 3px; white-space: normal; overflow: visible; }
.tile-name.wrap .tn { white-space: nowrap; }
.tile-name.wrap .stars, .tile-name.wrap .adv, .tile-name.wrap .aw { margin-left: 0; white-space: nowrap; }
/* 3 per row: the meta line already says 拆, keep the chip to quality + name */
.lib-item.t3 .skill .tag.warn { display: none; }
.lib-item.t3 .skill { padding: 5px 5px 5px 4px; }

.sk-slot.need-aw { box-shadow: inset 2px 0 0 rgba(176,125,232,.55); }
