:root {
  --bg: #f5f6f8; --panel: #fff; --text: #1d2330; --muted: #677085; --line: #dfe3ea;
  --accent: #3b5bdb; --accent-weak: #e7ecff; --good: #2b8a3e; --bad: #c92a2a; --warn: #e67700;
  --epic: #c2255c; --heroic: #7048e8; --rare: #1c7ed6; --good-rank: #2f9e44; --normal: #868e96;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --panel: #1b2029; --text: #e6e9ef; --muted: #98a1b3; --line: #2c3340;
    --accent: #7c93ff; --accent-weak: #232c4a; --good: #69db7c; --bad: #ff8787; --warn: #ffa94d;
    --epic: #f06595; --heroic: #9775fa; --rare: #4dabf7; --good-rank: #69db7c; --normal: #adb5bd;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}
button, select, input { font: inherit; color: inherit; }
::placeholder { color: var(--muted); opacity: .8; }
/* 数字の欄の上下の矢印は出さない（数字は打ち込んで入れる） */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select, input[type=number], input[type=search], input[type=text], input[type=email], input[type=password], textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; min-height: 32px;
}
button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; min-height: 36px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }

.top {
  position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 16px; flex-wrap: wrap;
}
.brand { font-weight: 700; padding: 10px 0; }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.lang { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lang .globe { flex: none; }
.lang select { width: auto; font-size: 13px; padding: 4px 6px; color: var(--text); }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 12px; white-space: nowrap; }
.tabs button.on { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }

main { max-width: 1200px; margin: 0 auto; padding: var(--main-py, 16px) 16px; }
.tab { display: none; }
.tab.on { display: block; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel h3 { margin: 16px 0 8px; font-size: 14px; }
.panel h3:first-child { margin-top: 0; }
.row { display: flex; gap: 12px; align-items: end; }
.row.wrap { flex-wrap: wrap; }
.row label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.row label select, .row label input { color: var(--text); font-size: 14px; }
.row .grow { flex: 1; }
.row .grow select { width: 100%; }
label.check { flex-direction: row !important; align-items: center; gap: 6px !important; font-size: 14px !important; color: var(--text) !important; }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
#tab-data .row { align-items: center; }
.row label.file { position: relative; flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.file input { font-size: 13px; }

.subtabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.subtabs button { white-space: nowrap; border-radius: 999px; padding: 6px 14px; }
.subtabs button small { color: var(--muted); }
.subtabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.subtabs button.on small { color: inherit; opacity: .85; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 8px; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.filters select { color: var(--text); font-size: 14px; }
.filters .field { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); position: relative; }
/* 複数選べる絞り込み（押すと下に選ぶ所が開く） */
.multi summary {
  list-style: none; cursor: pointer; color: var(--text); font-size: 14px; min-width: 9em;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 28px 6px 10px; background: var(--panel); position: relative; white-space: nowrap;
}
.multi summary::-webkit-details-marker { display: none; }
.multi summary::after {
  content: ''; position: absolute; right: 10px; top: 50%; width: 10px; height: 6px; margin-top: -3px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%2398a1b3'/%3E%3C/svg%3E") no-repeat;
}
.multi.active summary { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.multi-body {
  position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; width: min(440px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.filters .chips .chip { flex-direction: row; font-size: 13px; color: var(--text); padding: 4px 10px; }
.filters .chips .chip:has(input:checked) { color: var(--accent); }

/* 装備カード */
.gear-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.item {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--normal);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.item.r-epic { border-left-color: var(--epic); }
.item.r-heroic { border-left-color: var(--heroic); }
.item.r-rare { border-left-color: var(--rare); }
.item.r-good { border-left-color: var(--good-rank); }
.item .head { display: flex; justify-content: space-between; gap: 6px; font-weight: 600; }
.item .main { margin: 2px 0 4px; }
.item .subs { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; color: var(--muted);
  /* サブが 3 つ以下でも 4 行分の高さを取り、下の等級・装備中の行を隣のカードとそろえる */
  grid-auto-rows: 19.5px; min-height: calc(4 * 19.5px); align-items: center; }
.item .subs > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item { display: flex; flex-direction: column; }
.item > .owner { margin-top: auto; }
.item .subs b { color: var(--text); font-weight: 500; text-align: right; }
.item .owner { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; min-height: 24px; }
.item .owner.me { color: var(--accent); font-weight: 600; }
.item .owner.other { color: var(--warn); }
.item.empty { color: var(--muted); display: flex; align-items: center; justify-content: center; min-height: 90px; }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--accent-weak); color: var(--accent); font-size: 12px; font-weight: 500; }

/* 英雄 */
/* 英雄の表 */
/* 英雄画面：絞り込み・人数・表の見出しは常に見えるように、表の中だけを上下に動かす
   （--top-h は上の帯の高さ。app.js で入れる） */
#tab-heroes.on, #tab-gear.on { display: flex; flex-direction: column; height: calc(100dvh - var(--top-h, 56px) - 2 * var(--main-py, 16px)); }
#tab-heroes .table-wrap { flex: 1; min-height: 0; overflow: auto; }
/* 装備一覧も同じく、部位タブ・絞り込み・件数は残して一覧の中だけを動かす */
#tab-gear #gear-list { flex: 1; min-height: 0; overflow-y: auto; align-content: start; padding: 2px 4px 2px 0; }
#tab-gear .subtabs, #tab-gear .filters, #tab-gear #gear-count { flex: none; }

/* 装備ビルダー：広い画面では左に条件、右に結果。それぞれの中だけが動き、「探す」は条件の下に常に出す */
#tab-build.on { height: calc(100dvh - var(--top-h, 56px) - 2 * var(--main-py, 16px)); }
@media (min-width: 900px) {
  #tab-build.on { display: grid; grid-template-columns: minmax(340px, 430px) minmax(0, 1fr); gap: 16px; }
  #tab-build #build-form { overflow-y: auto; min-height: 0; margin: 0; padding-bottom: 0; }
  #tab-build #b-results { overflow-y: auto; min-height: 0; padding-right: 4px; }
  #tab-build #b-results .summary-bar { position: sticky; top: 0; z-index: 2; background: var(--bg); padding-bottom: 8px; }
}
@media (max-width: 899px) {
  #tab-build.on { display: block; overflow-y: auto; }
}
#tab-build .actions {
  position: sticky; bottom: 0; z-index: 3; background: var(--panel);
  margin: 16px -16px 0; padding: 12px 16px; border-top: 1px solid var(--line);
}
.results-hint { padding: 24px 8px; text-align: center; }
/* 装備ビルダーの専用装備の選ぶ欄 */
.b-ex-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin: 12px 0 0; }
.b-ex-field select { color: var(--text); font-size: 14px; height: 36px; }
.b-ex-field.off select { opacity: .45; cursor: not-allowed; }
.result .moves li.ex-move { color: var(--accent); }
/* 問い合わせ */
.contact { max-width: 720px; }
.contact label, .contact .field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin: 12px 0; }
.contact select, .contact textarea { color: var(--text); font-size: 14px; font: inherit; }
.contact select { max-width: 16em; height: 36px; }
.contact textarea { width: 100%; resize: vertical; min-height: 140px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.c-file-btn { flex-direction: row !important; align-self: flex-start; }
.c-file-btn input { display: none; }
.c-file-btn span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); cursor: pointer; }
.c-file-list { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 6px; }
.c-file-list li { display: flex; align-items: center; gap: 10px; color: var(--text); }
.c-file-list img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.c-file-list .link { background: none; border: 0; color: var(--accent); min-height: 0; padding: 2px 6px; }
.c-need-login { padding: 16px 0; }
#c-status.up { color: var(--good); }
#c-status.down { color: var(--bad); }
/* スマホ・タブレットでは「取り込み」画面を出さない */
html.phone .tabs [data-tab=data], html.phone #tab-data { display: none !important; }
.no-data { grid-column: 1 / -1; padding: 32px 16px; text-align: center; color: var(--muted); }
.no-data p { margin: 0 0 12px; }
/* ログイン */
.acct { margin-left: auto; font-size: 13px; padding: 4px 12px; min-height: 32px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct.on { border-color: var(--accent); color: var(--accent); }
.acct:not([hidden]) + .lang { margin-left: 8px; }
.login-dialog { width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 16px 18px; }
.login-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.login-dialog h3 { margin: 0 0 12px; }
.login-dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin: 8px 0; }
.login-dialog input { font-size: 14px; color: var(--text); padding: 8px 10px; }
.login-dialog .wide { width: 100%; }
.login-dialog .or { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0 4px; }
.login-dialog .row { gap: 8px; margin-top: 8px; align-items: center; }
.login-dialog button.link { background: none; border: 0; color: var(--accent); padding: 4px; min-height: 0; font-size: 13px; }
.login-dialog form { display: flex; justify-content: flex-end; margin-top: 12px; }
/* データとアカウントの削除 */
.danger-zone { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.danger-zone h4 { margin: 0 0 4px; font-size: 14px; color: var(--bad); }
.danger-zone .hint { font-size: 12px; margin: 0 0 8px; }
.danger-zone .row { display: flex; flex-wrap: wrap; gap: 8px; }
button.danger { border-color: var(--bad); color: var(--bad); background: transparent; }
button.danger.solid { background: var(--bad); color: #fff; }
button.danger:disabled { opacity: .4; cursor: not-allowed; }
.del-confirm { margin-top: 10px; padding: 10px; border: 1px solid var(--bad); border-radius: 6px; background: color-mix(in srgb, var(--bad) 8%, transparent); }
.del-confirm p { margin: 0 0 6px; font-size: 13px; }
.login-dev { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 10px; }
.login-dev input { flex: 1; }
.login-msg { font-size: 13px; min-height: 1em; margin: 10px 0 0; }
.login-msg.bad, .sync-line.bad { color: var(--bad); }
.login-msg.good, .sync-line.good { color: var(--good); }
.sync-line { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
/* ゲームから取り込む */
.cap { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--bg); }
.cap-status { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.cap .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--normal); flex: none; }
.cap[data-state=idle] .dot, .cap[data-state=done] .dot { background: var(--good); }
.cap[data-state=recording] .dot { background: var(--bad); animation: cap-blink 1s infinite; }
.cap[data-state=decoding] .dot, .cap[data-state=starting] .dot, .cap[data-state=importing] .dot { background: var(--warn); animation: cap-blink 1s infinite; }
.cap[data-state=error] .dot { background: var(--warn); }
.cap[data-state=error] #cap-msg { color: var(--bad); }
@keyframes cap-blink { 50% { opacity: .3; } }
.cap-steps { margin: 8px 0; padding-left: 1.4em; font-size: 13px; color: var(--muted); }
.cap-steps:empty { display: none; }
.cap-npcap { margin: 0 0 8px; font-size: 13px; }
.cap-npcap summary { cursor: pointer; color: var(--accent); }
.cap-npcap ol { margin: 8px 0; padding-left: 1.4em; line-height: 1.7; }
.cap-npcap p { margin: 4px 0; color: var(--muted); }
.cap-npcap code { font-size: 12px; }
.cap-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.cap-actions button[hidden], .cap-actions a[hidden] { display: none; }
/* ボタンの形のリンク */
a.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; font-size: 14px; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
#gear-list .more { grid-column: 1 / -1; display: flex; justify-content: center; padding: 12px; }
/* 専用装備 */
.ex-badge { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-card { border-left-color: var(--warn); }
.ex-card .ex-for { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.ex-card .main { display: flex; align-items: center; gap: 4px; }
.ex-card .stat-v { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.ex-line { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px; font-size: 13px; flex-wrap: wrap; }
.hero-table td.ex { white-space: nowrap; }
.hero-table thead th { white-space: nowrap; }

/* 装備一覧の見せ方の切り替え */
.seg { display: inline-flex; height: 36px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 0; height: 100%; padding: 0 14px; background: var(--panel); color: var(--text); font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.view-field { margin-left: auto; }

/* 装備一覧の表 */
#gear-list.as-table { display: block; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 0; }
.gear-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.gear-table th, .gear-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.gear-table thead th { position: sticky; top: 0; background: var(--panel); font-size: 12px; color: var(--muted); font-weight: 600; z-index: 1; }
.gear-table th.sort button { background: none; border: 0; padding: 0; min-height: 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.gear-table th.on { color: var(--accent); }
.gear-table td.on { color: var(--accent); font-weight: 600; }
.gear-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.gear-table .stat-v { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; vertical-align: middle; }
.gear-table .stat-v small { font-size: 11px; }
.gear-table .stat-v.on { color: var(--accent); font-weight: 700; }
.gear-table td.sub-c { min-width: 92px; }
.gear-table td.slot { border-left: 4px solid var(--normal); }
.gear-table thead th:first-child { border-left: 4px solid transparent; }
.gear-table tr.r-epic td.slot { border-left-color: var(--epic); }
.gear-table tr.r-heroic td.slot { border-left-color: var(--heroic); }
.gear-table tr.r-rare td.slot { border-left-color: var(--rare); }
.gear-table tr.r-good td.slot { border-left-color: var(--good-rank); }
.gear-table tr.r-epic .rank { color: var(--epic); }
.gear-table tr.r-heroic .rank { color: var(--heroic); }
.gear-table tr.r-rare .rank { color: var(--rare); }
.gear-table .main-c { font-weight: 600; }
.gear-table .who { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.gear-table .seticon { display: block; }
.gear-table tbody tr:hover td { background: var(--accent-weak); }
.gear-table th .dir { font-size: 10px; margin-left: 2px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.hero-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.hero-table th, .hero-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.hero-table thead th { position: sticky; top: 0; background: var(--panel); font-size: 12px; color: var(--muted); font-weight: 600; z-index: 1; }
.hero-table th.sort button { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: inherit; }
.hero-table th.on { color: var(--accent); }
.hero-table .num { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hero-table td.on { color: var(--accent); font-weight: 600; }
.hero-table td.over { color: var(--bad); font-weight: 700; }
/* 上限以上の値は赤く（増減の小さな数字はそのままの色） */
.stats b.over .v, .result .line .sv.over b { color: var(--bad); font-weight: 700; }
.hero-table th.num button { text-align: center; }
.hero-table .name { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 160px; }
.hero-table thead .name { z-index: 2; }
.hero-table .who { display: flex; align-items: center; gap: 8px; }
.hero-table .sets { min-width: 64px; }
.seticon { vertical-align: middle; flex: none; }
.staticon {
  display: inline-block; vertical-align: middle; flex: none; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.hero-table th.stat button { display: inline-flex; align-items: center; gap: 2px; position: relative; }
/* 並べ替えの ▲▼ はアイコンの右に重ねて、アイコンが真ん中からずれないようにする */
.hero-table th.stat .dir { position: absolute; left: 100%; margin-left: 1px; }
.hero-table th .dir { font-size: 10px; margin-left: 2px; }
.set-icons { display: inline-flex; gap: 4px; align-items: center; flex-wrap: nowrap; vertical-align: middle; }
.set-one { display: inline-flex; align-items: center; gap: 1px; }
.set-one small { color: var(--muted); font-size: 11px; }
.hero-table tr.hero-row:hover td { background: var(--accent-weak); }
.hero-table tr.detail td { background: var(--bg); padding: 10px; }
.hero-table .detail .slots6 { position: sticky; left: 10px; max-width: calc(100vw - 64px); }
.gear-btn { padding: 3px 8px; font-size: 12px; white-space: nowrap; }
.no-gear { display: inline-block; padding: 3px 8px; font-size: 12px; }
.gear-btn .caret { display: inline-block; transition: transform .15s; }
.gear-btn.on { border-color: var(--accent); color: var(--accent); }
.gear-btn.on .caret { transform: rotate(180deg); }
.hero-table .run { padding: 3px 8px; font-size: 12px; white-space: nowrap; }
.hero-table .center { text-align: center; }
.hero-table td.center input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent); }
/* 絞り込みの欄は、選ぶ欄・複数選択・検索のどれも同じ高さ・形にそろえる */
.filters label, .filters .field { gap: 4px; }
.filters select, .filters input[type=search], .filters .multi summary {
  box-sizing: border-box; height: 36px; min-width: 9em; font-size: 14px; color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; background-color: var(--panel);
}
.filters .multi summary { display: flex; align-items: center; padding: 0 28px 0 10px; }
.filters select {
  -webkit-appearance: none; appearance: none; padding: 0 28px 0 10px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%2398a1b3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.filters input[type=search] { padding: 0 10px; min-width: 14em; }
.hero-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.hero-card .title { display: flex; gap: 8px 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.hero-card .title h3 { margin: 0; font-size: 16px; }
/* 幅に合わせて 1 行に入る数だけ並べる（名前や増減が折り返さないように） */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; margin: 8px 0; }
.stats div { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px dashed var(--line); }
.stats span, .stats b { white-space: nowrap; }
.stats span { color: var(--muted); }
#build-form .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#build-form .stats span { overflow: hidden; text-overflow: ellipsis; }
.slots6 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
/* 装備ビルダーの結果は右の欄が狭いので、入るだけの列数にする（名前が切れないように） */
#b-results .slots6 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

/* 組み合わせ探し */
.current { margin: 8px 0 0; }
/* 英雄のアイコン */
.hicon { border-radius: 50%; object-fit: cover; flex: none; background: var(--line); vertical-align: middle; }
.hicon.ph { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }
.small { font-size: 12px; }
.take { display: inline-flex; align-items: center; gap: 6px; }
/* 英雄を選ぶ（アイコンの一覧から） */
.field { display: flex; flex-direction: column; gap: 4px; }
.hero-pick { position: relative; }
.hero-pick summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 36px 6px 8px; background: var(--panel); position: relative; min-height: 54px;
}
.hero-pick summary::-webkit-details-marker { display: none; }
.hero-pick summary::after { content: '\25BE'; position: absolute; right: 12px; color: var(--muted); }
.hero-pick[open] summary { border-color: var(--accent); }
.hero-pick-body {
  position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.hero-pick-body input { width: 100%; margin-bottom: 8px; height: 36px; padding: 0 10px; font-size: 14px; }
.hero-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px;
  max-height: min(420px, 60vh); overflow-y: auto;
}
.hero-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border: 1px solid transparent;
  background: none; font-size: 11px; line-height: 1.25; text-align: center;
}
.hero-btn span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.hero-btn:hover { background: var(--accent-weak); }
.hero-btn.on { border-color: var(--accent); background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.hero-btn[hidden] { display: none; }
.mains { display: grid; gap: 8px; }
.mains .slot { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); gap: 8px; align-items: start; }
.mains .slot > b { display: flex; align-items: center; height: 26px; }
.mains .slot-chips .chip { height: 26px; }
/* 札は部位名の右側だけで折り返す（2 段目も 1 段目と左がそろう） */
.mains .slot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: 13px; }
.chip input { margin: 0; }
.chip:has(input:checked) { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); }
.stat-table { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 28px; gap: 6px 8px; align-items: center; max-width: 560px; }
/* 行ごとの「×」（下限・上限・重要度を消す） */
.row-clear { min-height: 0; height: 30px; width: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.row-clear.all { width: auto; justify-self: end; font-size: 11px; height: 24px; padding: 0 6px; white-space: nowrap; grid-column: 5; }
.row-clear:hover:not(:disabled) { color: var(--bad); border-color: var(--bad); }
.row-clear:disabled { opacity: .3; cursor: default; }
.stat-table .h { font-size: 12px; color: var(--muted); }
.stat-table input, .stat-table select { width: 100%; }
.at15 { margin-left: 4px; font-size: 11px; font-weight: 400; color: var(--warn); white-space: nowrap; cursor: help; }
/* 装備ビルダーの条件の保存 */
.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0 0; }
.preset-row .refill { min-height: 30px; padding: 2px 12px; font-size: 13px; }
/* 「探す」と「条件を保存」は同じ形にそろえる（探すは塗り、保存は同じ色の枠） */
#b-run, #b-save { min-width: 9em; height: 36px; padding: 0 16px; font-weight: 600; border-width: 1px; }
#b-save { background: transparent; border-color: var(--accent); color: var(--accent); }
#b-save:hover:not(:disabled) { background: var(--accent-weak); }
#b-save:disabled { opacity: .4; cursor: not-allowed; }
#b-save.done { border-color: var(--good); color: var(--good); }
.actions .check.auto { font-size: 13px !important; color: var(--muted) !important; }
/* 画面の下のリンク（紹介・規約・プライバシーポリシー） */
.app-foot { max-width: 1200px; margin: 0 auto; padding: 8px 16px 20px; color: var(--muted); font-size: 12px; }
.app-foot nav { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-bottom: 4px; }
.app-foot a { color: var(--muted); }
.app-foot a:hover { color: var(--accent); }
.app-foot p { margin: 0; }
/* 画面いっぱいに広がる一覧の画面では、下のリンクで画面がはみ出さないよう出さない（ほかの画面と紹介ページには出す） */
body:has(#tab-gear.on, #tab-heroes.on, #tab-build.on) .app-foot { display: none; }
/* 採用 */
/* 結果の行：ほかの英雄から外す装備があるとき、その英雄のアイコン */
.result .score { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.takers { display: inline-flex; gap: 2px; }
.takers .hicon { border-radius: 50%; outline: 2px solid var(--bad); outline-offset: -1px; }
.adopt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.adopted { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--good); border-radius: var(--radius); background: color-mix(in srgb, var(--good) 10%, transparent); }
.adopted .link, .changes .link { background: none; border: 0; color: var(--accent); min-height: 0; padding: 2px 4px; }
/* 変更一覧 */
.tabs [data-tab=changes][data-count]:not([data-count=''])::after { content: attr(data-count); margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; }
.changes { max-width: 1000px; }
.ch-empty { padding: 24px 0; }
/* 変更一覧（英雄画面と同じ表） */
.changes { max-width: none; }
.ch-wrap { margin-top: 8px; }
.ch-table2 td.nowrap, .ch-table2 .nowrap { white-space: nowrap; }
.ch-table2 tr.ch-main td { border-top: 2px solid var(--line); }
.ch-table2 tr.ch-other td { background: color-mix(in srgb, var(--bad) 5%, transparent); font-size: 12px; }
.ch-table2 td.num small { font-size: 11px; }
.ch-indent { color: var(--muted); margin: 0 2px 0 6px; }
.ch-table2 td.when { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ch-table2 .undo { min-height: 26px; padding: 1px 10px; font-size: 12px; white-space: nowrap; }
.ch-table2 .undo:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); }
.ch-table2 .undo:disabled { opacity: .4; cursor: not-allowed; }
.ch-detail-body { display: flex; flex-wrap: wrap; gap: 12px; padding: 6px 0 10px; position: sticky; left: 10px; max-width: calc(100vw - 64px); }
.ch-slot { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.ch-slot-head { display: flex; align-items: center; gap: 10px; }
.ch-slot-head .down { display: inline-flex; align-items: center; gap: 4px; }
.ch-ex { min-width: 220px; font-size: 13px; }
.ch-cards { display: grid; grid-template-columns: repeat(2, 200px); gap: 8px; }
.ch-cards > div { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 640px) {
  .ch-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ch-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ch-top .undo-all { min-height: 30px; padding: 2px 12px; font-size: 13px; }
.ch-top .undo-all:hover { border-color: var(--bad); color: var(--bad); }
.gs, .who-chip { display: inline-flex; align-items: center; gap: 6px; }
.who-chip .hicon { border-radius: 50%; }
/* 見つからない原因 */
.diag { margin: 4px 0 12px; padding: 10px 14px; border: 1px solid var(--warn); border-radius: var(--radius); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.diag ul { margin: 6px 0; padding-left: 1.3em; }
.diag li { margin: 2px 0; }
.diag p { margin: 4px 0 0; }
/* 英雄画面の刻印 */
.imp { display: flex; flex-direction: column; gap: 2px; font-size: 12px; white-space: nowrap; }
.imp-v { display: inline-flex; align-items: center; gap: 4px; }
.imp-g { display: inline-block; min-width: 2.2em; padding: 0 4px; border-radius: 4px; text-align: center; font-size: 11px; font-weight: 700; background: var(--accent-weak); color: var(--accent); }
.imp-f { color: var(--muted); }
.imp.on .imp-f { color: var(--accent); font-weight: 600; }
.imp:not(.on) .imp-v { opacity: .6; }
.imp-note { margin-left: 12px; color: var(--warn); }
/* 重要度の計算方法 */
.help-btn { margin-top: 4px; font-size: 13px; min-height: 30px; }
.help-dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 48px); padding: 0; overflow: hidden; }
.help-dialog[open] { display: flex; flex-direction: column; }
.help-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.help-dialog h3 { margin: 0; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.help-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 18px 12px; font-size: 14px; line-height: 1.7; }
.help-body h4 { margin: 16px 0 4px; font-size: 14px; }
.help-body p { margin: 6px 0; }
.help-body ul { margin: 6px 0; padding-left: 1.4em; }
.help-body table { border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.help-body th, .help-body td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; }
.help-body th { color: var(--muted); font-weight: 500; }
.help-formula { padding: 8px 12px; border-radius: 6px; background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.help-foot { display: flex; justify-content: flex-end; padding: 10px 18px; border-top: 1px solid var(--line); }
/* 装備を使わない英雄（釦と、選んでいる英雄のアイコン） */
.ex-heroes { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.ex-heroes > button { align-self: flex-start; }
.ex-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; min-height: 28px; }
/* 装備を使わない英雄を選ぶダイアログ */
/* 大きさは中身の人数によらず決まった大きさにする */
.xd { width: min(760px, calc(100vw - 24px)); height: min(720px, calc(100dvh - 48px)); max-height: none; padding: 0; overflow: hidden; }
.xd[open] { display: flex; flex-direction: column; }
.xd::backdrop { background: rgba(0, 0, 0, .5); }
.xd-head { padding: 16px 18px 8px; border-bottom: 1px solid var(--line); }
.xd-head h3 { margin: 0 0 6px; }
.xd-head .hint { margin: 0 0 10px; }
.xd-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.xd-tools input[type=search] { flex: 1 1 220px; min-width: 0; height: 36px; padding: 0 10px; font-size: 14px; color: var(--text); }
.xd-count { margin-top: 8px; font-size: 13px; color: var(--accent); font-weight: 600; }
.xd-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 18px 14px; }
.xd-sec[hidden] { display: none; }
.xd-empty { text-align: center; padding: 40px 0; }
.xd-sec h4 { position: sticky; top: -4px; z-index: 1; margin: 0; padding: 10px 0 8px; background: var(--panel); font-size: 14px; display: flex; align-items: baseline; gap: 8px; }
.xd-sec + .xd-sec h4 { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.xd-sec-n { font-size: 12px; font-weight: 400; color: var(--muted); }
.xd-grid { padding-top: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 8px; align-content: start; }
.xd-hero { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: 13px; color: var(--text); }
.xd-hero[hidden] { display: none; }
.xd-hero:hover { background: var(--accent-weak); }
.xd-hero input { position: absolute; opacity: 0; pointer-events: none; }
.xd-hero:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.xd-name { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.xd-mark { display: none; position: absolute; top: -8px; right: 6px; font-style: normal; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; }
.xd-hero:has(input:checked) { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.xd-hero:has(input:checked) .xd-mark { display: block; }
.xd-hero:has(input:checked) .hicon { filter: grayscale(.7); opacity: .75; }
.xd-foot { display: flex; justify-content: space-between; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--line); }

.result { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.result > summary { list-style: none; cursor: pointer; padding: 10px 14px; display: grid; grid-template-columns: 2.5em 1fr auto; gap: 10px; align-items: center; }
.result > summary::-webkit-details-marker { display: none; }
.result .rank { font-weight: 700; color: var(--accent); }
/* 結果の見出しの行：セットのアイコンの下に、ステータスを 4 列の枠でそろえて並べる */
.result .line { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 12px; align-items: center; }
.result .line .sets-c { grid-column: 1 / -1; display: flex; align-items: center; }
.result .line .sv { display: flex; align-items: center; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.result .line .sv b { font-weight: 600; }
.result .line .sv small { font-size: 11px; }
.result .line small { color: var(--muted); }
.result .body { padding: 0 14px 14px; }
.up { color: var(--good); }
.down { color: var(--bad); }
.result .moves { margin: 8px 0; font-size: 13px; }
.result .moves li { margin: 2px 0; display: flex; align-items: center; gap: 4px; }
.result .moves li::before { content: '•'; color: var(--muted); margin-right: 2px; }
.result .moves { list-style: none; padding-left: 4px; }
.summary-bar { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin: 8px 0 12px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); max-width: 92vw; }

@media (max-width: 640px) {
  main { --main-py: 12px; }
  .top { gap: 0; padding: 0 8px; }
  .brand { padding: 8px 8px 0; flex: 1; }
  .lang { margin: 8px 8px 0 0; }
  .brand { white-space: nowrap; }
  .lang > span { display: none; } /* 狭い画面では地球の印だけ */
  .acct { margin-top: 8px; max-width: 130px; }
  .tabs { order: 3; width: 100%; }
  .stats { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
  .slots6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gear-grid { grid-template-columns: 1fr; }
  .row { flex-wrap: wrap; }
  .stat-table { grid-template-columns: 6.5em minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 28px; }
  .result > summary { grid-template-columns: 2em 1fr; }
  .result .line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 2 列に並ぶ狭いカードは、長いステータス名が切れないよう文字と余白を少し小さく */
  .slots6 .item { font-size: 12px; padding: 8px 8px 8px 10px; }
  .slots6 .item .subs { column-gap: 4px; }
  .slots6 .item .subs small { font-size: 10px; }
  .result > summary .score { grid-column: 2; }
}
.login-acct { font-weight: 600; word-break: break-all; }
