/* Tag Matrix — content-sized role columns, site-aligned page width */

.tm-page{
  --tm-four:#e8782a;
  --tm-six:#3b82f6;
  --tm-new:#a855f7;
  --tm-other:#64748b;
  --tm-series:#0d9488;
  --tm-attack:rgba(239,68,68,.1);
  --tm-support:rgba(234,179,8,.1);
  --tm-durability:rgba(59,130,246,.1);
  --tm-border:rgba(148,163,184,.2);
  --tm-thumb:38px;
  --tm-gap:2px;
  --tm-rail-w:16px;
  /* Supports/tag fixed; role cols use fr weights from JS (unit counts) */
  --tm-w-supp:72px;
  --tm-w-tag:76px;
  --tm-fr-atk:1fr;
  --tm-fr-role-sup:1fr;
  --tm-fr-dur:1fr;
  --tm-cols:var(--tm-rail-w) var(--tm-w-supp) var(--tm-w-tag) minmax(0,var(--tm-fr-atk)) minmax(0,var(--tm-fr-role-sup)) minmax(0,var(--tm-fr-dur));
  --tm-cols-body:var(--tm-w-supp) var(--tm-w-tag) minmax(0,var(--tm-fr-atk)) minmax(0,var(--tm-fr-role-sup)) minmax(0,var(--tm-fr-dur));
  --motion-quick:100ms;
  --motion-ease:cubic-bezier(.2,0,0,1);
  --tm-fixed-chrome-h:96px;
  display:flex !important;
  flex-direction:column !important;
  max-width:100%;
}
/*
  Tag Matrix is body.tm-page. App shell / iOS rules set body{min-height:…} which
  can beat max-height and let the DOCUMENT scroll — nav tabs leave the viewport
  in landscape. Force a locked viewport shell; board-wrap is the only scroller.
*/
html:has(body.tm-page){
  height:100dvh !important;
  max-height:100dvh !important;
  min-height:0 !important;
  overflow:hidden !important;
}
body.tm-page{
  height:100dvh !important;
  max-height:100dvh !important;
  min-height:0 !important;
  overflow:hidden !important;
}
.tm-page > .app-header{
  flex:0 0 auto;
  position:relative;
  z-index:300;
  overflow:visible;
}
.tm-page > .app-header .header-inner{
  overflow:visible;
}
.tm-page > .app-header .header-15-slot{
  flex-shrink:0;
}
.tm-page > .tm-main{
  flex:1 1 auto;
  min-height:0 !important;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
/* Lang open: keep normal absolute dropdown, just lift stacking + stop chrome clip */
body.tm-page.tm-lang-open > .app-header{
  z-index:500;
  overflow:visible;
}
body.tm-page.tm-lang-open > .app-header .header-inner{
  overflow:visible !important;
}
body.tm-page.tm-lang-open .header-controls,
body.tm-page.tm-lang-open .lang-selector{
  position:relative;
  z-index:520;
}
body.tm-page.tm-lang-open #tmLangDropdown,
body.tm-page.tm-lang-open .lang-dropdown.active{
  z-index:530 !important;
}

/*
  Landscape: keep header IN FLOW (not position:fixed).
  Fixed + body overflow:hidden made touch pan feel broken — users swipe the
  page (can't move) instead of the board. Flex shell already pins chrome;
  only .tm-board-wrap scrolls.
*/
@media (orientation: landscape) and (max-height:520px){
  body.tm-page > .tm-main{
    padding-top:6px;
    padding-bottom:8px;
  }
  body.tm-page .tm-toolbar{
    margin-bottom:2px;
    padding:2px 4px;
  }
  body.tm-page .tm-status{
    margin-top:0;
  }
}
/* CJK Exclusive rail needs room for 互斥 glyphs */
html[data-ui-lang="JA"] .tm-page,
html[data-ui-lang="JP"] .tm-page,
html[data-ui-lang="TW"] .tm-page,
html[data-ui-lang="HK"] .tm-page{
  --tm-rail-w:22px;
}
.tm-page.tm-hide-supports{
  --tm-rail-w:14px;
  --tm-cols:var(--tm-rail-w) var(--tm-w-tag) minmax(0,var(--tm-fr-atk)) minmax(0,var(--tm-fr-role-sup)) minmax(0,var(--tm-fr-dur));
  --tm-cols-body:var(--tm-w-tag) minmax(0,var(--tm-fr-atk)) minmax(0,var(--tm-fr-role-sup)) minmax(0,var(--tm-fr-dur));
}
html[data-ui-lang="JA"] .tm-page.tm-hide-supports,
html[data-ui-lang="JP"] .tm-page.tm-hide-supports,
html[data-ui-lang="TW"] .tm-page.tm-hide-supports,
html[data-ui-lang="HK"] .tm-page.tm-hide-supports{
  --tm-rail-w:20px;
}

.tm-main{
  width:100%;
  max-width:1600px;
  margin:0 auto;
  padding:12px 20px 28px;
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  min-height:0;
  min-width:0;
  box-sizing:border-box;
  overflow-x:hidden;
}

/* Nav shell width matches header column; tab row layout comes from classic shell CSS */
.tm-page .nav-tabs-shell{
  max-width:1600px;
  margin-left:auto;
  margin-right:auto;
  width:100%;
  box-sizing:border-box;
}

/*
  Nav tabs: match main browse (/c /u) — desktop wraps (full list), mobile = one-row scroll.
  TM does not load mobile_layout.css; mirror that breakpoint here.
*/
body.tm-page .nav-tabs-shell,
body.tm-page #navTabsShell{
  min-height:44px;
  overflow:hidden; /* allow auto-hide collapse; tabs themselves still scroll-x on mobile */
  width:100%;
  max-width:100%;
  opacity:1;
  transform:translateY(0);
  transition:
    opacity 180ms var(--motion-ease,cubic-bezier(.2,0,0,1)),
    transform 180ms var(--motion-ease,cubic-bezier(.2,0,0,1));
}
body.tm-page .nav-tabs,
body.tm-page #navTabs{
  display:flex;
  flex-wrap:wrap;
  align-items:stretch;
  justify-content:flex-start;
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  overflow-x:visible;
  overflow-y:visible;
  gap:0;
  padding:0 24px;
}
body.tm-page .nav-tab{
  flex:0 1 auto;
  white-space:nowrap;
}
@media (max-width:768px), (orientation:landscape) and (max-height:520px){
  body.tm-page .nav-tabs,
  body.tm-page #navTabs{
    flex-wrap:nowrap !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
    touch-action:pan-x;
    scroll-behavior:auto;
    scrollbar-width:none;
    -ms-overflow-style:none;
    padding:6px 12px 0;
    justify-content:flex-start;
  }
  body.tm-page .nav-tabs::-webkit-scrollbar,
  body.tm-page #navTabs::-webkit-scrollbar{display:none}
  body.tm-page .nav-tab{
    flex:0 0 auto !important;
    flex-shrink:0 !important;
  }
}
@media (prefers-reduced-motion:reduce){
  body.tm-page .nav-tabs,
  body.tm-page #navTabs{
    scroll-behavior:auto;
  }
}
/* Board scroll: collapse nav tabs + filters; brand header stays */
body.tm-page.tm-filters-collapsed #navTabsShell,
body.tm-page.tm-filters-collapsed .nav-tabs-shell{
  max-height:0 !important;
  min-height:0 !important;
  height:0 !important;
  opacity:0;
  border-bottom-width:0 !important;
  border-color:transparent !important;
  transform:translateY(-6px);
  pointer-events:none;
  margin:0 !important;
  padding:0 !important;
}
@media (prefers-reduced-motion:reduce){
  body.tm-page #navTabsShell,
  body.tm-page .nav-tabs-shell{
    transition:none !important;
  }
  body.tm-page.tm-filters-collapsed #navTabsShell,
  body.tm-page.tm-filters-collapsed .nav-tabs-shell{
    transform:none !important;
  }
}

.tm-intro{display:none} /* reclaim vertical space — title is in the nav tab */
.tm-legend{display:none}
.tm-foot{display:none}
.tm-status{margin:2px 0 0;font-size:9px;color:var(--text-muted,#94a3b8);flex:0 0 auto;line-height:1.2;display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}

@media (max-width:768px), (orientation:landscape) and (max-height:520px){
  .tm-main{padding:10px 12px 20px}
  /* Compact brand chrome on narrow / short viewports (nav wrap vs scroll is separate @768) */
  body.tm-page > .app-header .header-inner,
  html.ggen-15 body.tm-page > .app-header .header-inner,
  html.ggen-15 body.tm-page .app-header .header-inner:has(.header-15-slot),
  body.tm-page .app-header .header-inner:has(.header-15-slot){
    gap:8px;
    padding:8px 12px;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  body.tm-page > .app-header .header-inner::-webkit-scrollbar{display:none}
  body.tm-page > .app-header .header-brand{
    flex:0 1 auto;
    min-width:0;
    max-width:none;
  }
  body.tm-page > .app-header .brand-logo{
    width:32px;
    height:32px;
  }
  body.tm-page > .app-header .brand-text{
    font-size:clamp(10px,2vw + 5px,13px);
  }
  /* Brand panel emblem — match classic mobile scale (1.5 desktop 108×58 is too large here) */
  body.tm-page .brand-title-row::before,
  html.ggen-15 body.tm-page .brand-title-row::before,
  html.ggen-15 body.tm-page .app-header .brand-title-row::before{
    width:64px !important;
    height:34px !important;
    opacity:.72 !important;
    transform:translate(calc(-50% + var(--brand-emblem-optical-x, 0px)),-52%) !important;
  }
  body.tm-page > .app-header .brand-sub{
    display:none;
  }
  body.tm-page > .app-header .header-15-toggle{
    min-height:32px;
    padding:3px 10px;
    font-size:12px;
  }
  body.tm-page > .app-header .header-15-toggle--special{
    max-width:min(160px,42vw);
    min-height:32px;
    padding:3px 6px;
  }
  body.tm-page > .app-header .header-15-toggle--special img{
    display:block !important;
    height:22px !important;
    width:auto !important;
    max-width:100% !important;
  }
  body.tm-page .nav-tab{
    padding:10px 12px !important;
    font-size:13px !important;
    min-height:44px;
  }
  body.tm-page .nav-tab .nav-tab-icon,
  body.tm-page .nav-tab .nav-tab-icon--svg{
    width:22px !important;
    height:22px !important;
    margin-right:6px;
  }
  /* Role header labels hidden on phone; centering applied after base .tm-head-role rule */
  .tm-head-role-label{display:none}
  .tm-head-role img{width:16px;height:16px}
  /* Compact landscape nudge — art + wording as one centered cluster in the HUD */
  .tm-rotate-hint:not([hidden]){
    flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:center;
    gap:16px;
    margin:0 0 6px;padding:12px 12px;
    /* Do not use overflow-x:hidden — it forces overflow-y:auto and creates a scroller */
    overflow:visible;
    min-height:52px;
    box-sizing:border-box;
  }
  .tm-rotate-art{
    position:relative;
    width:48px;height:44px;flex:0 0 48px;
    overflow:visible;margin:0;
  }
  .tm-rotate-phone{
    position:absolute;left:50%;top:50%;
    width:30px;height:auto;max-width:none;
    transform:translate(-50%,-50%) rotate(-90deg);
    transform-origin:center center;
  }
  .tm-rotate-arrow{
    position:absolute;left:50%;top:50%;
    width:18px;height:auto;max-height:18px;
    transform:translate(-50%,-50%);
    animation:tm-rotate-nudge-m 1.6s var(--motion-ease,cubic-bezier(0.2,0,0,1)) infinite;
  }
  .tm-rotate-copy{
    font-size:11px;text-align:left;
    flex:0 1 auto;min-width:0;max-width:14em;margin:0;
  }
  @keyframes tm-rotate-nudge-m{
    0%,100%{opacity:.7;transform:translate(-50%,-50%) scale(1)}
    50%{opacity:1;transform:translate(-50%,-50%) scale(1.08)}
  }
}

.tm-toolbar{
  display:flex;flex-wrap:wrap;gap:3px 6px;align-items:flex-end;
  margin:0 0 2px;padding:3px 5px;
  border:1px solid var(--tm-border);border-radius:5px;
  background:rgba(15,23,42,.55);flex:0 0 auto;
  max-height:220px;
  opacity:1;
  transform:translateY(0);
  overflow:hidden;
  transition:
    max-height 220ms var(--motion-ease,cubic-bezier(.2,0,0,1)),
    opacity 180ms var(--motion-ease,cubic-bezier(.2,0,0,1)),
    transform 220ms var(--motion-ease,cubic-bezier(.2,0,0,1)),
    margin 220ms var(--motion-ease,cubic-bezier(.2,0,0,1)),
    padding 220ms var(--motion-ease,cubic-bezier(.2,0,0,1)),
    border-color 180ms var(--motion-ease,cubic-bezier(.2,0,0,1));
}
/* Board scroll-down: collapse filters; header stays. Reveal on strong scroll-up. */
body.tm-filters-collapsed .tm-toolbar{
  max-height:0 !important;
  height:0 !important;
  min-height:0 !important;
  opacity:0;
  margin:0 !important;
  padding:0 !important;
  border:none !important;
  transform:translateY(-8px);
  pointer-events:none;
  overflow:hidden;
}
@media (prefers-reduced-motion:reduce){
  .tm-toolbar{
    transition:none;
  }
  body.tm-filters-collapsed .tm-toolbar{
    transform:none;
  }
}
.tm-filter-block{display:flex;flex-direction:column;gap:2px;min-width:0}
.tm-filter-label{font-size:8px;letter-spacing:.04em;text-transform:uppercase;color:var(--text-muted,#94a3b8)}
.tm-chip-row,.tm-role-row{display:flex;flex-wrap:wrap;gap:2px;align-items:center}
.tm-chip,.tm-role-btn{
  appearance:none;border:1px solid var(--tm-border);background:rgba(30,41,59,.8);
  color:var(--text-secondary,#cbd5e1);font:inherit;font-size:11px;
  padding:3px 7px;border-radius:4px;cursor:pointer;line-height:1.1;
}
.tm-chip:hover,.tm-role-btn:hover{border-color:rgba(0,212,255,.45);color:#fff}
.tm-chip.is-active,.tm-role-btn.is-active{
  border-color:rgba(0,212,255,.7);background:rgba(0,212,255,.16);color:#fff;
}
.tm-role-btn{padding:2px 4px;display:inline-flex;align-items:center;justify-content:center}
.tm-role-btn img{display:block;width:16px;height:16px}
.tm-filter-block--toggles{flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px 8px}
.tm-rarity-row{align-items:center}
.tm-rarity-btn{
  padding:2px 4px;display:inline-flex;align-items:center;justify-content:center;
  line-height:0;min-height:0;
}
.tm-rarity-btn-icons{
  display:inline-flex;align-items:center;gap:1px;line-height:0;
}
.tm-rarity-btn .filter-inline-icon.rarity-filter-chip,
.tm-rarity-btn img{
  display:block;height:16px;width:auto;object-fit:contain;
}
.tm-toggle{display:inline-flex;align-items:center;gap:4px;font-size:10px;color:var(--text-secondary,#cbd5e1);cursor:pointer;user-select:none}
.tm-toggle input{accent-color:#00d4ff}
.tm-search{
  min-width:110px;flex:1 1 130px;max-width:180px;padding:3px 6px;border-radius:4px;
  border:1px solid var(--tm-border);background:rgba(15,23,42,.85);
  color:var(--text-primary,#e2e8f0);font:inherit;font-size:11px;
}
.tm-search:focus{outline:none;border-color:rgba(0,212,255,.55)}
.tm-search-hint{display:none}

/* Mobile Squad multi-select — desktop keeps right-click */
.tm-filter-block--squad{display:none}
.tm-squad-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:5px;
  min-height:28px;padding:3px 8px;
}
.tm-squad-btn .tm-squad-ic{width:16px;height:16px;object-fit:contain;display:block}
.tm-squad-btn.is-active{
  border-color:rgba(0,212,255,.75);background:rgba(0,212,255,.18);color:#fff;
  box-shadow:0 0 0 1px rgba(0,212,255,.25);
}
.tm-filter-block--squad .tm-squad-actions{
  display:inline-flex;align-items:center;gap:4px;flex-wrap:wrap;
}
.tm-squad-clear{
  display:none;min-height:28px;padding:3px 8px;
  border-color:rgba(148,163,184,.45);
}
.tm-squad-clear:hover{border-color:rgba(0,212,255,.5);color:#fff}
body.tm-squad-mode .tm-squad-clear{display:inline-flex}
body.tm-squad-mode .tm-tile[data-kind="unit"]{outline:1px dashed transparent}
@media (hover:none),(pointer:coarse){
  .tm-filter-block--squad{display:flex}
}
@media (hover:hover) and (pointer:fine){
  .tm-filter-block--squad{display:none!important}
}

.tm-rotate-hint{
  display:none;
  flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:center;gap:16px 18px;
  margin:0 0 8px;padding:12px 14px;
  border:1px solid rgba(0,212,255,.35);border-radius:8px;
  background:rgba(8,14,28,.88);
  overflow:visible;
}
.tm-rotate-hint:not([hidden]){display:flex}
.tm-rotate-art{
  position:relative;
  width:56px;height:48px;
  flex:0 0 56px;
  overflow:visible;
  margin:0;
}
.tm-rotate-phone{
  position:absolute;left:50%;top:50%;
  width:36px;height:auto;max-width:none;display:block;
  transform:translate(-50%,-50%) rotate(-90deg);
  transform-origin:center center;
  filter:drop-shadow(0 4px 12px rgba(0,0,0,.45));
}
.tm-rotate-arrow{
  position:absolute;left:50%;top:50%;
  width:22px;height:auto;max-height:22px;display:block;z-index:1;
  transform:translate(-50%,-50%);
  opacity:.95;
  filter:drop-shadow(0 1px 3px rgba(0,0,0,.65));
  animation:tm-rotate-nudge 1.6s var(--motion-ease,cubic-bezier(0.2,0,0,1)) infinite;
  pointer-events:none;
}
.tm-rotate-copy{
  margin:0;font-size:12px;font-weight:700;line-height:1.35;
  color:var(--text-primary,#e2e8f0);text-align:left;
  flex:0 1 auto;max-width:22em;
}
@keyframes tm-rotate-nudge{
  0%,100%{opacity:.7;transform:translate(-50%,-50%) scale(1)}
  50%{opacity:1;transform:translate(-50%,-50%) scale(1.08)}
}
@media (prefers-reduced-motion:reduce){
  .tm-rotate-arrow{animation:none!important}
}

.tm-legend{
  display:none;
}

/* Head is OUTSIDE the scrollport — always frozen (Chrome overflow-x bug safe) */
.tm-matrix{
  flex:1 1 auto;
  min-height:0;
  width:100%;
  max-width:100%;
  min-width:0;
  display:flex;
  flex-direction:column;
  border:1px solid var(--tm-border);
  border-radius:6px;
  overflow:hidden;
  background:rgba(2,6,23,.35);
}
.tm-sticky-head{
  flex:0 0 auto;
  z-index:30;
  display:grid;
  grid-template-columns:var(--tm-cols);
  width:100%;
  min-width:0;
  box-sizing:border-box;
  background:rgba(8,12,22,.98);
  border-bottom:2px solid var(--tm-border);
  box-shadow:0 2px 10px rgba(0,0,0,.4);
}
.tm-sticky-head > *{
  padding:5px 4px;font-size:10px;font-weight:700;
  letter-spacing:.03em;text-transform:uppercase;
  color:var(--text-muted,#94a3b8);
  background:rgba(8,12,22,.98);
  min-width:0;
  display:flex;align-items:center;gap:4px;
}
.tm-head-rail{grid-column:1}
.tm-head-supp{
  grid-column:2;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:#86efac;text-transform:none;
}
.tm-head-tag{
  grid-column:3;
  align-items:center;
  justify-content:center;
  text-align:center;
}
.tm-page.tm-hide-supports .tm-head-supp{display:none}
.tm-page.tm-hide-supports .tm-head-tag{grid-column:2}
.tm-head-role{justify-content:flex-start}
.tm-head-role img{width:14px;height:14px}
.tm-head-role--1{background:linear-gradient(180deg,rgba(239,68,68,.25),rgba(8,12,22,.98));color:#fecaca}
.tm-head-role--3{background:linear-gradient(180deg,rgba(234,179,8,.25),rgba(8,12,22,.98));color:#fde68a}
.tm-head-role--2{background:linear-gradient(180deg,rgba(59,130,246,.25),rgba(8,12,22,.98));color:#bfdbfe}
.tm-page.tm-hide-supports .tm-head-role--1{grid-column:3}
.tm-page.tm-hide-supports .tm-head-role--3{grid-column:4}
.tm-page.tm-hide-supports .tm-head-role--2{grid-column:5}
/* Portrait / phone: role icons alone — center in the column header box */
@media (max-width:768px) and (orientation:portrait),
       (orientation:landscape) and (max-height:520px){
  .tm-sticky-head .tm-head-role{
    justify-content:center;
    align-items:center;
    padding-left:2px;
    padding-right:2px;
  }
}

.tm-board-wrap{
  flex:1 1 auto;
  min-height:0;
  min-width:0;
  overflow-x:hidden;
  overflow-y:scroll; /* scroll (not auto) — more reliable touch pan on iOS/Android */
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-y:contain;
  overscroll-behavior-x:none;
  touch-action:pan-y;
  /* JS momentum owns wheel smoothness; keep auto so continuous wheel isn’t delayed */
  scroll-behavior:auto;
}

/*
  Height rule: each .tm-row is ONLY as tall as its chips.
  Never one board-grid with equal row tracks (11220/15 ≈ 748px empty).
  Cache: tag_matrix.css is in app_js_version — hard-refresh after edits.
*/
.tm-board{
  display:block;
  width:100%;
  min-width:0;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
}
.tm-row{
  display:grid;
  grid-template-columns:var(--tm-cols-body);
  grid-template-rows:max-content; /* single track = content, never 1fr */
  grid-auto-rows:max-content;
  width:100%;
  min-width:0;
  box-sizing:border-box;
  height:max-content !important;
  max-height:none;
  align-items:stretch; /* cells share THAT content height; do not invent extra */
  justify-items:stretch;
}
.tm-row > *{
  border-bottom:1px solid rgba(148,163,184,.14);
  border-right:1px solid rgba(148,163,184,.08);
  padding:2px 3px;
  min-width:0;
  width:auto;
  min-height:0;
  height:auto !important;
  max-height:none;
  display:block; /* avoid flex column stretch games inside the cell */
  box-sizing:border-box;
  overflow:visible;
}
.tm-row--alt > *{background:rgba(148,163,184,.025)}

/* One Exclusive rail spanning every tag in the same exclusive group */
.tm-rail-group{
  display:flex;
  flex-direction:row;
  align-items:stretch;
  width:100%;
  min-width:0;
}
/* Height follows unit rows only — never grow from letter stack (EXCLUSIVE gap bug) */
.tm-rail-group-bar{
  flex:0 0 var(--tm-rail-w);
  width:var(--tm-rail-w);
  align-self:stretch;
  min-height:0;
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:1px;
  padding:2px 0;
  box-sizing:border-box;
  font-size:9px;
  font-weight:800;
  letter-spacing:0;
  color:#fff;
  user-select:none;
  overflow:hidden;
  line-height:1;
  text-shadow:
    0 1px 2px rgba(0,0,0,.95),
    0 0 2px rgba(0,0,0,.9),
    0 2px 6px rgba(0,0,0,.75),
    0 0 8px rgba(0,0,0,.45);
  -webkit-font-smoothing:antialiased;
}
.tm-rail-group-ch{
  display:block;
  flex:0 0 auto;
  text-align:center;
  text-transform:uppercase;
  font-weight:inherit;
  font-size:inherit;
  line-height:1;
  max-height:1em;
}
html[data-ui-lang="JA"] .tm-rail-group-ch,
html[data-ui-lang="JP"] .tm-rail-group-ch,
html[data-ui-lang="TW"] .tm-rail-group-ch,
html[data-ui-lang="HK"] .tm-rail-group-ch{
  text-transform:none;
  font-weight:800;
}
.tm-rail-group--four .tm-rail-group-bar{background:var(--tm-four)}
.tm-rail-group--six .tm-rail-group-bar{background:var(--tm-six)}
.tm-rail-group--new .tm-rail-group-bar{background:var(--tm-new)}
.tm-rail-group--other .tm-rail-group-bar{background:var(--tm-other)}
.tm-rail-group--series .tm-rail-group-bar{background:var(--tm-series)}
.tm-page:not(.tm-exclusive-on) .tm-rail-group-bar{opacity:.35}
.tm-rail-group-rows{
  flex:1 1 auto;
  width:auto;
  min-width:0;
  display:flex;
  flex-direction:column;
}

.tm-rail{
  display:none; /* legacy per-row rail — groups own the rail now */
}
.tm-rail-bar{display:none}

.tm-tag-cell{
  display:flex !important;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:3px 3px;
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
  overflow:hidden;
}
.tm-tag-name{
  display:block;
  font-size:11px;font-weight:700;color:var(--text-primary,#e2e8f0);line-height:1.15;
  overflow-wrap:anywhere;
}

.tm-chip-strip{
  display:flex;
  flex-direction:row;
  flex-wrap:wrap;
  gap:var(--tm-gap);
  align-content:flex-start;
  align-items:flex-start;
  justify-content:flex-start;
  width:100%;
  min-width:0;
  height:auto !important;
  box-sizing:border-box;
}
.tm-chip-strip--supp{
  width:auto;
  max-width:100%;
  justify-content:center;
  align-content:center;
  gap:3px 4px;
}

.tm-supp{
  display:flex !important;
  align-items:center;
  justify-content:center;
  background:rgba(134,239,172,.06);
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
  overflow:hidden;
}
.tm-supp--empty{min-height:calc(var(--tm-thumb) + 4px)}
.tm-supp--hit{
  box-shadow:inset 0 0 0 2px rgba(0,212,255,.75);
  background:rgba(0,212,255,.16);
}
.tm-supp-stack{display:inline-flex;align-items:center;gap:2px;line-height:0}
.tm-supp-kind-badge{
  width:14px;height:14px;object-fit:contain;flex:0 0 auto;
  filter:drop-shadow(0 0 1px #000);
}

.tm-units{
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
  overflow:hidden;
}
.tm-units--1{background:var(--tm-attack)}
.tm-units--3{background:var(--tm-support)}
.tm-units--2{background:var(--tm-durability)}
.tm-board.tm-role-filter-1 .tm-units--3,
.tm-board.tm-role-filter-1 .tm-units--2,
.tm-board.tm-role-filter-3 .tm-units--1,
.tm-board.tm-role-filter-3 .tm-units--2,
.tm-board.tm-role-filter-2 .tm-units--1,
.tm-board.tm-role-filter-2 .tm-units--3{opacity:.16}

.tm-page.tm-hide-supports .tm-supp{display:none}

.tm-empty-board{
  width:100%;padding:20px 12px;text-align:center;
  font-size:13px;color:var(--text-muted,#94a3b8);
}

.tm-ft{
  position:relative;display:inline-block;flex:0 0 auto;
  width:var(--tm-thumb);height:var(--tm-thumb);line-height:0;
  overflow:hidden;border-radius:2px;
}
.tm-ft-base,.tm-ft-frame{
  position:absolute;inset:0;width:100%;height:100%;object-fit:fill;pointer-events:none;
}
.tm-ft-base{z-index:0}
.tm-ft-port-wrap{
  position:absolute;inset:8%;z-index:1;overflow:hidden;
  display:flex;align-items:center;justify-content:center;
}
.tm-ft--framed .tm-ft-port-wrap{inset:11%}
.tm-ft-portrait{width:100%;height:100%;object-fit:cover;display:block}
.tm-ft-frame{z-index:2}
.tm-ft-icons{
  position:absolute;top:0;left:0;z-index:3;display:flex;flex-direction:column;gap:0;
  pointer-events:none;
}
.tm-ft-ic{width:9px;height:9px;display:block;line-height:0}
.tm-ft-ic img{width:100%;height:100%;object-fit:contain;display:block;filter:drop-shadow(0 0 1px #000)}
/* Collections-style limited ribbon (unit magenta / supporter teal–gold) */
.tm-lim{
  position:absolute;left:0;right:0;top:0;z-index:5;
  width:100%;margin:0;padding:1px 1px 2px;box-sizing:border-box;
  text-align:center;border-radius:2px 2px 0 0;
  box-shadow:0 1px 6px rgba(0,0,0,.45);
  pointer-events:none;
}
.tm-lim--unit{background:linear-gradient(95deg,#be185d 0%,#a855f7 55%,#1d4ed8 100%)}
.tm-lim--supp{background:linear-gradient(95deg,#0e7490 0%,#155e75 45%,#b8954a 100%)}
.tm-lim-inner{
  display:block;font-size:5px;font-weight:900;letter-spacing:.04em;
  text-transform:uppercase;color:#fff;
  text-shadow:0 1px 2px rgba(0,0,0,.88);line-height:1.1;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 1px;
}
.tm-ft-hit{position:absolute;inset:0;z-index:4}
.tm-ft--supp .tm-ft-port-wrap{inset:6%}
.tm-ft--tb .tm-ft-port-wrap{inset:12%}
.tm-ft-tb{position:absolute;z-index:2;pointer-events:none;object-fit:fill}
.tm-ft-tb--l{left:0;top:0;bottom:0;width:14%;height:100%}
.tm-ft-tb--r{right:0;top:0;bottom:0;width:14%;height:100%;transform:scaleX(-1)}
.tm-ft-tb--t{left:0;right:0;top:0;height:14%;width:100%}
.tm-ft-tb--b{left:0;right:0;bottom:0;height:14%;width:100%;transform:scaleY(-1)}

.tm-tile{
  position:relative;
  display:inline-flex;
  flex:0 0 auto;
  z-index:1;
  width:var(--tm-thumb);
  height:var(--tm-thumb);
  line-height:0;
  vertical-align:top;
}
.tm-tile--supp{
  width:auto;
  height:var(--tm-thumb);
}
.tm-tile:hover,.tm-tile:focus-within{z-index:30}
.tm-tile--dim > .tm-ft,
.tm-tile--dim > .tm-supp-stack,
.tm-tile--dim > .tm-select-target{
  opacity:.18;filter:grayscale(.35);
}
/* Dim only the thumb — hover cards stay full strength */
.tm-tile--dim{opacity:1;filter:none}
.tm-tile--selected{z-index:2}
.tm-tile--supp-hit{
  position:relative;z-index:3;border-radius:4px;
}
.tm-tile--supp-hit::after{
  content:'';position:absolute;inset:-3px;z-index:6;pointer-events:none;border-radius:4px;
  border:2px solid rgba(0,212,255,.95);
  box-shadow:
    0 0 0 2px rgba(255,215,0,.55),
    0 0 14px rgba(0,212,255,.55),
    inset 0 0 0 1px rgba(255,255,255,.12);
}
.tm-tile--supp-hit > .tm-supp-stack{
  filter:brightness(1.12) saturate(1.08);
}
.tm-row--supp-shared .tm-supp{
  box-shadow:inset 0 0 0 2px rgba(0,212,255,.8);
  background:rgba(0,212,255,.2);
}
.tm-row--supp-shared .tm-tag-cell{
  box-shadow:inset 3px 0 0 rgba(0,212,255,.85);
  background:rgba(0,212,255,.08);
}
.tm-row--focus-out,
.tm-rail-group--focus-out{display:none!important}
.tm-select-target{
  position:absolute;inset:-3px;z-index:5;pointer-events:none;
  width:calc(100% + 6px);height:calc(100% + 6px);object-fit:fill;
}

.tm-hover-card{
  position:fixed !important;left:0;top:0;z-index:200;
  display:flex;flex-direction:column;align-items:center;gap:4px;
  width:max-content;max-width:min(160px,70vw);
  padding:8px 8px 6px;
  border-radius:8px;border:1px solid rgba(255,215,0,.55);
  background:rgba(8,12,22,.97);
  box-shadow:0 10px 28px rgba(0,0,0,.55),0 0 0 1px rgba(168,85,247,.35);
  opacity:0;visibility:hidden;pointer-events:none;
  transform:scale(.96);
  transform-origin:center center;
  transition:opacity var(--motion-quick) var(--motion-ease),visibility 0s linear 80ms;
}
.tm-hover-card.tm-hover-card--open,
.tm-tile.tm-hover-placed:hover .tm-hover-card,
.tm-tile.tm-hover-placed:focus-within .tm-hover-card{
  opacity:1;visibility:visible;
  transform:scale(1);
  transition-delay:0s;
}
.tm-hover-card--portal[hidden]{display:none!important}
@media (hover:none),(pointer:coarse){
  .tm-hover-card--portal.tm-hover-card--open{
    pointer-events:auto;
  }
}

.tm-hover-thumb{position:relative;line-height:0;display:flex;flex-direction:column;align-items:center}
.tm-hover-thumb .tm-lim{
  position:relative;width:56px;border-radius:6px 6px 0 0;padding:4px 4px 5px;margin:0;
  box-shadow:0 2px 10px rgba(0,0,0,.4);
}
.tm-hover-thumb .tm-lim-inner{
  font-size:9px;letter-spacing:.1em;padding:0 2px;
}
.tm-hover-thumb .tm-ft{
  width:56px!important;height:56px!important;
  border-radius:0 0 6px 6px;
}
.tm-hover-thumb .tm-ft-hit{display:none}
.tm-hover-name{
  font-size:10px;font-weight:800;line-height:1.2;color:var(--text-primary,#e2e8f0);
  text-align:center;max-width:140px;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.tm-hover-skills{display:flex;gap:4px;justify-content:center;align-items:center}
.tm-hover-skill{
  width:22px;height:22px;border-radius:4px;overflow:hidden;
  border:1px solid rgba(125,211,252,.3);background:#0b1220;
}
.tm-hover-skill img{width:100%;height:100%;object-fit:contain;display:block}
.tm-hover-meta{
  font-size:9px;font-weight:700;line-height:1.25;color:var(--text-muted,#94a3b8);
  text-align:center;max-width:140px;
}
.tm-hover-card--portal.tm-hover-card--open{pointer-events:auto}
.tm-focus-clear{
  appearance:none;margin:0;padding:3px 8px;border-radius:4px;
  border:1px solid rgba(148,163,184,.4);background:rgba(30,41,59,.85);
  color:var(--text-secondary,#cbd5e1);font:inherit;font-size:10px;font-weight:700;
  cursor:pointer;line-height:1.2;min-height:28px;
}
.tm-focus-clear:hover{border-color:rgba(0,212,255,.5);color:#fff}

.tm-foot{display:none}

@media (prefers-reduced-motion:reduce){
  .tm-hover-card{transition:none!important}
}
